forked from len0rd/rockbox
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
This commit is contained in:
parent
5f26f21ab2
commit
e55618d07a
1 changed files with 13 additions and 11 deletions
|
@ -59,14 +59,21 @@ void lcd_init_device(void)
|
||||||
panicf("Cannot read framebuffer fixed information");
|
panicf("Cannot read framebuffer fixed information");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
|
||||||
/* check resolution and framebuffer size */
|
|
||||||
if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH)
|
|
||||||
{
|
{
|
||||||
panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres,
|
panicf("Cannot read framebuffer variable information");
|
||||||
vinfo.yres, vinfo.bits_per_pixel);
|
}
|
||||||
|
|
||||||
|
/* Make sure we match our desired bitdepth */
|
||||||
|
if (vinfo.bits_per_pixel != LCD_DEPTH || vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT) {
|
||||||
|
vinfo.bits_per_pixel = LCD_DEPTH;
|
||||||
|
vinfo.xres = LCD_WIDTH;
|
||||||
|
vinfo.yres = LCD_HEIGHT;
|
||||||
|
if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo)) {
|
||||||
|
panicf("Cannot set framebuffer to %dx%dx%d",
|
||||||
|
vinfo.xres, vinfo.yres, vinfo.bits_per_pixel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* Note: we use a framebuffer size of width*height*bbp. We cannot trust the
|
/* Note: we use a framebuffer size of width*height*bbp. We cannot trust the
|
||||||
* values returned by the driver for line_length */
|
* values returned by the driver for line_length */
|
||||||
|
|
||||||
|
@ -77,11 +84,6 @@ void lcd_init_device(void)
|
||||||
panicf("Cannot map framebuffer");
|
panicf("Cannot map framebuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
|
|
||||||
{
|
|
||||||
panicf("Cannot read framebuffer variable information");
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(framebuffer, 0, finfo.smem_len);
|
memset(framebuffer, 0, finfo.smem_len);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue