]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
two-step: Deal with buggy firmware which does not pre-rotate the bgrt image
authorHans de Goede <hdegoede@redhat.com>
Thu, 18 Jul 2019 15:51:54 +0000 (17:51 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 18 Jul 2019 15:55:23 +0000 (17:55 +0200)
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 <hdegoede@redhat.com>
src/plugins/splash/two-step/plugin.c

index 795bded060701c2a786f663285843b1e392de654..2e596d54054bac3a2905ae0cf200e82e2185d3fe 100644 (file)
@@ -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