From: Hans de Goede Date: Thu, 18 Jul 2019 15:51:54 +0000 (+0200) Subject: two-step: Deal with buggy firmware which does not pre-rotate the bgrt image X-Git-Tag: 0.9.5~52^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aac0f839ec120fdd4dadd198709216f313bb0ac0;p=thirdparty%2Fplymouth.git two-step: Deal with buggy firmware which does not pre-rotate the bgrt image Some buggy Lenovo 2-in-1s with a 90 degree rotated panel, behave as if the panel is mounted up-right / not rotated at all. These devices have a buggy efifb size (landscape resolution instead of the actual portrait resolution of the panel), this gets fixed-up by the kernel. These buggy devices also do not pre-rotate the bgrt_image nor do they set the ACPI-6.2 rotation status-bits. We can detect this by checking that the bgrt_image is perfectly centered horizontally when we use the panel's height as the width. This commit uses this check to override the bgrt-rotation read from the ACPI-6.2 rotation status-bits, fixing us displaying the bgrt image with the wrong rotation. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1730783 Signed-off-by: Hans de Goede --- diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index 795bded0..2e596d54 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -408,6 +408,23 @@ view_set_bgrt_background (view_t *view) &panel_width, &panel_height, &panel_rotation, &panel_scale); + /* + * Some buggy Lenovo 2-in-1s with a 90 degree rotated panel, behave as + * if the panel is mounted up-right / not rotated at all. These devices + * have a buggy efifb size (landscape resolution instead of the actual + * portrait resolution of the panel), this gets fixed-up by the kernel. + * These buggy devices also do not pre-rotate the bgrt_image nor do + * they set the ACPI-6.2 rotation status-bits. We can detect this by + * checking that the bgrt_image is perfectly centered horizontally + * when we use the panel's height as the width. + */ + if (have_panel_props && + (panel_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE || + panel_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) && + (panel_width - view->plugin->background_bgrt_raw_width) / 2 != sysfs_x_offset && + (panel_height - view->plugin->background_bgrt_raw_width) / 2 == sysfs_x_offset) + bgrt_rotation = panel_rotation; + /* * Before the ACPI 6.2 specification, the BGRT table did not contain * any rotation information, so to make sure that the firmware-splash