blob: 29c7da645cecb982ced7fc05be7364979b9e5254 [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
Nico Hubercf88f3d2018-06-05 13:27:34 +020020with
21 Refined_State => (State => FB.State, Base_Address => FB.Base_Address)
Nico Huber83693c82016-10-08 22:17:55 +020022is
23
24 type FB_Index is new Natural range
25 0 .. Natural (Width_Type'Last * Height_Type'Last) - 1;
26 type FB_Range is array (FB_Index) of Word32 with Pack;
27 package FB is new MMIO_Range (0, Word32, FB_Index, FB_Range);
28
29 procedure Fill (Linear_FB : Word64; Framebuffer : Framebuffer_Type)
30 is
31 Line_Start : Int32 := 0;
32 begin
Nico Huber5374c3a2017-07-15 21:48:06 +020033 if not HW.Config.Dynamic_MMIO then
34 return;
35 end if;
36
Nico Huber83693c82016-10-08 22:17:55 +020037 FB.Set_Base_Address (Linear_FB);
38 for Line in 0 .. Framebuffer.Height - 1 loop
39 pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride);
40 for Col in 0 .. Framebuffer.Width - 1 loop
41 pragma Loop_Invariant (Line_Start = Line * Framebuffer.Stride);
42 FB.Write (FB_Index (Line_Start + Col), 16#ff000000#);
43 end loop;
44 Line_Start := Line_Start + Framebuffer.Stride;
45 end loop;
46 end Fill;
47
48end HW.GFX.Framebuffer_Filler;