[coreboot-gerrit] Change in libgfxinit[master]: [WIP] gfx_test: Refactor "bored" loop

Nico Huber (Code Review) gerrit at coreboot.org
Wed Feb 7 12:13:04 CET 2018


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


Change subject: [WIP] gfx_test: Refactor "bored" loop
......................................................................

[WIP] gfx_test: Refactor "bored" loop

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



  git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/37/23637/1

diff --git a/gfxtest/hw-gfx-gma-gfx_test.adb b/gfxtest/hw-gfx-gma-gfx_test.adb
index 231d5dd..0c29fbe 100644
--- a/gfxtest/hw-gfx-gma-gfx_test.adb
+++ b/gfxtest/hw-gfx-gma-gfx_test.adb
@@ -465,9 +465,11 @@
             end loop;
          end loop;
 
-         if Delay_S > 8 then -- getting bored?
+         if Delay_S >= 12 then -- getting bored?
+            Time.M_Delay (8_000);
+            Delay_S := Delay_S - 8;
             declare
-               New_Pipes : GMA.Pipe_Configs;
+               New_Pipes : GMA.Pipe_Configs := Pipes;
 
                function Rand_Div (Num : Pos_Type) return Pos_Type is
                  (case Rand mod 4 is
@@ -476,30 +478,32 @@
                      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;
+               while Delay_S >= 4 loop
                   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));
+                     exit when Pipes (Pipe).Port = Disabled;
+                     declare
+                        New_FB : Framebuffer_Type renames
+                           New_Pipes (Pipe).Framebuffer;
+                        Width : constant Width_Type :=
+                           Pipes (Pipe).Framebuffer.Width;
+                        Height : constant Height_Type :=
+                           Pipes (Pipe).Framebuffer.Height;
+                     begin
+                        New_FB.Start_X := Pos_Type'Min
+                          (Width - 320, Rand_Div (Width));
+                        New_FB.Start_Y := Pos_Type'Min
+                          (Height - 320, Rand_Div (Height));
+                        New_FB.Width := Width_Type'Max
+                          (320, Width - New_FB.Start_X - Rand_Div (Width));
+                        New_FB.Height := Height_Type'Max
+                          (320, Height - New_FB.Start_Y - Rand_Div (Height));
+                     end;
                   end loop;
                   GMA.Dump_Configs (New_Pipes);
                   GMA.Update_Outputs (New_Pipes);
+                  Time.M_Delay (4_000);
+                  Delay_S := Delay_S - 4;
                end loop;
             end;
          end if;

-- 
To view, visit https://review.coreboot.org/23637
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: I44920c35b4ea3f0a08ce306dcf8203379c15791b
Gerrit-Change-Number: 23637
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/20180207/f7267c94/attachment-0001.html>


More information about the coreboot-gerrit mailing list