From: Hans de Goede Date: Tue, 4 Mar 2025 17:26:01 +0000 (+0100) Subject: drm: Reject 800x600 and 1024x768 simpledrm drm devices X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f23b07e5b58d6522a565d8c275b7b4c70b3378e7;p=thirdparty%2Fplymouth.git drm: Reject 800x600 and 1024x768 simpledrm drm devices Sometimes the EFI firmware initializes the framebuffer at a very low resolution rather then at the panel's native resolution. In this case it is better to wait for the native GPU driver to load rather then rendering a not-so-pretty splash at this very low resolution. Reject these low resolutions for simpledrm devices except when query_device () is called with force=true. Signed-off-by: Hans de Goede --- diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index 2fddaee4..0249dbfa 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -1391,12 +1391,37 @@ check_if_output_has_changed (ply_renderer_backend_t *backend, return true; } +/* Sometimes the EFI firmware sets up the framebuffer at 800x600 or 1024x768 + * instead of the native panel resolution. In this case it is better to wait + * for the native driver to load, so we return false from query_device (). + */ +static bool +check_simpledrm_resolution (ply_renderer_backend_t *backend, + ply_output_t *output) +{ + if (!backend->simpledrm) + return true; + + if (!output->connected) + return true; + + if ((output->mode.hdisplay == 800 && output->mode.vdisplay == 600) || + (output->mode.hdisplay == 1024 && output->mode.vdisplay == 768)) { + ply_trace ("Skipping simpledrm device with mode %dx%d", + output->mode.hdisplay, output->mode.vdisplay); + return false; + } + + return true; +} + /* Update our outputs array to match the hardware state and * create and/or remove heads as necessary. * Returns true if any heads were modified. */ static bool create_heads_for_active_connectors (ply_renderer_backend_t *backend, + bool force, bool change) { int i, j, number_of_setup_outputs, outputs_len; @@ -1420,6 +1445,11 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend, for (i = 0; i < outputs_len; i++) { get_output_info (backend, backend->resources->connectors[i], &outputs[i]); + if (!force && !check_simpledrm_resolution (backend, &outputs[i])) { + free (outputs); + return false; + } + if (check_if_output_has_changed (backend, &outputs[i])) changed = true; @@ -1578,7 +1608,7 @@ query_device (ply_renderer_backend_t *backend, return false; } - if (!create_heads_for_active_connectors (backend, false)) { + if (!create_heads_for_active_connectors (backend, force, false)) { ply_trace ("Could not initialize heads"); ret = false; } else if (!has_32bpp_support (backend)) { @@ -1603,7 +1633,7 @@ handle_change_event (ply_renderer_backend_t *backend) return false; } - ret = create_heads_for_active_connectors (backend, true); + ret = create_heads_for_active_connectors (backend, true, true); drmModeFreeResources (backend->resources); backend->resources = NULL;