gma: Set tiled framebuffers up through Plane_Control
On platforms with Plane_Control registers (Broxton/Skylake+) we can
use X and Y tiled framebuffers for scanout (older platforms support
X tiling only). As our main use case is 90° rotation with Y tiled
framebuffers, we implement it for the newer platforms only for now.
We also set up a fence register for linear access to the tiled frame-
buffer through the aperture.
Change-Id: I913c82f62fd28b681a06ce13f41160a07e559799
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/22709
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads
index cd992b8..9943e44 100644
--- a/common/hw-gfx-gma.ads
+++ b/common/hw-gfx-gma.ads
@@ -157,4 +157,17 @@
subtype DDI_HDMI_Buf_Trans_Range is Integer range 0 .. 11;
+ ----------------------------------------------------------------------------
+
+ Tile_Width : constant array (Tiling_Type) of Pos32 :=
+ (Linear => 16, X_Tiled => 128, Y_Tiled => 32);
+
+ function FB_Pitch (Px : Pixel_Type; FB : Framebuffer_Type) return Natural is
+ (Natural (Div_Round_Up
+ (Pixel_To_Bytes (Px, FB), Tile_Width (FB.Tiling) * 4)));
+
+ function Valid_Stride (FB : Framebuffer_Type) return Boolean is
+ (FB.Width <= FB.Stride and
+ Pixel_To_Bytes (FB.Stride, FB) mod (Tile_Width (FB.Tiling) * 4) = 0);
+
end HW.GFX.GMA;