| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| Nico Huber | 3d06de8 | 2018-05-29 01:35:04 +0200 | [diff] [blame] | 2 | -- Copyright (C) 2014-2018 secunet Security Networks AG |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 3 | -- Copyright (C) 2017 Nico Huber <nico.h@gmx.de> |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 4 | -- |
| 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 Huber | 125a29e | 2016-10-18 00:23:54 +0200 | [diff] [blame] | 7 | -- the Free Software Foundation; either version 2 of the License, or |
| 8 | -- (at your option) any later version. |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 9 | -- |
| 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 Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 16 | with HW.MMIO_Range; |
| 17 | pragma Elaborate_All (HW.MMIO_Range); |
| 18 | with HW.PCI.Dev; |
| 19 | pragma Elaborate_All (HW.PCI.Dev); |
| 20 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 21 | with HW.GFX.GMA.Config; |
| Nico Huber | 8c45bcf | 2016-11-20 17:30:57 +0100 | [diff] [blame] | 22 | with HW.GFX.GMA.Config_Helpers; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 23 | with HW.GFX.GMA.Registers; |
| Nico Huber | 312433c | 2019-09-28 03:15:48 +0200 | [diff] [blame] | 24 | with HW.GFX.GMA.PCode; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 25 | with HW.GFX.GMA.Power_And_Clocks; |
| 26 | with HW.GFX.GMA.Panel; |
| 27 | with HW.GFX.GMA.PLLs; |
| 28 | with HW.GFX.GMA.Port_Detect; |
| 29 | with HW.GFX.GMA.Connectors; |
| 30 | with HW.GFX.GMA.Connector_Info; |
| 31 | with HW.GFX.GMA.Pipe_Setup; |
| 32 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 33 | with HW.Debug; |
| 34 | with GNAT.Source_Info; |
| 35 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 36 | use type HW.Int32; |
| 37 | |
| 38 | package body HW.GFX.GMA |
| 39 | with Refined_State => |
| 40 | (State => |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 41 | (Dev.Address_State, |
| 42 | Registers.Address_State, |
| Nico Huber | 312433c | 2019-09-28 03:15:48 +0200 | [diff] [blame] | 43 | PCode.Mailbox_Ready, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 44 | PLLs.State, Panel.Panel_State, |
| Nico Huber | 1a712d3 | 2017-01-09 15:11:04 +0100 | [diff] [blame] | 45 | Cur_Configs, Allocated_PLLs, |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 46 | HPD_Delay, Wait_For_HPD, |
| 47 | Linear_FB_Base), |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 48 | Init_State => Initialized, |
| Nico Huber | 30e8408 | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 49 | Config_State => (Config.Variable), |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 50 | Device_State => |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 51 | (Dev.PCI_State, Registers.Register_State, Registers.GTT_State)) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 52 | is |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 53 | pragma Disable_Atomic_Synchronization; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 54 | |
| 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 Huber | 0d454cd | 2016-11-21 13:33:43 +0100 | [diff] [blame] | 63 | HDMI1 => "HDMI1 ", |
| 64 | HDMI2 => "HDMI2 ", |
| 65 | HDMI3 => "HDMI3 ", |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 66 | Analog => "Analog "); |
| 67 | |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 68 | package Dev is new HW.PCI.Dev (PCI.Address'(0, 2, 0)); |
| 69 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 70 | package Display_Controller renames Pipe_Setup; |
| 71 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 72 | type PLLs_Type is array (Pipe_Index) of PLLs.T; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 73 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 74 | type HPD_Type is array (Port_Type) of Boolean; |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 75 | type HPD_Delay_Type is array (Active_Port_Type) of Time.T; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 76 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 77 | Allocated_PLLs : PLLs_Type; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 78 | HPD_Delay : HPD_Delay_Type; |
| 79 | Wait_For_HPD : HPD_Type; |
| 80 | Initialized : Boolean := False; |
| 81 | |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 82 | Linear_FB_Base : Word64; |
| 83 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 84 | ---------------------------------------------------------------------------- |
| 85 | |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 86 | 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 Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 96 | procedure Enable_Output |
| 97 | (Pipe : in Pipe_Index; |
| 98 | Pipe_Cfg : in Pipe_Config; |
| 99 | Success : out Boolean) |
| Nico Huber | 8a5a3b5 | 2018-06-04 14:42:13 +0200 | [diff] [blame] | 100 | with |
| 101 | Pre => Pipe_Cfg.Port in Active_Port_Type |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 102 | is |
| 103 | Port_Cfg : Port_Config; |
| Nico Huber | f361ec8 | 2018-06-02 18:01:45 +0200 | [diff] [blame] | 104 | Scaler_Available : Boolean; |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 105 | begin |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 106 | pragma Debug (Debug.New_Line); |
| 107 | pragma Debug (Debug.Put_Line |
| 108 | ("Trying to enable port " & Port_Names (Pipe_Cfg.Port))); |
| 109 | |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 110 | Config_Helpers.Fill_Port_Config |
| 111 | (Port_Cfg, Pipe, Pipe_Cfg.Port, Pipe_Cfg.Mode, Success); |
| 112 | |
| 113 | if Success then |
| Nico Huber | f361ec8 | 2018-06-02 18:01:45 +0200 | [diff] [blame] | 114 | Display_Controller.Scaler_Available (Scaler_Available, Pipe); |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 115 | Success := Config_Helpers.Validate_Config |
| Nico Huber | f361ec8 | 2018-06-02 18:01:45 +0200 | [diff] [blame] | 116 | (Pipe_Cfg.Framebuffer, Port_Cfg.Mode, Pipe, Scaler_Available); |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 117 | end if; |
| 118 | |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 119 | if Success then |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 120 | Connector_Info.Preferred_Link_Setting (Port_Cfg, Success); |
| 121 | end if; |
| 122 | |
| 123 | -- loop over all possible DP-lane configurations |
| 124 | -- (non-DP ports use a single fake configuration) |
| 125 | while Success loop |
| 126 | pragma Loop_Invariant |
| 127 | (Pipe_Cfg.Port in Active_Port_Type and |
| 128 | Port_Cfg.Mode = Port_Cfg.Mode'Loop_Entry); |
| 129 | |
| 130 | PLLs.Alloc |
| 131 | (Port_Cfg => Port_Cfg, |
| 132 | PLL => Allocated_PLLs (Pipe), |
| 133 | Success => Success); |
| 134 | |
| 135 | if Success then |
| 136 | -- try each DP-lane configuration twice |
| 137 | for Try in 1 .. 2 loop |
| 138 | pragma Loop_Invariant |
| 139 | (Pipe_Cfg.Port in Active_Port_Type); |
| 140 | |
| Nico Huber | 4798c66 | 2017-01-11 12:44:48 +0100 | [diff] [blame] | 141 | -- Clear pending hot-plug events before every try |
| 142 | Port_Detect.Clear_Hotplug_Detect (Pipe_Cfg.Port); |
| 143 | |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 144 | Connectors.Pre_On |
| 145 | (Pipe => Pipe, |
| 146 | Port_Cfg => Port_Cfg, |
| 147 | PLL_Hint => PLLs.Register_Value (Allocated_PLLs (Pipe)), |
| 148 | Success => Success); |
| 149 | |
| 150 | if Success then |
| 151 | Display_Controller.On |
| 152 | (Pipe => Pipe, |
| 153 | Port_Cfg => Port_Cfg, |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 154 | Framebuffer => Pipe_Cfg.Framebuffer, |
| 155 | Cursor => Pipe_Cfg.Cursor); |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 156 | |
| 157 | Connectors.Post_On |
| Arthur Heymans | 60d0e5f | 2018-03-28 17:08:27 +0200 | [diff] [blame] | 158 | (Pipe => Pipe, |
| 159 | Port_Cfg => Port_Cfg, |
| Nico Huber | 43370ba | 2017-01-09 15:26:19 +0100 | [diff] [blame] | 160 | PLL_Hint => PLLs.Register_Value (Allocated_PLLs (Pipe)), |
| 161 | Success => Success); |
| 162 | |
| 163 | if not Success then |
| 164 | Display_Controller.Off (Pipe); |
| 165 | Connectors.Post_Off (Port_Cfg); |
| 166 | end if; |
| 167 | end if; |
| 168 | |
| 169 | exit when Success; |
| 170 | end loop; |
| 171 | exit when Success; -- connection established => stop loop |
| 172 | |
| 173 | -- connection failed |
| 174 | PLLs.Free (Allocated_PLLs (Pipe)); |
| 175 | end if; |
| 176 | |
| 177 | Connector_Info.Next_Link_Setting (Port_Cfg, Success); |
| 178 | end loop; |
| 179 | |
| 180 | if Success then |
| 181 | pragma Debug (Debug.Put_Line |
| 182 | ("Enabled port " & Port_Names (Pipe_Cfg.Port))); |
| 183 | else |
| 184 | Wait_For_HPD (Pipe_Cfg.Port) := True; |
| 185 | if Pipe_Cfg.Port = Internal then |
| 186 | Panel.Off; |
| 187 | end if; |
| 188 | end if; |
| 189 | end Enable_Output; |
| 190 | |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 191 | procedure Disable_Output (Pipe : Pipe_Index; Pipe_Cfg : Pipe_Config) |
| 192 | is |
| 193 | Port_Cfg : Port_Config; |
| 194 | Success : Boolean; |
| 195 | begin |
| 196 | Config_Helpers.Fill_Port_Config |
| 197 | (Port_Cfg, Pipe, Pipe_Cfg.Port, Pipe_Cfg.Mode, Success); |
| 198 | if Success then |
| 199 | pragma Debug (Debug.New_Line); |
| 200 | pragma Debug (Debug.Put_Line |
| 201 | ("Disabling port " & Port_Names (Pipe_Cfg.Port))); |
| 202 | pragma Debug (Debug.New_Line); |
| 203 | |
| 204 | Connectors.Pre_Off (Port_Cfg); |
| 205 | Display_Controller.Off (Pipe); |
| 206 | Connectors.Post_Off (Port_Cfg); |
| 207 | |
| 208 | PLLs.Free (Allocated_PLLs (Pipe)); |
| 209 | end if; |
| 210 | end Disable_Output; |
| 211 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 212 | procedure Update_Outputs (Configs : Pipe_Configs) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 213 | is |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 214 | procedure Check_HPD (Port : in Active_Port_Type; Detected : out Boolean) |
| 215 | is |
| 216 | HPD_Delay_Over : constant Boolean := Time.Timed_Out (HPD_Delay (Port)); |
| 217 | begin |
| 218 | if HPD_Delay_Over then |
| 219 | Port_Detect.Hotplug_Detect (Port, Detected); |
| 220 | HPD_Delay (Port) := Time.MS_From_Now (333); |
| 221 | else |
| 222 | Detected := False; |
| 223 | end if; |
| 224 | end Check_HPD; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 225 | |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 226 | Power_Changed : Boolean := False; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 227 | Old_Configs : Pipe_Configs; |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 228 | |
| 229 | -- Only called when we actually tried to change something |
| 230 | -- so we don't congest the log with unnecessary messages. |
| 231 | procedure Update_Power |
| 232 | is |
| 233 | begin |
| 234 | if not Power_Changed then |
| 235 | Power_And_Clocks.Power_Up (Old_Configs, Configs); |
| 236 | Power_Changed := True; |
| 237 | end if; |
| 238 | end Update_Power; |
| Nico Huber | 3d06de8 | 2018-05-29 01:35:04 +0200 | [diff] [blame] | 239 | |
| 240 | function Full_Update (Cur_Config, New_Config : Pipe_Config) return Boolean |
| 241 | is |
| 242 | begin |
| 243 | return |
| Nico Huber | 958c564 | 2018-06-02 16:59:31 +0200 | [diff] [blame] | 244 | Cur_Config.Port /= New_Config.Port |
| 245 | or else |
| 246 | Cur_Config.Mode /= New_Config.Mode |
| 247 | or else |
| Nico Huber | 3d06de8 | 2018-05-29 01:35:04 +0200 | [diff] [blame] | 248 | (Config.Use_PDW_For_EDP_Scaling and then |
| 249 | (Cur_Config.Port = Internal and |
| Nico Huber | 958c564 | 2018-06-02 16:59:31 +0200 | [diff] [blame] | 250 | Requires_Scaling (Cur_Config) /= Requires_Scaling (New_Config))) |
| 251 | or else |
| 252 | (Config.Has_GMCH_PFIT_CONTROL and then |
| 253 | (Requires_Scaling (Cur_Config) /= Requires_Scaling (New_Config) or |
| 254 | Scaling_Type (Cur_Config) /= Scaling_Type (New_Config))); |
| Nico Huber | 3d06de8 | 2018-05-29 01:35:04 +0200 | [diff] [blame] | 255 | end Full_Update; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 256 | begin |
| 257 | Old_Configs := Cur_Configs; |
| 258 | |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 259 | -- disable all pipes that changed or had a hot-plug event |
| 260 | for Pipe in Pipe_Index loop |
| 261 | declare |
| 262 | Unplug_Detected : Boolean; |
| 263 | Cur_Config : Pipe_Config renames Cur_Configs (Pipe); |
| 264 | New_Config : Pipe_Config renames Configs (Pipe); |
| 265 | begin |
| 266 | if Cur_Config.Port /= Disabled then |
| 267 | Check_HPD (Cur_Config.Port, Unplug_Detected); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 268 | |
| Nico Huber | 3d06de8 | 2018-05-29 01:35:04 +0200 | [diff] [blame] | 269 | if Full_Update (Cur_Config, New_Config) or Unplug_Detected then |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 270 | Disable_Output (Pipe, Cur_Config); |
| 271 | Cur_Config.Port := Disabled; |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 272 | Update_Power; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 273 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 274 | end if; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 275 | end; |
| 276 | end loop; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 277 | |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 278 | -- enable all pipes that changed and should be active |
| 279 | for Pipe in Pipe_Index loop |
| 280 | declare |
| 281 | Success : Boolean; |
| Nico Huber | f361ec8 | 2018-06-02 18:01:45 +0200 | [diff] [blame] | 282 | Scaler_Available : Boolean; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 283 | Cur_Config : Pipe_Config renames Cur_Configs (Pipe); |
| 284 | New_Config : Pipe_Config renames Configs (Pipe); |
| 285 | begin |
| Nico Huber | 3d06de8 | 2018-05-29 01:35:04 +0200 | [diff] [blame] | 286 | if New_Config.Port /= Disabled and |
| 287 | Full_Update (Cur_Config, New_Config) |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 288 | then |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 289 | if Wait_For_HPD (New_Config.Port) then |
| 290 | Check_HPD (New_Config.Port, Success); |
| 291 | Wait_For_HPD (New_Config.Port) := not Success; |
| 292 | else |
| 293 | Success := True; |
| Nico Huber | 8c45bcf | 2016-11-20 17:30:57 +0100 | [diff] [blame] | 294 | end if; |
| Nico Huber | c7a4fee | 2016-11-03 18:18:03 +0100 | [diff] [blame] | 295 | |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 296 | if Success then |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 297 | Update_Power; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 298 | Enable_Output (Pipe, New_Config, Success); |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 299 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 300 | |
| 301 | if Success then |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 302 | Cur_Config := New_Config; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 303 | end if; |
| Nico Huber | 3be61d4 | 2017-01-09 13:58:18 +0100 | [diff] [blame] | 304 | |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 305 | -- update framebuffer offset only |
| 306 | elsif New_Config.Port /= Disabled and |
| Nico Huber | f361ec8 | 2018-06-02 18:01:45 +0200 | [diff] [blame] | 307 | Cur_Config.Framebuffer /= New_Config.Framebuffer |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 308 | then |
| Nico Huber | f361ec8 | 2018-06-02 18:01:45 +0200 | [diff] [blame] | 309 | Display_Controller.Scaler_Available (Scaler_Available, Pipe); |
| 310 | if Config_Helpers.Validate_Config |
| 311 | (New_Config.Framebuffer, New_Config.Mode, |
| 312 | Pipe, Scaler_Available) |
| 313 | then |
| 314 | Display_Controller.Setup_FB |
| 315 | (Pipe, New_Config.Mode, New_Config.Framebuffer); |
| 316 | Display_Controller.Update_Cursor |
| 317 | (Pipe, New_Config.Framebuffer, New_Config.Cursor); |
| 318 | Cur_Config := New_Config; |
| 319 | end if; |
| Nico Huber | b56b9c5 | 2017-01-11 15:12:23 +0100 | [diff] [blame] | 320 | end if; |
| 321 | end; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 322 | end loop; |
| 323 | |
| Nico Huber | 564103f | 2017-01-11 15:33:07 +0100 | [diff] [blame] | 324 | if Power_Changed then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 325 | Power_And_Clocks.Power_Down (Old_Configs, Configs, Cur_Configs); |
| 326 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 327 | end Update_Outputs; |
| 328 | |
| 329 | ---------------------------------------------------------------------------- |
| 330 | |
| Nico Huber | 15ffc4f | 2018-01-11 14:44:43 +0100 | [diff] [blame] | 331 | procedure Update_Cursor (Pipe : Pipe_Index; Cursor : Cursor_Type) |
| 332 | is |
| 333 | begin |
| 334 | Cur_Configs (Pipe).Cursor := Cursor; |
| 335 | Display_Controller.Update_Cursor |
| 336 | (Pipe, Cur_Configs (Pipe).Framebuffer, Cur_Configs (Pipe).Cursor); |
| 337 | end Update_Cursor; |
| 338 | |
| 339 | procedure Place_Cursor |
| 340 | (Pipe : Pipe_Index; |
| 341 | X : Cursor_Pos; |
| 342 | Y : Cursor_Pos) |
| 343 | is |
| 344 | begin |
| 345 | Cur_Configs (Pipe).Cursor.Center_X := X; |
| 346 | Cur_Configs (Pipe).Cursor.Center_Y := Y; |
| 347 | Display_Controller.Place_Cursor |
| 348 | (Pipe, Cur_Configs (Pipe).Framebuffer, Cur_Configs (Pipe).Cursor); |
| 349 | end Place_Cursor; |
| 350 | |
| 351 | procedure Move_Cursor |
| 352 | (Pipe : Pipe_Index; |
| 353 | X : Cursor_Pos; |
| 354 | Y : Cursor_Pos) |
| 355 | is |
| 356 | function Cap_Add (A, B : Cursor_Pos) return Cursor_Pos is |
| 357 | (if A + B < 0 |
| 358 | then Int32'Max (Cursor_Pos'First, A + B) |
| 359 | else Int32'Min (Cursor_Pos'Last, A + B)); |
| 360 | begin |
| 361 | Place_Cursor |
| 362 | (Pipe => Pipe, |
| 363 | X => Cap_Add (Cur_Configs (Pipe).Cursor.Center_X, X), |
| 364 | Y => Cap_Add (Cur_Configs (Pipe).Cursor.Center_Y, Y)); |
| 365 | end Move_Cursor; |
| 366 | |
| 367 | ---------------------------------------------------------------------------- |
| 368 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 369 | procedure Initialize |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 370 | (Write_Delay : in Word64 := 0; |
| Nico Huber | 793a8d4 | 2016-11-21 18:57:03 +0100 | [diff] [blame] | 371 | Clean_State : in Boolean := False; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 372 | Success : out Boolean) |
| 373 | with |
| 374 | Refined_Global => |
| Nico Huber | 27088aa | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 375 | (Input => (Time.State), |
| 376 | In_Out => (Dev.PCI_State, Registers.Register_State, Port_IO.State), |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 377 | Output => |
| Nico Huber | 27088aa | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 378 | (Config.Variable, |
| 379 | Dev.Address_State, |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 380 | Registers.Address_State, |
| Nico Huber | 312433c | 2019-09-28 03:15:48 +0200 | [diff] [blame] | 381 | PCode.Mailbox_Ready, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 382 | PLLs.State, Panel.Panel_State, |
| Nico Huber | 1a712d3 | 2017-01-09 15:11:04 +0100 | [diff] [blame] | 383 | Cur_Configs, Allocated_PLLs, |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 384 | HPD_Delay, Wait_For_HPD, |
| 385 | Linear_FB_Base, Initialized)) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 386 | is |
| 387 | use type HW.Word64; |
| 388 | |
| Nico Huber | 0b2329a | 2018-06-09 21:14:27 +0200 | [diff] [blame] | 389 | function MMIO_GTT_Offset return Natural is |
| 390 | (if Config.Has_64bit_GTT |
| 391 | then Registers.MMIO_GTT_64_Offset |
| 392 | else Registers.MMIO_GTT_32_Offset); |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 393 | PCI_MMIO_Base, PCI_GTT_Base : Word64; |
| 394 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 395 | Now : constant Time.T := Time.Now; |
| 396 | |
| 397 | procedure Check_Platform (Success : out Boolean) |
| 398 | is |
| 399 | Audio_VID_DID : Word32; |
| 400 | begin |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 401 | case Config.Gen is |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 402 | when G45 => |
| 403 | Registers.Read (Registers.G4X_AUD_VID_DID, Audio_VID_DID); |
| Nico Huber | 6621a14 | 2018-06-07 23:56:54 +0200 | [diff] [blame] | 404 | when Ironlake => |
| 405 | Registers.Read (Registers.PCH_AUD_VID_DID, Audio_VID_DID); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 406 | when Haswell .. Skylake => |
| 407 | Registers.Read (Registers.AUD_VID_DID, Audio_VID_DID); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 408 | end case; |
| 409 | Success := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 410 | ((Config.Gen_Broxton and Audio_VID_DID = 16#8086_280a#) or |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame] | 411 | (Config.CPU_Kabylake and Audio_VID_DID = 16#8086_280b#) or |
| 412 | (Config.CPU_Skylake and Audio_VID_DID = 16#8086_2809#) or |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 413 | (Config.CPU_Broadwell and Audio_VID_DID = 16#8086_2808#) or |
| 414 | (Config.CPU_Haswell and Audio_VID_DID = 16#8086_2807#) or |
| 415 | ((Config.CPU_Ivybridge or |
| 416 | Config.CPU_Sandybridge) and (Audio_VID_DID = 16#8086_2806# or |
| 417 | Audio_VID_DID = 16#8086_2805#)) or |
| 418 | (Config.CPU_Ironlake and Audio_VID_DID = 16#0000_0000#) or |
| 419 | (Config.Gen_G45 and (Audio_VID_DID = 16#8086_2801# or |
| 420 | Audio_VID_DID = 16#8086_2802# or |
| 421 | Audio_VID_DID = 16#8086_2803#))); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 422 | end Check_Platform; |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 423 | |
| 424 | procedure Check_Platform_PCI (Success : out Boolean) |
| 425 | is |
| 426 | use type HW.Word16; |
| 427 | Vendor, Device : Word16; |
| 428 | begin |
| 429 | Dev.Read16 (Vendor, PCI.Vendor_Id); |
| 430 | Dev.Read16 (Device, PCI.Device_Id); |
| 431 | |
| Nico Huber | 6a996dc | 2018-06-17 16:30:33 +0200 | [diff] [blame] | 432 | Config.Detect_CPU (Device); |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 433 | Success := Vendor = 16#8086# and Config.Compatible_GPU (Device); |
| 434 | end Check_Platform_PCI; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 435 | begin |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 436 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 437 | |
| 438 | pragma Debug (Debug.Set_Register_Write_Delay (Write_Delay)); |
| 439 | |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 440 | Linear_FB_Base := 0; |
| Nico Huber | 312433c | 2019-09-28 03:15:48 +0200 | [diff] [blame] | 441 | PCode.Mailbox_Ready := False; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 442 | Wait_For_HPD := HPD_Type'(others => False); |
| 443 | HPD_Delay := HPD_Delay_Type'(others => Now); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 444 | Allocated_PLLs := (others => PLLs.Invalid); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 445 | Cur_Configs := Pipe_Configs' |
| 446 | (others => Pipe_Config' |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 447 | (Port => Disabled, |
| 448 | Framebuffer => HW.GFX.Default_FB, |
| Nico Huber | a02b2c6 | 2018-01-09 15:58:34 +0100 | [diff] [blame] | 449 | Cursor => Default_Cursor, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 450 | Mode => HW.GFX.Invalid_Mode)); |
| Nico Huber | 27088aa | 2018-06-10 13:28:05 +0200 | [diff] [blame] | 451 | Config.Variable := Config.Initial_Settings; |
| Nico Huber | 6a996dc | 2018-06-17 16:30:33 +0200 | [diff] [blame] | 452 | Registers.Set_Register_Base (Config.Default_MMIO_Base); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 453 | PLLs.Initialize; |
| 454 | |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 455 | Dev.Initialize (Success); |
| 456 | |
| 457 | if Success then |
| Nico Huber | 6a996dc | 2018-06-17 16:30:33 +0200 | [diff] [blame] | 458 | Check_Platform_PCI (Success); |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 459 | if Success then |
| Nico Huber | 6a996dc | 2018-06-17 16:30:33 +0200 | [diff] [blame] | 460 | Dev.Map (PCI_MMIO_Base, PCI.Res0, Length => MMIO_GTT_Offset); |
| 461 | Dev.Map (PCI_GTT_Base, PCI.Res0, Offset => MMIO_GTT_Offset); |
| 462 | if PCI_MMIO_Base /= 0 and PCI_GTT_Base /= 0 then |
| 463 | Registers.Set_Register_Base (PCI_MMIO_Base, PCI_GTT_Base); |
| 464 | else |
| 465 | pragma Debug (Debug.Put_Line |
| 466 | ("ERROR: Couldn't map resoure0.")); |
| 467 | Success := Config.Default_MMIO_Base_Set; |
| 468 | end if; |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 469 | end if; |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 470 | else |
| 471 | pragma Debug (Debug.Put_Line |
| 472 | ("WARNING: Couldn't initialize PCI dev.")); |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 473 | Success := Config.Default_MMIO_Base_Set; |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 474 | |
| Nico Huber | e7ac6eb | 2017-09-04 23:54:13 +0200 | [diff] [blame] | 475 | if Success then |
| 476 | Check_Platform (Success); |
| 477 | end if; |
| Nico Huber | 2b6f699 | 2017-07-09 18:11:34 +0200 | [diff] [blame] | 478 | end if; |
| 479 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 480 | if not Success then |
| 481 | pragma Debug (Debug.Put_Line ("ERROR: Incompatible CPU or PCH.")); |
| 482 | |
| 483 | Panel.Static_Init; -- for flow analysis |
| 484 | |
| 485 | Initialized := False; |
| 486 | return; |
| 487 | end if; |
| 488 | |
| 489 | Panel.Setup_PP_Sequencer; |
| 490 | Port_Detect.Initialize; |
| Nico Huber | 0923b79 | 2017-06-09 15:28:41 +0200 | [diff] [blame] | 491 | Connectors.Initialize; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 492 | |
| Nico Huber | 793a8d4 | 2016-11-21 18:57:03 +0100 | [diff] [blame] | 493 | if Clean_State then |
| 494 | Power_And_Clocks.Pre_All_Off; |
| 495 | Connectors.Pre_All_Off; |
| 496 | Display_Controller.All_Off; |
| 497 | Connectors.Post_All_Off; |
| 498 | PLLs.All_Off; |
| 499 | Power_And_Clocks.Post_All_Off; |
| Nico Huber | 17d64b6 | 2017-07-15 20:51:25 +0200 | [diff] [blame] | 500 | Registers.Clear_Fences; |
| Nico Huber | 33912aa | 2016-12-06 20:36:23 +0100 | [diff] [blame] | 501 | else |
| 502 | -- According to PRMs, VGA plane is the only thing |
| Nico Huber | 3a0e2a0 | 2017-07-19 14:41:46 +0200 | [diff] [blame] | 503 | -- that's enabled by default after reset... |
| Nico Huber | 33912aa | 2016-12-06 20:36:23 +0100 | [diff] [blame] | 504 | Display_Controller.Legacy_VGA_Off; |
| Nico Huber | 3a0e2a0 | 2017-07-19 14:41:46 +0200 | [diff] [blame] | 505 | -- ... along with some DDI port bits since Skylake. |
| 506 | Connectors.Post_Reset_Off; |
| Nico Huber | 793a8d4 | 2016-11-21 18:57:03 +0100 | [diff] [blame] | 507 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 508 | |
| 509 | -------------------- Now restart from a clean state --------------------- |
| 510 | Power_And_Clocks.Initialize; |
| 511 | |
| Nico Huber | 1c3b928 | 2017-02-09 13:57:04 +0100 | [diff] [blame] | 512 | if Config.Has_PCH then |
| 513 | Registers.Unset_And_Set_Mask |
| 514 | (Register => Registers.PCH_RAWCLK_FREQ, |
| 515 | Mask_Unset => PCH_RAWCLK_FREQ_MASK, |
| 516 | Mask_Set => PCH_RAWCLK_FREQ (Config.Default_RawClk_Freq)); |
| 517 | end if; |
| Nico Huber | f54d096 | 2016-10-20 14:17:18 +0200 | [diff] [blame] | 518 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 519 | Initialized := True; |
| 520 | |
| 521 | end Initialize; |
| 522 | |
| 523 | function Is_Initialized return Boolean |
| 524 | with |
| 525 | Refined_Post => Is_Initialized'Result = Initialized |
| 526 | is |
| 527 | begin |
| 528 | return Initialized; |
| 529 | end Is_Initialized; |
| 530 | |
| 531 | ---------------------------------------------------------------------------- |
| 532 | |
| Nico Huber | cf88f3d | 2018-06-05 13:27:34 +0200 | [diff] [blame] | 533 | pragma Warnings |
| 534 | (GNATprove, Off, """Registers.Register_State"" * is not modified*", |
| Nico Huber | adfe11f | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 535 | Reason => "Power_Up_VGA is only effective in certain configurations."); |
| Nico Huber | 42fb2d0 | 2017-09-01 17:01:51 +0200 | [diff] [blame] | 536 | procedure Power_Up_VGA |
| Nico Huber | cf88f3d | 2018-06-05 13:27:34 +0200 | [diff] [blame] | 537 | with |
| 538 | Refined_Global => |
| Nico Huber | adfe11f | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 539 | (Input => (Cur_Configs, Config.Variable, Time.State), |
| Nico Huber | cf88f3d | 2018-06-05 13:27:34 +0200 | [diff] [blame] | 540 | In_Out => (Registers.Register_State), |
| 541 | Proof_In => (Initialized)) |
| Nico Huber | 42fb2d0 | 2017-09-01 17:01:51 +0200 | [diff] [blame] | 542 | is |
| 543 | Fake_Config : constant Pipe_Configs := |
| 544 | (Primary => |
| 545 | (Port => Analog, |
| 546 | Framebuffer => HW.GFX.Default_FB, |
| Nico Huber | a02b2c6 | 2018-01-09 15:58:34 +0100 | [diff] [blame] | 547 | Cursor => Default_Cursor, |
| Nico Huber | 42fb2d0 | 2017-09-01 17:01:51 +0200 | [diff] [blame] | 548 | Mode => HW.GFX.Invalid_Mode), |
| 549 | others => |
| 550 | (Port => Disabled, |
| 551 | Framebuffer => HW.GFX.Default_FB, |
| Nico Huber | a02b2c6 | 2018-01-09 15:58:34 +0100 | [diff] [blame] | 552 | Cursor => Default_Cursor, |
| Nico Huber | 42fb2d0 | 2017-09-01 17:01:51 +0200 | [diff] [blame] | 553 | Mode => HW.GFX.Invalid_Mode)); |
| 554 | begin |
| 555 | Power_And_Clocks.Power_Up (Cur_Configs, Fake_Config); |
| 556 | end Power_Up_VGA; |
| Nico Huber | cf88f3d | 2018-06-05 13:27:34 +0200 | [diff] [blame] | 557 | pragma Warnings |
| 558 | (GNATprove, Off, "no check message justified*", Reason => "see below"); |
| 559 | pragma Annotate |
| 560 | (GNATprove, Intentional, "unused global", |
| Nico Huber | adfe11f | 2018-06-10 14:59:04 +0200 | [diff] [blame] | 561 | "Power_Up_VGA is only effective in certain configurations."); |
| Nico Huber | cf88f3d | 2018-06-05 13:27:34 +0200 | [diff] [blame] | 562 | pragma Warnings (GNATprove, On, "no check message justified*"); |
| 563 | pragma Warnings |
| 564 | (GNATprove, On, """Registers.Register_State"" * is not modified*"); |
| Nico Huber | 42fb2d0 | 2017-09-01 17:01:51 +0200 | [diff] [blame] | 565 | |
| 566 | ---------------------------------------------------------------------------- |
| 567 | |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 568 | function FB_First_Page (FB : Framebuffer_Type) return Natural is |
| Nico Huber | 34be654 | 2017-12-13 09:26:24 +0100 | [diff] [blame] | 569 | (Natural (Phys_Offset (FB) / GTT_Page_Size)); |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 570 | function FB_Pages (FB : Framebuffer_Type) return Natural is |
| 571 | (Natural (Div_Round_Up (FB_Size (FB), GTT_Page_Size))); |
| 572 | function FB_Last_Page (FB : Framebuffer_Type) return Natural is |
| 573 | (FB_First_Page (FB) + FB_Pages (FB) - 1); |
| 574 | |
| Nico Huber | 34be654 | 2017-12-13 09:26:24 +0100 | [diff] [blame] | 575 | -- Check basics and that it fits in GTT. For 90 degree rotations, |
| 576 | -- the Offset should be above GTT_Rotation_Offset. The latter will |
| 577 | -- be subtracted for the aperture mapping. |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 578 | function Valid_FB (FB : Framebuffer_Type) return Boolean is |
| Nico Huber | 34be654 | 2017-12-13 09:26:24 +0100 | [diff] [blame] | 579 | (Valid_Stride (FB) and |
| 580 | FB_First_Page (FB) in GTT_Range and |
| 581 | FB_Last_Page (FB) in GTT_Range and |
| 582 | (not Rotation_90 (FB) or |
| 583 | (FB_Last_Page (FB) + GTT_Rotation_Offset in GTT_Range and |
| 584 | FB.Offset >= Word32 (GTT_Rotation_Offset) * GTT_Page_Size))); |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 585 | |
| 586 | -- Also check that we don't overflow the GTT's 39-bit space |
| 587 | -- (always true with a 32-bit base) |
| 588 | function Valid_Phys_FB (FB : Framebuffer_Type; Phys_Base : Word32) |
| 589 | return Boolean is |
| 590 | (Valid_FB (FB) and |
| Nico Huber | 34be654 | 2017-12-13 09:26:24 +0100 | [diff] [blame] | 591 | Int64 (Phys_Base) + Int64 (Phys_Offset (FB)) + Int64 (FB_Size (FB)) <= |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 592 | Int64 (GTT_Address_Type'Last)) |
| 593 | with |
| 594 | Ghost; |
| 595 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 596 | procedure Write_GTT |
| 597 | (GTT_Page : GTT_Range; |
| 598 | Device_Address : GTT_Address_Type; |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 599 | Valid : Boolean) |
| 600 | is |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 601 | begin |
| 602 | Registers.Write_GTT (GTT_Page, Device_Address, Valid); |
| 603 | end Write_GTT; |
| 604 | |
| Nico Huber | ceda17d | 2018-06-09 22:00:29 +0200 | [diff] [blame] | 605 | procedure Read_GTT |
| 606 | (Device_Address : out GTT_Address_Type; |
| 607 | Valid : out Boolean; |
| 608 | GTT_Page : in GTT_Range) |
| 609 | is |
| 610 | begin |
| 611 | Registers.Read_GTT (Device_Address, Valid, GTT_Page); |
| 612 | end Read_GTT; |
| 613 | |
| Nico Huber | 194e57e | 2017-07-15 21:15:46 +0200 | [diff] [blame] | 614 | procedure Setup_Default_GTT (FB : Framebuffer_Type; Phys_Base : Word32) |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 615 | with |
| 616 | Pre => Is_Initialized and Valid_Phys_FB (FB, Phys_Base) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 617 | is |
| Nico Huber | 194e57e | 2017-07-15 21:15:46 +0200 | [diff] [blame] | 618 | Phys_Addr : GTT_Address_Type := |
| Nico Huber | 34be654 | 2017-12-13 09:26:24 +0100 | [diff] [blame] | 619 | GTT_Address_Type (Phys_Base) + GTT_Address_Type (Phys_Offset (FB)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 620 | begin |
| Nico Huber | 194e57e | 2017-07-15 21:15:46 +0200 | [diff] [blame] | 621 | for Idx in FB_First_Page (FB) .. FB_Last_Page (FB) loop |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 622 | Registers.Write_GTT |
| 623 | (GTT_Page => Idx, |
| 624 | Device_Address => Phys_Addr, |
| 625 | Valid => True); |
| Nico Huber | 194e57e | 2017-07-15 21:15:46 +0200 | [diff] [blame] | 626 | Phys_Addr := Phys_Addr + GTT_Page_Size; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 627 | end loop; |
| Nico Huber | 9b47941 | 2017-08-27 11:55:56 +0200 | [diff] [blame] | 628 | |
| 629 | if Rotation_90 (FB) and FB.Tiling = Y_Tiled and FB.V_Stride >= 32 then |
| 630 | declare |
| 631 | V_Pages : constant Natural := Natural (FB.V_Stride) / 32; |
| 632 | Bytes_Per_Row : constant GTT_Address_Type := |
| 633 | GTT_Address_Type (Pixel_To_Bytes (32 * FB.Stride, FB)); |
| 634 | begin |
| 635 | Phys_Addr := GTT_Address_Type (Phys_Base) + |
| Nico Huber | 34be654 | 2017-12-13 09:26:24 +0100 | [diff] [blame] | 636 | GTT_Address_Type (Phys_Offset (FB)) + |
| Nico Huber | 9b47941 | 2017-08-27 11:55:56 +0200 | [diff] [blame] | 637 | GTT_Address_Type (FB_Size (FB)); |
| 638 | for Page in FB_First_Page (FB) .. FB_Last_Page (FB) loop |
| 639 | Phys_Addr := Phys_Addr - Bytes_Per_Row; |
| 640 | Registers.Write_GTT |
| 641 | (GTT_Page => GTT_Rotation_Offset + Page, |
| 642 | Device_Address => Phys_Addr, |
| 643 | Valid => True); |
| 644 | |
| 645 | if (Page - FB_First_Page (FB) + 1) mod V_Pages = 0 then |
| 646 | Phys_Addr := Phys_Addr + GTT_Page_Size + |
| 647 | GTT_Address_Type (V_Pages) * Bytes_Per_Row; |
| 648 | end if; |
| 649 | end loop; |
| 650 | end; |
| 651 | end if; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 652 | end Setup_Default_GTT; |
| 653 | |
| 654 | ---------------------------------------------------------------------------- |
| 655 | |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 656 | use type HW.Word16; |
| 657 | subtype Stolen_Size_Range is Int64 range 0 .. 2 ** 33; |
| 658 | |
| 659 | function GGMS_Gen4 (GGC : Word16) return Natural is |
| 660 | (Natural (Shift_Right (GGC, 8) and 16#07#)); |
| 661 | function GTT_Size_Gen4 (GGC : Word16) return Natural is |
| 662 | (if GGMS_Gen4 (GGC) in 1 .. 3 then |
| 663 | (GGMS_Gen4 (GGC) + 1) * 2 ** 19 else 0); |
| 664 | |
| 665 | function GMS_Gen4 (GGC : Word16) return Natural is |
| 666 | (Natural (Shift_Right (GGC, 4) and 16#0f#)); |
| 667 | Valid_Stolen_Size_Gen4 : constant |
| 668 | array (Natural range 1 .. 13) of Stolen_Size_Range := |
| 669 | (1, 4, 8, 16, 32, 48, 64, 128, 256, 96, 160, 224, 352); |
| 670 | function Stolen_Size_Gen4 (GGC : Word16) return Stolen_Size_Range is |
| 671 | (if GMS_Gen4 (GGC) in Valid_Stolen_Size_Gen4'Range then |
| Arthur Heymans | 5fd9a31 | 2017-09-12 12:45:18 +0200 | [diff] [blame] | 672 | Valid_Stolen_Size_Gen4 (GMS_Gen4 (GGC)) * 2 ** 20 else 0); |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 673 | |
| 674 | function GTT_Size_Gen6 (GGC : Word16) return Natural is |
| 675 | (Natural (Shift_Right (GGC, 8) and 16#03#) * 2 ** 20); |
| 676 | |
| 677 | function Stolen_Size_Gen6 (GGC : Word16) return Stolen_Size_Range is |
| 678 | (Stolen_Size_Range (Shift_Right (GGC, 3) and 16#1f#) * 32 * 2 ** 20); |
| 679 | |
| 680 | function GTT_Size_Gen8 (GGC : Word16) return Natural is |
| 681 | (Natural (Shift_Right (GGC, 6) and 16#03#) * 2 ** 20); |
| 682 | |
| 683 | function GMS_Gen8 (GGC : Word16) return Stolen_Size_Range is |
| 684 | (Stolen_Size_Range (Shift_Right (GGC, 8) and 16#ff#)); |
| 685 | function Stolen_Size_Gen8 (GGC : Word16) return Stolen_Size_Range is |
| 686 | (GMS_Gen8 (GGC) * 32 * 2 ** 20); |
| 687 | |
| 688 | function Stolen_Size_Gen9 (GGC : Word16) return Stolen_Size_Range is |
| 689 | (if GMS_Gen8 (GGC) < 16#f0# then |
| 690 | Stolen_Size_Gen8 (GGC) |
| 691 | else |
| 692 | (GMS_Gen8 (GGC) - 16#f0# + 1) * 4 * 2 ** 20); |
| 693 | |
| 694 | procedure Decode_Stolen |
| 695 | (GTT_Size : out Natural; |
| 696 | Stolen_Size : out Stolen_Size_Range) |
| 697 | with |
| 698 | Pre => Is_Initialized |
| 699 | is |
| Nico Huber | 63ec836 | 2018-06-09 17:42:19 +0200 | [diff] [blame] | 700 | GGC_Reg : constant PCI.Index := |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 701 | (if Config.Gen_G45 or Config.CPU_Ironlake then 16#52# else 16#50#); |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 702 | GGC : Word16; |
| 703 | begin |
| 704 | Dev.Read16 (GGC, GGC_Reg); |
| Nico Huber | 998ee2b | 2018-06-12 23:02:17 +0200 | [diff] [blame] | 705 | if Config.Gen_G45 or Config.CPU_Ironlake then |
| 706 | GTT_Size := GTT_Size_Gen4 (GGC); |
| 707 | Stolen_Size := Stolen_Size_Gen4 (GGC); |
| 708 | elsif Config.CPU_Sandybridge or Config.CPU_Ivybridge or Config.CPU_Haswell |
| 709 | then |
| 710 | GTT_Size := GTT_Size_Gen6 (GGC); |
| 711 | Stolen_Size := Stolen_Size_Gen6 (GGC); |
| 712 | elsif Config.CPU_Broadwell then |
| 713 | GTT_Size := GTT_Size_Gen8 (GGC); |
| 714 | Stolen_Size := Stolen_Size_Gen8 (GGC); |
| 715 | else |
| 716 | GTT_Size := GTT_Size_Gen8 (GGC); |
| 717 | Stolen_Size := Stolen_Size_Gen9 (GGC); |
| 718 | end if; |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 719 | end Decode_Stolen; |
| 720 | |
| 721 | -- Additional runtime validation that FB fits stolen memory and aperture. |
| 722 | procedure Validate_FB (FB : Framebuffer_Type; Valid : out Boolean) |
| 723 | with |
| 724 | Pre => Is_Initialized, |
| 725 | Post => (if Valid then Valid_FB (FB)) |
| 726 | is |
| 727 | GTT_Size, Aperture_Size : Natural; |
| 728 | Stolen_Size : Stolen_Size_Range; |
| 729 | begin |
| 730 | Valid := Valid_FB (FB); |
| 731 | |
| 732 | if Valid then |
| 733 | Decode_Stolen (GTT_Size, Stolen_Size); |
| 734 | Dev.Resource_Size (Aperture_Size, PCI.Res2); |
| 735 | Valid := |
| 736 | FB_Last_Page (FB) < GTT_Size / Config.GTT_PTE_Size and |
| 737 | FB_Last_Page (FB) < Natural (Stolen_Size / GTT_Page_Size) and |
| 738 | FB_Last_Page (FB) < Aperture_Size / GTT_Page_Size; |
| Nico Huber | 34be654 | 2017-12-13 09:26:24 +0100 | [diff] [blame] | 739 | pragma Debug (not Valid, Debug.Put_Line |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 740 | ("Stolen memory too small to hold framebuffer.")); |
| 741 | end if; |
| 742 | end Validate_FB; |
| 743 | |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 744 | procedure Setup_Default_FB |
| 745 | (FB : in Framebuffer_Type; |
| 746 | Clear : in Boolean := True; |
| 747 | Success : out Boolean) |
| 748 | is |
| 749 | GMA_Phys_Base : constant PCI.Index := 16#5c#; |
| 750 | GMA_Phys_Base_Mask : constant := 16#fff0_0000#; |
| 751 | |
| 752 | Phys_Base : Word32; |
| 753 | begin |
| Nico Huber | eedde88 | 2017-07-16 02:54:39 +0200 | [diff] [blame] | 754 | Validate_FB (FB, Success); |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 755 | |
| 756 | if Success then |
| 757 | Dev.Read32 (Phys_Base, GMA_Phys_Base); |
| 758 | Phys_Base := Phys_Base and GMA_Phys_Base_Mask; |
| 759 | Success := Phys_Base /= GMA_Phys_Base_Mask and Phys_Base /= 0; |
| 760 | pragma Debug (not Success, Debug.Put_Line |
| 761 | ("Failed to read stolen memory base.")); |
| Nico Huber | 0164b02 | 2017-08-24 15:12:51 +0200 | [diff] [blame] | 762 | |
| 763 | if Success then |
| 764 | if FB.Tiling in XY_Tiling then |
| 765 | Registers.Add_Fence |
| 766 | (First_Page => FB_First_Page (FB), |
| 767 | Last_Page => FB_Last_Page (FB), |
| 768 | Tiling => FB.Tiling, |
| 769 | Pitch => FB_Pitch (FB.Stride, FB), |
| 770 | Success => Success); |
| 771 | end if; |
| 772 | pragma Debug (not Success, Debug.Put_Line |
| 773 | ("Tiled framebuffer but no fence regs available.")); |
| 774 | end if; |
| 775 | |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 776 | if Success then |
| 777 | Setup_Default_GTT (FB, Phys_Base); |
| 778 | end if; |
| 779 | end if; |
| 780 | |
| 781 | if Success and then Clear then |
| 782 | declare |
| 783 | use type HW.Word64; |
| 784 | Linear_FB : Word64; |
| 785 | begin |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 786 | Map_Linear_FB (Linear_FB, FB); |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 787 | if Linear_FB /= 0 then |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 788 | Framebuffer_Filler.Fill (Linear_FB, FB); |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 789 | end if; |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 790 | end; |
| 791 | end if; |
| 792 | end Setup_Default_FB; |
| 793 | |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 794 | procedure Map_Linear_FB (Linear_FB : out Word64; FB : in Framebuffer_Type) |
| 795 | is |
| 796 | use type HW.Word64; |
| 797 | |
| 798 | Valid : Boolean; |
| 799 | begin |
| 800 | Linear_FB := 0; |
| 801 | |
| 802 | if Linear_FB_Base = 0 then |
| 803 | Dev.Map (Linear_FB_Base, PCI.Res2); |
| 804 | pragma Debug |
| 805 | (Linear_FB_Base = 0, Debug.Put_Line ("Failed to map resource2.")); |
| 806 | end if; |
| 807 | |
| 808 | if Linear_FB_Base /= 0 then |
| 809 | Validate_FB (FB, Valid); |
| 810 | if Valid then |
| Nico Huber | 34be654 | 2017-12-13 09:26:24 +0100 | [diff] [blame] | 811 | Linear_FB := Linear_FB_Base + Word64 (Phys_Offset (FB)); |
| Nico Huber | c3f66f6 | 2017-07-16 21:39:54 +0200 | [diff] [blame] | 812 | end if; |
| 813 | end if; |
| 814 | end Map_Linear_FB; |
| 815 | |
| Nico Huber | 5374c3a | 2017-07-15 21:48:06 +0200 | [diff] [blame] | 816 | ---------------------------------------------------------------------------- |
| 817 | |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 818 | procedure Dump_Configs (Configs : Pipe_Configs) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 819 | is |
| 820 | subtype Pipe_Name is String (1 .. 9); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 821 | type Pipe_Name_Array is array (Pipe_Index) of Pipe_Name; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 822 | Pipe_Names : constant Pipe_Name_Array := |
| 823 | (Primary => "Primary ", |
| 824 | Secondary => "Secondary", |
| 825 | Tertiary => "Tertiary "); |
| Nico Huber | 5ef4d60 | 2017-12-13 13:56:47 +0100 | [diff] [blame] | 826 | |
| 827 | subtype Tiling_Name is String (1 .. 7); |
| 828 | type Tiling_Name_Array is array (Tiling_Type) of Tiling_Name; |
| 829 | Tilings : constant Tiling_Name_Array := |
| 830 | (Linear => "Linear ", |
| 831 | X_Tiled => "X_Tiled", |
| 832 | Y_Tiled => "Y_Tiled"); |
| 833 | |
| 834 | subtype Rotation_Name is String (1 .. 11); |
| 835 | type Rotation_Name_Array is array (Rotation_Type) of Rotation_Name; |
| 836 | Rotations : constant Rotation_Name_Array := |
| 837 | (No_Rotation => "No_Rotation", |
| 838 | Rotated_90 => "Rotated_90 ", |
| 839 | Rotated_180 => "Rotated_180", |
| 840 | Rotated_270 => "Rotated_270"); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 841 | begin |
| 842 | Debug.New_Line; |
| Paul Menzel | b83107c | 2017-05-04 09:02:33 +0200 | [diff] [blame] | 843 | Debug.Put_Line ("CONFIG =>"); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 844 | for Pipe in Pipe_Index loop |
| 845 | if Pipe = Pipe_Index'First then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 846 | Debug.Put (" ("); |
| 847 | else |
| 848 | Debug.Put (" "); |
| 849 | end if; |
| 850 | Debug.Put_Line (Pipe_Names (Pipe) & " =>"); |
| 851 | Debug.Put_Line |
| 852 | (" (Port => " & Port_Names (Configs (Pipe).Port) & ","); |
| 853 | Debug.Put_Line (" Framebuffer =>"); |
| Nico Huber | 5ef4d60 | 2017-12-13 13:56:47 +0100 | [diff] [blame] | 854 | Debug.Put (" (Width => "); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 855 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Width); |
| 856 | Debug.Put_Line (","); |
| Nico Huber | 5ef4d60 | 2017-12-13 13:56:47 +0100 | [diff] [blame] | 857 | Debug.Put (" Height => "); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 858 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Height); |
| 859 | Debug.Put_Line (","); |
| Nico Huber | 5ef4d60 | 2017-12-13 13:56:47 +0100 | [diff] [blame] | 860 | Debug.Put (" Start_X => "); |
| 861 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Start_X); |
| 862 | Debug.Put_Line (","); |
| 863 | Debug.Put (" Start_Y => "); |
| 864 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Start_Y); |
| 865 | Debug.Put_Line (","); |
| 866 | Debug.Put (" Stride => "); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 867 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.Stride); |
| 868 | Debug.Put_Line (","); |
| Nico Huber | 5ef4d60 | 2017-12-13 13:56:47 +0100 | [diff] [blame] | 869 | Debug.Put (" V_Stride => "); |
| 870 | Debug.Put_Int32 (Configs (Pipe).Framebuffer.V_Stride); |
| 871 | Debug.Put_Line (","); |
| 872 | Debug.Put (" Tiling => "); |
| 873 | Debug.Put_Line (Tilings (Configs (Pipe).Framebuffer.Tiling) & ","); |
| 874 | Debug.Put (" Rotation => "); |
| 875 | Debug.Put_Line (Rotations (Configs (Pipe).Framebuffer.Rotation) & ","); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 876 | Debug.Put (" Offset => "); |
| 877 | Debug.Put_Word32 (Configs (Pipe).Framebuffer.Offset); |
| 878 | Debug.Put_Line (","); |
| 879 | Debug.Put (" BPC => "); |
| 880 | Debug.Put_Int64 (Configs (Pipe).Framebuffer.BPC); |
| 881 | Debug.Put_Line ("),"); |
| 882 | Debug.Put_Line (" Mode =>"); |
| 883 | Debug.Put (" (Dotclock => "); |
| 884 | Debug.Put_Int64 (Configs (Pipe).Mode.Dotclock); |
| 885 | Debug.Put_Line (","); |
| 886 | Debug.Put (" H_Visible => "); |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 887 | Debug.Put_Int32 (Configs (Pipe).Mode.H_Visible); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 888 | Debug.Put_Line (","); |
| 889 | Debug.Put (" H_Sync_Begin => "); |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 890 | Debug.Put_Int32 (Configs (Pipe).Mode.H_Sync_Begin); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 891 | Debug.Put_Line (","); |
| 892 | Debug.Put (" H_Sync_End => "); |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 893 | Debug.Put_Int32 (Configs (Pipe).Mode.H_Sync_End); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 894 | Debug.Put_Line (","); |
| 895 | Debug.Put (" H_Total => "); |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 896 | Debug.Put_Int32 (Configs (Pipe).Mode.H_Total); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 897 | Debug.Put_Line (","); |
| 898 | Debug.Put (" V_Visible => "); |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 899 | Debug.Put_Int32 (Configs (Pipe).Mode.V_Visible); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 900 | Debug.Put_Line (","); |
| 901 | Debug.Put (" V_Sync_Begin => "); |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 902 | Debug.Put_Int32 (Configs (Pipe).Mode.V_Sync_Begin); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 903 | Debug.Put_Line (","); |
| 904 | Debug.Put (" V_Sync_End => "); |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 905 | Debug.Put_Int32 (Configs (Pipe).Mode.V_Sync_End); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 906 | Debug.Put_Line (","); |
| 907 | Debug.Put (" V_Total => "); |
| Nico Huber | c5c767a | 2018-06-03 01:09:04 +0200 | [diff] [blame] | 908 | Debug.Put_Int32 (Configs (Pipe).Mode.V_Total); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 909 | Debug.Put_Line (","); |
| 910 | Debug.Put_Line (" H_Sync_Active_High => " & |
| 911 | (if Configs (Pipe).Mode.H_Sync_Active_High |
| 912 | then "True," |
| 913 | else "False,")); |
| 914 | Debug.Put_Line (" V_Sync_Active_High => " & |
| 915 | (if Configs (Pipe).Mode.V_Sync_Active_High |
| 916 | then "True," |
| 917 | else "False,")); |
| 918 | Debug.Put (" BPC => "); |
| 919 | Debug.Put_Int64 (Configs (Pipe).Mode.BPC); |
| Nico Huber | 99f10f3 | 2016-11-20 00:34:05 +0100 | [diff] [blame] | 920 | if Pipe /= Pipe_Index'Last then |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 921 | Debug.Put_Line (")),"); |
| 922 | else |
| 923 | Debug.Put_Line (")));"); |
| 924 | end if; |
| 925 | end loop; |
| 926 | end Dump_Configs; |
| 927 | |
| 928 | end HW.GFX.GMA; |