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;