Nico Huber has uploaded this change for review. ( https://review.coreboot.org/22710
Change subject: Add Rotation setting to Framebuffer ......................................................................
Add Rotation setting to Framebuffer
Add a Rotation setting to the Framebuffer type that tells us if the framebuffer is rotated by 90, 180 or 270 degrees. The hardware should rotate the picture in the opposite direction before display.
To support more complex memory layouts, we also add a V_Stride (ver- tical stride) setting.
Change-Id: I6430fb44b5c9cfcf9fa58684a425e8c2e4647ac3 Signed-off-by: Nico Huber nico.huber@secunet.com --- M common/hw-gfx.ads M gfxtest/hw-gfx-gma-gfx_test.adb 2 files changed, 13 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/10/22710/1
diff --git a/common/hw-gfx.ads b/common/hw-gfx.ads index 67662ed..5594b18 100644 --- a/common/hw-gfx.ads +++ b/common/hw-gfx.ads @@ -23,9 +23,9 @@ -- such that the count of pixels in any framebuffer may fit subtype Pixel_Type is Pos32 range 1 .. 8192 * 8192;
- -- implementation only supports 4800p for now ;-) - subtype Width_Type is Pos32 range 1 .. 4800; - subtype Height_Type is Pos32 range 1 .. 7680; + -- Allow same range for width and height (for rotated framebuffers) + subtype Width_Type is Pos32 range 1 .. 8192; + subtype Height_Type is Pos32 range 1 .. 8192;
Auto_BPC : constant := 5; subtype BPC_Type is Int64 range Auto_BPC .. 16; @@ -33,27 +33,33 @@ type Tiling_Type is (Linear, X_Tiled, Y_Tiled); subtype XY_Tiling is Tiling_Type range X_Tiled .. Y_Tiled;
+ type Rotation_Type is (No_Rotation, Rotated_90, Rotated_180, Rotated_270); + type Framebuffer_Type is record Width : Width_Type; Height : Height_Type; BPC : BPC_Type; Stride : Width_Type; + V_Stride : Height_Type; Tiling : Tiling_Type; + Rotation : Rotation_Type; Offset : Word32; end record;
function Pixel_To_Bytes (Pixel : Pixel_Type; FB : Framebuffer_Type) return Pos32 is (Pixel * Pos32 (FB.BPC) / (8 / 4)); function FB_Size (FB : Framebuffer_Type) return Pos32 is - (Pixel_To_Bytes (FB.Stride * FB.Height, FB)); + (Pixel_To_Bytes (FB.Stride * FB.V_Stride, FB));
Default_FB : constant Framebuffer_Type := Framebuffer_Type' (Width => 1, Height => 1, BPC => 8, Stride => 1, + V_Stride => 1, Tiling => Linear, + Rotation => No_Rotation, Offset => 0);
subtype Frequency_Type is Pos64 range 24_000_000 .. 600_000_000; diff --git a/gfxtest/hw-gfx-gma-gfx_test.adb b/gfxtest/hw-gfx-gma-gfx_test.adb index ef6c91d..9a5ce0a 100644 --- a/gfxtest/hw-gfx-gma-gfx_test.adb +++ b/gfxtest/hw-gfx-gma-gfx_test.adb @@ -157,9 +157,11 @@ Height => Height_Type (Mode.V_Visible), BPC => 8, Stride => Width_Type ((Word32 (Mode.H_Visible) + 15) and not 15), + V_Stride => Height_Type (Mode.V_Visible), Tiling => Linear, + Rotation => No_Rotation, Offset => Offset); - Offset := Offset + Word32 (FB.Stride * FB.Height * 4); + Offset := Offset + Word32 (FB_Size (FB)); end Calc_Framebuffer;
Pipes : GMA.Pipe_Configs;