Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+13 -11
+13 -11
firmware/target/hosted/lcd-linuxfb.c
··· 59 59 panicf("Cannot read framebuffer fixed information"); 60 60 } 61 61 62 - #if 0 63 - /* check resolution and framebuffer size */ 64 - if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH) 62 + if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) 65 63 { 66 - panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres, 67 - vinfo.yres, vinfo.bits_per_pixel); 64 + panicf("Cannot read framebuffer variable information"); 68 65 } 69 - #endif 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 + } 76 + } 70 77 /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the 71 78 * values returned by the driver for line_length */ 72 79 ··· 75 82 if((void *)framebuffer == MAP_FAILED) 76 83 { 77 84 panicf("Cannot map framebuffer"); 78 - } 79 - 80 - if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) 81 - { 82 - panicf("Cannot read framebuffer variable information"); 83 85 } 84 86 85 87 memset(framebuffer, 0, finfo.smem_len);