1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(drivers): drm driver not initialising with small screens (#6244)

This commit is contained in:
Tim Stableford 2024-05-24 04:31:01 +01:00 committed by GitHub
parent f2e81d80b3
commit 5ac14e42dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -153,9 +153,12 @@ void lv_linux_drm_set_file(lv_display_t * disp, const char * file, int64_t conne
int32_t width = drm_dev->mmWidth;
size_t buf_size = LV_MIN(drm_dev->drm_bufs[1].size, drm_dev->drm_bufs[0].size);
/* Resolution must be set first because if the screen is smaller than the size passed
* to lv_display_create then the buffers aren't big enough for LV_DISPLAY_RENDER_MODE_DIRECT.
*/
lv_display_set_resolution(disp, hor_res, ver_res);
lv_display_set_buffers(disp, drm_dev->drm_bufs[1].map, drm_dev->drm_bufs[0].map, buf_size,
LV_DISPLAY_RENDER_MODE_DIRECT);
lv_display_set_resolution(disp, hor_res, ver_res);
if(width) {
lv_display_set_dpi(disp, DIV_ROUND_UP(hor_res * 25400, width * 1000));