From: Emil Velikov Date: Mon, 18 Oct 2021 10:58:29 +0000 (+0100) Subject: drm: Honour screen rotation when detecting HiDPI X-Git-Tag: 22.02.122~7^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a76fe9a06993a2e2c7ee11da9d39202f47195b39;p=thirdparty%2Fplymouth.git drm: Honour screen rotation when detecting HiDPI Currently if the screen is rotated by 90 degrees, the effective width/height will be swapped. Thus we will incorrectly detect the panel as HiDPI. Signed-off-by: Emil Velikov --- diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index 1f222af9..02e9413a 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -1164,6 +1164,7 @@ get_output_info (ply_renderer_backend_t *backend, { drmModeModeInfo *mode = NULL; drmModeConnector *connector; + bool has_90_rotation = false; memset (output, 0, sizeof(*output)); output->connector_id = connector_id; @@ -1178,6 +1179,9 @@ get_output_info (ply_renderer_backend_t *backend, output_get_controller_info (backend, connector, output); ply_renderer_connector_get_rotation_and_tiled (backend, connector, output); + if (output->rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE || + output->rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE) + has_90_rotation = true; if (!output->tiled) mode = get_preferred_mode (connector); @@ -1192,7 +1196,8 @@ get_output_info (ply_renderer_backend_t *backend, } output->mode = *mode; output->device_scale = ply_get_device_scale (mode->hdisplay, mode->vdisplay, - connector->mmWidth, connector->mmHeight); + (!has_90_rotation) ? connector->mmWidth : connector->mmHeight, + (!has_90_rotation) ? connector->mmHeight : connector->mmWidth); output->connector_type = connector->connector_type; output->connected = true; out: