summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-07-01 09:36:52 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-07-01 09:51:50 -0400
commite55618d07a62dc64f1b4cf236f23c59dacf17e30 (patch)
tree1c418bdbb964d824f701cbeafa3532439d3b407c
parent5f26f21ab2bb4ecc09f983798e4641ac335f98d6 (diff)
downloadrockbox-e55618d07a62dc64f1b4cf236f23c59dacf17e30.tar.gz
rockbox-e55618d07a62dc64f1b4cf236f23c59dacf17e30.zip
hosted: Minor corrections to the linux framebuffer driver.
* Query variable info _before_ mmaping the framebuffer * Sanity-check the resolution/bitdepth, and if it doens't match try to set it to what we want. This is functionally a no-op. Change-Id: I087ff81775d8f63bf7846b7fef19f6fc36c1cc84
-rw-r--r--firmware/target/hosted/lcd-linuxfb.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/firmware/target/hosted/lcd-linuxfb.c b/firmware/target/hosted/lcd-linuxfb.c
index 14c8c30f89..5dda5cf1cc 100644
--- a/firmware/target/hosted/lcd-linuxfb.c
+++ b/firmware/target/hosted/lcd-linuxfb.c
@@ -59,14 +59,21 @@ void lcd_init_device(void)
59 panicf("Cannot read framebuffer fixed information"); 59 panicf("Cannot read framebuffer fixed information");
60 } 60 }
61 61
62#if 0 62 if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
63 /* check resolution and framebuffer size */
64 if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH)
65 { 63 {
66 panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres, 64 panicf("Cannot read framebuffer variable information");
67 vinfo.yres, vinfo.bits_per_pixel); 65 }
66
67 /* Make sure we match our desired bitdepth */
68 if (vinfo.bits_per_pixel != LCD_DEPTH || vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT) {
69 vinfo.bits_per_pixel = LCD_DEPTH;
70 vinfo.xres = LCD_WIDTH;
71 vinfo.yres = LCD_HEIGHT;
72 if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo)) {
73 panicf("Cannot set framebuffer to %dx%dx%d",
74 vinfo.xres, vinfo.yres, vinfo.bits_per_pixel);
75 }
68 } 76 }
69#endif
70 /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the 77 /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the
71 * values returned by the driver for line_length */ 78 * values returned by the driver for line_length */
72 79
@@ -77,11 +84,6 @@ void lcd_init_device(void)
77 panicf("Cannot map framebuffer"); 84 panicf("Cannot map framebuffer");
78 } 85 }
79 86
80 if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
81 {
82 panicf("Cannot read framebuffer variable information");
83 }
84
85 memset(framebuffer, 0, finfo.smem_len); 87 memset(framebuffer, 0, finfo.smem_len);
86 88
87#ifdef HAVE_LCD_ENABLE 89#ifdef HAVE_LCD_ENABLE