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>
diff --git a/common/hw-gfx.ads b/common/hw-gfx.ads
index cff3e18..93a3684 100644
--- a/common/hw-gfx.ads
+++ b/common/hw-gfx.ads
@@ -24,6 +24,9 @@
subtype Pixel_Type is Int32 range 0 .. 8192 * 8192;
subtype Pos_Pixel_Type is Pixel_Type range 1 .. Pixel_Type'Last;
+ -- assume at most 8 bytes per pixel
+ subtype Size_Type is Int32 range 0 .. Pixel_Type'Last * 8;
+
-- Allow same range for width and height (for rotated framebuffers)
subtype Width_Type is Pos32 range 1 .. 8192;
subtype Height_Type is Pos32 range 1 .. 8192;
@@ -188,7 +191,7 @@
(if Rotation_90 (FB) then FB.Width else FB.Height);
function Pixel_To_Bytes (Pixel : Pixel_Type; FB : Framebuffer_Type)
- return Int32 is (Pixel * Pos32 (FB.BPC) / (8 / 4));
+ return Size_Type is (Pixel * Pos32 (FB.BPC) / (8 / 4));
function FB_Size (FB : Framebuffer_Type)
return Pos32 is (Pixel_To_Bytes (FB.Stride * FB.V_Stride, FB));