]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
drm: Use first output for panel info if there is no builtin display
authorHans de Goede <hdegoede@redhat.com>
Mon, 14 Aug 2023 14:50:22 +0000 (16:50 +0200)
committerRay Strode <halfline@gmail.com>
Wed, 16 Aug 2023 22:06:18 +0000 (22:06 +0000)
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 <hdegoede@redhat.com>
src/plugins/renderers/drm/plugin.c

index af94df3855f39f564c0e7dee214aee5206465a51..b9b338f8e803f0814f252e04efb3c876c52d8c99 100644 (file)
@@ -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);