<p>Nico Huber has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/26766">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gfx, gma: Add helper to decide scaling aspect<br><br>Scaling_Type() returns the resulting scaling format, `Letterbox`,<br>`Pillarbox`, or `Evenly` when keeping aspect ratio.<br><br>Change-Id: I86fb15b03c2f4b55cb00e85b57dc7a64583557d0<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>---<br>M common/Makefile.inc<br>M common/hw-gfx-gma.ads<br>A common/hw-gfx.adb<br>M common/hw-gfx.ads<br>4 files changed, 42 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/66/26766/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/common/Makefile.inc b/common/Makefile.inc</span><br><span>index 8d6634e..eff0be0 100644</span><br><span>--- a/common/Makefile.inc</span><br><span>+++ b/common/Makefile.inc</span><br><span>@@ -41,6 +41,7 @@</span><br><span> gfxinit-y += hw-gfx-gma.adb</span><br><span> gfxinit-y += hw-gfx-gma.ads</span><br><span> gfxinit-y += hw-gfx-i2c.ads</span><br><span style="color: hsl(120, 100%, 40%);">+gfxinit-y += hw-gfx.adb</span><br><span> gfxinit-y += hw-gfx.ads</span><br><span> gfxinit-y += hw-gfx-framebuffer_filler.adb</span><br><span> gfxinit-y += hw-gfx-framebuffer_filler.ads</span><br><span>diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads</span><br><span>index 99ae279..8a83ae3 100644</span><br><span>--- a/common/hw-gfx-gma.ads</span><br><span>+++ b/common/hw-gfx-gma.ads</span><br><span>@@ -164,6 +164,9 @@</span><br><span> function Requires_Scaling (Pipe_Cfg : Pipe_Config) return Boolean is</span><br><span> (Requires_Scaling (Pipe_Cfg.Framebuffer, Pipe_Cfg.Mode));</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ function Scaling_Type (Pipe_Cfg : Pipe_Config) return Scaling_Aspect is</span><br><span style="color: hsl(120, 100%, 40%);">+ (Scaling_Type (Pipe_Cfg.Framebuffer, Pipe_Cfg.Mode));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ----------------------------------------------------------------------------</span><br><span> -- Internal representation of a single pipe's configuration</span><br><span> </span><br><span>diff --git a/common/hw-gfx.adb b/common/hw-gfx.adb</span><br><span>new file mode 100644</span><br><span>index 0000000..7124663</span><br><span>--- /dev/null</span><br><span>+++ b/common/hw-gfx.adb</span><br><span>@@ -0,0 +1,34 @@</span><br><span style="color: hsl(120, 100%, 40%);">+--</span><br><span style="color: hsl(120, 100%, 40%);">+-- Copyright (C) 2015-2016 secunet Security Networks AG</span><br><span style="color: hsl(120, 100%, 40%);">+-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de></span><br><span style="color: hsl(120, 100%, 40%);">+--</span><br><span style="color: hsl(120, 100%, 40%);">+-- This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+-- it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+-- the Free Software Foundation; either version 2 of the License, or</span><br><span style="color: hsl(120, 100%, 40%);">+-- (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+--</span><br><span style="color: hsl(120, 100%, 40%);">+-- This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+-- but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span><br><span style="color: hsl(120, 100%, 40%);">+-- GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+--</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+package body HW.GFX is</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ function Scaling_Type</span><br><span style="color: hsl(120, 100%, 40%);">+ (FB : Framebuffer_Type;</span><br><span style="color: hsl(120, 100%, 40%);">+ Mode : Mode_Type)</span><br><span style="color: hsl(120, 100%, 40%);">+ return Scaling_Aspect</span><br><span style="color: hsl(120, 100%, 40%);">+ is</span><br><span style="color: hsl(120, 100%, 40%);">+ H_Factor : constant Pos32 :=</span><br><span style="color: hsl(120, 100%, 40%);">+ Pos32 (Mode.H_Visible) * Pos32 (Rotated_Height (FB));</span><br><span style="color: hsl(120, 100%, 40%);">+ V_Factor : constant Pos32 :=</span><br><span style="color: hsl(120, 100%, 40%);">+ Pos32 (Mode.V_Visible) * Pos32 (Rotated_Width (FB));</span><br><span style="color: hsl(120, 100%, 40%);">+ begin</span><br><span style="color: hsl(120, 100%, 40%);">+ return</span><br><span style="color: hsl(120, 100%, 40%);">+ (if H_Factor < V_Factor then Letterbox</span><br><span style="color: hsl(120, 100%, 40%);">+ elsif H_Factor > V_Factor then Pillarbox</span><br><span style="color: hsl(120, 100%, 40%);">+ else Evenly);</span><br><span style="color: hsl(120, 100%, 40%);">+ end Scaling_Type;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+end HW.GFX;</span><br><span>diff --git a/common/hw-gfx.ads b/common/hw-gfx.ads</span><br><span>index 71182da..66aafca 100644</span><br><span>--- a/common/hw-gfx.ads</span><br><span>+++ b/common/hw-gfx.ads</span><br><span>@@ -197,4 +197,8 @@</span><br><span> (Rotated_Width (FB) /= Mode.H_Visible or</span><br><span> Rotated_Height (FB) /= Mode.V_Visible);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ type Scaling_Aspect is (Evenly, Letterbox, Pillarbox);</span><br><span style="color: hsl(120, 100%, 40%);">+ function Scaling_Type (FB : Framebuffer_Type; Mode : Mode_Type)</span><br><span style="color: hsl(120, 100%, 40%);">+ return Scaling_Aspect;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> end HW.GFX;</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/26766">change 26766</a>. To unsubscribe, or for help writing mail filters, 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/26766"/><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: I86fb15b03c2f4b55cb00e85b57dc7a64583557d0 </div>
<div style="display:none"> Gerrit-Change-Number: 26766 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>