Nico Huber has uploaded this change for review. ( https://review.coreboot.org/22712
Change subject: gfx_test: Add corner markers to test screen ......................................................................
gfx_test: Add corner markers to test screen
Show a white-framed square with rotating colors in each corner.
Change-Id: Ifcd20a3f531c9cebcaf0e7502a76ffb7ff6ca4f8 Signed-off-by: Nico Huber nico.h@gmx.de --- M gfxtest/hw-gfx-gma-gfx_test.adb 1 file changed, 38 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/12/22712/1
diff --git a/gfxtest/hw-gfx-gma-gfx_test.adb b/gfxtest/hw-gfx-gma-gfx_test.adb index 9a5ce0a..4016664 100644 --- a/gfxtest/hw-gfx-gma-gfx_test.adb +++ b/gfxtest/hw-gfx-gma-gfx_test.adb @@ -56,6 +56,12 @@ Alpha at 3 range 0 .. 7; end record;
+ White : constant Pixel_Type := (255, 255, 255, 255); + Black : constant Pixel_Type := ( 0, 0, 0, 255); + Red : constant Pixel_Type := (255, 0, 0, 255); + Green : constant Pixel_Type := ( 0, 255, 0, 255); + Blue : constant Pixel_Type := ( 0, 0, 255, 255); + function Pixel_To_Word (P : Pixel_Type) return Word32 with SPARK_Mode => Off @@ -96,10 +102,35 @@ end loop; end Restore_Screen;
+ function Corner_Fill + (X, Y : Natural; + FB : Framebuffer_Type; + Pipe : Pipe_Index) + return Pixel_Type + is + Xrel : constant Integer := + (if X < 32 then X else X - (Natural (FB.Width) - 32)); + Yrel : constant Integer := + (if Y < 32 then Y else Y - (Natural (FB.Height) - 32)); + + function Color (Idx : Natural) return Pixel_Type is + (case (Idx + Pipe_Index'Pos (Pipe)) mod 4 is + when 0 => Blue, when 1 => Black, + when 3 => Green, when others => Red); + begin + return + (if Xrel mod 16 = 0 or Xrel = 31 or Yrel mod 16 = 0 or Yrel = 31 then + White + elsif Yrel < 16 then + (if Xrel < 16 then Color (0) else Color (1)) + else + (if Xrel < 16 then Color (3) else Color (2))); + end Corner_Fill; + function Fill (X, Y : Natural; Framebuffer : Framebuffer_Type; - Pipe : GMA.Pipe_Index) + Pipe : Pipe_Index) return Pixel_Type is use type HW.Byte; @@ -133,8 +164,12 @@ for Y in 0 .. Natural (Framebuffer.Height) - 1 loop Offset := Offset_Y; for X in 0 .. Natural (Framebuffer.Width) - 1 loop - if Y mod 16 = 0 or X mod 16 = 0 then - P := (0, 0, 0, 0); + if (X < 32 or X >= Natural (Framebuffer.Width) - 32) and + (Y < 32 or Y >= Natural (Framebuffer.Height) - 32) + then + P := Corner_Fill (X, Y, Framebuffer, Pipe); + elsif Y mod 16 = 0 or X mod 16 = 0 then + P := Black; else P := Fill (X, Y, Framebuffer, Pipe); end if;