blob: 250d903fd7d2bf8e6bd88ac53691ea55049b12ba [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
Nico Huber5374c3a2017-07-15 21:48:06 +020015with HW.Config;
Nico Huber83693c82016-10-08 22:17:55 +020016with HW.MMIO_Range;
17pragma Elaborate_All (HW.MMIO_Range);
18
19package body HW.GFX.Framebuffer_Filler
20is
21
22 type FB_Index is new Natural range
23 0 .. Natural (Width_Type'Last * Height_Type'Last) - 1;
24 type FB_Range is array (FB_Index) of Word32 with Pack;
25 package FB is new MMIO_Range (0, Word32, FB_Index, FB_Range);
26
27 procedure Fill (Linear_FB : Word64; Framebuffer : Framebuffer_Type)
28 is
29 Line_Start : Int32 := 0;
30 begin
Nico Huber5374c3a2017-07-15 21:48:06 +020031 if not HW.Config.Dynamic_MMIO then
32 return;
33 end if;
34
Nico Huber83693c82016-10-08 22:17:55 +020035 FB.Set_Base_Address (Linear_FB);
36 for Line in 0 .. Framebuffer.Height - 1 loop
37 pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride);
38 for Col in 0 .. Framebuffer.Width - 1 loop
39 pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride);
40 FB.Write (FB_Index (Line_Start + Col), 16#ff000000#);
41 end loop;
42 Line_Start := Line_Start + Framebuffer.Stride;
43 end loop;
44 end Fill;
45
46end HW.GFX.Framebuffer_Filler;