<p>Nico Huber has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22713">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gfx_test: Add rotation parameter<br><br>Pass the requested rotation through to libgfxinit and enable Y tiling<br>in case of 90° rotations.<br><br>Change-Id: Icc4c4ee1ce43ecf1603cb673f1a10609494f757d<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>---<br>M gfxtest/gfx_test.sh<br>M gfxtest/hw-gfx-gma-gfx_test.adb<br>2 files changed, 44 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/13/22713/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/gfxtest/gfx_test.sh b/gfxtest/gfx_test.sh<br>index 9df0005..0115443 100755<br>--- a/gfxtest/gfx_test.sh<br>+++ b/gfxtest/gfx_test.sh<br>@@ -2,7 +2,7 @@<br> <br> set -e<br> <br>-usage="Usage: $0 [seconds]\n"<br>+usage="Usage: $0 [<delay seconds> [(0|90|128|270)]]\n"<br> <br> err_msgs=<br> command -v chvt >/dev/null || err_msgs="${err_msgs}"'Need `chvt`\n'<br>@@ -13,7 +13,7 @@<br> [ -x build/gfx_test ] || \<br> err_msgs="${err_msgs}"'Please run from *libgfxinit* source dir and build `gfx_test` first.\n'<br> <br>-[ "$#" -gt 1 ] && err_msgs="${err_msgs}${usage}"<br>+[ "$#" -gt 2 ] && err_msgs="${err_msgs}${usage}"<br> <br> if [ -n "$err_msgs" ]; then<br> printf "$err_msgs"<br>diff --git a/gfxtest/hw-gfx-gma-gfx_test.adb b/gfxtest/hw-gfx-gma-gfx_test.adb<br>index 4016664..e0ad71f 100644<br>--- a/gfxtest/hw-gfx-gma-gfx_test.adb<br>+++ b/gfxtest/hw-gfx-gma-gfx_test.adb<br>@@ -183,25 +183,38 @@<br> procedure Calc_Framebuffer<br> (FB : out Framebuffer_Type;<br> Mode : in Mode_Type;<br>+ Rotation : in Rotation_Type;<br> Offset : in out Word32)<br> is<br> begin<br> Offset := (Offset + FB_Align - 1) and not (FB_Align - 1);<br>- FB :=<br>- (Width => Width_Type (Mode.H_Visible),<br>- Height => Height_Type (Mode.V_Visible),<br>- BPC => 8,<br>- Stride => Width_Type ((Word32 (Mode.H_Visible) + 15) and not 15),<br>- V_Stride => Height_Type (Mode.V_Visible),<br>- Tiling => Linear,<br>- Rotation => No_Rotation,<br>- Offset => Offset);<br>+ if Rotation = Rotated_90 or Rotation = Rotated_270 then<br>+ FB :=<br>+ (Width => Width_Type (Mode.V_Visible),<br>+ Height => Height_Type (Mode.H_Visible),<br>+ BPC => 8,<br>+ Stride => Div_Round_Up (Pos32 (Mode.V_Visible), 32) * 32,<br>+ V_Stride => Div_Round_Up (Pos32 (Mode.H_Visible), 32) * 32,<br>+ Tiling => Y_Tiled,<br>+ Rotation => Rotation,<br>+ Offset => Offset);<br>+ else<br>+ FB :=<br>+ (Width => Width_Type (Mode.H_Visible),<br>+ Height => Width_Type (Mode.V_Visible),<br>+ BPC => 8,<br>+ Stride => Div_Round_Up (Pos32 (Mode.H_Visible), 16) * 16,<br>+ V_Stride => Height_Type (Mode.V_Visible),<br>+ Tiling => Linear,<br>+ Rotation => Rotation,<br>+ Offset => Offset);<br>+ end if;<br> Offset := Offset + Word32 (FB_Size (FB));<br> end Calc_Framebuffer;<br> <br> Pipes : GMA.Pipe_Configs;<br> <br>- procedure Prepare_Configs<br>+ procedure Prepare_Configs (Rotation : Rotation_Type)<br> is<br> use type HW.GFX.GMA.Port_Type;<br> <br>@@ -215,6 +228,7 @@<br> Calc_Framebuffer<br> (FB => Pipes (Pipe).Framebuffer,<br> Mode => Pipes (Pipe).Mode,<br>+ Rotation => Rotation,<br> Offset => Offset);<br> GMA.Setup_Default_FB<br> (FB => Pipes (Pipe).Framebuffer,<br>@@ -233,7 +247,9 @@<br> is<br> begin<br> Debug.Put_Line<br>- ("Usage: " & Ada.Command_Line.Command_Name & " <delay seconds>");<br>+ ("Usage: " & Ada.Command_Line.Command_Name &<br>+ " <delay seconds>" &<br>+ " [(0|90|180|270)]");<br> Debug.New_Line;<br> end Print_Usage;<br> <br>@@ -246,6 +262,7 @@<br> Res_Addr : Word64;<br> <br> Delay_S : Natural;<br>+ Rotation : Rotation_Type := No_Rotation;<br> <br> Dev_Init,<br> Initialized : Boolean;<br>@@ -253,12 +270,24 @@<br> function iopl (level : Interfaces.C.int) return Interfaces.C.int;<br> pragma Import (C, iopl, "iopl");<br> begin<br>- if Ada.Command_Line.Argument_Count /= 1 then<br>+ if Ada.Command_Line.Argument_Count < 1 then<br> Print_Usage;<br> return;<br> end if;<br> <br> Delay_S := Natural'Value (Ada.Command_Line.Argument (1));<br>+<br>+ if Ada.Command_Line.Argument_Count >= 2 then<br>+ declare<br>+ Rotation_Degree : constant String := Ada.Command_Line.Argument (2);<br>+ begin<br>+ if Rotation_Degree = "0" then Rotation := No_Rotation;<br>+ elsif Rotation_Degree = "90" then Rotation := Rotated_90;<br>+ elsif Rotation_Degree = "180" then Rotation := Rotated_180;<br>+ elsif Rotation_Degree = "270" then Rotation := Rotated_270;<br>+ else Print_Usage; return; end if;<br>+ end;<br>+ end if;<br> <br> if iopl (3) /= 0 then<br> Debug.Put_Line ("Failed to change i/o privilege level.");<br>@@ -292,7 +321,7 @@<br> if Initialized then<br> Backup_GTT;<br> <br>- Prepare_Configs;<br>+ Prepare_Configs (Rotation);<br> <br> GMA.Update_Outputs (Pipes);<br> <br></pre><p>To view, visit <a href="https://review.coreboot.org/22713">change 22713</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22713"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: libgfxinit </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Icc4c4ee1ce43ecf1603cb673f1a10609494f757d </div>
<div style="display:none"> Gerrit-Change-Number: 22713 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>