Skip to content

Instantly share code, notes, and snippets.

@webgeek1234
Created May 26, 2016 06:18
Show Gist options
  • Save webgeek1234/6e431235f54ca4c1a33b4b0d50489eaf to your computer and use it in GitHub Desktop.
Save webgeek1234/6e431235f54ca4c1a33b4b0d50489eaf to your computer and use it in GitHub Desktop.
diff --git a/minuitwrp/graphics_fbdev.cpp b/minuitwrp/graphics_fbdev.cpp
index 066be8d..4632e0f 100644
--- a/minuitwrp/graphics_fbdev.cpp
+++ b/minuitwrp/graphics_fbdev.cpp
@@ -124,15 +124,37 @@ static GRSurface* fbdev_init(minui_backend* backend) {
}
}
- fb_fix_screeninfo fi;
- if (ioctl(fd, FBIOGET_FSCREENINFO, &fi) < 0) {
- perror("failed to get fb0 info (FBIOGET_FSCREENINFO)");
+ if (ioctl(fd, FBIOGET_VSCREENINFO, &vi) < 0) {
+ perror("failed to get fb0 info (FBIOGET_VSCREENINFO)");
close(fd);
return NULL;
}
- if (ioctl(fd, FBIOGET_VSCREENINFO, &vi) < 0) {
- perror("failed to get fb0 info (FBIOGET_VSCREENINFO)");
+#ifdef RECOVERY_FORCE_RGB_565
+ printf("Forcing pixel format: RGB_565\n");
+ vi.blue.offset = 0;
+ vi.green.offset = 5;
+ vi.red.offset = 11;
+ vi.blue.length = 5;
+ vi.green.length = 6;
+ vi.red.length = 5;
+ vi.blue.msb_right = 0;
+ vi.green.msb_right = 0;
+ vi.red.msb_right = 0;
+ vi.transp.offset = 0;
+ vi.transp.length = 0;
+ vi.bits_per_pixel = 16;
+
+ if (ioctl(fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
+ perror("failed to put fb0 info");
+ close(fd);
+ return NULL;
+ }
+#endif
+
+ fb_fix_screeninfo fi;
+ if (ioctl(fd, FBIOGET_FSCREENINFO, &fi) < 0) {
+ perror("failed to get fb0 info (FBIOGET_FSCREENINFO)");
close(fd);
return NULL;
}
@@ -167,22 +189,6 @@ static GRSurface* fbdev_init(minui_backend* backend) {
memset(bits, 0, fi.smem_len);
-#ifdef RECOVERY_FORCE_RGB_565
- printf("Forcing pixel format: RGB_565\n");
- vi.blue.offset = 0;
- vi.green.offset = 5;
- vi.red.offset = 11;
- vi.blue.length = 5;
- vi.green.length = 6;
- vi.red.length = 5;
- vi.blue.msb_right = 0;
- vi.green.msb_right = 0;
- vi.red.msb_right = 0;
- vi.transp.offset = 0;
- vi.transp.length = 0;
- vi.bits_per_pixel = 16;
-#endif
-
gr_framebuffer[0].width = vi.xres;
gr_framebuffer[0].height = vi.yres;
gr_framebuffer[0].row_bytes = fi.line_length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment