summaryrefslogtreecommitdiffstats
path: root/minuitwrp/graphics_fbdev.cpp
diff options
context:
space:
mode:
authorAaron Kling <webgeek1234@gmail.com>2016-05-26 21:49:33 +0200
committerAaron Kling <webgeek1234@gmail.com>2016-05-26 21:49:33 +0200
commitb9e547e6aca1f38d883dc418f47a64b7d27fe99f (patch)
treeb7e7673c12dbf7a8bf4ef3aac72e8cb91dbff8c2 /minuitwrp/graphics_fbdev.cpp
parentcrypto: remove redundant convert_key_to_hex_ascii call (diff)
downloadandroid_bootable_recovery-b9e547e6aca1f38d883dc418f47a64b7d27fe99f.tar
android_bootable_recovery-b9e547e6aca1f38d883dc418f47a64b7d27fe99f.tar.gz
android_bootable_recovery-b9e547e6aca1f38d883dc418f47a64b7d27fe99f.tar.bz2
android_bootable_recovery-b9e547e6aca1f38d883dc418f47a64b7d27fe99f.tar.lz
android_bootable_recovery-b9e547e6aca1f38d883dc418f47a64b7d27fe99f.tar.xz
android_bootable_recovery-b9e547e6aca1f38d883dc418f47a64b7d27fe99f.tar.zst
android_bootable_recovery-b9e547e6aca1f38d883dc418f47a64b7d27fe99f.zip
Diffstat (limited to 'minuitwrp/graphics_fbdev.cpp')
-rw-r--r--minuitwrp/graphics_fbdev.cpp50
1 files changed, 29 insertions, 21 deletions
diff --git a/minuitwrp/graphics_fbdev.cpp b/minuitwrp/graphics_fbdev.cpp
index 066be8dae..2126cf9cb 100644
--- a/minuitwrp/graphics_fbdev.cpp
+++ b/minuitwrp/graphics_fbdev.cpp
@@ -124,15 +124,39 @@ 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
+ // Changing fb_var_screeninfo can affect fb_fix_screeninfo,
+ // so this needs done before querying for fi.
+ 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 force_rgb_565 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 +191,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;