From e83abc08e49b5ee3ecb6bd85d95a91e703200d32 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 14 Aug 2023 16:50:22 +0200 Subject: [PATCH] drm: Use first output for panel info if there is no builtin display The two-step renderer uses ply_renderer_get_panel_properties() to get the device-scale used for the builtin panel, assuming this is most likely light-up by the firmware on boot and that this is thus also displaying the bgrt boot splash shown by the firmware at boot. It needs to know the device-scale for this output so that if hi-dpi (device-scale=2) rendering is used on the output it can also set device-scale=2 on the ply_pixel_buffer() used for the bgrt background so that the pixel-buffer code knows the splash is pre-scaled and doesn't double it in size making it twice as big as original. ATM this doubling in size of the splash is exactly what happens when using a desktop with a hidpi monitor because the drm plugin does not provide any "panel" properties in this case. To avoid this fall-back to using the properties of the first enumerated (connected) output for get_panel_properties(). Signed-off-by: Hans de Goede --- src/plugins/renderers/drm/plugin.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index af94df38..b9b338f8 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -166,6 +166,7 @@ struct _ply_renderer_backend int panel_height; ply_pixel_buffer_rotation_t panel_rotation; int panel_scale; + bool panel_info_set; }; ply_renderer_plugin_interface_t *ply_renderer_backend_get_interface (void); @@ -636,13 +637,21 @@ ply_renderer_head_new (ply_renderer_backend_t *backend, /* Delay flush till first actual draw */ ply_region_clear (ply_pixel_buffer_get_updated_areas (head->pixel_buffer)); - if (output->connector_type == DRM_MODE_CONNECTOR_LVDS || + /* + * On devices without a builtin display, use the info from the first + * enumerated output as panel info to sensure correct BGRT scaling. + * Note all outputs are enumerated before this info is used, so if + * there is a builtin display then that will override things. + */ + if (!backend->panel_info_set || + output->connector_type == DRM_MODE_CONNECTOR_LVDS || output->connector_type == DRM_MODE_CONNECTOR_eDP || output->connector_type == DRM_MODE_CONNECTOR_DSI) { backend->panel_width = output->mode.hdisplay; backend->panel_height = output->mode.vdisplay; backend->panel_rotation = output->rotation; backend->panel_scale = output->device_scale; + backend->panel_info_set = true; } ply_list_append_data (backend->heads, head);