blob: da0d6fb231a8ac8d0707dd550a0fe4230a352405 [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;
15
16use type HW.Pos64;
17use type HW.Word32;
18
19package HW.GFX is
20
21 -- implementation only supports 4800p for now ;-)
22 subtype Width_Type is Pos32 range 1 .. 4800;
23 subtype Height_Type is Pos32 range 1 .. 7680;
24
25 Auto_BPC : constant := 5;
26 subtype BPC_Type is Int64 range Auto_BPC .. 16;
27
28 type Framebuffer_Type is
29 record
30 Width : Width_Type;
31 Height : Height_Type;
32 BPC : BPC_Type;
33 Stride : Width_Type;
34 Offset : Word32;
35 end record;
36
37 Default_FB : constant Framebuffer_Type := Framebuffer_Type'
38 (Width => 1,
39 Height => 1,
40 BPC => 8,
41 Stride => 1,
42 Offset => 0);
43
44 subtype Frequency_Type is Pos64 range 25_000_000 .. 600_000_000;
45
46 type DP_Lane_Count is (DP_Lane_Count_1, DP_Lane_Count_2, DP_Lane_Count_4);
47 subtype DP_Lane_Count_Type is Pos64 range 1 .. 4;
48 type DP_Lane_Count_Integers is array (DP_Lane_Count) of DP_Lane_Count_Type;
49 Lane_Count_As_Integer : constant DP_Lane_Count_Integers :=
50 DP_Lane_Count_Integers'
51 (DP_Lane_Count_1 => 1, DP_Lane_Count_2 => 2, DP_Lane_Count_4 => 4);
52
53 type DP_Bandwidth is (DP_Bandwidth_1_62, DP_Bandwidth_2_7, DP_Bandwidth_5_4);
54 for DP_Bandwidth use
55 (DP_Bandwidth_1_62 => 6, DP_Bandwidth_2_7 => 10, DP_Bandwidth_5_4 => 20);
56 for DP_Bandwidth'Size use 8;
57 subtype DP_Symbol_Rate_Type is Pos64 range 1 .. 810_000_000;
58 type DP_Symbol_Rate_Array is array (DP_Bandwidth) of DP_Symbol_Rate_Type;
59 DP_Symbol_Rate : constant DP_Symbol_Rate_Array := DP_Symbol_Rate_Array'
60 (DP_Bandwidth_1_62 => 162_000_000,
61 DP_Bandwidth_2_7 => 270_000_000,
62 DP_Bandwidth_5_4 => 540_000_000);
63
64 type DP_Caps is record
65 Rev : Word8;
66 Max_Link_Rate : DP_Bandwidth;
67 Max_Lane_Count : DP_Lane_Count;
68 TPS3_Supported : Boolean;
69 Enhanced_Framing : Boolean;
70 No_Aux_Handshake : Boolean;
71 Aux_RD_Interval : Word8;
72 end record;
73
74 type DP_Link is
75 record
76 Receiver_Caps : DP_Caps;
77 Lane_Count : DP_Lane_Count;
78 Bandwidth : DP_Bandwidth;
79 Enhanced_Framing : Boolean;
80 Opportunistic_Training : Boolean;
81 end record;
82 Default_DP : constant DP_Link := DP_Link'
83 (Receiver_Caps => DP_Caps'
84 (Rev => 16#00#,
85 Max_Link_Rate => DP_Bandwidth'First,
86 Max_Lane_Count => DP_Lane_Count'First,
87 TPS3_Supported => False,
88 Enhanced_Framing => False,
89 No_Aux_Handshake => False,
90 Aux_RD_Interval => 16#00#),
91 Lane_Count => DP_Lane_Count'First,
92 Bandwidth => DP_Bandwidth'First,
93 Enhanced_Framing => False,
94 Opportunistic_Training => False);
95
96 type Mode_Type is
97 record
98 Dotclock : Frequency_Type;
99 H_Visible : Pos16;
100 H_Sync_Begin : Pos16;
101 H_Sync_End : Pos16;
102 H_Total : Pos16;
103 V_Visible : Pos16;
104 V_Sync_Begin : Pos16;
105 V_Sync_End : Pos16;
106 V_Total : Pos16;
107 H_Sync_Active_High : Boolean;
108 V_Sync_Active_High : Boolean;
109 BPC : BPC_Type;
110 end record;
111
112 ----------------------------------------------------------------------------
113 -- Constants
114 ----------------------------------------------------------------------------
115
116 -- modeline constants
117 -- Dotclock is calculated using: Refresh_Rate * H_Total * V_Total
118
119 M2560x1600_60 : constant Mode_Type := Mode_Type'
120 (60*(2720*1646), 2560, 2608, 2640, 2720, 1600, 1603, 1609, 1646, True, True, Auto_BPC);
121
122 M2560x1440_60 : constant Mode_Type := Mode_Type'
123 (60*(2720*1481), 2560, 2608, 2640, 2720, 1440, 1443, 1448, 1481, True, False, Auto_BPC);
124
125 M1920x1200_60 : constant Mode_Type := Mode_Type'
126 (60*(2080*1235), 1920, 1968, 2000, 2080, 1200, 1203, 1209, 1235, False, False, Auto_BPC);
127
128 M1920x1080_60 : constant Mode_Type := Mode_Type'
129 (60*(2185*1135), 1920, 2008, 2052, 2185, 1080, 1084, 1089, 1135, False, False, Auto_BPC);
130
131 M1680x1050_60 : constant Mode_Type := Mode_Type'
132 (60*(2256*1087), 1680, 1784, 1968, 2256, 1050, 1051, 1054, 1087, False, True, Auto_BPC);
133
134 M1600x1200_60 : constant Mode_Type := Mode_Type'
135 (60*(2160*1250), 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, True, True, Auto_BPC);
136
137 M1600x900_60 : constant Mode_Type := Mode_Type'
138 (60*(2010*912), 1600, 1664, 1706, 2010, 900, 903, 906, 912, False, False, Auto_BPC);
139
140 M1440x900_60 : constant Mode_Type := Mode_Type'
141 (60*(1834*920), 1440, 1488, 1520, 1834, 900, 903, 909, 920, False, False, Auto_BPC);
142
143 M1366x768_60 : constant Mode_Type := Mode_Type'
144 (60*(1446*788), 1366, 1414, 1446, 1466, 768, 769, 773, 788, False, False, Auto_BPC);
145
146 M1280x1024_60 : constant Mode_Type := Mode_Type'
147 (60*(1712*1063), 1280, 1368, 1496, 1712, 1024, 1027, 1034, 1063, False, True, Auto_BPC);
148
149 M1024x768_60 : constant Mode_Type := Mode_Type'
150 (60*(1344*806), 1024, 1048, 1184, 1344, 768, 771, 777, 806, False, False, Auto_BPC);
151
152 Invalid_Mode : constant Mode_Type := Mode_Type'
153 (Frequency_Type'First, 1, 1, 1, 1, 1, 1, 1, 1, False, False, Auto_BPC);
154
155end HW.GFX;