| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| 2 | -- Copyright (C) 2014-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 Huber | 125a29e | 2016-10-18 00:23:54 +0200 | [diff] [blame] | 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 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 | |
| 15 | with HW.GFX.EDID; |
| 16 | with HW.GFX.GMA.Config; |
| 17 | with HW.GFX.GMA.DP_Info; |
| 18 | with HW.GFX.GMA.Registers; |
| 19 | with HW.GFX.GMA.Power_And_Clocks; |
| 20 | with HW.GFX.GMA.Panel; |
| 21 | with HW.GFX.GMA.PLLs; |
| 22 | with HW.GFX.GMA.Port_Detect; |
| 23 | with HW.GFX.GMA.Connectors; |
| 24 | with HW.GFX.GMA.Connector_Info; |
| 25 | with HW.GFX.GMA.Pipe_Setup; |
| 26 | |
| 27 | with System; |
| 28 | |
| 29 | with HW.Debug; |
| 30 | with GNAT.Source_Info; |
| 31 | |
| 32 | use type HW.Word8; |
| 33 | use type HW.Int32; |
| 34 | |
| 35 | package body HW.GFX.GMA |
| 36 | with Refined_State => |
| 37 | (State => |
| 38 | (Registers.Address_State, |
| 39 | PLLs.State, Panel.Panel_State, |
| 40 | Cur_Configs, Allocated_PLLs, DP_Links, |
| 41 | HPD_Delay, Wait_For_HPD), |
| 42 | Init_State => Initialized, |
| 43 | Config_State => Config.Valid_Port_GPU, |
| 44 | Device_State => |
| 45 | (Registers.Register_State, Registers.GTT_State)) |
| 46 | is |
| 47 | |
| 48 | subtype Port_Name is String (1 .. 8); |
| 49 | type Port_Name_Array is array (Port_Type) of Port_Name; |
| 50 | Port_Names : constant Port_Name_Array := |
| 51 | (Disabled => "Disabled", |
| 52 | Internal => "Internal", |
| 53 | DP1 => "DP1 ", |
| 54 | DP2 => "DP2 ", |
| 55 | DP3 => "DP3 ", |
| 56 | Digital1 => "Digital1", |
| 57 | Digital2 => "Digital2", |
| 58 | Digital3 => "Digital3", |
| 59 | Analog => "Analog "); |
| 60 | |
| 61 | package Display_Controller renames Pipe_Setup; |
| 62 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 63 | type PLLs_Type is array (Pipe_Index) of PLLs.T; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 64 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 65 | type Links_Type is array (Pipe_Index) of DP_Link; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 66 | |
| 67 | type HPD_Type is array (Port_Type) of Boolean; |
| 68 | type HPD_Delay_Type is array (Port_Type) of Time.T; |
| 69 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 70 | Cur_Configs : Pipe_Configs; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 71 | Allocated_PLLs : PLLs_Type; |
| 72 | DP_Links : Links_Type; |
| 73 | HPD_Delay : HPD_Delay_Type; |
| 74 | Wait_For_HPD : HPD_Type; |
| 75 | Initialized : Boolean := False; |
| 76 | |
| 77 | subtype Active_Port_Type is Port_Type range Port_Type'Succ (Disabled) .. Port_Type'Last; |
| 78 | |
| 79 | ---------------------------------------------------------------------------- |
| 80 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 81 | PCH_RAWCLK_FREQ_MASK : constant := 16#3ff# * 2 ** 0; |
| 82 | |
| 83 | function PCH_RAWCLK_FREQ (Freq : Frequency_Type) return Word32 |
| 84 | is |
| 85 | begin |
| 86 | return Word32 (Freq / 1_000_000); |
| 87 | end PCH_RAWCLK_FREQ; |
| 88 | |
| 89 | ---------------------------------------------------------------------------- |
| 90 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 91 | function To_GPU_Port |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 92 | (Configs : Pipe_Configs; |
| 93 | Idx : Pipe_Index) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 94 | return GPU_Port |
| 95 | is |
| 96 | begin |
| 97 | return |
| 98 | (case Config.CPU is |
| 99 | when Ironlake .. Ivybridge => -- everything but eDP through FDI/PCH |
| 100 | (if Config.Internal_Is_EDP and then Configs (Idx).Port = Internal |
| 101 | then |
| 102 | DIGI_A |
| 103 | else |
| 104 | (case Idx is |
| 105 | -- FDIs are fixed to the CPU pipe |
| 106 | when Primary => DIGI_B, |
| 107 | when Secondary => DIGI_C, |
| 108 | when Tertiary => DIGI_D)), |
| 109 | when Haswell .. Skylake => -- everything but VGA directly on CPU |
| 110 | (case Configs (Idx).Port is |
| 111 | when Disabled => GPU_Port'First, |
| 112 | when Internal => DIGI_A, -- LVDS not available |
| 113 | when Digital1 | DP1 => DIGI_B, |
| 114 | when Digital2 | DP2 => DIGI_C, |
| 115 | when Digital3 | DP3 => DIGI_D, |
| 116 | when Analog => DIGI_E)); |
| 117 | end To_GPU_Port; |
| 118 | |
| 119 | function To_PCH_Port (Port : Active_Port_Type) return PCH_Port |
| 120 | is |
| 121 | begin |
| 122 | return |
| 123 | (case Port is |
| 124 | when Internal => PCH_LVDS, -- will be ignored if Internal is DP |
| 125 | when Analog => PCH_DAC, |
| 126 | when Digital1 => PCH_HDMI_B, |
| 127 | when Digital2 => PCH_HDMI_C, |
| 128 | when Digital3 => PCH_HDMI_D, |
| 129 | when DP1 => PCH_DP_B, |
| 130 | when DP2 => PCH_DP_C, |
| 131 | when DP3 => PCH_DP_D); |
| 132 | end To_PCH_Port; |
| 133 | |
| 134 | function To_Display_Type (Port : Active_Port_Type) return Display_Type |
| 135 | with Pre => True |
| 136 | is |
| 137 | begin |
| 138 | return |
| 139 | (case Port is |
| 140 | when Internal => Config.Internal_Display, |
| 141 | when Analog => VGA, |
| 142 | when Digital1 | |
| 143 | Digital2 | |
| 144 | Digital3 => HDMI, |
| 145 | when DP1 | |
| 146 | DP2 | |
| 147 | DP3 => DP); |
| 148 | end To_Display_Type; |
| 149 | |
| 150 | procedure Configure_FDI_Link |
| 151 | (Port_Cfg : in out Port_Config; |
| 152 | Success : out Boolean) |
| Nico Huber | 47ff069 | 2016-11-04 14:29:39 +0100 | [diff] [blame] | 153 | with |
| 154 | Post => Port_Cfg.Mode = Port_Cfg.Mode'Old |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 155 | is |
| 156 | procedure Limit_Lane_Count |
| 157 | is |
| 158 | FDI_TX_CTL_FDI_TX_ENABLE : constant := 1 * 2 ** 31; |
| 159 | Enabled : Boolean; |
| 160 | begin |
| 161 | -- if DIGI_D enabled: (FDI names are off by one) |
| 162 | Registers.Is_Set_Mask |
| 163 | (Register => Registers.FDI_TX_CTL_C, |
| 164 | Mask => FDI_TX_CTL_FDI_TX_ENABLE, |
| 165 | Result => Enabled); |
| 166 | if Enabled then |
| 167 | Port_Cfg.FDI.Receiver_Caps.Max_Lane_Count := DP_Lane_Count_2; |
| 168 | end if; |
| 169 | end Limit_Lane_Count; |
| 170 | begin |
| 171 | Port_Cfg.FDI.Receiver_Caps.Max_Link_Rate := DP_Bandwidth_2_7; |
| 172 | Port_Cfg.FDI.Receiver_Caps.Max_Lane_Count := |
| 173 | Config.FDI_Lane_Count (Port_Cfg.Port); |
| 174 | Port_Cfg.FDI.Receiver_Caps.Enhanced_Framing := True; |
| 175 | if Config.Has_FDI_C and then Port_Cfg.Port = DIGI_C then |
| 176 | Limit_Lane_Count; |
| 177 | end if; |
| 178 | DP_Info.Preferred_Link_Setting (Port_Cfg.FDI, Port_Cfg.Mode, Success); |
| 179 | end Configure_FDI_Link; |
| 180 | |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 181 | function Validate_Config |
| 182 | (Framebuffer : Framebuffer_Type; |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 183 | Port_Cfg : Port_Config; |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 184 | I : Pipe_Index) |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 185 | return Boolean |
| Nico Huber | 47ff069 | 2016-11-04 14:29:39 +0100 | [diff] [blame] | 186 | with |
| 187 | Post => |
| 188 | (if Validate_Config'Result then |
| 189 | Framebuffer.Width <= Pos32 (Port_Cfg.Mode.H_Visible) and |
| 190 | Framebuffer.Height <= Pos32 (Port_Cfg.Mode.V_Visible)) |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 191 | is |
| 192 | begin |
| 193 | -- No downscaling |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 194 | -- Respect maximum scalable width |
| Nico Huber | 3675db5 | 2016-11-04 16:27:29 +0100 | [diff] [blame] | 195 | -- VGA plane is only allowed on the primary pipe |
| 196 | -- Only 32bpp RGB (ignored for VGA plane) |
| 197 | -- Stride must be a multiple of 64 (ignored for VGA plane) |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 198 | return |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 199 | ((Framebuffer.Width = Pos32 (Port_Cfg.Mode.H_Visible) and |
| 200 | Framebuffer.Height = Pos32 (Port_Cfg.Mode.V_Visible)) or |
| 201 | (Framebuffer.Width <= Config.Maximum_Scalable_Width (I) and |
| 202 | Framebuffer.Width <= Pos32 (Port_Cfg.Mode.H_Visible) and |
| 203 | Framebuffer.Height <= Pos32 (Port_Cfg.Mode.V_Visible))) and |
| Nico Huber | 3675db5 | 2016-11-04 16:27:29 +0100 | [diff] [blame] | 204 | (Framebuffer.Offset /= VGA_PLANE_FRAMEBUFFER_OFFSET or I = Primary) and |
| 205 | (Framebuffer.Offset = VGA_PLANE_FRAMEBUFFER_OFFSET or |
| 206 | (Framebuffer.BPC = 8 and |
| 207 | Framebuffer.Stride mod 64 = 0)); |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 208 | end Validate_Config; |
| 209 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 210 | procedure Fill_Port_Config |
| 211 | (Port_Cfg : out Port_Config; |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 212 | Configs : in Pipe_Configs; |
| 213 | Idx : in Pipe_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 214 | Success : out Boolean) |
| 215 | with Pre => True |
| 216 | is |
| 217 | begin |
| 218 | Success := |
| 219 | Config.Supported_Pipe (Idx) and then |
| 220 | Config.Valid_Port (Configs (Idx).Port) and then |
| 221 | Configs (Idx).Port /= Disabled; |
| 222 | |
| 223 | if Success then |
| 224 | declare |
| 225 | Port : constant Port_Type := Configs (Idx).Port; |
| 226 | Mode : constant Mode_Type := Configs (Idx).Mode; |
| 227 | Link : constant DP_Link := DP_Links (Idx); |
| 228 | begin |
| 229 | Port_Cfg := Port_Config' |
| 230 | (Port => To_GPU_Port (Configs, Idx), |
| 231 | PCH_Port => To_PCH_Port (Port), |
| 232 | Display => To_Display_Type (Port), |
| 233 | Mode => Mode, |
| 234 | Is_FDI => Config.FDI_Port (To_GPU_Port (Configs, Idx)), |
| 235 | FDI => Default_DP, |
| 236 | DP => Link); |
| 237 | if Port_Cfg.Mode.BPC = Auto_BPC then |
| 238 | Port_Cfg.Mode.BPC := Connector_Info.Default_BPC (Port_Cfg); |
| 239 | end if; |
| Nico Huber | 74ec962 | 2016-11-19 03:00:43 +0100 | [diff] [blame] | 240 | if Port_Cfg.Display = HDMI then |
| 241 | declare |
| 242 | pragma Assert (Config.HDMI_Max_Clock_24bpp * 8 |
| 243 | / Port_Cfg.Mode.BPC >= Frequency_Type'First); |
| 244 | Max_Dotclock : constant Frequency_Type := |
| 245 | Config.HDMI_Max_Clock_24bpp * 8 / Port_Cfg.Mode.BPC; |
| 246 | begin |
| 247 | if Port_Cfg.Mode.Dotclock > Max_Dotclock then |
| 248 | pragma Debug (Debug.Put ("Dotclock ")); |
| 249 | pragma Debug (Debug.Put_Int64 (Port_Cfg.Mode.Dotclock)); |
| 250 | pragma Debug (Debug.Put (" too high, limiting to ")); |
| 251 | pragma Debug (Debug.Put_Int64 (Max_Dotclock)); |
| 252 | pragma Debug (Debug.Put_Line (".")); |
| 253 | Port_Cfg.Mode.Dotclock := Max_Dotclock; |
| 254 | end if; |
| 255 | end; |
| 256 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 257 | end; |
| 258 | else |
| 259 | Port_Cfg := Port_Config' |
| 260 | (Port => GPU_Port'First, |
| 261 | PCH_Port => PCH_Port'First, |
| 262 | Display => Display_Type'First, |
| 263 | Mode => Invalid_Mode, |
| 264 | Is_FDI => False, |
| 265 | FDI => Default_DP, |
| 266 | DP => Default_DP); |
| 267 | end if; |
| 268 | end Fill_Port_Config; |
| 269 | |
| 270 | ---------------------------------------------------------------------------- |
| 271 | |
| 272 | function To_Controller |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 273 | (Dsp_Config : Pipe_Index) return Display_Controller.Controller_Type |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 274 | is |
| 275 | Result : Display_Controller.Controller_Type; |
| 276 | begin |
| 277 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 278 | |
| 279 | case Dsp_Config is |
| 280 | when Primary => |
| 281 | Result := Display_Controller.Controllers (Display_Controller.A); |
| 282 | when Secondary => |
| 283 | Result := Display_Controller.Controllers (Display_Controller.B); |
| 284 | when Tertiary => |
| 285 | Result := Display_Controller.Controllers (Display_Controller.C); |
| 286 | end case; |
| 287 | return Result; |
| 288 | end To_Controller; |
| 289 | |
| 290 | ---------------------------------------------------------------------------- |
| 291 | |
| 292 | function To_Head |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 293 | (N_Config : Pipe_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 294 | Port : Active_Port_Type) |
| 295 | return Display_Controller.Head_Type |
| 296 | is |
| 297 | Result : Display_Controller.Head_Type; |
| 298 | begin |
| 299 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 300 | |
| 301 | if Config.Has_EDP_Pipe and then Port = Internal then |
| 302 | Result := Display_Controller.Heads (Display_Controller.Head_EDP); |
| 303 | else |
| 304 | case N_Config is |
| 305 | when Primary => |
| 306 | Result := Display_Controller.Heads (Display_Controller.Head_A); |
| 307 | when Secondary => |
| 308 | Result := Display_Controller.Heads (Display_Controller.Head_B); |
| 309 | when Tertiary => |
| 310 | Result := Display_Controller.Heads (Display_Controller.Head_C); |
| 311 | end case; |
| 312 | end if; |
| 313 | return Result; |
| 314 | end To_Head; |
| 315 | |
| 316 | ---------------------------------------------------------------------------- |
| 317 | |
| 318 | procedure Legacy_VGA_Off |
| 319 | is |
| 320 | Reg8 : Word8; |
| 321 | begin |
| 322 | -- disable legacy VGA plane, taking over control now |
| 323 | Port_IO.OutB (VGA_SR_INDEX, VGA_SR01); |
| 324 | Port_IO.InB (Reg8, VGA_SR_DATA); |
| 325 | Port_IO.OutB (VGA_SR_DATA, Reg8 or 1 * 2 ** 5); |
| 326 | Time.U_Delay (100); -- PRM says 100us, Linux does 300 |
| 327 | Registers.Set_Mask (Registers.VGACNTRL, 1 * 2 ** 31); |
| 328 | end Legacy_VGA_Off; |
| 329 | |
| 330 | ---------------------------------------------------------------------------- |
| 331 | |
| 332 | function Port_Configured |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 333 | (Configs : Pipe_Configs; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 334 | Port : Port_Type) |
| 335 | return Boolean |
| 336 | with |
| 337 | Global => null |
| 338 | is |
| 339 | begin |
| 340 | return Configs (Primary).Port = Port or |
| 341 | Configs (Secondary).Port = Port or |
| 342 | Configs (Tertiary).Port = Port; |
| 343 | end Port_Configured; |
| 344 | |
| 345 | procedure Scan_Ports |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 346 | (Configs : out Pipe_Configs; |
| Nico Huber | aa91bb5 | 2016-11-07 12:51:20 +0100 | [diff] [blame] | 347 | Ports : in Port_List; |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 348 | Max_Pipe : in Pipe_Index := Pipe_Index'Last) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 349 | is |
| 350 | Raw_EDID : EDID.Raw_EDID_Data := (others => 16#00#); |
| 351 | Port_Idx : Port_List_Range := Port_List_Range'First; |
| 352 | Port_Cfg : Port_Config; |
| 353 | Success : Boolean := False; |
| 354 | begin |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 355 | Configs := (Pipe_Index => |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 356 | (Port => Disabled, |
| 357 | Mode => Invalid_Mode, |
| 358 | Framebuffer => Default_FB)); |
| 359 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 360 | for Config_Idx in Pipe_Index range Pipe_Index'First .. Max_Pipe loop |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 361 | while Ports (Port_Idx) /= Disabled loop |
| 362 | if not Port_Configured (Configs, Ports (Port_Idx)) then |
| 363 | Configs (Config_Idx).Port := Ports (Port_Idx); |
| 364 | Fill_Port_Config (Port_Cfg, Configs, Config_Idx, Success); |
| 365 | |
| 366 | if Success then |
| 367 | -- May need power to probe port |
| 368 | if Port_Cfg.Display = DP then |
| 369 | Power_And_Clocks.Power_Up (Cur_Configs, Configs); |
| 370 | end if; |
| 371 | if Ports (Port_Idx) = Internal then |
| 372 | Panel.On; |
| 373 | end if; |
| 374 | |
| 375 | Connector_Info.Read_EDID (Raw_EDID, Port_Cfg, Success); |
| 376 | end if; |
| 377 | |
| Nico Huber | 393aa8a | 2016-10-21 14:18:53 +0200 | [diff] [blame] | 378 | if Success and then |
| 379 | (EDID.Compatible_Display (Raw_EDID, Port_Cfg.Display) and |
| 380 | EDID.Has_Preferred_Mode (Raw_EDID)) |
| 381 | then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 382 | Configs (Config_Idx).Mode := EDID.Preferred_Mode (Raw_EDID); |
| 383 | else |
| 384 | Configs (Config_Idx).Port := Disabled; |
| Nico Huber | 6a35667 | 2016-10-21 15:13:55 +0200 | [diff] [blame] | 385 | Success := False; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 386 | |
| 387 | if Ports (Port_Idx) = Internal and |
| 388 | not Port_Configured (Cur_Configs, Internal) |
| 389 | then |
| 390 | Panel.Off; |
| 391 | end if; |
| 392 | end if; |
| 393 | end if; |
| 394 | |
| 395 | exit when Port_Idx = Port_List_Range'Last; |
| 396 | Port_Idx := Port_List_Range'Succ (Port_Idx); |
| 397 | |
| 398 | exit when Success; |
| 399 | end loop; |
| 400 | end loop; |
| 401 | |
| 402 | Power_And_Clocks.Power_Set_To (Cur_Configs); |
| 403 | end Scan_Ports; |
| 404 | |
| 405 | procedure Auto_Configure |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 406 | (Configs : in out Pipe_Configs; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 407 | Keep_Power : in Boolean := False) |
| 408 | is |
| 409 | Raw_EDID : EDID.Raw_EDID_Data := (others => 16#00#); |
| 410 | Success : Boolean; |
| 411 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 412 | Config_Idx : Pipe_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 413 | Port_Cfg : Port_Config; |
| 414 | |
| 415 | function Free_Config return Boolean |
| 416 | with |
| 417 | Pre => True |
| 418 | is |
| 419 | begin |
| 420 | return Port_Configured (Configs, Disabled); |
| 421 | end Free_Config; |
| 422 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 423 | function First_Free_Config return Pipe_Index |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 424 | with |
| 425 | Pre => Free_Config |
| 426 | is |
| 427 | begin |
| 428 | return (if Configs (Primary).Port = Disabled then Primary else |
| 429 | (if Configs (Secondary).Port = Disabled then Secondary |
| 430 | else Tertiary)); |
| 431 | end First_Free_Config; |
| 432 | begin |
| 433 | -- TODO: Only check ports with hot-plug event? |
| 434 | |
| 435 | if Config.Has_Internal_Display and then |
| 436 | not Keep_Power and then |
| 437 | not Port_Configured (Cur_Configs, Internal) |
| 438 | then |
| 439 | Panel.On (Wait => False); |
| 440 | end if; |
| 441 | |
| 442 | -- Check if displays are still connected |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 443 | for I in Pipe_Index loop |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 444 | if Configs (I).Port /= Disabled then |
| 445 | Fill_Port_Config (Port_Cfg, Configs, I, Success); |
| 446 | if Success then |
| 447 | Connector_Info.Read_EDID |
| 448 | (Raw_EDID => Raw_EDID, |
| 449 | Port_Cfg => Port_Cfg, |
| 450 | Success => Success); |
| 451 | end if; |
| 452 | if not Success or else |
| 453 | not EDID.Has_Preferred_Mode (Raw_EDID) or else |
| 454 | Configs (I).Mode /= EDID.Preferred_Mode (Raw_EDID) |
| 455 | then |
| 456 | Configs (I).Port := Disabled; |
| 457 | end if; |
| 458 | end if; |
| 459 | end loop; |
| 460 | |
| 461 | -- Add new displays as long as there is a free pipe config |
| 462 | for Port in Active_Port_Type loop |
| 463 | if Free_Config and then not Port_Configured (Configs, Port) then |
| 464 | Config_Idx := First_Free_Config; |
| 465 | Configs (Config_Idx).Port := Port; |
| 466 | Fill_Port_Config (Port_Cfg, Configs, Config_Idx, Success); |
| 467 | |
| 468 | if Success then |
| 469 | -- Need power to probe port |
| 470 | if not Keep_Power and then To_Display_Type (Port) = DP then |
| 471 | Power_And_Clocks.Power_Up (Cur_Configs, Configs); |
| 472 | end if; |
| 473 | if not Keep_Power and then Port = Internal then |
| 474 | Panel.Wait_On; |
| 475 | end if; |
| 476 | |
| 477 | Connector_Info.Read_EDID |
| 478 | (Raw_EDID => Raw_EDID, |
| 479 | Port_Cfg => Port_Cfg, |
| 480 | Success => Success); |
| 481 | end if; |
| 482 | |
| Nico Huber | 393aa8a | 2016-10-21 14:18:53 +0200 | [diff] [blame] | 483 | if Success and then |
| 484 | (EDID.Compatible_Display (Raw_EDID, Port_Cfg.Display) and |
| 485 | EDID.Has_Preferred_Mode (Raw_EDID)) |
| 486 | then |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 487 | Configs (Config_Idx) := Pipe_Config' |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 488 | (Port => Port, |
| 489 | Framebuffer => Configs (Config_Idx).Framebuffer, |
| 490 | Mode => EDID.Preferred_Mode (Raw_EDID)); |
| 491 | else |
| 492 | Configs (Config_Idx).Port := Disabled; |
| 493 | end if; |
| 494 | end if; |
| 495 | end loop; |
| 496 | |
| 497 | if not Keep_Power then |
| 498 | Power_And_Clocks.Power_Set_To (Cur_Configs); |
| 499 | |
| 500 | if Config.Has_Internal_Display and then |
| 501 | not Port_Configured (Cur_Configs, Internal) |
| 502 | then |
| 503 | Panel.Off; |
| 504 | end if; |
| 505 | end if; |
| 506 | end Auto_Configure; |
| 507 | |
| 508 | ---------------------------------------------------------------------------- |
| 509 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 510 | procedure Update_Outputs (Configs : Pipe_Configs) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 511 | is |
| 512 | Did_Power_Up : Boolean := False; |
| 513 | |
| 514 | HPD, HPD_Delay_Over, Success : Boolean; |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 515 | Old_Config, New_Config : Pipe_Config; |
| 516 | Old_Configs : Pipe_Configs; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 517 | Port_Cfg : Port_Config; |
| 518 | |
| 519 | procedure Check_HPD |
| 520 | (Port_Cfg : in Port_Config; |
| 521 | Port : in Port_Type; |
| 522 | Detected : out Boolean) |
| 523 | is |
| 524 | begin |
| 525 | HPD_Delay_Over := Time.Timed_Out (HPD_Delay (Port)); |
| 526 | if HPD_Delay_Over then |
| 527 | Port_Detect.Hotplug_Detect (Port_Cfg, Detected); |
| 528 | HPD_Delay (Port) := Time.MS_From_Now (333); |
| 529 | else |
| 530 | Detected := False; |
| 531 | end if; |
| 532 | end Check_HPD; |
| 533 | begin |
| 534 | Old_Configs := Cur_Configs; |
| 535 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 536 | for I in Pipe_Index loop |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 537 | HPD := False; |
| 538 | |
| 539 | Old_Config := Cur_Configs (I); |
| 540 | New_Config := Configs (I); |
| 541 | |
| 542 | Fill_Port_Config (Port_Cfg, Old_Configs, I, Success); |
| 543 | if Success then |
| 544 | Check_HPD (Port_Cfg, Old_Config.Port, HPD); |
| 545 | end if; |
| 546 | |
| 547 | -- Connector changed? |
| 548 | if (Success and then HPD) or |
| 549 | Old_Config.Port /= New_Config.Port or |
| 550 | Old_Config.Mode /= New_Config.Mode |
| 551 | then |
| 552 | if Old_Config.Port /= Disabled then |
| 553 | if Success then |
| 554 | pragma Debug (Debug.New_Line); |
| 555 | pragma Debug (Debug.Put_Line |
| 556 | ("Disabling port " & Port_Names (Old_Config.Port))); |
| 557 | |
| 558 | Connectors.Pre_Off (Port_Cfg); |
| 559 | |
| 560 | Display_Controller.Off |
| 561 | (To_Controller (I), To_Head (I, Old_Config.Port)); |
| 562 | |
| 563 | Connectors.Post_Off (Port_Cfg); |
| 564 | end if; |
| 565 | |
| 566 | -- Free PLL |
| 567 | PLLs.Free (Allocated_PLLs (I)); |
| 568 | |
| 569 | Cur_Configs (I).Port := Disabled; |
| 570 | end if; |
| 571 | |
| 572 | if New_Config.Port /= Disabled then |
| 573 | Fill_Port_Config (Port_Cfg, Configs, I, Success); |
| 574 | |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 575 | Success := Success and then |
| Nico Huber | dcd274b | 2016-11-03 20:15:39 +0100 | [diff] [blame] | 576 | Validate_Config (New_Config.Framebuffer, Port_Cfg, I); |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 577 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 578 | if Success and then Wait_For_HPD (New_Config.Port) then |
| 579 | Check_HPD (Port_Cfg, New_Config.Port, Success); |
| 580 | Wait_For_HPD (New_Config.Port) := not Success; |
| 581 | end if; |
| 582 | |
| 583 | if Success then |
| 584 | pragma Debug (Debug.New_Line); |
| 585 | pragma Debug (Debug.Put_Line |
| 586 | ("Trying to enable port " & Port_Names (New_Config.Port))); |
| 587 | |
| 588 | if not Did_Power_Up then |
| 589 | Power_And_Clocks.Power_Up (Old_Configs, Configs); |
| 590 | Did_Power_Up := True; |
| 591 | end if; |
| 592 | |
| 593 | if Port_Cfg.Is_FDI then |
| 594 | Configure_FDI_Link (Port_Cfg, Success); |
| 595 | end if; |
| 596 | end if; |
| 597 | |
| 598 | if Success then |
| 599 | Connector_Info.Preferred_Link_Setting |
| 600 | (Port_Cfg => Port_Cfg, |
| 601 | Success => Success); |
| 602 | end if; |
| 603 | |
| 604 | while Success loop |
| Nico Huber | 47ff069 | 2016-11-04 14:29:39 +0100 | [diff] [blame] | 605 | pragma Loop_Invariant |
| 606 | (New_Config.Port in Active_Port_Type and |
| 607 | Port_Cfg.Mode = Port_Cfg.Mode'Loop_Entry); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 608 | |
| 609 | PLLs.Alloc |
| 610 | (Port_Cfg => Port_Cfg, |
| 611 | PLL => Allocated_PLLs (I), |
| 612 | Success => Success); |
| 613 | |
| 614 | if Success then |
| 615 | for Try in 1 .. 2 loop |
| 616 | pragma Loop_Invariant |
| 617 | (New_Config.Port in Active_Port_Type); |
| 618 | |
| 619 | Connectors.Pre_On |
| 620 | (Port_Cfg => Port_Cfg, |
| 621 | PLL_Hint => PLLs.Register_Value |
| 622 | (Allocated_PLLs (I)), |
| 623 | Pipe_Hint => Display_Controller.Get_Pipe_Hint |
| 624 | (To_Head (I, New_Config.Port)), |
| 625 | Success => Success); |
| 626 | |
| 627 | if Success then |
| 628 | Display_Controller.On |
| 629 | (Controller => To_Controller (I), |
| 630 | Head => To_Head (I, New_Config.Port), |
| 631 | Port_Cfg => Port_Cfg, |
| 632 | Framebuffer => New_Config.Framebuffer); |
| 633 | |
| 634 | Connectors.Post_On |
| 635 | (Port_Cfg => Port_Cfg, |
| 636 | PLL_Hint => PLLs.Register_Value |
| 637 | (Allocated_PLLs (I)), |
| 638 | Success => Success); |
| 639 | |
| 640 | if not Success then |
| 641 | Display_Controller.Off |
| 642 | (To_Controller (I), |
| 643 | To_Head (I, New_Config.Port)); |
| 644 | Connectors.Post_Off (Port_Cfg); |
| 645 | end if; |
| 646 | end if; |
| 647 | |
| 648 | exit when Success; |
| 649 | end loop; |
| 650 | exit when Success; -- connection established => stop loop |
| 651 | |
| 652 | -- connection failed |
| 653 | PLLs.Free (Allocated_PLLs (I)); |
| 654 | end if; |
| 655 | |
| 656 | Connector_Info.Next_Link_Setting |
| 657 | (Port_Cfg => Port_Cfg, |
| 658 | Success => Success); |
| 659 | end loop; |
| 660 | |
| 661 | if Success then |
| 662 | pragma Debug (Debug.Put_Line |
| 663 | ("Enabled port " & Port_Names (New_Config.Port))); |
| 664 | Cur_Configs (I) := New_Config; |
| 665 | DP_Links (I) := Port_Cfg.DP; |
| 666 | else |
| 667 | Wait_For_HPD (New_Config.Port) := True; |
| 668 | if New_Config.Port = Internal then |
| 669 | Panel.Off; |
| 670 | end if; |
| 671 | end if; |
| 672 | else |
| 673 | Cur_Configs (I) := New_Config; |
| 674 | end if; |
| 675 | elsif Old_Config.Framebuffer /= New_Config.Framebuffer and |
| 676 | Old_Config.Port /= Disabled |
| 677 | then |
| 678 | Display_Controller.Update_Offset |
| 679 | (Controller => To_Controller (I), |
| 680 | Framebuffer => New_Config.Framebuffer); |
| 681 | Cur_Configs (I) := New_Config; |
| 682 | end if; |
| 683 | end loop; |
| 684 | |
| 685 | if Did_Power_Up then |
| 686 | Power_And_Clocks.Power_Down (Old_Configs, Configs, Cur_Configs); |
| 687 | end if; |
| 688 | |
| 689 | end Update_Outputs; |
| 690 | |
| 691 | ---------------------------------------------------------------------------- |
| 692 | |
| 693 | procedure Initialize |
| 694 | (MMIO_Base : in Word64 := 0; |
| 695 | Write_Delay : in Word64 := 0; |
| 696 | Success : out Boolean) |
| 697 | with |
| 698 | Refined_Global => |
| 699 | (In_Out => |
| 700 | (Config.Valid_Port_GPU, |
| 701 | Registers.Register_State, Port_IO.State), |
| 702 | Input => |
| 703 | (Time.State), |
| 704 | Output => |
| 705 | (Registers.Address_State, |
| 706 | PLLs.State, Panel.Panel_State, |
| 707 | Cur_Configs, Allocated_PLLs, DP_Links, |
| 708 | HPD_Delay, Wait_For_HPD, Initialized)) |
| 709 | is |
| 710 | use type HW.Word64; |
| 711 | |
| 712 | Now : constant Time.T := Time.Now; |
| 713 | |
| 714 | procedure Check_Platform (Success : out Boolean) |
| 715 | is |
| 716 | Audio_VID_DID : Word32; |
| 717 | begin |
| 718 | case Config.CPU is |
| 719 | when Haswell .. Skylake => |
| 720 | Registers.Read (Registers.AUD_VID_DID, Audio_VID_DID); |
| 721 | when Ironlake .. Ivybridge => |
| 722 | Registers.Read (Registers.PCH_AUD_VID_DID, Audio_VID_DID); |
| 723 | end case; |
| 724 | Success := |
| 725 | (case Config.CPU is |
| 726 | when Skylake => Audio_VID_DID = 16#8086_2809#, |
| 727 | when Broadwell => Audio_VID_DID = 16#8086_2808#, |
| 728 | when Haswell => Audio_VID_DID = 16#8086_2807#, |
| 729 | when Ivybridge | |
| 730 | Sandybridge => Audio_VID_DID = 16#8086_2806# or |
| 731 | Audio_VID_DID = 16#8086_2805#, |
| Nico Huber | eeb5a39 | 2016-10-09 19:28:30 +0200 | [diff] [blame] | 732 | when Ironlake => Audio_VID_DID = 16#0000_0000#); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 733 | end Check_Platform; |
| 734 | begin |
| 735 | pragma Warnings (GNATprove, Off, "unused variable ""Write_Delay""", |
| 736 | Reason => "Write_Delay is used for debugging only"); |
| 737 | |
| 738 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 739 | |
| 740 | pragma Debug (Debug.Set_Register_Write_Delay (Write_Delay)); |
| 741 | |
| 742 | Wait_For_HPD := HPD_Type'(others => False); |
| 743 | HPD_Delay := HPD_Delay_Type'(others => Now); |
| 744 | DP_Links := Links_Type'(others => HW.GFX.Default_DP); |
| 745 | Allocated_PLLs := (others => PLLs.Invalid); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 746 | Cur_Configs := Pipe_Configs' |
| 747 | (others => Pipe_Config' |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 748 | (Port => Disabled, |
| 749 | Framebuffer => HW.GFX.Default_FB, |
| 750 | Mode => HW.GFX.Invalid_Mode)); |
| 751 | Registers.Set_Register_Base |
| 752 | (if MMIO_Base /= 0 then |
| 753 | MMIO_Base |
| 754 | else |
| 755 | Config.Default_MMIO_Base); |
| 756 | PLLs.Initialize; |
| 757 | |
| 758 | Check_Platform (Success); |
| 759 | if not Success then |
| 760 | pragma Debug (Debug.Put_Line ("ERROR: Incompatible CPU or PCH.")); |
| 761 | |
| 762 | Panel.Static_Init; -- for flow analysis |
| 763 | |
| 764 | Initialized := False; |
| 765 | return; |
| 766 | end if; |
| 767 | |
| 768 | Panel.Setup_PP_Sequencer; |
| 769 | Port_Detect.Initialize; |
| 770 | |
| 771 | Power_And_Clocks.Pre_All_Off; |
| 772 | |
| 773 | Legacy_VGA_Off; |
| 774 | |
| 775 | Connectors.Pre_All_Off; |
| 776 | Display_Controller.All_Off; |
| 777 | Connectors.Post_All_Off; |
| 778 | PLLs.All_Off; |
| 779 | |
| 780 | Power_And_Clocks.Post_All_Off; |
| 781 | |
| 782 | -------------------- Now restart from a clean state --------------------- |
| 783 | Power_And_Clocks.Initialize; |
| 784 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 785 | Registers.Unset_And_Set_Mask |
| 786 | (Register => Registers.PCH_RAWCLK_FREQ, |
| 787 | Mask_Unset => PCH_RAWCLK_FREQ_MASK, |
| 788 | Mask_Set => PCH_RAWCLK_FREQ (Config.Default_RawClk_Freq)); |
| 789 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 790 | Initialized := True; |
| 791 | |
| 792 | end Initialize; |
| 793 | |
| 794 | function Is_Initialized return Boolean |
| 795 | with |
| 796 | Refined_Post => Is_Initialized'Result = Initialized |
| 797 | is |
| 798 | begin |
| 799 | return Initialized; |
| 800 | end Is_Initialized; |
| 801 | |
| 802 | ---------------------------------------------------------------------------- |
| 803 | |
| 804 | procedure Write_GTT |
| 805 | (GTT_Page : GTT_Range; |
| 806 | Device_Address : GTT_Address_Type; |
| 807 | Valid : Boolean) is |
| 808 | begin |
| 809 | Registers.Write_GTT (GTT_Page, Device_Address, Valid); |
| 810 | end Write_GTT; |
| 811 | |
| 812 | procedure Setup_Default_GTT (FB : Framebuffer_Type; Phys_FB : Word32) |
| 813 | is |
| 814 | FB_Size : constant Pos32 := |
| 815 | FB.Stride * FB.Height * Pos32 (((FB.BPC * 4) / 8)); |
| 816 | Phys_Addr : GTT_Address_Type := GTT_Address_Type (Phys_FB); |
| 817 | begin |
| 818 | for Idx in GTT_Range range 0 .. GTT_Range (((FB_Size + 4095) / 4096) - 1) |
| 819 | loop |
| 820 | Registers.Write_GTT |
| 821 | (GTT_Page => Idx, |
| 822 | Device_Address => Phys_Addr, |
| 823 | Valid => True); |
| 824 | Phys_Addr := Phys_Addr + 4096; |
| 825 | end loop; |
| 826 | end Setup_Default_GTT; |
| 827 | |
| 828 | ---------------------------------------------------------------------------- |
| 829 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 830 | procedure Dump_Configs (Configs : Pipe_Configs) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 831 | is |
| 832 | subtype Pipe_Name is String (1 .. 9); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 833 | type Pipe_Name_Array is array (Pipe_Index) of Pipe_Name; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 834 | Pipe_Names : constant Pipe_Name_Array := |
| 835 | (Primary => "Primary ", |
| 836 | Secondary => "Secondary", |
| 837 | Tertiary => "Tertiary "); |
| 838 | begin |
| 839 | Debug.New_Line; |
| 840 | Debug.Put_Line ("CONFIG => "); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 841 | for Pipe in Pipe_Index loop |
| 842 | if Pipe = Pipe_Index'First then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 843 | Debug.Put (" ("); |
| 844 | else |
| 845 | Debug.Put (" "); |
| 846 | end if; |
| 847 | Debug.Put_Line (Pipe_Names (Pipe) & " =>"); |
| 848 | Debug.Put_Line |
| 849 | (" (Port => " & Port_Names (Configs (Pipe).Port) & ","); |
| 850 | Debug.Put_Line (" Framebuffer =>"); |
| 851 | Debug.Put (" (Width => "); |
| 852 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Width); |
| 853 | Debug.Put_Line (","); |
| 854 | Debug.Put (" Height => "); |
| 855 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Height); |
| 856 | Debug.Put_Line (","); |
| 857 | Debug.Put (" Stride => "); |
| 858 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Stride); |
| 859 | Debug.Put_Line (","); |
| 860 | Debug.Put (" Offset => "); |
| 861 | Debug.Put_Word32 (Configs (Pipe).Framebuffer.Offset); |
| 862 | Debug.Put_Line (","); |
| 863 | Debug.Put (" BPC => "); |
| 864 | Debug.Put_Int64 (Configs (Pipe).Framebuffer.BPC); |
| 865 | Debug.Put_Line ("),"); |
| 866 | Debug.Put_Line (" Mode =>"); |
| 867 | Debug.Put (" (Dotclock => "); |
| 868 | Debug.Put_Int64 (Configs (Pipe).Mode.Dotclock); |
| 869 | Debug.Put_Line (","); |
| 870 | Debug.Put (" H_Visible => "); |
| 871 | Debug.Put_Int16 (Configs (Pipe).Mode.H_Visible); |
| 872 | Debug.Put_Line (","); |
| 873 | Debug.Put (" H_Sync_Begin => "); |
| 874 | Debug.Put_Int16 (Configs (Pipe).Mode.H_Sync_Begin); |
| 875 | Debug.Put_Line (","); |
| 876 | Debug.Put (" H_Sync_End => "); |
| 877 | Debug.Put_Int16 (Configs (Pipe).Mode.H_Sync_End); |
| 878 | Debug.Put_Line (","); |
| 879 | Debug.Put (" H_Total => "); |
| 880 | Debug.Put_Int16 (Configs (Pipe).Mode.H_Total); |
| 881 | Debug.Put_Line (","); |
| 882 | Debug.Put (" V_Visible => "); |
| 883 | Debug.Put_Int16 (Configs (Pipe).Mode.V_Visible); |
| 884 | Debug.Put_Line (","); |
| 885 | Debug.Put (" V_Sync_Begin => "); |
| 886 | Debug.Put_Int16 (Configs (Pipe).Mode.V_Sync_Begin); |
| 887 | Debug.Put_Line (","); |
| 888 | Debug.Put (" V_Sync_End => "); |
| 889 | Debug.Put_Int16 (Configs (Pipe).Mode.V_Sync_End); |
| 890 | Debug.Put_Line (","); |
| 891 | Debug.Put (" V_Total => "); |
| 892 | Debug.Put_Int16 (Configs (Pipe).Mode.V_Total); |
| 893 | Debug.Put_Line (","); |
| 894 | Debug.Put_Line (" H_Sync_Active_High => " & |
| 895 | (if Configs (Pipe).Mode.H_Sync_Active_High |
| 896 | then "True," |
| 897 | else "False,")); |
| 898 | Debug.Put_Line (" V_Sync_Active_High => " & |
| 899 | (if Configs (Pipe).Mode.V_Sync_Active_High |
| 900 | then "True," |
| 901 | else "False,")); |
| 902 | Debug.Put (" BPC => "); |
| 903 | Debug.Put_Int64 (Configs (Pipe).Mode.BPC); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame^] | 904 | if Pipe /= Pipe_Index'Last then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 905 | Debug.Put_Line (")),"); |
| 906 | else |
| 907 | Debug.Put_Line (")));"); |
| 908 | end if; |
| 909 | end loop; |
| 910 | end Dump_Configs; |
| 911 | |
| 912 | end HW.GFX.GMA; |