b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | --- a/src/serdisp_specific_framebuffer.c |
| 2 | +++ b/src/serdisp_specific_framebuffer.c |
| 3 | @@ -312,13 +312,15 @@ serdisp_t* serdisp_framebuffer_setup(con |
| 4 | |
| 5 | if (fb_success) { |
| 6 | /* check if colour mode is supported */ |
| 7 | - if (! (vinfo.bits_per_pixel == 16 || vinfo.bits_per_pixel == 24 || vinfo.bits_per_pixel == 32) ) { |
| 8 | + if (! (vinfo.bits_per_pixel == 1 ||vinfo.bits_per_pixel == 16 || vinfo.bits_per_pixel == 24 || vinfo.bits_per_pixel == 32) ) { |
| 9 | sd_error(SERDISP_ERUNTIME, "unsupported colour depth (%d)", vinfo.bits_per_pixel); |
| 10 | fb_success = 0; |
| 11 | } |
| 12 | } |
| 13 | - |
| 14 | - dd->scrbuf_size = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel/8; |
| 15 | + if (vinfo.bits_per_pixel == 1) |
| 16 | + dd->scrbuf_size = (vinfo.xres * vinfo.yres) / 8; |
| 17 | + else |
| 18 | + dd->scrbuf_size = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel/8; |
| 19 | |
| 20 | if (fb_success) { |
| 21 | /* map framebuffer device to memory */ |