diff --git a/system/screen.c b/system/screen.c index 4dda81a..93b2b76 100644 --- a/system/screen.c +++ b/system/screen.c @@ -195,11 +195,16 @@ void screen_init(void) // Clip the framebuffer size to make sure we can map it into the 0.5GB device region. // This will produce a garbled display, but that's better than nothing. - if (lfb_width > 8192) lfb_width = 8192; + if (lfb_stride > 32768) { + lfb_stride = 32768; + if (lfb_width > (lfb_stride / lfb_bytes_per_pixel)) { + lfb_width = (lfb_stride / lfb_bytes_per_pixel); + } + } if (lfb_height > 8192) lfb_height = 8192; // The above clipping should guarantee the mapping never fails. - lfb_base = map_region(lfb_base, lfb_height * lfb_width * lfb_bytes_per_pixel, false); + lfb_base = map_region(lfb_base, lfb_height * lfb_stride, false); // Blank the whole framebuffer. int pixels_per_word = sizeof(uint32_t) / lfb_bytes_per_pixel;