blob: 7bbf423ae4e8d445bcb86ec07bdb0cefe0bb10bd [file] [log] [blame]
Nico Huber8c45bcf2016-11-20 17:30:57 +01001--
Nico Huber3be61d42017-01-09 13:58:18 +01002-- Copyright (C) 2015-2017 secunet Security Networks AG
Nico Huber8c45bcf2016-11-20 17:30:57 +01003--
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; either version 2 of the License, or
7-- (at your option) any later version.
8--
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;
16
17private package HW.GFX.GMA.Config_Helpers
18is
19
Nico Huber3be61d42017-01-09 13:58:18 +010020 function To_GPU_Port
21 (Pipe : Pipe_Index;
22 Port : Active_Port_Type)
23 return GPU_Port;
24
Nico Huber8c45bcf2016-11-20 17:30:57 +010025 function To_PCH_Port (Port : Active_Port_Type) return PCH_Port;
26
27 function To_Display_Type (Port : Active_Port_Type) return Display_Type;
28
29 procedure Fill_Port_Config
30 (Port_Cfg : out Port_Config;
31 Pipe : in Pipe_Index;
32 Port : in Port_Type;
33 Mode : in Mode_Type;
34 Success : out Boolean);
35
36 ----------------------------------------------------------------------------
37
Nico Huber31a52172017-03-05 14:17:34 +010038 pragma Warnings (GNAT, Off, """Integer_32"" is already use-visible *",
39 Reason => "Needed for older compiler versions");
Nico Huber8c45bcf2016-11-20 17:30:57 +010040 use type HW.Pos32;
Nico Huber31a52172017-03-05 14:17:34 +010041 pragma Warnings (GNAT, On, """Integer_32"" is already use-visible *");
Nico Huber9e96a452019-09-22 20:25:17 +020042
43 -- Validate just enough to satisfy Pipe_Setup pre conditions.
44 function Valid_FB
45 (FB : Framebuffer_Type;
46 Mode : Mode_Type)
47 return Boolean is
48 (Rotated_Width (FB) <= Mode.H_Visible and
49 Rotated_Height (FB) <= Mode.V_Visible and
50 (FB.Offset = VGA_PLANE_FRAMEBUFFER_OFFSET or
51 FB.Height + FB.Start_Y <= FB.V_Stride));
52
53 -- Also validate that we only use supported values / features.
Nico Huber8c45bcf2016-11-20 17:30:57 +010054 function Validate_Config
Nico Huberf361ec82018-06-02 18:01:45 +020055 (FB : Framebuffer_Type;
56 Mode : Mode_Type;
57 Pipe : Pipe_Index;
58 Scaler_Available : Boolean)
Nico Huber8c45bcf2016-11-20 17:30:57 +010059 return Boolean
60 with
Nico Huber9e96a452019-09-22 20:25:17 +020061 Post => (if Validate_Config'Result then Valid_FB (FB, Mode));
Nico Huber8c45bcf2016-11-20 17:30:57 +010062
63end HW.GFX.GMA.Config_Helpers;