| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| 2 | -- Copyright (C) 2015-2016 secunet Security Networks AG |
| 3 | -- |
| 4 | -- This program is free software; you can redistribute it and/or modify |
| 5 | -- it under the terms of the GNU General Public License as published by |
| 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 | |
| Nico Huber | 75a707f | 2018-06-18 16:28:33 +0200 | [diff] [blame] | 15 | with HW.GFX.GMA.Config; |
| Nico Huber | 9e96a45 | 2019-09-22 20:25:17 +0200 | [diff] [blame] | 16 | with HW.GFX.GMA.Config_Helpers; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 17 | with HW.GFX.GMA.Registers; |
| 18 | |
| Nico Huber | 47ff069 | 2016-11-04 14:29:39 +0100 | [diff] [blame] | 19 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 20 | private package HW.GFX.GMA.Pipe_Setup |
| 21 | is |
| 22 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 23 | procedure On |
| Nico Huber | f3e2366 | 2016-12-05 21:33:03 +0100 | [diff] [blame] | 24 | (Pipe : Pipe_Index; |
| Nico Huber | 4d592b4 | 2026-06-23 12:21:37 +0000 | [diff] [blame] | 25 | Pipe_Cfg : Pipe_Config; |
| 26 | Port_Cfg : Port_Config) |
| Nico Huber | 47ff069 | 2016-11-04 14:29:39 +0100 | [diff] [blame] | 27 | with |
| Nico Huber | 4d592b4 | 2026-06-23 12:21:37 +0000 | [diff] [blame] | 28 | Pre => Config_Helpers.Valid_FB (Pipe_Cfg.Framebuffer, Port_Cfg.Mode); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 29 | |
| Nico Huber | 7ad2d65 | 2016-12-07 15:19:32 +0100 | [diff] [blame] | 30 | procedure Off (Pipe : Pipe_Index); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 31 | |
| Nico Huber | 33912aa | 2016-12-06 20:36:23 +0100 | [diff] [blame] | 32 | procedure Legacy_VGA_Off; |
| 33 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 34 | procedure All_Off; |
| 35 | |
| Nico Huber | 4d592b4 | 2026-06-23 12:21:37 +0000 | [diff] [blame] | 36 | -- TODO: Passing `Pipe_Cfg` and `Mode` seems redundant. However, |
| 37 | -- the `Pipe_Cfg.Mode` is what the user requested and we |
| 38 | -- may have altered that in `Mode`. This should be refac- |
| 39 | -- tored to always have a single, synchronized `Mode`. |
| Nico Huber | f7f537e | 2018-01-02 14:15:43 +0100 | [diff] [blame] | 40 | procedure Setup_FB |
| 41 | (Pipe : Pipe_Index; |
| Nico Huber | 4d592b4 | 2026-06-23 12:21:37 +0000 | [diff] [blame] | 42 | Pipe_Cfg : Pipe_Config; |
| 43 | Mode : Mode_Type) |
| Nico Huber | f7f537e | 2018-01-02 14:15:43 +0100 | [diff] [blame] | 44 | with |
| Nico Huber | 4d592b4 | 2026-06-23 12:21:37 +0000 | [diff] [blame] | 45 | Pre => Config_Helpers.Valid_FB (Pipe_Cfg.Framebuffer, Mode); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 46 | |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 47 | procedure Update_Cursor |
| 48 | (Pipe : Pipe_Index; |
| 49 | FB : Framebuffer_Type; |
| 50 | Cursor : Cursor_Type); |
| 51 | procedure Place_Cursor |
| 52 | (Pipe : Pipe_Index; |
| 53 | FB : Framebuffer_Type; |
| Nico Huber | 1dae220 | 2020-10-05 13:31:25 +0200 | [diff] [blame] | 54 | Cursor : Cursor_Type; |
| Nico Huber | 5903f92 | 2020-10-05 14:15:57 +0200 | [diff] [blame] | 55 | Center : Cursor_Coord; |
| 56 | Update : Boolean := False); |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 57 | |
| Nico Huber | 9a4c4c3 | 2019-09-16 22:05:11 +0200 | [diff] [blame] | 58 | type Scaler_Reservation is private; |
| 59 | Null_Scaler_Reservation : constant Scaler_Reservation; |
| 60 | procedure Reserve_Scaler |
| 61 | (Success : out Boolean; |
| 62 | Reservation : in out Scaler_Reservation; |
| 63 | Pipe : in Pipe_Index); |
| Nico Huber | f361ec8 | 2018-06-02 18:01:45 +0200 | [diff] [blame] | 64 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 65 | private |
| 66 | |
| Nico Huber | 9a4c4c3 | 2019-09-16 22:05:11 +0200 | [diff] [blame] | 67 | type Scaler_Reservation is record |
| 68 | Reserved : Boolean; |
| 69 | Pipe : Pipe_Index; |
| 70 | end record; |
| 71 | Null_Scaler_Reservation : constant Scaler_Reservation := |
| 72 | (Reserved => False, Pipe => Pipe_Index'First); |
| 73 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 74 | subtype WM_Levels is Natural range 0 .. 7; |
| 75 | type PLANE_WM_Type is array (WM_Levels) of Registers.Registers_Index; |
| 76 | |
| 77 | type Controller_Type is |
| 78 | record |
| Nico Huber | f3e2366 | 2016-12-05 21:33:03 +0100 | [diff] [blame] | 79 | Pipe : Pipe_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 80 | PIPESRC : Registers.Registers_Index; |
| 81 | PIPEMISC : Registers.Registers_Index; |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 82 | PF_CTRL : Registers.Registers_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 83 | PF_WIN_POS : Registers.Registers_Index; |
| 84 | PF_WIN_SZ : Registers.Registers_Index; |
| 85 | DSPCNTR : Registers.Registers_Index; |
| 86 | DSPLINOFF : Registers.Registers_Index; |
| 87 | DSPSTRIDE : Registers.Registers_Index; |
| 88 | DSPSURF : Registers.Registers_Index; |
| 89 | DSPTILEOFF : Registers.Registers_Index; |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame] | 90 | DSPSIZE : Registers.Registers_Index; |
| 91 | DSPPOS : Registers.Registers_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 92 | -- Skylake registers (partially aliased) |
| 93 | PLANE_CTL : Registers.Registers_Index; |
| Nico Huber | f7a644b | 2020-10-20 15:26:01 +0200 | [diff] [blame^] | 94 | PLANE_KEYVAL : Registers.Registers_Index; |
| 95 | PLANE_KEYMSK : Registers.Registers_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 96 | PLANE_OFFSET : Registers.Registers_Index; |
| 97 | PLANE_POS : Registers.Registers_Index; |
| 98 | PLANE_SIZE : Registers.Registers_Index; |
| 99 | PLANE_STRIDE : Registers.Registers_Index; |
| 100 | PLANE_SURF : Registers.Registers_Index; |
| 101 | PS_CTRL_1 : Registers.Registers_Index; |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 102 | PS_WIN_POS_1 : Registers.Registers_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 103 | PS_WIN_SZ_1 : Registers.Registers_Index; |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 104 | PS_CTRL_2 : Registers.Registers_Invalid_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 105 | PS_WIN_SZ_2 : Registers.Registers_Invalid_Index; |
| 106 | WM_LINETIME : Registers.Registers_Index; |
| 107 | PLANE_BUF_CFG : Registers.Registers_Index; |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 108 | PLANE_COLOR_CTL : Registers.Registers_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 109 | PLANE_WM : PLANE_WM_Type; |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 110 | PLANE_2_CTL : Registers.Registers_Index; |
| Nico Huber | f7a644b | 2020-10-20 15:26:01 +0200 | [diff] [blame^] | 111 | PLANE_2_KEYVAL : Registers.Registers_Index; |
| 112 | PLANE_2_KEYMSK : Registers.Registers_Index; |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 113 | PLANE_2_OFFSET : Registers.Registers_Index; |
| 114 | PLANE_2_POS : Registers.Registers_Index; |
| 115 | PLANE_2_SIZE : Registers.Registers_Index; |
| 116 | PLANE_2_STRIDE : Registers.Registers_Index; |
| 117 | PLANE_2_SURF : Registers.Registers_Index; |
| 118 | PLANE_2_BUF_CFG : Registers.Registers_Index; |
| 119 | PLANE_2_COLOR_CTL : Registers.Registers_Index; |
| 120 | PLANE_2_WM : PLANE_WM_Type; |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 121 | CUR_BUF_CFG : Registers.Registers_Index; |
| 122 | CUR_WM : PLANE_WM_Type; |
| Tim Wawrzynczak | 0da761a | 2022-09-09 10:42:36 -0600 | [diff] [blame] | 123 | MBUS_DBOX_CTL : Registers.Registers_Index; |
| 124 | PIPE_CHICKEN : Registers.Registers_Index; |
| Tim Wawrzynczak | 0da761a | 2022-09-09 10:42:36 -0600 | [diff] [blame] | 125 | PLANE_AUX_DIST : Registers.Registers_Index; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 126 | end record; |
| 127 | |
| Nico Huber | f3e2366 | 2016-12-05 21:33:03 +0100 | [diff] [blame] | 128 | type Controller_Array is array (Pipe_Index) of Controller_Type; |
| 129 | |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame] | 130 | -- On Gen3 (i945), FBC only works with Plane A, but LVDS and the |
| 131 | -- panel fitter are hooked to Pipe B. Hence we want Plane A feeding |
| 132 | -- Pipe B, which means swapping the plane register assignments: |
| 133 | -- Primary (Pipe A) gets Plane B, Secondary (Pipe B) gets Plane A. |
| 134 | |
| Nico Huber | f3e2366 | 2016-12-05 21:33:03 +0100 | [diff] [blame] | 135 | Controllers : constant Controller_Array := |
| 136 | (Primary => Controller_Type' |
| 137 | (Pipe => Primary, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 138 | PIPESRC => Registers.PIPEASRC, |
| 139 | PIPEMISC => Registers.PIPEAMISC, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 140 | PF_CTRL => Registers.PFA_CTL_1, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 141 | PF_WIN_POS => Registers.PFA_WIN_POS, |
| 142 | PF_WIN_SZ => Registers.PFA_WIN_SZ, |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame] | 143 | DSPCNTR => |
| 144 | (if Config.Planes_Pipes_Swapped |
| 145 | then Registers.DSPBCNTR else Registers.DSPACNTR), |
| 146 | DSPLINOFF => |
| 147 | (if Config.Planes_Pipes_Swapped |
| 148 | then Registers.DSPBLINOFF else Registers.DSPALINOFF), |
| 149 | DSPSTRIDE => |
| 150 | (if Config.Planes_Pipes_Swapped |
| 151 | then Registers.DSPBSTRIDE else Registers.DSPASTRIDE), |
| 152 | DSPSURF => |
| 153 | (if Config.Planes_Pipes_Swapped |
| 154 | then Registers.DSPBSURF else Registers.DSPASURF), |
| 155 | DSPTILEOFF => |
| 156 | (if Config.Planes_Pipes_Swapped |
| 157 | then Registers.DSPBTILEOFF else Registers.DSPATILEOFF), |
| 158 | DSPSIZE => |
| 159 | (if Config.Planes_Pipes_Swapped |
| 160 | then Registers.PLANE_SIZE_1_B else Registers.PLANE_SIZE_1_A), |
| 161 | DSPPOS => |
| 162 | (if Config.Planes_Pipes_Swapped |
| 163 | then Registers.PLANE_POS_1_B else Registers.PLANE_POS_1_A), |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 164 | PLANE_CTL => Registers.DSPACNTR, |
| Nico Huber | f7a644b | 2020-10-20 15:26:01 +0200 | [diff] [blame^] | 165 | PLANE_KEYVAL => Registers.PLANE_KEYVAL_1_A, |
| 166 | PLANE_KEYMSK => Registers.PLANE_KEYMSK_1_A, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 167 | PLANE_OFFSET => Registers.DSPATILEOFF, |
| 168 | PLANE_POS => Registers.PLANE_POS_1_A, |
| 169 | PLANE_SIZE => Registers.PLANE_SIZE_1_A, |
| 170 | PLANE_STRIDE => Registers.DSPASTRIDE, |
| 171 | PLANE_SURF => Registers.DSPASURF, |
| 172 | PS_CTRL_1 => Registers.PS_CTRL_1_A, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 173 | PS_WIN_POS_1 => Registers.PS_WIN_POS_1_A, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 174 | PS_WIN_SZ_1 => Registers.PS_WIN_SZ_1_A, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 175 | PS_CTRL_2 => Registers.PS_CTRL_2_A, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 176 | PS_WIN_SZ_2 => Registers.PS_WIN_SZ_2_A, |
| 177 | WM_LINETIME => Registers.WM_LINETIME_A, |
| 178 | PLANE_BUF_CFG => Registers.PLANE_BUF_CFG_1_A, |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 179 | PLANE_COLOR_CTL => Registers.PLANE_COLOR_CTL_1_A, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 180 | PLANE_WM => PLANE_WM_Type'( |
| 181 | Registers.PLANE_WM_1_A_0, |
| 182 | Registers.PLANE_WM_1_A_1, |
| 183 | Registers.PLANE_WM_1_A_2, |
| 184 | Registers.PLANE_WM_1_A_3, |
| 185 | Registers.PLANE_WM_1_A_4, |
| 186 | Registers.PLANE_WM_1_A_5, |
| 187 | Registers.PLANE_WM_1_A_6, |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 188 | Registers.PLANE_WM_1_A_7), |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 189 | PLANE_2_CTL => Registers.PLANE_CTL_2_A, |
| Nico Huber | f7a644b | 2020-10-20 15:26:01 +0200 | [diff] [blame^] | 190 | PLANE_2_KEYVAL => Registers.PLANE_KEYVAL_2_A, |
| 191 | PLANE_2_KEYMSK => Registers.PLANE_KEYMSK_2_A, |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 192 | PLANE_2_OFFSET => Registers.PLANE_OFFSET_2_A, |
| 193 | PLANE_2_POS => Registers.PLANE_POS_2_A, |
| 194 | PLANE_2_SIZE => Registers.PLANE_SIZE_2_A, |
| 195 | PLANE_2_STRIDE => Registers.PLANE_STRIDE_2_A, |
| 196 | PLANE_2_SURF => Registers.PLANE_SURF_2_A, |
| 197 | PLANE_2_BUF_CFG => Registers.PLANE_BUF_CFG_2_A, |
| 198 | PLANE_2_COLOR_CTL => Registers.PLANE_COLOR_CTL_2_A, |
| 199 | PLANE_2_WM => PLANE_WM_Type'( |
| 200 | Registers.PLANE_WM_2_A_0, |
| 201 | Registers.PLANE_WM_2_A_1, |
| 202 | Registers.PLANE_WM_2_A_2, |
| 203 | Registers.PLANE_WM_2_A_3, |
| 204 | Registers.PLANE_WM_2_A_4, |
| 205 | Registers.PLANE_WM_2_A_5, |
| 206 | Registers.PLANE_WM_2_A_6, |
| 207 | Registers.PLANE_WM_2_A_7), |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 208 | CUR_BUF_CFG => Registers.CUR_BUF_CFG_A, |
| 209 | CUR_WM => PLANE_WM_Type'( |
| 210 | Registers.CUR_WM_A_0, |
| 211 | Registers.CUR_WM_A_1, |
| 212 | Registers.CUR_WM_A_2, |
| 213 | Registers.CUR_WM_A_3, |
| 214 | Registers.CUR_WM_A_4, |
| 215 | Registers.CUR_WM_A_5, |
| 216 | Registers.CUR_WM_A_6, |
| Tim Wawrzynczak | 0da761a | 2022-09-09 10:42:36 -0600 | [diff] [blame] | 217 | Registers.CUR_WM_A_7), |
| 218 | MBUS_DBOX_CTL => Registers.PIPE_MBUS_DBOX_CTL_A, |
| 219 | PIPE_CHICKEN => Registers.PIPEA_CHICKEN, |
| Tim Wawrzynczak | 0da761a | 2022-09-09 10:42:36 -0600 | [diff] [blame] | 220 | PLANE_AUX_DIST => Registers.PLANE_AUX_DIST_1_A), |
| Nico Huber | f3e2366 | 2016-12-05 21:33:03 +0100 | [diff] [blame] | 221 | Secondary => Controller_Type' |
| 222 | (Pipe => Secondary, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 223 | PIPESRC => Registers.PIPEBSRC, |
| 224 | PIPEMISC => Registers.PIPEBMISC, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 225 | PF_CTRL => Registers.PFB_CTL_1, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 226 | PF_WIN_POS => Registers.PFB_WIN_POS, |
| 227 | PF_WIN_SZ => Registers.PFB_WIN_SZ, |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame] | 228 | DSPCNTR => |
| 229 | (if Config.Planes_Pipes_Swapped |
| 230 | then Registers.DSPACNTR else Registers.DSPBCNTR), |
| 231 | DSPLINOFF => |
| 232 | (if Config.Planes_Pipes_Swapped |
| 233 | then Registers.DSPALINOFF else Registers.DSPBLINOFF), |
| 234 | DSPSTRIDE => |
| 235 | (if Config.Planes_Pipes_Swapped |
| 236 | then Registers.DSPASTRIDE else Registers.DSPBSTRIDE), |
| 237 | DSPSURF => |
| 238 | (if Config.Planes_Pipes_Swapped |
| 239 | then Registers.DSPASURF else Registers.DSPBSURF), |
| 240 | DSPTILEOFF => |
| 241 | (if Config.Planes_Pipes_Swapped |
| 242 | then Registers.DSPATILEOFF else Registers.DSPBTILEOFF), |
| 243 | DSPSIZE => |
| 244 | (if Config.Planes_Pipes_Swapped |
| 245 | then Registers.PLANE_SIZE_1_A else Registers.PLANE_SIZE_1_B), |
| 246 | DSPPOS => |
| 247 | (if Config.Planes_Pipes_Swapped |
| 248 | then Registers.PLANE_POS_1_A else Registers.PLANE_POS_1_B), |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 249 | PLANE_CTL => Registers.DSPBCNTR, |
| Nico Huber | f7a644b | 2020-10-20 15:26:01 +0200 | [diff] [blame^] | 250 | PLANE_KEYVAL => Registers.PLANE_KEYVAL_1_B, |
| 251 | PLANE_KEYMSK => Registers.PLANE_KEYMSK_1_B, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 252 | PLANE_OFFSET => Registers.DSPBTILEOFF, |
| 253 | PLANE_POS => Registers.PLANE_POS_1_B, |
| 254 | PLANE_SIZE => Registers.PLANE_SIZE_1_B, |
| 255 | PLANE_STRIDE => Registers.DSPBSTRIDE, |
| 256 | PLANE_SURF => Registers.DSPBSURF, |
| 257 | PS_CTRL_1 => Registers.PS_CTRL_1_B, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 258 | PS_WIN_POS_1 => Registers.PS_WIN_POS_1_B, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 259 | PS_WIN_SZ_1 => Registers.PS_WIN_SZ_1_B, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 260 | PS_CTRL_2 => Registers.PS_CTRL_2_B, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 261 | PS_WIN_SZ_2 => Registers.PS_WIN_SZ_2_B, |
| 262 | WM_LINETIME => Registers.WM_LINETIME_B, |
| 263 | PLANE_BUF_CFG => Registers.PLANE_BUF_CFG_1_B, |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 264 | PLANE_COLOR_CTL => Registers.PLANE_COLOR_CTL_1_B, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 265 | PLANE_WM => PLANE_WM_Type'( |
| 266 | Registers.PLANE_WM_1_B_0, |
| 267 | Registers.PLANE_WM_1_B_1, |
| 268 | Registers.PLANE_WM_1_B_2, |
| 269 | Registers.PLANE_WM_1_B_3, |
| 270 | Registers.PLANE_WM_1_B_4, |
| 271 | Registers.PLANE_WM_1_B_5, |
| 272 | Registers.PLANE_WM_1_B_6, |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 273 | Registers.PLANE_WM_1_B_7), |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 274 | PLANE_2_CTL => Registers.PLANE_CTL_2_B, |
| Nico Huber | f7a644b | 2020-10-20 15:26:01 +0200 | [diff] [blame^] | 275 | PLANE_2_KEYVAL => Registers.PLANE_KEYVAL_2_B, |
| 276 | PLANE_2_KEYMSK => Registers.PLANE_KEYMSK_2_B, |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 277 | PLANE_2_OFFSET => Registers.PLANE_OFFSET_2_B, |
| 278 | PLANE_2_POS => Registers.PLANE_POS_2_B, |
| 279 | PLANE_2_SIZE => Registers.PLANE_SIZE_2_B, |
| 280 | PLANE_2_STRIDE => Registers.PLANE_STRIDE_2_B, |
| 281 | PLANE_2_SURF => Registers.PLANE_SURF_2_B, |
| 282 | PLANE_2_BUF_CFG => Registers.PLANE_BUF_CFG_2_B, |
| 283 | PLANE_2_COLOR_CTL => Registers.PLANE_COLOR_CTL_2_B, |
| 284 | PLANE_2_WM => PLANE_WM_Type'( |
| 285 | Registers.PLANE_WM_2_B_0, |
| 286 | Registers.PLANE_WM_2_B_1, |
| 287 | Registers.PLANE_WM_2_B_2, |
| 288 | Registers.PLANE_WM_2_B_3, |
| 289 | Registers.PLANE_WM_2_B_4, |
| 290 | Registers.PLANE_WM_2_B_5, |
| 291 | Registers.PLANE_WM_2_B_6, |
| 292 | Registers.PLANE_WM_2_B_7), |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 293 | CUR_BUF_CFG => Registers.CUR_BUF_CFG_B, |
| 294 | CUR_WM => PLANE_WM_Type'( |
| 295 | Registers.CUR_WM_B_0, |
| 296 | Registers.CUR_WM_B_1, |
| 297 | Registers.CUR_WM_B_2, |
| 298 | Registers.CUR_WM_B_3, |
| 299 | Registers.CUR_WM_B_4, |
| 300 | Registers.CUR_WM_B_5, |
| 301 | Registers.CUR_WM_B_6, |
| Tim Wawrzynczak | 0da761a | 2022-09-09 10:42:36 -0600 | [diff] [blame] | 302 | Registers.CUR_WM_B_7), |
| 303 | MBUS_DBOX_CTL => Registers.PIPE_MBUS_DBOX_CTL_B, |
| 304 | PIPE_CHICKEN => Registers.PIPEB_CHICKEN, |
| Tim Wawrzynczak | 0da761a | 2022-09-09 10:42:36 -0600 | [diff] [blame] | 305 | PLANE_AUX_DIST => Registers.PLANE_AUX_DIST_1_B), |
| Nico Huber | f3e2366 | 2016-12-05 21:33:03 +0100 | [diff] [blame] | 306 | Tertiary => Controller_Type' |
| 307 | (Pipe => Tertiary, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 308 | PIPESRC => Registers.PIPECSRC, |
| 309 | PIPEMISC => Registers.PIPECMISC, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 310 | PF_CTRL => Registers.PFC_CTL_1, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 311 | PF_WIN_POS => Registers.PFC_WIN_POS, |
| 312 | PF_WIN_SZ => Registers.PFC_WIN_SZ, |
| 313 | DSPCNTR => Registers.DSPCCNTR, |
| 314 | DSPLINOFF => Registers.DSPCLINOFF, |
| 315 | DSPSTRIDE => Registers.DSPCSTRIDE, |
| 316 | DSPSURF => Registers.DSPCSURF, |
| 317 | DSPTILEOFF => Registers.DSPCTILEOFF, |
| Arthur Heymans | 960e239 | 2026-03-03 19:45:24 +0100 | [diff] [blame] | 318 | DSPSIZE => Registers.PLANE_SIZE_1_C, |
| 319 | DSPPOS => Registers.PLANE_POS_1_C, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 320 | PLANE_CTL => Registers.DSPCCNTR, |
| Nico Huber | f7a644b | 2020-10-20 15:26:01 +0200 | [diff] [blame^] | 321 | PLANE_KEYVAL => Registers.PLANE_KEYVAL_1_C, |
| 322 | PLANE_KEYMSK => Registers.PLANE_KEYMSK_1_C, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 323 | PLANE_OFFSET => Registers.DSPCTILEOFF, |
| 324 | PLANE_POS => Registers.PLANE_POS_1_C, |
| 325 | PLANE_SIZE => Registers.PLANE_SIZE_1_C, |
| 326 | PLANE_STRIDE => Registers.DSPCSTRIDE, |
| 327 | PLANE_SURF => Registers.DSPCSURF, |
| 328 | PS_CTRL_1 => Registers.PS_CTRL_1_C, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 329 | PS_WIN_POS_1 => Registers.PS_WIN_POS_1_C, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 330 | PS_WIN_SZ_1 => Registers.PS_WIN_SZ_1_C, |
| Nico Huber | 4916e34 | 2016-11-04 14:37:53 +0100 | [diff] [blame] | 331 | PS_CTRL_2 => Registers.Invalid_Register, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 332 | PS_WIN_SZ_2 => Registers.Invalid_Register, |
| 333 | WM_LINETIME => Registers.WM_LINETIME_C, |
| 334 | PLANE_BUF_CFG => Registers.PLANE_BUF_CFG_1_C, |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 335 | PLANE_COLOR_CTL => Registers.PLANE_COLOR_CTL_1_C, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 336 | PLANE_WM => PLANE_WM_Type'( |
| 337 | Registers.PLANE_WM_1_C_0, |
| 338 | Registers.PLANE_WM_1_C_1, |
| 339 | Registers.PLANE_WM_1_C_2, |
| 340 | Registers.PLANE_WM_1_C_3, |
| 341 | Registers.PLANE_WM_1_C_4, |
| 342 | Registers.PLANE_WM_1_C_5, |
| 343 | Registers.PLANE_WM_1_C_6, |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 344 | Registers.PLANE_WM_1_C_7), |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 345 | PLANE_2_CTL => Registers.PLANE_CTL_2_C, |
| Nico Huber | f7a644b | 2020-10-20 15:26:01 +0200 | [diff] [blame^] | 346 | PLANE_2_KEYVAL => Registers.PLANE_KEYVAL_2_C, |
| 347 | PLANE_2_KEYMSK => Registers.PLANE_KEYMSK_2_C, |
| Nico Huber | 07aab5a | 2020-10-01 15:06:53 +0200 | [diff] [blame] | 348 | PLANE_2_OFFSET => Registers.PLANE_OFFSET_2_C, |
| 349 | PLANE_2_POS => Registers.PLANE_POS_2_C, |
| 350 | PLANE_2_SIZE => Registers.PLANE_SIZE_2_C, |
| 351 | PLANE_2_STRIDE => Registers.PLANE_STRIDE_2_C, |
| 352 | PLANE_2_SURF => Registers.PLANE_SURF_2_C, |
| 353 | PLANE_2_BUF_CFG => Registers.PLANE_BUF_CFG_2_C, |
| 354 | PLANE_2_COLOR_CTL => Registers.PLANE_COLOR_CTL_2_C, |
| 355 | PLANE_2_WM => PLANE_WM_Type'( |
| 356 | Registers.PLANE_WM_2_C_0, |
| 357 | Registers.PLANE_WM_2_C_1, |
| 358 | Registers.PLANE_WM_2_C_2, |
| 359 | Registers.PLANE_WM_2_C_3, |
| 360 | Registers.PLANE_WM_2_C_4, |
| 361 | Registers.PLANE_WM_2_C_5, |
| 362 | Registers.PLANE_WM_2_C_6, |
| 363 | Registers.PLANE_WM_2_C_7), |
| Nico Huber | 4dc4c61 | 2018-01-10 15:55:09 +0100 | [diff] [blame] | 364 | CUR_BUF_CFG => Registers.CUR_BUF_CFG_C, |
| 365 | CUR_WM => PLANE_WM_Type'( |
| 366 | Registers.CUR_WM_C_0, |
| 367 | Registers.CUR_WM_C_1, |
| 368 | Registers.CUR_WM_C_2, |
| 369 | Registers.CUR_WM_C_3, |
| 370 | Registers.CUR_WM_C_4, |
| 371 | Registers.CUR_WM_C_5, |
| 372 | Registers.CUR_WM_C_6, |
| Tim Wawrzynczak | 0da761a | 2022-09-09 10:42:36 -0600 | [diff] [blame] | 373 | Registers.CUR_WM_C_7), |
| 374 | MBUS_DBOX_CTL => Registers.PIPE_MBUS_DBOX_CTL_C, |
| 375 | PIPE_CHICKEN => Registers.PIPEC_CHICKEN, |
| Tim Wawrzynczak | 0da761a | 2022-09-09 10:42:36 -0600 | [diff] [blame] | 376 | PLANE_AUX_DIST => Registers.PLANE_AUX_DIST_1_C)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 377 | |
| Nico Huber | 75a707f | 2018-06-18 16:28:33 +0200 | [diff] [blame] | 378 | type Cursor_Regs is record |
| 379 | CTL : Registers.Registers_Index; |
| 380 | BASE : Registers.Registers_Index; |
| 381 | POS : Registers.Registers_Index; |
| 382 | FBC_CTL : Registers.Registers_Invalid_Index; |
| 383 | end record; |
| 384 | |
| 385 | function Cursors (Pipe : Pipe_Index) return Cursor_Regs is |
| 386 | (if not Config.Has_Ivybridge_Cursors then |
| 387 | (if Pipe = Primary then |
| 388 | (CTL => Registers.CURACNTR, |
| 389 | BASE => Registers.CURABASE, |
| 390 | POS => Registers.CURAPOS, |
| 391 | FBC_CTL => Registers.Invalid_Register) |
| 392 | else |
| 393 | (CTL => Registers.CURBCNTR, |
| 394 | BASE => Registers.CURBBASE, |
| 395 | POS => Registers.CURBPOS, |
| 396 | FBC_CTL => Registers.Invalid_Register)) |
| 397 | else |
| 398 | (if Pipe = Primary then |
| 399 | (CTL => Registers.CUR_CTL_A, |
| 400 | BASE => Registers.CUR_BASE_A, |
| 401 | POS => Registers.CUR_POS_A, |
| 402 | FBC_CTL => Registers.CUR_FBC_CTL_A) |
| 403 | elsif Pipe = Secondary then |
| 404 | (CTL => Registers.CUR_CTL_B, |
| 405 | BASE => Registers.CUR_BASE_B, |
| 406 | POS => Registers.CUR_POS_B, |
| 407 | FBC_CTL => Registers.CUR_FBC_CTL_B) |
| 408 | else |
| 409 | (CTL => Registers.CUR_CTL_C, |
| 410 | BASE => Registers.CUR_BASE_C, |
| 411 | POS => Registers.CUR_POS_C, |
| 412 | FBC_CTL => Registers.CUR_FBC_CTL_C))); |
| 413 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 414 | end HW.GFX.GMA.Pipe_Setup; |