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