blob: a5e9dbe08dd7cdc6c0ac697280456db58e6ee5fb [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
Nico Huber3d06de82018-05-29 01:35:04 +02002-- Copyright (C) 2014-2018 secunet Security Networks AG
Nico Huber2b6f6992017-07-09 18:11:34 +02003-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de>
Nico Huber83693c82016-10-08 22:17:55 +02004--
5-- This program is free software; you can redistribute it and/or modify
6-- it under the terms of the GNU General Public License as published by
Nico Huber125a29e2016-10-18 00:23:54 +02007-- the Free Software Foundation; either version 2 of the License, or
8-- (at your option) any later version.
Nico Huber83693c82016-10-08 22:17:55 +02009--
10-- This program is distributed in the hope that it will be useful,
11-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-- GNU General Public License for more details.
14--
15
Nico Huber2b6f6992017-07-09 18:11:34 +020016with HW.MMIO_Range;
17pragma Elaborate_All (HW.MMIO_Range);
18with HW.PCI.Dev;
19pragma Elaborate_All (HW.PCI.Dev);
20
Nico Huber5374c3a2017-07-15 21:48:06 +020021with HW.GFX.Framebuffer_Filler;
22
Nico Huber83693c82016-10-08 22:17:55 +020023with HW.GFX.GMA.Config;
Nico Huber8c45bcf2016-11-20 17:30:57 +010024with HW.GFX.GMA.Config_Helpers;
Nico Huber83693c82016-10-08 22:17:55 +020025with HW.GFX.GMA.Registers;
26with HW.GFX.GMA.Power_And_Clocks;
27with HW.GFX.GMA.Panel;
28with HW.GFX.GMA.PLLs;
29with HW.GFX.GMA.Port_Detect;
30with HW.GFX.GMA.Connectors;
31with HW.GFX.GMA.Connector_Info;
32with HW.GFX.GMA.Pipe_Setup;
33
Nico Huber83693c82016-10-08 22:17:55 +020034with HW.Debug;
35with GNAT.Source_Info;
36
Nico Huber83693c82016-10-08 22:17:55 +020037use type HW.Int32;
38
39package body HW.GFX.GMA
40 with Refined_State =>
41 (State =>
Nico Huber2b6f6992017-07-09 18:11:34 +020042 (Dev.Address_State,
43 Registers.Address_State,
Nico Huber83693c82016-10-08 22:17:55 +020044 PLLs.State, Panel.Panel_State,
Nico Huber1a712d32017-01-09 15:11:04 +010045 Cur_Configs, Allocated_PLLs,
Nico Huberc3f66f62017-07-16 21:39:54 +020046 HPD_Delay, Wait_For_HPD,
47 Linear_FB_Base),
Nico Huber83693c82016-10-08 22:17:55 +020048 Init_State => Initialized,
Arthur Heymansd1988d12018-03-28 16:27:57 +020049 Config_State => (Config.Valid_Port_GPU, Config.Raw_Clock),
Nico Huber83693c82016-10-08 22:17:55 +020050 Device_State =>
Nico Huber2b6f6992017-07-09 18:11:34 +020051 (Dev.PCI_State, Registers.Register_State, Registers.GTT_State))
Nico Huber83693c82016-10-08 22:17:55 +020052is
Nico Huber2b6f6992017-07-09 18:11:34 +020053 pragma Disable_Atomic_Synchronization;
Nico Huber83693c82016-10-08 22:17:55 +020054
55 subtype Port_Name is String (1 .. 8);
56 type Port_Name_Array is array (Port_Type) of Port_Name;
57 Port_Names : constant Port_Name_Array :=
58 (Disabled => "Disabled",
59 Internal => "Internal",
60 DP1 => "DP1 ",
61 DP2 => "DP2 ",
62 DP3 => "DP3 ",
Nico Huber0d454cd2016-11-21 13:33:43 +010063 HDMI1 => "HDMI1 ",
64 HDMI2 => "HDMI2 ",
65 HDMI3 => "HDMI3 ",
Nico Huber83693c82016-10-08 22:17:55 +020066 Analog => "Analog ");
67
Nico Huber2b6f6992017-07-09 18:11:34 +020068 package Dev is new HW.PCI.Dev (PCI.Address'(0, 2, 0));
69
Nico Huber83693c82016-10-08 22:17:55 +020070 package Display_Controller renames Pipe_Setup;
71
Nico Huber99f10f32016-11-20 00:34:05 +010072 type PLLs_Type is array (Pipe_Index) of PLLs.T;
Nico Huber83693c82016-10-08 22:17:55 +020073
Nico Huber83693c82016-10-08 22:17:55 +020074 type HPD_Type is array (Port_Type) of Boolean;
Nico Huber3be61d42017-01-09 13:58:18 +010075 type HPD_Delay_Type is array (Active_Port_Type) of Time.T;
Nico Huber83693c82016-10-08 22:17:55 +020076
Nico Huber83693c82016-10-08 22:17:55 +020077 Allocated_PLLs : PLLs_Type;
Nico Huber83693c82016-10-08 22:17:55 +020078 HPD_Delay : HPD_Delay_Type;
79 Wait_For_HPD : HPD_Type;
80 Initialized : Boolean := False;
81
Nico Huberc3f66f62017-07-16 21:39:54 +020082 Linear_FB_Base : Word64;
83
Nico Huber83693c82016-10-08 22:17:55 +020084 ----------------------------------------------------------------------------
85
Nico Huberf54d0962016-10-20 14:17:18 +020086 PCH_RAWCLK_FREQ_MASK : constant := 16#3ff# * 2 ** 0;
87
88 function PCH_RAWCLK_FREQ (Freq : Frequency_Type) return Word32
89 is
90 begin
91 return Word32 (Freq / 1_000_000);
92 end PCH_RAWCLK_FREQ;
93
94 ----------------------------------------------------------------------------
95
Nico Huber43370ba2017-01-09 15:26:19 +010096 procedure Enable_Output
97 (Pipe : in Pipe_Index;
98 Pipe_Cfg : in Pipe_Config;
99 Success : out Boolean)
100 is
101 Port_Cfg : Port_Config;
Nico Huberf361ec82018-06-02 18:01:45 +0200102 Scaler_Available : Boolean;
Nico Huber43370ba2017-01-09 15:26:19 +0100103 begin
Nico Huber3be61d42017-01-09 13:58:18 +0100104 pragma Debug (Debug.New_Line);
105 pragma Debug (Debug.Put_Line
106 ("Trying to enable port " & Port_Names (Pipe_Cfg.Port)));
107
Nico Huber43370ba2017-01-09 15:26:19 +0100108 Config_Helpers.Fill_Port_Config
109 (Port_Cfg, Pipe, Pipe_Cfg.Port, Pipe_Cfg.Mode, Success);
110
111 if Success then
Nico Huberf361ec82018-06-02 18:01:45 +0200112 Display_Controller.Scaler_Available (Scaler_Available, Pipe);
Nico Huber43370ba2017-01-09 15:26:19 +0100113 Success := Config_Helpers.Validate_Config
Nico Huberf361ec82018-06-02 18:01:45 +0200114 (Pipe_Cfg.Framebuffer, Port_Cfg.Mode, Pipe, Scaler_Available);
Nico Huber43370ba2017-01-09 15:26:19 +0100115 end if;
116
Nico Huber43370ba2017-01-09 15:26:19 +0100117 if Success then
Nico Huber43370ba2017-01-09 15:26:19 +0100118 Connector_Info.Preferred_Link_Setting (Port_Cfg, Success);
119 end if;
120
121 -- loop over all possible DP-lane configurations
122 -- (non-DP ports use a single fake configuration)
123 while Success loop
124 pragma Loop_Invariant
125 (Pipe_Cfg.Port in Active_Port_Type and
126 Port_Cfg.Mode = Port_Cfg.Mode'Loop_Entry);
127
128 PLLs.Alloc
129 (Port_Cfg => Port_Cfg,
130 PLL => Allocated_PLLs (Pipe),
131 Success => Success);
132
133 if Success then
134 -- try each DP-lane configuration twice
135 for Try in 1 .. 2 loop
136 pragma Loop_Invariant
137 (Pipe_Cfg.Port in Active_Port_Type);
138
Nico Huber4798c662017-01-11 12:44:48 +0100139 -- Clear pending hot-plug events before every try
140 Port_Detect.Clear_Hotplug_Detect (Pipe_Cfg.Port);
141
Nico Huber43370ba2017-01-09 15:26:19 +0100142 Connectors.Pre_On
143 (Pipe => Pipe,
144 Port_Cfg => Port_Cfg,
145 PLL_Hint => PLLs.Register_Value (Allocated_PLLs (Pipe)),
146 Success => Success);
147
148 if Success then
149 Display_Controller.On
150 (Pipe => Pipe,
151 Port_Cfg => Port_Cfg,
Nico Huber4dc4c612018-01-10 15:55:09 +0100152 Framebuffer => Pipe_Cfg.Framebuffer,
153 Cursor => Pipe_Cfg.Cursor);
Nico Huber43370ba2017-01-09 15:26:19 +0100154
155 Connectors.Post_On
Arthur Heymans60d0e5f2018-03-28 17:08:27 +0200156 (Pipe => Pipe,
157 Port_Cfg => Port_Cfg,
Nico Huber43370ba2017-01-09 15:26:19 +0100158 PLL_Hint => PLLs.Register_Value (Allocated_PLLs (Pipe)),
159 Success => Success);
160
161 if not Success then
162 Display_Controller.Off (Pipe);
163 Connectors.Post_Off (Port_Cfg);
164 end if;
165 end if;
166
167 exit when Success;
168 end loop;
169 exit when Success; -- connection established => stop loop
170
171 -- connection failed
172 PLLs.Free (Allocated_PLLs (Pipe));
173 end if;
174
175 Connector_Info.Next_Link_Setting (Port_Cfg, Success);
176 end loop;
177
178 if Success then
179 pragma Debug (Debug.Put_Line
180 ("Enabled port " & Port_Names (Pipe_Cfg.Port)));
181 else
182 Wait_For_HPD (Pipe_Cfg.Port) := True;
183 if Pipe_Cfg.Port = Internal then
184 Panel.Off;
185 end if;
186 end if;
187 end Enable_Output;
188
Nico Huber3be61d42017-01-09 13:58:18 +0100189 procedure Disable_Output (Pipe : Pipe_Index; Pipe_Cfg : Pipe_Config)
190 is
191 Port_Cfg : Port_Config;
192 Success : Boolean;
193 begin
194 Config_Helpers.Fill_Port_Config
195 (Port_Cfg, Pipe, Pipe_Cfg.Port, Pipe_Cfg.Mode, Success);
196 if Success then
197 pragma Debug (Debug.New_Line);
198 pragma Debug (Debug.Put_Line
199 ("Disabling port " & Port_Names (Pipe_Cfg.Port)));
200 pragma Debug (Debug.New_Line);
201
202 Connectors.Pre_Off (Port_Cfg);
203 Display_Controller.Off (Pipe);
204 Connectors.Post_Off (Port_Cfg);
205
206 PLLs.Free (Allocated_PLLs (Pipe));
207 end if;
208 end Disable_Output;
209
Nico Huber99f10f32016-11-20 00:34:05 +0100210 procedure Update_Outputs (Configs : Pipe_Configs)
Nico Huber83693c82016-10-08 22:17:55 +0200211 is
Nico Huber3be61d42017-01-09 13:58:18 +0100212 procedure Check_HPD (Port : in Active_Port_Type; Detected : out Boolean)
213 is
214 HPD_Delay_Over : constant Boolean := Time.Timed_Out (HPD_Delay (Port));
215 begin
216 if HPD_Delay_Over then
217 Port_Detect.Hotplug_Detect (Port, Detected);
218 HPD_Delay (Port) := Time.MS_From_Now (333);
219 else
220 Detected := False;
221 end if;
222 end Check_HPD;
Nico Huberb56b9c52017-01-11 15:12:23 +0100223
Nico Huber564103f2017-01-11 15:33:07 +0100224 Power_Changed : Boolean := False;
Nico Huberb56b9c52017-01-11 15:12:23 +0100225 Old_Configs : Pipe_Configs;
Nico Huber564103f2017-01-11 15:33:07 +0100226
227 -- Only called when we actually tried to change something
228 -- so we don't congest the log with unnecessary messages.
229 procedure Update_Power
230 is
231 begin
232 if not Power_Changed then
233 Power_And_Clocks.Power_Up (Old_Configs, Configs);
234 Power_Changed := True;
235 end if;
236 end Update_Power;
Nico Huber3d06de82018-05-29 01:35:04 +0200237
238 function Full_Update (Cur_Config, New_Config : Pipe_Config) return Boolean
239 is
240 begin
241 return
Nico Huber958c5642018-06-02 16:59:31 +0200242 Cur_Config.Port /= New_Config.Port
243 or else
244 Cur_Config.Mode /= New_Config.Mode
245 or else
Nico Huber3d06de82018-05-29 01:35:04 +0200246 (Config.Use_PDW_For_EDP_Scaling and then
247 (Cur_Config.Port = Internal and
Nico Huber958c5642018-06-02 16:59:31 +0200248 Requires_Scaling (Cur_Config) /= Requires_Scaling (New_Config)))
249 or else
250 (Config.Has_GMCH_PFIT_CONTROL and then
251 (Requires_Scaling (Cur_Config) /= Requires_Scaling (New_Config) or
252 Scaling_Type (Cur_Config) /= Scaling_Type (New_Config)));
Nico Huber3d06de82018-05-29 01:35:04 +0200253 end Full_Update;
Nico Huber83693c82016-10-08 22:17:55 +0200254 begin
255 Old_Configs := Cur_Configs;
256
Nico Huberb56b9c52017-01-11 15:12:23 +0100257 -- disable all pipes that changed or had a hot-plug event
258 for Pipe in Pipe_Index loop
259 declare
260 Unplug_Detected : Boolean;
261 Cur_Config : Pipe_Config renames Cur_Configs (Pipe);
262 New_Config : Pipe_Config renames Configs (Pipe);
263 begin
264 if Cur_Config.Port /= Disabled then
265 Check_HPD (Cur_Config.Port, Unplug_Detected);
Nico Huber83693c82016-10-08 22:17:55 +0200266
Nico Huber3d06de82018-05-29 01:35:04 +0200267 if Full_Update (Cur_Config, New_Config) or Unplug_Detected then
Nico Huberb56b9c52017-01-11 15:12:23 +0100268 Disable_Output (Pipe, Cur_Config);
269 Cur_Config.Port := Disabled;
Nico Huber564103f2017-01-11 15:33:07 +0100270 Update_Power;
Nico Huberb56b9c52017-01-11 15:12:23 +0100271 end if;
Nico Huber83693c82016-10-08 22:17:55 +0200272 end if;
Nico Huberb56b9c52017-01-11 15:12:23 +0100273 end;
274 end loop;
Nico Huber83693c82016-10-08 22:17:55 +0200275
Nico Huberb56b9c52017-01-11 15:12:23 +0100276 -- enable all pipes that changed and should be active
277 for Pipe in Pipe_Index loop
278 declare
279 Success : Boolean;
Nico Huberf361ec82018-06-02 18:01:45 +0200280 Scaler_Available : Boolean;
Nico Huberb56b9c52017-01-11 15:12:23 +0100281 Cur_Config : Pipe_Config renames Cur_Configs (Pipe);
282 New_Config : Pipe_Config renames Configs (Pipe);
283 begin
Nico Huber3d06de82018-05-29 01:35:04 +0200284 if New_Config.Port /= Disabled and
285 Full_Update (Cur_Config, New_Config)
Nico Huberb56b9c52017-01-11 15:12:23 +0100286 then
Nico Huber3be61d42017-01-09 13:58:18 +0100287 if Wait_For_HPD (New_Config.Port) then
288 Check_HPD (New_Config.Port, Success);
289 Wait_For_HPD (New_Config.Port) := not Success;
290 else
291 Success := True;
Nico Huber8c45bcf2016-11-20 17:30:57 +0100292 end if;
Nico Huberc7a4fee2016-11-03 18:18:03 +0100293
Nico Huber3be61d42017-01-09 13:58:18 +0100294 if Success then
Nico Huber564103f2017-01-11 15:33:07 +0100295 Update_Power;
Nico Huberb56b9c52017-01-11 15:12:23 +0100296 Enable_Output (Pipe, New_Config, Success);
Nico Huber3be61d42017-01-09 13:58:18 +0100297 end if;
Nico Huber83693c82016-10-08 22:17:55 +0200298
299 if Success then
Nico Huberb56b9c52017-01-11 15:12:23 +0100300 Cur_Config := New_Config;
Nico Huber83693c82016-10-08 22:17:55 +0200301 end if;
Nico Huber3be61d42017-01-09 13:58:18 +0100302
Nico Huberb56b9c52017-01-11 15:12:23 +0100303 -- update framebuffer offset only
304 elsif New_Config.Port /= Disabled and
Nico Huberf361ec82018-06-02 18:01:45 +0200305 Cur_Config.Framebuffer /= New_Config.Framebuffer
Nico Huberb56b9c52017-01-11 15:12:23 +0100306 then
Nico Huberf361ec82018-06-02 18:01:45 +0200307 Display_Controller.Scaler_Available (Scaler_Available, Pipe);
308 if Config_Helpers.Validate_Config
309 (New_Config.Framebuffer, New_Config.Mode,
310 Pipe, Scaler_Available)
311 then
312 Display_Controller.Setup_FB
313 (Pipe, New_Config.Mode, New_Config.Framebuffer);
314 Display_Controller.Update_Cursor
315 (Pipe, New_Config.Framebuffer, New_Config.Cursor);
316 Cur_Config := New_Config;
317 end if;
Nico Huberb56b9c52017-01-11 15:12:23 +0100318 end if;
319 end;
Nico Huber83693c82016-10-08 22:17:55 +0200320 end loop;
321
Nico Huber564103f2017-01-11 15:33:07 +0100322 if Power_Changed then
Nico Huber83693c82016-10-08 22:17:55 +0200323 Power_And_Clocks.Power_Down (Old_Configs, Configs, Cur_Configs);
324 end if;
Nico Huber83693c82016-10-08 22:17:55 +0200325 end Update_Outputs;
326
327 ----------------------------------------------------------------------------
328
Nico Huber15ffc4f2018-01-11 14:44:43 +0100329 procedure Update_Cursor (Pipe : Pipe_Index; Cursor : Cursor_Type)
330 is
331 begin
332 Cur_Configs (Pipe).Cursor := Cursor;
333 Display_Controller.Update_Cursor
334 (Pipe, Cur_Configs (Pipe).Framebuffer, Cur_Configs (Pipe).Cursor);
335 end Update_Cursor;
336
337 procedure Place_Cursor
338 (Pipe : Pipe_Index;
339 X : Cursor_Pos;
340 Y : Cursor_Pos)
341 is
342 begin
343 Cur_Configs (Pipe).Cursor.Center_X := X;
344 Cur_Configs (Pipe).Cursor.Center_Y := Y;
345 Display_Controller.Place_Cursor
346 (Pipe, Cur_Configs (Pipe).Framebuffer, Cur_Configs (Pipe).Cursor);
347 end Place_Cursor;
348
349 procedure Move_Cursor
350 (Pipe : Pipe_Index;
351 X : Cursor_Pos;
352 Y : Cursor_Pos)
353 is
354 function Cap_Add (A, B : Cursor_Pos) return Cursor_Pos is
355 (if A + B < 0
356 then Int32'Max (Cursor_Pos'First, A + B)
357 else Int32'Min (Cursor_Pos'Last, A + B));
358 begin
359 Place_Cursor
360 (Pipe => Pipe,
361 X => Cap_Add (Cur_Configs (Pipe).Cursor.Center_X, X),
362 Y => Cap_Add (Cur_Configs (Pipe).Cursor.Center_Y, Y));
363 end Move_Cursor;
364
365 ----------------------------------------------------------------------------
366
Nico Huber83693c82016-10-08 22:17:55 +0200367 procedure Initialize
Nico Huber2b6f6992017-07-09 18:11:34 +0200368 (Write_Delay : in Word64 := 0;
Nico Huber793a8d42016-11-21 18:57:03 +0100369 Clean_State : in Boolean := False;
Nico Huber83693c82016-10-08 22:17:55 +0200370 Success : out Boolean)
371 with
372 Refined_Global =>
373 (In_Out =>
Nico Hubere015e822017-08-25 20:12:09 +0200374 (Config.Valid_Port_GPU, Dev.PCI_State,
Arthur Heymansd1988d12018-03-28 16:27:57 +0200375 Registers.Register_State, Port_IO.State,
376 Config.Raw_Clock),
Nico Huber83693c82016-10-08 22:17:55 +0200377 Input =>
378 (Time.State),
379 Output =>
Nico Huber2b6f6992017-07-09 18:11:34 +0200380 (Dev.Address_State,
381 Registers.Address_State,
Nico Huber83693c82016-10-08 22:17:55 +0200382 PLLs.State, Panel.Panel_State,
Nico Huber1a712d32017-01-09 15:11:04 +0100383 Cur_Configs, Allocated_PLLs,
Nico Huberc3f66f62017-07-16 21:39:54 +0200384 HPD_Delay, Wait_For_HPD,
385 Linear_FB_Base, Initialized))
Nico Huber83693c82016-10-08 22:17:55 +0200386 is
387 use type HW.Word64;
388
Nico Huber2b6f6992017-07-09 18:11:34 +0200389 PCI_MMIO_Base, PCI_GTT_Base : Word64;
390
Nico Huber83693c82016-10-08 22:17:55 +0200391 Now : constant Time.T := Time.Now;
392
393 procedure Check_Platform (Success : out Boolean)
394 is
395 Audio_VID_DID : Word32;
396 begin
397 case Config.CPU is
Arthur Heymans73ea0322018-03-28 17:17:07 +0200398 when G45 =>
399 Registers.Read (Registers.G4X_AUD_VID_DID, Audio_VID_DID);
Nico Huber83693c82016-10-08 22:17:55 +0200400 when Haswell .. Skylake =>
401 Registers.Read (Registers.AUD_VID_DID, Audio_VID_DID);
402 when Ironlake .. Ivybridge =>
403 Registers.Read (Registers.PCH_AUD_VID_DID, Audio_VID_DID);
404 end case;
405 Success :=
406 (case Config.CPU is
Nico Huber21da5742017-01-20 14:00:53 +0100407 when Broxton => Audio_VID_DID = 16#8086_280a#,
Nico Huber83693c82016-10-08 22:17:55 +0200408 when Skylake => Audio_VID_DID = 16#8086_2809#,
409 when Broadwell => Audio_VID_DID = 16#8086_2808#,
410 when Haswell => Audio_VID_DID = 16#8086_2807#,
411 when Ivybridge |
412 Sandybridge => Audio_VID_DID = 16#8086_2806# or
413 Audio_VID_DID = 16#8086_2805#,
Arthur Heymans73ea0322018-03-28 17:17:07 +0200414 when Ironlake => Audio_VID_DID = 16#0000_0000#,
415 when G45 => Audio_VID_DID = 16#8086_2801# or
416 Audio_VID_DID = 16#8086_2802# or
417 Audio_VID_DID = 16#8086_2803#);
Nico Huber83693c82016-10-08 22:17:55 +0200418 end Check_Platform;
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200419
420 procedure Check_Platform_PCI (Success : out Boolean)
421 is
422 use type HW.Word16;
423 Vendor, Device : Word16;
424 begin
425 Dev.Read16 (Vendor, PCI.Vendor_Id);
426 Dev.Read16 (Device, PCI.Device_Id);
427
428 Success := Vendor = 16#8086# and Config.Compatible_GPU (Device);
429 end Check_Platform_PCI;
Nico Huber83693c82016-10-08 22:17:55 +0200430 begin
Nico Huber83693c82016-10-08 22:17:55 +0200431 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
432
433 pragma Debug (Debug.Set_Register_Write_Delay (Write_Delay));
434
Nico Huberc3f66f62017-07-16 21:39:54 +0200435 Linear_FB_Base := 0;
Nico Huber83693c82016-10-08 22:17:55 +0200436 Wait_For_HPD := HPD_Type'(others => False);
437 HPD_Delay := HPD_Delay_Type'(others => Now);
Nico Huber83693c82016-10-08 22:17:55 +0200438 Allocated_PLLs := (others => PLLs.Invalid);
Nico Huber99f10f32016-11-20 00:34:05 +0100439 Cur_Configs := Pipe_Configs'
440 (others => Pipe_Config'
Nico Huber83693c82016-10-08 22:17:55 +0200441 (Port => Disabled,
442 Framebuffer => HW.GFX.Default_FB,
Nico Hubera02b2c62018-01-09 15:58:34 +0100443 Cursor => Default_Cursor,
Nico Huber83693c82016-10-08 22:17:55 +0200444 Mode => HW.GFX.Invalid_Mode));
Nico Huber83693c82016-10-08 22:17:55 +0200445 PLLs.Initialize;
446
Nico Huber2b6f6992017-07-09 18:11:34 +0200447 Dev.Initialize (Success);
448
449 if Success then
450 Dev.Map (PCI_MMIO_Base, PCI.Res0, Length => Config.GTT_Offset);
451 Dev.Map (PCI_GTT_Base, PCI.Res0, Offset => Config.GTT_Offset);
452 if PCI_MMIO_Base /= 0 and PCI_GTT_Base /= 0 then
453 Registers.Set_Register_Base (PCI_MMIO_Base, PCI_GTT_Base);
454 else
455 pragma Debug (Debug.Put_Line
456 ("ERROR: Couldn't map resoure0."));
457 Registers.Set_Register_Base (Config.Default_MMIO_Base);
458 Success := Config.Default_MMIO_Base_Set;
459 end if;
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200460
461 if Success then
462 Check_Platform_PCI (Success);
463 end if;
Nico Huber2b6f6992017-07-09 18:11:34 +0200464 else
465 pragma Debug (Debug.Put_Line
466 ("WARNING: Couldn't initialize PCI dev."));
467 Registers.Set_Register_Base (Config.Default_MMIO_Base);
468 Success := Config.Default_MMIO_Base_Set;
Nico Huber2b6f6992017-07-09 18:11:34 +0200469
Nico Hubere7ac6eb2017-09-04 23:54:13 +0200470 if Success then
471 Check_Platform (Success);
472 end if;
Nico Huber2b6f6992017-07-09 18:11:34 +0200473 end if;
474
Nico Huber83693c82016-10-08 22:17:55 +0200475 if not Success then
476 pragma Debug (Debug.Put_Line ("ERROR: Incompatible CPU or PCH."));
477
478 Panel.Static_Init; -- for flow analysis
479
480 Initialized := False;
481 return;
482 end if;
483
484 Panel.Setup_PP_Sequencer;
485 Port_Detect.Initialize;
Nico Huber0923b792017-06-09 15:28:41 +0200486 Connectors.Initialize;
Nico Huber83693c82016-10-08 22:17:55 +0200487
Nico Huber793a8d42016-11-21 18:57:03 +0100488 if Clean_State then
489 Power_And_Clocks.Pre_All_Off;
490 Connectors.Pre_All_Off;
491 Display_Controller.All_Off;
492 Connectors.Post_All_Off;
493 PLLs.All_Off;
494 Power_And_Clocks.Post_All_Off;
Nico Huber17d64b62017-07-15 20:51:25 +0200495 Registers.Clear_Fences;
Nico Huber33912aa2016-12-06 20:36:23 +0100496 else
497 -- According to PRMs, VGA plane is the only thing
Nico Huber3a0e2a02017-07-19 14:41:46 +0200498 -- that's enabled by default after reset...
Nico Huber33912aa2016-12-06 20:36:23 +0100499 Display_Controller.Legacy_VGA_Off;
Nico Huber3a0e2a02017-07-19 14:41:46 +0200500 -- ... along with some DDI port bits since Skylake.
501 Connectors.Post_Reset_Off;
Nico Huber793a8d42016-11-21 18:57:03 +0100502 end if;
Nico Huber83693c82016-10-08 22:17:55 +0200503
504 -------------------- Now restart from a clean state ---------------------
505 Power_And_Clocks.Initialize;
506
Nico Huber1c3b9282017-02-09 13:57:04 +0100507 if Config.Has_PCH then
508 Registers.Unset_And_Set_Mask
509 (Register => Registers.PCH_RAWCLK_FREQ,
510 Mask_Unset => PCH_RAWCLK_FREQ_MASK,
511 Mask_Set => PCH_RAWCLK_FREQ (Config.Default_RawClk_Freq));
512 end if;
Nico Huberf54d0962016-10-20 14:17:18 +0200513
Nico Huber83693c82016-10-08 22:17:55 +0200514 Initialized := True;
515
516 end Initialize;
517
518 function Is_Initialized return Boolean
519 with
520 Refined_Post => Is_Initialized'Result = Initialized
521 is
522 begin
523 return Initialized;
524 end Is_Initialized;
525
526 ----------------------------------------------------------------------------
527
Nico Huber42fb2d02017-09-01 17:01:51 +0200528 procedure Power_Up_VGA
529 is
530 Fake_Config : constant Pipe_Configs :=
531 (Primary =>
532 (Port => Analog,
533 Framebuffer => HW.GFX.Default_FB,
Nico Hubera02b2c62018-01-09 15:58:34 +0100534 Cursor => Default_Cursor,
Nico Huber42fb2d02017-09-01 17:01:51 +0200535 Mode => HW.GFX.Invalid_Mode),
536 others =>
537 (Port => Disabled,
538 Framebuffer => HW.GFX.Default_FB,
Nico Hubera02b2c62018-01-09 15:58:34 +0100539 Cursor => Default_Cursor,
Nico Huber42fb2d02017-09-01 17:01:51 +0200540 Mode => HW.GFX.Invalid_Mode));
541 begin
542 Power_And_Clocks.Power_Up (Cur_Configs, Fake_Config);
543 end Power_Up_VGA;
544
545 ----------------------------------------------------------------------------
546
Nico Huber5374c3a2017-07-15 21:48:06 +0200547 function FB_First_Page (FB : Framebuffer_Type) return Natural is
Nico Huber34be6542017-12-13 09:26:24 +0100548 (Natural (Phys_Offset (FB) / GTT_Page_Size));
Nico Huber5374c3a2017-07-15 21:48:06 +0200549 function FB_Pages (FB : Framebuffer_Type) return Natural is
550 (Natural (Div_Round_Up (FB_Size (FB), GTT_Page_Size)));
551 function FB_Last_Page (FB : Framebuffer_Type) return Natural is
552 (FB_First_Page (FB) + FB_Pages (FB) - 1);
553
Nico Huber34be6542017-12-13 09:26:24 +0100554 -- Check basics and that it fits in GTT. For 90 degree rotations,
555 -- the Offset should be above GTT_Rotation_Offset. The latter will
556 -- be subtracted for the aperture mapping.
Nico Huber5374c3a2017-07-15 21:48:06 +0200557 function Valid_FB (FB : Framebuffer_Type) return Boolean is
Nico Huber34be6542017-12-13 09:26:24 +0100558 (Valid_Stride (FB) and
559 FB_First_Page (FB) in GTT_Range and
560 FB_Last_Page (FB) in GTT_Range and
561 (not Rotation_90 (FB) or
562 (FB_Last_Page (FB) + GTT_Rotation_Offset in GTT_Range and
563 FB.Offset >= Word32 (GTT_Rotation_Offset) * GTT_Page_Size)));
Nico Huber5374c3a2017-07-15 21:48:06 +0200564
565 -- Also check that we don't overflow the GTT's 39-bit space
566 -- (always true with a 32-bit base)
567 function Valid_Phys_FB (FB : Framebuffer_Type; Phys_Base : Word32)
568 return Boolean is
569 (Valid_FB (FB) and
Nico Huber34be6542017-12-13 09:26:24 +0100570 Int64 (Phys_Base) + Int64 (Phys_Offset (FB)) + Int64 (FB_Size (FB)) <=
Nico Huber5374c3a2017-07-15 21:48:06 +0200571 Int64 (GTT_Address_Type'Last))
572 with
573 Ghost;
574
Nico Huber83693c82016-10-08 22:17:55 +0200575 procedure Write_GTT
576 (GTT_Page : GTT_Range;
577 Device_Address : GTT_Address_Type;
Nico Huber5374c3a2017-07-15 21:48:06 +0200578 Valid : Boolean)
579 is
Nico Huber83693c82016-10-08 22:17:55 +0200580 begin
581 Registers.Write_GTT (GTT_Page, Device_Address, Valid);
582 end Write_GTT;
583
Nico Huber194e57e2017-07-15 21:15:46 +0200584 procedure Setup_Default_GTT (FB : Framebuffer_Type; Phys_Base : Word32)
Nico Huber5374c3a2017-07-15 21:48:06 +0200585 with
586 Pre => Is_Initialized and Valid_Phys_FB (FB, Phys_Base)
Nico Huber83693c82016-10-08 22:17:55 +0200587 is
Nico Huber194e57e2017-07-15 21:15:46 +0200588 Phys_Addr : GTT_Address_Type :=
Nico Huber34be6542017-12-13 09:26:24 +0100589 GTT_Address_Type (Phys_Base) + GTT_Address_Type (Phys_Offset (FB));
Nico Huber83693c82016-10-08 22:17:55 +0200590 begin
Nico Huber194e57e2017-07-15 21:15:46 +0200591 for Idx in FB_First_Page (FB) .. FB_Last_Page (FB) loop
Nico Huber83693c82016-10-08 22:17:55 +0200592 Registers.Write_GTT
593 (GTT_Page => Idx,
594 Device_Address => Phys_Addr,
595 Valid => True);
Nico Huber194e57e2017-07-15 21:15:46 +0200596 Phys_Addr := Phys_Addr + GTT_Page_Size;
Nico Huber83693c82016-10-08 22:17:55 +0200597 end loop;
Nico Huber9b479412017-08-27 11:55:56 +0200598
599 if Rotation_90 (FB) and FB.Tiling = Y_Tiled and FB.V_Stride >= 32 then
600 declare
601 V_Pages : constant Natural := Natural (FB.V_Stride) / 32;
602 Bytes_Per_Row : constant GTT_Address_Type :=
603 GTT_Address_Type (Pixel_To_Bytes (32 * FB.Stride, FB));
604 begin
605 Phys_Addr := GTT_Address_Type (Phys_Base) +
Nico Huber34be6542017-12-13 09:26:24 +0100606 GTT_Address_Type (Phys_Offset (FB)) +
Nico Huber9b479412017-08-27 11:55:56 +0200607 GTT_Address_Type (FB_Size (FB));
608 for Page in FB_First_Page (FB) .. FB_Last_Page (FB) loop
609 Phys_Addr := Phys_Addr - Bytes_Per_Row;
610 Registers.Write_GTT
611 (GTT_Page => GTT_Rotation_Offset + Page,
612 Device_Address => Phys_Addr,
613 Valid => True);
614
615 if (Page - FB_First_Page (FB) + 1) mod V_Pages = 0 then
616 Phys_Addr := Phys_Addr + GTT_Page_Size +
617 GTT_Address_Type (V_Pages) * Bytes_Per_Row;
618 end if;
619 end loop;
620 end;
621 end if;
Nico Huber83693c82016-10-08 22:17:55 +0200622 end Setup_Default_GTT;
623
624 ----------------------------------------------------------------------------
625
Nico Hubereedde882017-07-16 02:54:39 +0200626 use type HW.Word16;
627 subtype Stolen_Size_Range is Int64 range 0 .. 2 ** 33;
628
629 function GGMS_Gen4 (GGC : Word16) return Natural is
630 (Natural (Shift_Right (GGC, 8) and 16#07#));
631 function GTT_Size_Gen4 (GGC : Word16) return Natural is
632 (if GGMS_Gen4 (GGC) in 1 .. 3 then
633 (GGMS_Gen4 (GGC) + 1) * 2 ** 19 else 0);
634
635 function GMS_Gen4 (GGC : Word16) return Natural is
636 (Natural (Shift_Right (GGC, 4) and 16#0f#));
637 Valid_Stolen_Size_Gen4 : constant
638 array (Natural range 1 .. 13) of Stolen_Size_Range :=
639 (1, 4, 8, 16, 32, 48, 64, 128, 256, 96, 160, 224, 352);
640 function Stolen_Size_Gen4 (GGC : Word16) return Stolen_Size_Range is
641 (if GMS_Gen4 (GGC) in Valid_Stolen_Size_Gen4'Range then
Arthur Heymans5fd9a312017-09-12 12:45:18 +0200642 Valid_Stolen_Size_Gen4 (GMS_Gen4 (GGC)) * 2 ** 20 else 0);
Nico Hubereedde882017-07-16 02:54:39 +0200643
644 function GTT_Size_Gen6 (GGC : Word16) return Natural is
645 (Natural (Shift_Right (GGC, 8) and 16#03#) * 2 ** 20);
646
647 function Stolen_Size_Gen6 (GGC : Word16) return Stolen_Size_Range is
648 (Stolen_Size_Range (Shift_Right (GGC, 3) and 16#1f#) * 32 * 2 ** 20);
649
650 function GTT_Size_Gen8 (GGC : Word16) return Natural is
651 (Natural (Shift_Right (GGC, 6) and 16#03#) * 2 ** 20);
652
653 function GMS_Gen8 (GGC : Word16) return Stolen_Size_Range is
654 (Stolen_Size_Range (Shift_Right (GGC, 8) and 16#ff#));
655 function Stolen_Size_Gen8 (GGC : Word16) return Stolen_Size_Range is
656 (GMS_Gen8 (GGC) * 32 * 2 ** 20);
657
658 function Stolen_Size_Gen9 (GGC : Word16) return Stolen_Size_Range is
659 (if GMS_Gen8 (GGC) < 16#f0# then
660 Stolen_Size_Gen8 (GGC)
661 else
662 (GMS_Gen8 (GGC) - 16#f0# + 1) * 4 * 2 ** 20);
663
664 procedure Decode_Stolen
665 (GTT_Size : out Natural;
666 Stolen_Size : out Stolen_Size_Range)
667 with
668 Pre => Is_Initialized
669 is
670 GGC_Reg : constant :=
671 (case Config.CPU is
Arthur Heymans73ea0322018-03-28 17:17:07 +0200672 when G45 | Ironlake => 16#52#,
Nico Hubereedde882017-07-16 02:54:39 +0200673 when Sandybridge .. Skylake => 16#50#);
674 GGC : Word16;
675 begin
676 Dev.Read16 (GGC, GGC_Reg);
677 case Config.CPU is
Arthur Heymans73ea0322018-03-28 17:17:07 +0200678 when G45 | Ironlake =>
Nico Hubereedde882017-07-16 02:54:39 +0200679 GTT_Size := GTT_Size_Gen4 (GGC);
680 Stolen_Size := Stolen_Size_Gen4 (GGC);
681 when Sandybridge .. Haswell =>
682 GTT_Size := GTT_Size_Gen6 (GGC);
683 Stolen_Size := Stolen_Size_Gen6 (GGC);
684 when Broadwell =>
685 GTT_Size := GTT_Size_Gen8 (GGC);
686 Stolen_Size := Stolen_Size_Gen8 (GGC);
687 when Broxton .. Skylake =>
688 GTT_Size := GTT_Size_Gen8 (GGC);
689 Stolen_Size := Stolen_Size_Gen9 (GGC);
690 end case;
691 end Decode_Stolen;
692
693 -- Additional runtime validation that FB fits stolen memory and aperture.
694 procedure Validate_FB (FB : Framebuffer_Type; Valid : out Boolean)
695 with
696 Pre => Is_Initialized,
697 Post => (if Valid then Valid_FB (FB))
698 is
699 GTT_Size, Aperture_Size : Natural;
700 Stolen_Size : Stolen_Size_Range;
701 begin
702 Valid := Valid_FB (FB);
703
704 if Valid then
705 Decode_Stolen (GTT_Size, Stolen_Size);
706 Dev.Resource_Size (Aperture_Size, PCI.Res2);
707 Valid :=
708 FB_Last_Page (FB) < GTT_Size / Config.GTT_PTE_Size and
709 FB_Last_Page (FB) < Natural (Stolen_Size / GTT_Page_Size) and
710 FB_Last_Page (FB) < Aperture_Size / GTT_Page_Size;
Nico Huber34be6542017-12-13 09:26:24 +0100711 pragma Debug (not Valid, Debug.Put_Line
Nico Hubereedde882017-07-16 02:54:39 +0200712 ("Stolen memory too small to hold framebuffer."));
713 end if;
714 end Validate_FB;
715
Nico Huber5374c3a2017-07-15 21:48:06 +0200716 procedure Setup_Default_FB
717 (FB : in Framebuffer_Type;
718 Clear : in Boolean := True;
719 Success : out Boolean)
720 is
721 GMA_Phys_Base : constant PCI.Index := 16#5c#;
722 GMA_Phys_Base_Mask : constant := 16#fff0_0000#;
723
724 Phys_Base : Word32;
725 begin
Nico Hubereedde882017-07-16 02:54:39 +0200726 Validate_FB (FB, Success);
Nico Huber5374c3a2017-07-15 21:48:06 +0200727
728 if Success then
729 Dev.Read32 (Phys_Base, GMA_Phys_Base);
730 Phys_Base := Phys_Base and GMA_Phys_Base_Mask;
731 Success := Phys_Base /= GMA_Phys_Base_Mask and Phys_Base /= 0;
732 pragma Debug (not Success, Debug.Put_Line
733 ("Failed to read stolen memory base."));
Nico Huber0164b022017-08-24 15:12:51 +0200734
735 if Success then
736 if FB.Tiling in XY_Tiling then
737 Registers.Add_Fence
738 (First_Page => FB_First_Page (FB),
739 Last_Page => FB_Last_Page (FB),
740 Tiling => FB.Tiling,
741 Pitch => FB_Pitch (FB.Stride, FB),
742 Success => Success);
743 end if;
744 pragma Debug (not Success, Debug.Put_Line
745 ("Tiled framebuffer but no fence regs available."));
746 end if;
747
Nico Huber5374c3a2017-07-15 21:48:06 +0200748 if Success then
749 Setup_Default_GTT (FB, Phys_Base);
750 end if;
751 end if;
752
753 if Success and then Clear then
754 declare
755 use type HW.Word64;
756 Linear_FB : Word64;
757 begin
Nico Huberc3f66f62017-07-16 21:39:54 +0200758 Map_Linear_FB (Linear_FB, FB);
Nico Huber5374c3a2017-07-15 21:48:06 +0200759 if Linear_FB /= 0 then
Nico Huberc3f66f62017-07-16 21:39:54 +0200760 Framebuffer_Filler.Fill (Linear_FB, FB);
Nico Huber5374c3a2017-07-15 21:48:06 +0200761 end if;
Nico Huber5374c3a2017-07-15 21:48:06 +0200762 end;
763 end if;
764 end Setup_Default_FB;
765
Nico Huberc3f66f62017-07-16 21:39:54 +0200766 procedure Map_Linear_FB (Linear_FB : out Word64; FB : in Framebuffer_Type)
767 is
768 use type HW.Word64;
769
770 Valid : Boolean;
771 begin
772 Linear_FB := 0;
773
774 if Linear_FB_Base = 0 then
775 Dev.Map (Linear_FB_Base, PCI.Res2);
776 pragma Debug
777 (Linear_FB_Base = 0, Debug.Put_Line ("Failed to map resource2."));
778 end if;
779
780 if Linear_FB_Base /= 0 then
781 Validate_FB (FB, Valid);
782 if Valid then
Nico Huber34be6542017-12-13 09:26:24 +0100783 Linear_FB := Linear_FB_Base + Word64 (Phys_Offset (FB));
Nico Huberc3f66f62017-07-16 21:39:54 +0200784 end if;
785 end if;
786 end Map_Linear_FB;
787
Nico Huber5374c3a2017-07-15 21:48:06 +0200788 ----------------------------------------------------------------------------
789
Nico Huber99f10f32016-11-20 00:34:05 +0100790 procedure Dump_Configs (Configs : Pipe_Configs)
Nico Huber83693c82016-10-08 22:17:55 +0200791 is
792 subtype Pipe_Name is String (1 .. 9);
Nico Huber99f10f32016-11-20 00:34:05 +0100793 type Pipe_Name_Array is array (Pipe_Index) of Pipe_Name;
Nico Huber83693c82016-10-08 22:17:55 +0200794 Pipe_Names : constant Pipe_Name_Array :=
795 (Primary => "Primary ",
796 Secondary => "Secondary",
797 Tertiary => "Tertiary ");
Nico Huber5ef4d602017-12-13 13:56:47 +0100798
799 subtype Tiling_Name is String (1 .. 7);
800 type Tiling_Name_Array is array (Tiling_Type) of Tiling_Name;
801 Tilings : constant Tiling_Name_Array :=
802 (Linear => "Linear ",
803 X_Tiled => "X_Tiled",
804 Y_Tiled => "Y_Tiled");
805
806 subtype Rotation_Name is String (1 .. 11);
807 type Rotation_Name_Array is array (Rotation_Type) of Rotation_Name;
808 Rotations : constant Rotation_Name_Array :=
809 (No_Rotation => "No_Rotation",
810 Rotated_90 => "Rotated_90 ",
811 Rotated_180 => "Rotated_180",
812 Rotated_270 => "Rotated_270");
Nico Huber83693c82016-10-08 22:17:55 +0200813 begin
814 Debug.New_Line;
Paul Menzelb83107c2017-05-04 09:02:33 +0200815 Debug.Put_Line ("CONFIG =>");
Nico Huber99f10f32016-11-20 00:34:05 +0100816 for Pipe in Pipe_Index loop
817 if Pipe = Pipe_Index'First then
Nico Huber83693c82016-10-08 22:17:55 +0200818 Debug.Put (" (");
819 else
820 Debug.Put (" ");
821 end if;
822 Debug.Put_Line (Pipe_Names (Pipe) & " =>");
823 Debug.Put_Line
824 (" (Port => " & Port_Names (Configs (Pipe).Port) & ",");
825 Debug.Put_Line (" Framebuffer =>");
Nico Huber5ef4d602017-12-13 13:56:47 +0100826 Debug.Put (" (Width => ");
Nico Huber83693c82016-10-08 22:17:55 +0200827 Debug.Put_Int32 (Configs (Pipe).Framebuffer.Width);
828 Debug.Put_Line (",");
Nico Huber5ef4d602017-12-13 13:56:47 +0100829 Debug.Put (" Height => ");
Nico Huber83693c82016-10-08 22:17:55 +0200830 Debug.Put_Int32 (Configs (Pipe).Framebuffer.Height);
831 Debug.Put_Line (",");
Nico Huber5ef4d602017-12-13 13:56:47 +0100832 Debug.Put (" Start_X => ");
833 Debug.Put_Int32 (Configs (Pipe).Framebuffer.Start_X);
834 Debug.Put_Line (",");
835 Debug.Put (" Start_Y => ");
836 Debug.Put_Int32 (Configs (Pipe).Framebuffer.Start_Y);
837 Debug.Put_Line (",");
838 Debug.Put (" Stride => ");
Nico Huber83693c82016-10-08 22:17:55 +0200839 Debug.Put_Int32 (Configs (Pipe).Framebuffer.Stride);
840 Debug.Put_Line (",");
Nico Huber5ef4d602017-12-13 13:56:47 +0100841 Debug.Put (" V_Stride => ");
842 Debug.Put_Int32 (Configs (Pipe).Framebuffer.V_Stride);
843 Debug.Put_Line (",");
844 Debug.Put (" Tiling => ");
845 Debug.Put_Line (Tilings (Configs (Pipe).Framebuffer.Tiling) & ",");
846 Debug.Put (" Rotation => ");
847 Debug.Put_Line (Rotations (Configs (Pipe).Framebuffer.Rotation) & ",");
Nico Huber83693c82016-10-08 22:17:55 +0200848 Debug.Put (" Offset => ");
849 Debug.Put_Word32 (Configs (Pipe).Framebuffer.Offset);
850 Debug.Put_Line (",");
851 Debug.Put (" BPC => ");
852 Debug.Put_Int64 (Configs (Pipe).Framebuffer.BPC);
853 Debug.Put_Line ("),");
854 Debug.Put_Line (" Mode =>");
855 Debug.Put (" (Dotclock => ");
856 Debug.Put_Int64 (Configs (Pipe).Mode.Dotclock);
857 Debug.Put_Line (",");
858 Debug.Put (" H_Visible => ");
859 Debug.Put_Int16 (Configs (Pipe).Mode.H_Visible);
860 Debug.Put_Line (",");
861 Debug.Put (" H_Sync_Begin => ");
862 Debug.Put_Int16 (Configs (Pipe).Mode.H_Sync_Begin);
863 Debug.Put_Line (",");
864 Debug.Put (" H_Sync_End => ");
865 Debug.Put_Int16 (Configs (Pipe).Mode.H_Sync_End);
866 Debug.Put_Line (",");
867 Debug.Put (" H_Total => ");
868 Debug.Put_Int16 (Configs (Pipe).Mode.H_Total);
869 Debug.Put_Line (",");
870 Debug.Put (" V_Visible => ");
871 Debug.Put_Int16 (Configs (Pipe).Mode.V_Visible);
872 Debug.Put_Line (",");
873 Debug.Put (" V_Sync_Begin => ");
874 Debug.Put_Int16 (Configs (Pipe).Mode.V_Sync_Begin);
875 Debug.Put_Line (",");
876 Debug.Put (" V_Sync_End => ");
877 Debug.Put_Int16 (Configs (Pipe).Mode.V_Sync_End);
878 Debug.Put_Line (",");
879 Debug.Put (" V_Total => ");
880 Debug.Put_Int16 (Configs (Pipe).Mode.V_Total);
881 Debug.Put_Line (",");
882 Debug.Put_Line (" H_Sync_Active_High => " &
883 (if Configs (Pipe).Mode.H_Sync_Active_High
884 then "True,"
885 else "False,"));
886 Debug.Put_Line (" V_Sync_Active_High => " &
887 (if Configs (Pipe).Mode.V_Sync_Active_High
888 then "True,"
889 else "False,"));
890 Debug.Put (" BPC => ");
891 Debug.Put_Int64 (Configs (Pipe).Mode.BPC);
Nico Huber99f10f32016-11-20 00:34:05 +0100892 if Pipe /= Pipe_Index'Last then
Nico Huber83693c82016-10-08 22:17:55 +0200893 Debug.Put_Line (")),");
894 else
895 Debug.Put_Line (")));");
896 end if;
897 end loop;
898 end Dump_Configs;
899
900end HW.GFX.GMA;