diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/device/Kconfig | 33 | ||||
-rw-r--r-- | src/drivers/intel/gma/hires_fb/gma-gfx_init.adb | 30 |
2 files changed, 59 insertions, 4 deletions
diff --git a/src/device/Kconfig b/src/device/Kconfig index 243e23e52a..bcff6fd8b0 100644 --- a/src/device/Kconfig +++ b/src/device/Kconfig @@ -519,6 +519,39 @@ config LINEAR_FRAMEBUFFER_MAX_HEIGHT Set the maximum height of the framebuffer. This may help with default fonts too tiny for high-resolution displays. +choice DEFAULT_SCREEN_ROTATION + prompt "Default screen orientation" + depends on LINEAR_FRAMEBUFFER && MAINBOARD_USE_LIBGFXINIT + depends on GFX_GMA_GENERATION = "Broxton" || GFX_GMA_GENERATION = "Skylake" + default DEFAULT_SCREEN_ROTATION_NONE + help + This allows to configure how the physical screen is mounted in + 90 degree steps (counter-clockwise). The framebuffer contents + will then be displayed rotated by the same amount in the other + direction; i.e. if you turn the screen to the left, the picture + has to be rotated to the right to accommodate. + +config DEFAULT_SCREEN_ROTATION_NONE + bool "Non-rotated" + +config DEFAULT_SCREEN_ROTATION_90 + bool "Rotated 90 degrees (rotate framebuffer to the right)" + +config DEFAULT_SCREEN_ROTATION_180 + bool "Rotated 180 degrees" + +config DEFAULT_SCREEN_ROTATION_270 + bool "Rotated 270 degrees (rotate framebuffer to the left)" + +endchoice + +config DEFAULT_SCREEN_ROTATION_INT + int + default 90 if DEFAULT_SCREEN_ROTATION_90 + default 180 if DEFAULT_SCREEN_ROTATION_180 + default 270 if DEFAULT_SCREEN_ROTATION_270 + default 0 + endmenu # "Display" config PCI diff --git a/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb b/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb index 49d0ca495a..66269b22d7 100644 --- a/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb +++ b/src/drivers/intel/gma/hires_fb/gma-gfx_init.adb @@ -21,6 +21,17 @@ is configs : Pipe_Configs; ---------------------------------------------------------------------------- + procedure Screen_Rotation (rotation : out Rotation_Type) + is + begin + rotation := + (case Config.DEFAULT_SCREEN_ROTATION_INT is + when 90 => Rotated_90, + when 180 => Rotated_180, + when 270 => Rotated_270, + when others => No_Rotation); + end Screen_Rotation; + procedure gfxinit (lightup_ok : out Interfaces.C.int) is use type pos32; @@ -60,10 +71,21 @@ is end loop; fb := configs (Primary).Framebuffer; - fb.Width := Width_Type (min_h); - fb.Height := Height_Type (min_v); - fb.Stride := Div_Round_Up (fb.Width, 16) * 16; - fb.V_Stride := fb.Height; + Screen_Rotation (fb.Rotation); + + if fb.Rotation = Rotated_90 or fb.Rotation = Rotated_270 then + fb.Width := Width_Type (min_v); + fb.Height := Height_Type (min_h); + fb.Stride := Div_Round_Up (fb.Width, 32) * 32; + fb.V_Stride := Div_Round_Up (fb.Height, 32) * 32; + fb.Tiling := Y_Tiled; + fb.Offset := word32 (GTT_Rotation_Offset) * GTT_Page_Size; + else + fb.Width := Width_Type (min_h); + fb.Height := Height_Type (min_v); + fb.Stride := Div_Round_Up (fb.Width, 16) * 16; + fb.V_Stride := fb.Height; + end if; for i in Pipe_Index loop exit when configs (i).Port = Disabled; |