Skip to content

Commit 865f1fa

Browse files
n-huberi-c-o-n
authored andcommitted
gfx: Introduce Size_Type for framebuffer size in bytes
Change-Id: I8809a887b12124e5331f188dfa1674cbcca7152e Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/26865 Tested-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
1 parent c5c767a commit 865f1fa

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

common/hw-gfx.ads

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ package HW.GFX is
2424
subtype Pixel_Type is Int32 range 0 .. 8192 * 8192;
2525
subtype Pos_Pixel_Type is Pixel_Type range 1 .. Pixel_Type'Last;
2626

27+
-- assume at most 8 bytes per pixel
28+
subtype Size_Type is Int32 range 0 .. Pixel_Type'Last * 8;
29+
2730
-- Allow same range for width and height (for rotated framebuffers)
2831
subtype Width_Type is Pos32 range 1 .. 8192;
2932
subtype Height_Type is Pos32 range 1 .. 8192;
@@ -188,7 +191,7 @@ private
188191
(if Rotation_90 (FB) then FB.Width else FB.Height);
189192

190193
function Pixel_To_Bytes (Pixel : Pixel_Type; FB : Framebuffer_Type)
191-
return Int32 is (Pixel * Pos32 (FB.BPC) / (8 / 4));
194+
return Size_Type is (Pixel * Pos32 (FB.BPC) / (8 / 4));
192195
function FB_Size (FB : Framebuffer_Type)
193196
return Pos32 is (Pixel_To_Bytes (FB.Stride * FB.V_Stride, FB));
194197

0 commit comments

Comments
 (0)