gma pipe_setup: Pass new and old cursor position in
To use the secondary plane as a cursor, we have to know when
the cursor becomes visible or vanishes (e.g. moved to a dif-
ferent screen). So we need to know both, its old and its new
position.
Change-Id: I13785be10c6c50fccfd2b930b82da203d6cc6df9
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/544
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Tested-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/hw-gfx-gma-pipe_setup.adb b/common/hw-gfx-gma-pipe_setup.adb
index 3e592ff..5182205 100644
--- a/common/hw-gfx-gma-pipe_setup.adb
+++ b/common/hw-gfx-gma-pipe_setup.adb
@@ -529,13 +529,14 @@
(if Config.Need_Pipe_Arb_Slots
then MCURSOR_ARB_SLOTS (1)
else CUR_CTL_PIPE_SELECT (Pipe)));
- Place_Cursor (Pipe, FB, Cursor);
+ Place_Cursor (Pipe, FB, Cursor, (Cursor.Center_X, Cursor.Center_Y));
end Update_Cursor;
procedure Place_Cursor
(Pipe : Pipe_Index;
FB : Framebuffer_Type;
- Cursor : Cursor_Type)
+ Cursor : Cursor_Type;
+ Center : Cursor_Coord)
is
Width : constant Width_Type := Cursor_Width (Cursor.Size);
@@ -543,16 +544,16 @@
-- but we need to place it on the physical screen:
Center_X : constant Int32 :=
(case FB.Rotation is
- when No_Rotation => Cursor.Center_X,
- when Rotated_90 => FB.Height - 1 - Cursor.Center_Y,
- when Rotated_180 => FB.Width - 1 - Cursor.Center_X,
- when Rotated_270 => Cursor.Center_Y);
+ when No_Rotation => Center.X,
+ when Rotated_90 => FB.Height - 1 - Center.Y,
+ when Rotated_180 => FB.Width - 1 - Center.X,
+ when Rotated_270 => Center.Y);
Center_Y : constant Int32 :=
(case FB.Rotation is
- when No_Rotation => Cursor.Center_Y,
- when Rotated_90 => Cursor.Center_X,
- when Rotated_180 => FB.Height - 1 - Cursor.Center_Y,
- when Rotated_270 => FB.Width - 1 - Cursor.Center_X);
+ when No_Rotation => Center.Y,
+ when Rotated_90 => Center.X,
+ when Rotated_180 => FB.Height - 1 - Center.Y,
+ when Rotated_270 => FB.Width - 1 - Center.X);
X : Int32 := Center_X - Width / 2;
Y : Int32 := Center_Y - Width / 2;
diff --git a/common/hw-gfx-gma-pipe_setup.ads b/common/hw-gfx-gma-pipe_setup.ads
index 953820b..892d218 100644
--- a/common/hw-gfx-gma-pipe_setup.ads
+++ b/common/hw-gfx-gma-pipe_setup.ads
@@ -51,7 +51,8 @@
procedure Place_Cursor
(Pipe : Pipe_Index;
FB : Framebuffer_Type;
- Cursor : Cursor_Type);
+ Cursor : Cursor_Type;
+ Center : Cursor_Coord);
type Scaler_Reservation is private;
Null_Scaler_Reservation : constant Scaler_Reservation;
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 449f7b3..6108a89 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -420,10 +420,10 @@
Y : Cursor_Pos)
is
begin
+ Display_Controller.Place_Cursor
+ (Pipe, Cur_Configs (Pipe).Framebuffer, Cur_Configs (Pipe).Cursor, (X, Y));
Cur_Configs (Pipe).Cursor.Center_X := X;
Cur_Configs (Pipe).Cursor.Center_Y := Y;
- Display_Controller.Place_Cursor
- (Pipe, Cur_Configs (Pipe).Framebuffer, Cur_Configs (Pipe).Cursor);
end Place_Cursor;
procedure Move_Cursor
diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads
index c0c1687..2b1177c 100644
--- a/common/hw-gfx-gma.ads
+++ b/common/hw-gfx-gma.ads
@@ -378,4 +378,11 @@
FB.Height + FB.Start_Y <= FB.V_Stride and
FB.V_Stride mod Tile_Rows (FB.Tiling) = 0);
+ ----------------------------------------------------------------------------
+
+ type Cursor_Coord is record
+ X : Cursor_Pos;
+ Y : Cursor_Pos;
+ end record;
+
end HW.GFX.GMA;