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 <hdegoede@redhat.com>
This commit is contained in:
Hans de Goede 2023-08-14 16:50:22 +02:00 committed by Ray Strode
parent e70c0fb49e
commit e83abc08e4

View 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);