From 388c97ed9d911a572b2fc429ad98ac5d80d9a079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Costa?= Date: Wed, 25 Mar 2026 09:13:25 +0100 Subject: [PATCH] fix(drm/egl): choose compatible nanovg config when it's enabled (#9909) --- src/drivers/display/drm/lv_linux_drm_egl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/drivers/display/drm/lv_linux_drm_egl.c b/src/drivers/display/drm/lv_linux_drm_egl.c index 2e7d3f3ac8..64253412f6 100644 --- a/src/drivers/display/drm/lv_linux_drm_egl.c +++ b/src/drivers/display/drm/lv_linux_drm_egl.c @@ -594,11 +594,14 @@ static size_t drm_egl_select_config_cb(void * driver_data, const lv_egl_config_t for(size_t i = 0; i < config_count; ++i) { lv_color_format_t config_cf = lv_opengles_egl_color_format_from_egl_config(&configs[i]); - if(configs[i].max_width >= target_w && - configs[i].max_height >= target_h && - config_cf == target_cf && - configs[i].surface_type & EGL_WINDOW_BIT - ) { + const bool resolution_matches = configs[i].max_width >= target_w && + configs[i].max_height >= target_h; + const bool is_nanovg_compatible = (configs[i].renderable_type & EGL_OPENGL_ES2_BIT) != 0 && + configs[i].stencil == 8 && configs[i].samples == 4; + const bool is_window = (configs[i].surface_type & EGL_WINDOW_BIT) != 0; + const bool is_compatible_with_draw_unit = is_nanovg_compatible || !LV_USE_DRAW_NANOVG; + + if(is_window && resolution_matches && config_cf == target_cf && is_compatible_with_draw_unit) { LV_LOG_TRACE("Choosing config %zu", i); return i; }