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>
This commit is contained in:
Nico Huber
2018-01-09 15:58:34 +01:00
committed by Nico Huber
parent 7a740439ed
commit a02b2c699b
4 changed files with 37 additions and 5 deletions

View File

@@ -286,6 +286,13 @@ is
Secondary => 4096,
Tertiary => 4096));
-- Maximum X position of hardware cursors
Maximum_Cursor_X : constant := (case CPU is
when G45 .. Ivybridge => 4095,
when Haswell .. Skylake => 8191);
Maximum_Cursor_Y : constant := 4095;
----------------------------------------------------------------------------
-- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D

View File

@@ -189,6 +189,7 @@ is
Configs := (Pipe_Index =>
(Port => Disabled,
Mode => Invalid_Mode,
Cursor => Default_Cursor,
Framebuffer => Default_FB));
-- Turn panel on early to probe other ports during the power on delay.

View File

@@ -386,6 +386,7 @@ is
(others => Pipe_Config'
(Port => Disabled,
Framebuffer => HW.GFX.Default_FB,
Cursor => Default_Cursor,
Mode => HW.GFX.Invalid_Mode));
PLLs.Initialize;
@@ -476,10 +477,12 @@ is
(Primary =>
(Port => Analog,
Framebuffer => HW.GFX.Default_FB,
Cursor => Default_Cursor,
Mode => HW.GFX.Invalid_Mode),
others =>
(Port => Disabled,
Framebuffer => HW.GFX.Default_FB,
Cursor => Default_Cursor,
Mode => HW.GFX.Invalid_Mode));
begin
Power_And_Clocks.Power_Up (Cur_Configs, Fake_Config);

View File

@@ -29,6 +29,11 @@ with
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 @@ is
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 @@ is
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;