blob: e55e9bee7913e353e4867b0fec516cb333bbcab9 [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
2-- Copyright (C) 2015-2016 secunet Security Networks AG
3--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
Nico Huber125a29e2016-10-18 00:23:54 +02006-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
Nico Huber83693c82016-10-08 22:17:55 +02008--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
15with HW.MMIO_Range;
16pragma Elaborate_All (HW.MMIO_Range);
17
18package body HW.GFX.Framebuffer_Filler
19is
20
21 type FB_Index is new Natural range
22 0 .. Natural (Width_Type'Last * Height_Type'Last) - 1;
23 type FB_Range is array (FB_Index) of Word32 with Pack;
24 package FB is new MMIO_Range (0, Word32, FB_Index, FB_Range);
25
26 procedure Fill (Linear_FB : Word64; Framebuffer : Framebuffer_Type)
27 is
28 Line_Start : Int32 := 0;
29 begin
30 FB.Set_Base_Address (Linear_FB);
31 for Line in 0 .. Framebuffer.Height - 1 loop
32 pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride);
33 for Col in 0 .. Framebuffer.Width - 1 loop
34 pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride);
35 FB.Write (FB_Index (Line_Start + Col), 16#ff000000#);
36 end loop;
37 Line_Start := Line_Start + Framebuffer.Stride;
38 end loop;
39 end Fill;
40
41end HW.GFX.Framebuffer_Filler;