[coreboot-gerrit] Change in libgfxinit[master]: [WIP] gma: Configure cursor plane
Nico Huber (Code Review)
gerrit at coreboot.org
Wed Jan 10 15:55:13 CET 2018
Nico Huber has uploaded this change for review. ( https://review.coreboot.org/23204
Change subject: [WIP] gma: Configure cursor plane
......................................................................
[WIP] gma: Configure cursor plane
Change-Id: I08ffd81d524e14e464af6e6f6fb5effbd4890d8a
Signed-off-by: Nico Huber <nico.huber at secunet.com>
---
M common/hw-gfx-gma-pipe_setup.adb
M common/hw-gfx-gma-pipe_setup.ads
M common/hw-gfx-gma.adb
M common/hw-gfx-gma.ads
4 files changed, 58 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/04/23204/1
diff --git a/common/hw-gfx-gma-pipe_setup.adb b/common/hw-gfx-gma-pipe_setup.adb
index 569f682..1aa7683 100644
--- a/common/hw-gfx-gma-pipe_setup.adb
+++ b/common/hw-gfx-gma-pipe_setup.adb
@@ -72,6 +72,27 @@
VGA_CONTROL_BLINK_DUTY_CYCLE_50 : constant := 2 * 2 ** 6;
VGA_CONTROL_VSYNC_BLINK_RATE_MASK : constant := 16#003f# * 2 ** 0;
+ -- on some platforms writing CUR_CTL disables self-arming of CUR_POS
+ CUR_CTL_PIPE_SELECT : constant array (Pipe_Index) of Word32 :=
+ (Primary => 0, Secondary => 1 * 2 ** 28, Tertiary => 2 * 2 ** 28);
+ CUR_CTL_MODE_MASK : constant := 16#27#;
+ CUR_CTL_MODE : constant array (Cursor_Mode, Cursor_Size) of Word32 :=
+ (No_Cursor => (others => 16#00#),
+ ARGB_Cursor =>
+ (Cursor_64x64 => 16#27#,
+ Cursor_128x128 => 16#22#,
+ Cursor_256x256 => 16#23#));
+
+ function CUR_POS_Y (Y : Cursor_Y_Pos) return Word32 is
+ ((if Y >= 0 then 0 else 1 * 2 ** 31) or
+ Shift_Left (Word32 (abs Y), 16));
+ function CUR_POS_X (X : Cursor_X_Pos) return Word32 is
+ ((if X >= 0 then 0 else 1 * 2 ** 15) or
+ (Word32 (abs X) and Config.Maximum_Cursor_X));
+
+ -- write always arms other CUR_* registers
+ CUR_BASE_MASK : constant := 16#fffff# * 2 ** 12;
+
subtype VGA_Cycle_Count is Pos32 range 2 .. 128;
function VGA_CONTROL_VSYNC_BLINK_RATE
(Cycles : VGA_Cycle_Count)
@@ -290,6 +311,30 @@
----------------------------------------------------------------------------
+ procedure Setup_Cursor (Pipe : Pipe_Index; Cursor : Cursor_Type)
+ is
+ begin
+ Registers.Write
+ (Register => Controllers (Pipe).CUR_CTL,
+ Value => CUR_CTL_PIPE_SELECT (Pipe) or
+ CUR_CTL_MODE (Cursor.Mode, Cursor.Size));
+ Update_Cursor (Pipe, Cursor);
+ end Setup_Cursor;
+
+ procedure Update_Cursor (Pipe : Pipe_Index; Cursor : Cursor_Type)
+ is
+ begin
+ Registers.Write
+ (Register => Controllers (Pipe).CUR_POS,
+ Value => CUR_POS_Y (Cursor.Center_Y) or
+ CUR_POS_X (Cursor.Center_X));
+ Registers.Write
+ (Register => Controllers (Pipe).CUR_BASE,
+ Value => Cursor.GTT_Offset and CUR_BASE_MASK);
+ end Update_Cursor;
+
+ ----------------------------------------------------------------------------
+
procedure Scale_Keep_Aspect
(Width : out Pos32;
Height : out Pos32;
@@ -479,7 +524,8 @@
procedure On
(Pipe : Pipe_Index;
Port_Cfg : Port_Config;
- Framebuffer : Framebuffer_Type)
+ Framebuffer : Framebuffer_Type;
+ Cursor : Cursor_Type)
is
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
@@ -487,6 +533,7 @@
Transcoder.Setup (Pipe, Port_Cfg);
Setup_FB (Pipe, Port_Cfg.Mode, Framebuffer);
+ Setup_Cursor (Pipe, Cursor);
Transcoder.On (Pipe, Port_Cfg, Framebuffer.BPC /= Port_Cfg.Mode.BPC);
end On;
@@ -495,6 +542,8 @@
procedure Planes_Off (Controller : Controller_Type) is
begin
+ Registers.Write (Controller.CUR_CTL, 16#0000_0000#);
+ Registers.Write (Controller.CUR_FBC_CTL, 16#0000_0000#);
Registers.Unset_Mask (Controller.SPCNTR, DSPCNTR_ENABLE);
if Config.Has_Plane_Control then
Clear_Watermarks (Controller);
diff --git a/common/hw-gfx-gma-pipe_setup.ads b/common/hw-gfx-gma-pipe_setup.ads
index 33d543e..dff664d 100644
--- a/common/hw-gfx-gma-pipe_setup.ads
+++ b/common/hw-gfx-gma-pipe_setup.ads
@@ -22,7 +22,8 @@
procedure On
(Pipe : Pipe_Index;
Port_Cfg : Port_Config;
- Framebuffer : Framebuffer_Type)
+ Framebuffer : Framebuffer_Type;
+ Cursor : Cursor_Type)
with
Pre =>
Rotated_Width (Framebuffer) <= Port_Cfg.Mode.H_Visible and
@@ -47,6 +48,8 @@
(Framebuffer.Offset = VGA_PLANE_FRAMEBUFFER_OFFSET or
Framebuffer.Height + Framebuffer.Start_Y <= Framebuffer.V_Stride);
+ procedure Update_Cursor (Pipe : Pipe_Index; Cursor : Cursor_Type);
+
private
subtype WM_Levels is Natural range 0 .. 7;
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 7dc8918..c179474 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -147,7 +147,8 @@
Display_Controller.On
(Pipe => Pipe,
Port_Cfg => Port_Cfg,
- Framebuffer => Pipe_Cfg.Framebuffer);
+ Framebuffer => Pipe_Cfg.Framebuffer,
+ Cursor => Pipe_Cfg.Cursor);
Connectors.Post_On
(Port_Cfg => Port_Cfg,
diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads
index baadbeb..363461b 100644
--- a/common/hw-gfx-gma.ads
+++ b/common/hw-gfx-gma.ads
@@ -60,8 +60,8 @@
type Cursor_Type is record
Mode : Cursor_Mode;
Size : Cursor_Size;
- Start_X : Cursor_X_Pos;
- Start_Y : Cursor_Y_Pos;
+ Center_X : Cursor_X_Pos;
+ Center_Y : Cursor_Y_Pos;
GTT_Offset : Word32;
end record;
Default_Cursor : constant Cursor_Type := (Mode => No_Cursor, others => <>);
--
To view, visit https://review.coreboot.org/23204
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: libgfxinit
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I08ffd81d524e14e464af6e6f6fb5effbd4890d8a
Gerrit-Change-Number: 23204
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h at gmx.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180110/64d3e5c9/attachment-0001.html>
More information about the coreboot-gerrit
mailing list