blob: 8c1ffdf5df80cd3493df132b2752580fb58f73a9 [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
6-- the Free Software Foundation; version 2 of the License.
7--
8-- This program is distributed in the hope that it will be useful,
9-- but WITHOUT ANY WARRANTY; without even the implied warranty of
10-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11-- GNU General Public License for more details.
12--
13
14with HW.MMIO_Range;
15pragma Elaborate_All (HW.MMIO_Range);
16
17package body HW.GFX.Framebuffer_Filler
18is
19
20 type FB_Index is new Natural range
21 0 .. Natural (Width_Type'Last * Height_Type'Last) - 1;
22 type FB_Range is array (FB_Index) of Word32 with Pack;
23 package FB is new MMIO_Range (0, Word32, FB_Index, FB_Range);
24
25 procedure Fill (Linear_FB : Word64; Framebuffer : Framebuffer_Type)
26 is
27 Line_Start : Int32 := 0;
28 begin
29 FB.Set_Base_Address (Linear_FB);
30 for Line in 0 .. Framebuffer.Height - 1 loop
31 pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride);
32 for Col in 0 .. Framebuffer.Width - 1 loop
33 pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride);
34 FB.Write (FB_Index (Line_Start + Col), 16#ff000000#);
35 end loop;
36 Line_Start := Line_Start + Framebuffer.Stride;
37 end loop;
38 end Fill;
39
40end HW.GFX.Framebuffer_Filler;