gfxtest: Always ensure a valid cursor size
To avoid glitching, the cursor plane mustn't be bigger than the
primary one, i.e. the currently displayed framebuffer clipping.
So far, we only checked this after explicitly changing the cur-
sor size, but not after changing the framebuffer clipping.
Also disable the cursor whilst changing the clipping to avoid
further issues before the cursor settings are updated, too.
Change-Id: Ibadd3298eee8d373974e22f4d69b5b6f68be3c78
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/551
Reviewed-by: Thomas Heijligen <src@posteo.de>
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/gfxtest/hw-gfx-gma-gfx_test.adb b/gfxtest/hw-gfx-gma-gfx_test.adb
index 5042f77..3ae9635 100644
--- a/gfxtest/hw-gfx-gma-gfx_test.adb
+++ b/gfxtest/hw-gfx-gma-gfx_test.adb
@@ -484,12 +484,15 @@
else
CI.Size := Cursor_Size'Val
((Cursor_Size'Pos (CI.Size) + 1 + Rand (Gen) mod 2) mod 3);
- if Cursor_Width (CI.Size) > Pipes (P).Framebuffer.Width or
- Cursor_Width (CI.Size) > Pipes (P).Framebuffer.Height
- then
- CI.Size := Cursor_64x64;
- end if;
end if;
+
+ -- always ensure the cursor fits
+ if Cursor_Width (CI.Size) > Pipes (P).Framebuffer.Width or
+ Cursor_Width (CI.Size) > Pipes (P).Framebuffer.Height
+ then
+ CI.Size := Cursor_64x64;
+ end if;
+
C := Cursors (CI.Color) (CI.Size);
C.Center_X := Old_C.Center_X;
C.Center_Y := Old_C.Center_Y;
@@ -631,9 +634,9 @@
New_FB.Height := Height_Type'Max
(64, Height - New_FB.Start_Y - Rand_Div (Height));
+ Cursor.Mode := No_Cursor;
Cursor.Center_X := Rotated_Width (New_FB) / 2;
Cursor.Center_Y := Rotated_Height (New_FB) / 2;
- GMA.Update_Cursor (Pipe, Cursor);
end;
end loop;
GMA.Dump_Configs (New_Pipes);