gma: Add cursor infrastructure
Allow ARGB cursors of 64x64, 128x128 or 256x256 pixels. Valid positions
depend a lot on the hardware generation, so we'll accept arbitrary
integer values in the interface and filter them internally. An out of
bounds cursor will simply be invisible.
It's unclear if the parameters also apply to other GFX hardware. Thus,
we keep the types in the GMA sub-package for now.
Change-Id: I1a380037ac91ba2beeb33c27a6882eb5caa126f9
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/23185
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads
index 824a59e..d6c5572 100644
--- a/common/hw-gfx-gma.ads
+++ b/common/hw-gfx-gma.ads
@@ -29,6 +29,11 @@
Config_State)
is
+ GTT_Page_Size : constant := 4096;
+ type GTT_Address_Type is mod 2 ** 39;
+ subtype GTT_Range is Natural range 0 .. 16#8_0000# - 1;
+ GTT_Rotation_Offset : constant GTT_Range := GTT_Range'Last / 2 + 1;
+
type CPU_Type is
(G45,
Ironlake,
@@ -52,9 +57,30 @@
HDMI3, -- or DVI
Analog);
+ type Cursor_Mode is (No_Cursor, ARGB_Cursor);
+ type Cursor_Size is (Cursor_64x64, Cursor_128x128, Cursor_256x256);
+ Cursor_Width : constant array (Cursor_Size) of Width_Type := (64, 128, 256);
+
+ subtype Cursor_Pos is Int32 range Int32'First / 2 .. Int32'Last / 2;
+
+ type Cursor_Type is record
+ Mode : Cursor_Mode;
+ Size : Cursor_Size;
+ Center_X : Cursor_Pos;
+ Center_Y : Cursor_Pos;
+ GTT_Offset : GTT_Range;
+ end record;
+ Default_Cursor : constant Cursor_Type :=
+ (Mode => No_Cursor,
+ Size => Cursor_Size'First,
+ Center_X => 0,
+ Center_Y => 0,
+ GTT_Offset => 0);
+
type Pipe_Config is record
Port : Port_Type;
Framebuffer : Framebuffer_Type;
+ Cursor : Cursor_Type;
Mode : Mode_Type;
end record;
type Pipe_Index is (Primary, Secondary, Tertiary);
@@ -93,11 +119,6 @@
Reason => "It's only used for debugging");
procedure Dump_Configs (Configs : Pipe_Configs);
- GTT_Page_Size : constant := 4096;
- type GTT_Address_Type is mod 2 ** 39;
- subtype GTT_Range is Natural range 0 .. 16#8_0000# - 1;
- GTT_Rotation_Offset : constant GTT_Range := GTT_Range'Last / 2 + 1;
-
procedure Write_GTT
(GTT_Page : GTT_Range;
Device_Address : GTT_Address_Type;