[coreboot-gerrit] Change in libgfxinit[master]: gfx_test: Add loop that shows cuttings of the test image

Nico Huber (Code Review) gerrit at coreboot.org
Mon Jan 8 13:32:45 CET 2018


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


Change subject: gfx_test: Add loop that shows cuttings of the test image
......................................................................

gfx_test: Add loop that shows cuttings of the test image

If we are supposed to show the test image longer than 8s, show a
different cutting of the image every 4s.

Change-Id: I8ce22c4f8dc2615ae1dbe8c39ad249aa959a3005
Signed-off-by: Nico Huber <nico.h at gmx.de>
---
M gfxtest/hw-gfx-gma-gfx_test.adb
1 file changed, 43 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/66/23166/1

diff --git a/gfxtest/hw-gfx-gma-gfx_test.adb b/gfxtest/hw-gfx-gma-gfx_test.adb
index 833240f..145230b 100644
--- a/gfxtest/hw-gfx-gma-gfx_test.adb
+++ b/gfxtest/hw-gfx-gma-gfx_test.adb
@@ -1,3 +1,4 @@
+with Ada.Numerics.Discrete_Random;
 with Ada.Unchecked_Conversion;
 with Ada.Command_Line;
 with Interfaces.C;
@@ -14,6 +15,10 @@
 is
    pragma Disable_Atomic_Synchronization;
 
+   package Rand_P is new Ada.Numerics.Discrete_Random (Pos_Type);
+   Gen : Rand_P.Generator;
+   function Rand return Pos_Type is (Rand_P.Random (Gen));
+
    Start_X : constant := 0;
    Start_Y : constant := 0;
 
@@ -369,6 +374,44 @@
             end if;
          end loop;
 
+         if Delay_S > 8 then -- getting bored?
+            declare
+               New_Pipes : GMA.Pipe_Configs;
+
+               function Rand_Div (Num : Pos_Type) return Pos_Type is
+                 (case Rand mod 4 is
+                     when 3 => Rand mod Num / 3,
+                     when 2 => Rand mod Num / 2,
+                     when 1 => Rand mod Num,
+                     when others => 0);
+            begin
+               Time.M_Delay (4_000);
+               Delay_S := Delay_S - 4;
+               while Delay_S > 4 loop
+                  Time.M_Delay (4_000);
+                  Delay_S := Delay_S - 4;
+                  New_Pipes := Pipes;
+                  for Pipe in GMA.Pipe_Index loop
+                     New_Pipes (Pipe).Framebuffer.Start_X :=
+                        Rand_Div (Pipes (Pipe).Framebuffer.Width);
+                     New_Pipes (Pipe).Framebuffer.Start_Y :=
+                        Rand_Div (Pipes (Pipe).Framebuffer.Height);
+                     New_Pipes (Pipe).Framebuffer.Width :=
+                        Width_Type'Max (320,
+                           Pipes (Pipe).Framebuffer.Width
+                           - New_Pipes (Pipe).Framebuffer.Start_X
+                           - Rand_Div (Pipes (Pipe).Framebuffer.Width));
+                     New_Pipes (Pipe).Framebuffer.Height :=
+                        Height_Type'Max (320,
+                           Pipes (Pipe).Framebuffer.Height
+                           - New_Pipes (Pipe).Framebuffer.Start_Y
+                           - Rand_Div (Pipes (Pipe).Framebuffer.Height));
+                  end loop;
+                  GMA.Dump_Configs (New_Pipes);
+                  GMA.Update_Outputs (New_Pipes);
+               end loop;
+            end;
+         end if;
          Time.M_Delay (Delay_S * 1_000);
 
          for Pipe in GMA.Pipe_Index loop

-- 
To view, visit https://review.coreboot.org/23166
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: I8ce22c4f8dc2615ae1dbe8c39ad249aa959a3005
Gerrit-Change-Number: 23166
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/20180108/721eb1cf/attachment-0001.html>


More information about the coreboot-gerrit mailing list