[coreboot-gerrit] Change in libgfxinit[master]: [WIP] gma: Add interface functions to set/move cursor

Nico Huber (Code Review) gerrit at coreboot.org
Thu Jan 11 15:02:46 CET 2018


Nico Huber has uploaded this change for review. ( https://review.coreboot.org/23216


Change subject: [WIP] gma: Add interface functions to set/move cursor
......................................................................

[WIP] gma: Add interface functions to set/move cursor

Change-Id: I6e97442847ea42662214390d80aaf634a4b1ab5a
Signed-off-by: Nico Huber <nico.huber at secunet.com>
---
M common/hw-gfx-gma.adb
M common/hw-gfx-gma.ads
2 files changed, 41 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/16/23216/1

diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index c179474..9ab6a92 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -303,6 +303,38 @@
 
    ----------------------------------------------------------------------------
 
+   procedure Set_Cursor
+     (Pipe : Pipe_Index;
+      X : Cursor_X_Pos;
+      Y : Cursor_Y_Pos)
+   is
+   begin
+      if X < 0 then
+         Cur_Configs (Pipe).Cursor.Center_X :=
+            Int32'Max (-Config.Maximum_Cursor_X, X);
+      else
+         Cur_Configs (Pipe).Cursor.Center_X :=
+            Int32'Min (Config.Maximum_Cursor_X, X);
+      end if;
+      Cur_Configs (Pipe).Cursor.Center_Y := Y;
+   end Set_Cursor;
+
+   procedure Move_Cursor
+     (Pipe : Pipe_Index;
+      X : Cursor_X_Pos;
+      Y : Cursor_Y_Pos)
+   is
+      function Cap_Add (A, B, Max : Cursor_Pos) return Cursor_Pos is
+        (if A + B < 0 then Int32'Max (-Max, A + B) else Int32'Min (Max, A + B));
+   begin
+      Cur_Configs (Pipe).Cursor.Center_X := Cap_Add
+        (Cur_Configs (Pipe).Cursor.Center_X, X, Config.Maximum_Cursor_X);
+      Cur_Configs (Pipe).Cursor.Center_Y := Cap_Add
+        (Cur_Configs (Pipe).Cursor.Center_Y, Y, Cursor_Y_Pos'Last);
+   end Move_Cursor;
+
+   ----------------------------------------------------------------------------
+
    procedure Initialize
      (Write_Delay : in     Word64 := 0;
       Clean_State : in     Boolean := False;
diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads
index eef0edc..f710bec 100644
--- a/common/hw-gfx-gma.ads
+++ b/common/hw-gfx-gma.ads
@@ -110,6 +110,15 @@
 
    procedure Update_Outputs (Configs : Pipe_Configs);
 
+   procedure Set_Cursor
+     (Pipe : Pipe_Index;
+      X : Cursor_X_Pos;
+      Y : Cursor_Y_Pos);
+   procedure Move_Cursor
+     (Pipe : Pipe_Index;
+      X : Cursor_X_Pos;
+      Y : Cursor_Y_Pos);
+
    pragma Warnings (GNATprove, Off, "subprogram ""Dump_Configs"" has no effect",
                     Reason => "It's only used for debugging");
    procedure Dump_Configs (Configs : Pipe_Configs);

-- 
To view, visit https://review.coreboot.org/23216
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: I6e97442847ea42662214390d80aaf634a4b1ab5a
Gerrit-Change-Number: 23216
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/20180111/d0c727bc/attachment.html>


More information about the coreboot-gerrit mailing list