diff options
Diffstat (limited to 'drivers/char/drm/r128_cce.c')
-rw-r--r-- | drivers/char/drm/r128_cce.c | 596 |
1 files changed, 299 insertions, 297 deletions
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c index 895152206b31..7452753d4d01 100644 --- a/drivers/char/drm/r128_cce.c +++ b/drivers/char/drm/r128_cce.c | |||
@@ -80,7 +80,7 @@ static u32 r128_cce_microcode[] = { | |||
80 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | 80 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static int R128_READ_PLL(drm_device_t *dev, int addr) | 83 | static int R128_READ_PLL(drm_device_t * dev, int addr) |
84 | { | 84 | { |
85 | drm_r128_private_t *dev_priv = dev->dev_private; | 85 | drm_r128_private_t *dev_priv = dev->dev_private; |
86 | 86 | ||
@@ -89,106 +89,105 @@ static int R128_READ_PLL(drm_device_t *dev, int addr) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | #if R128_FIFO_DEBUG | 91 | #if R128_FIFO_DEBUG |
92 | static void r128_status( drm_r128_private_t *dev_priv ) | 92 | static void r128_status(drm_r128_private_t * dev_priv) |
93 | { | 93 | { |
94 | printk( "GUI_STAT = 0x%08x\n", | 94 | printk("GUI_STAT = 0x%08x\n", |
95 | (unsigned int)R128_READ( R128_GUI_STAT ) ); | 95 | (unsigned int)R128_READ(R128_GUI_STAT)); |
96 | printk( "PM4_STAT = 0x%08x\n", | 96 | printk("PM4_STAT = 0x%08x\n", |
97 | (unsigned int)R128_READ( R128_PM4_STAT ) ); | 97 | (unsigned int)R128_READ(R128_PM4_STAT)); |
98 | printk( "PM4_BUFFER_DL_WPTR = 0x%08x\n", | 98 | printk("PM4_BUFFER_DL_WPTR = 0x%08x\n", |
99 | (unsigned int)R128_READ( R128_PM4_BUFFER_DL_WPTR ) ); | 99 | (unsigned int)R128_READ(R128_PM4_BUFFER_DL_WPTR)); |
100 | printk( "PM4_BUFFER_DL_RPTR = 0x%08x\n", | 100 | printk("PM4_BUFFER_DL_RPTR = 0x%08x\n", |
101 | (unsigned int)R128_READ( R128_PM4_BUFFER_DL_RPTR ) ); | 101 | (unsigned int)R128_READ(R128_PM4_BUFFER_DL_RPTR)); |
102 | printk( "PM4_MICRO_CNTL = 0x%08x\n", | 102 | printk("PM4_MICRO_CNTL = 0x%08x\n", |
103 | (unsigned int)R128_READ( R128_PM4_MICRO_CNTL ) ); | 103 | (unsigned int)R128_READ(R128_PM4_MICRO_CNTL)); |
104 | printk( "PM4_BUFFER_CNTL = 0x%08x\n", | 104 | printk("PM4_BUFFER_CNTL = 0x%08x\n", |
105 | (unsigned int)R128_READ( R128_PM4_BUFFER_CNTL ) ); | 105 | (unsigned int)R128_READ(R128_PM4_BUFFER_CNTL)); |
106 | } | 106 | } |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | |||
110 | /* ================================================================ | 109 | /* ================================================================ |
111 | * Engine, FIFO control | 110 | * Engine, FIFO control |
112 | */ | 111 | */ |
113 | 112 | ||
114 | static int r128_do_pixcache_flush( drm_r128_private_t *dev_priv ) | 113 | static int r128_do_pixcache_flush(drm_r128_private_t * dev_priv) |
115 | { | 114 | { |
116 | u32 tmp; | 115 | u32 tmp; |
117 | int i; | 116 | int i; |
118 | 117 | ||
119 | tmp = R128_READ( R128_PC_NGUI_CTLSTAT ) | R128_PC_FLUSH_ALL; | 118 | tmp = R128_READ(R128_PC_NGUI_CTLSTAT) | R128_PC_FLUSH_ALL; |
120 | R128_WRITE( R128_PC_NGUI_CTLSTAT, tmp ); | 119 | R128_WRITE(R128_PC_NGUI_CTLSTAT, tmp); |
121 | 120 | ||
122 | for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { | 121 | for (i = 0; i < dev_priv->usec_timeout; i++) { |
123 | if ( !(R128_READ( R128_PC_NGUI_CTLSTAT ) & R128_PC_BUSY) ) { | 122 | if (!(R128_READ(R128_PC_NGUI_CTLSTAT) & R128_PC_BUSY)) { |
124 | return 0; | 123 | return 0; |
125 | } | 124 | } |
126 | DRM_UDELAY( 1 ); | 125 | DRM_UDELAY(1); |
127 | } | 126 | } |
128 | 127 | ||
129 | #if R128_FIFO_DEBUG | 128 | #if R128_FIFO_DEBUG |
130 | DRM_ERROR( "failed!\n" ); | 129 | DRM_ERROR("failed!\n"); |
131 | #endif | 130 | #endif |
132 | return DRM_ERR(EBUSY); | 131 | return DRM_ERR(EBUSY); |
133 | } | 132 | } |
134 | 133 | ||
135 | static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries ) | 134 | static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries) |
136 | { | 135 | { |
137 | int i; | 136 | int i; |
138 | 137 | ||
139 | for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { | 138 | for (i = 0; i < dev_priv->usec_timeout; i++) { |
140 | int slots = R128_READ( R128_GUI_STAT ) & R128_GUI_FIFOCNT_MASK; | 139 | int slots = R128_READ(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK; |
141 | if ( slots >= entries ) return 0; | 140 | if (slots >= entries) |
142 | DRM_UDELAY( 1 ); | 141 | return 0; |
142 | DRM_UDELAY(1); | ||
143 | } | 143 | } |
144 | 144 | ||
145 | #if R128_FIFO_DEBUG | 145 | #if R128_FIFO_DEBUG |
146 | DRM_ERROR( "failed!\n" ); | 146 | DRM_ERROR("failed!\n"); |
147 | #endif | 147 | #endif |
148 | return DRM_ERR(EBUSY); | 148 | return DRM_ERR(EBUSY); |
149 | } | 149 | } |
150 | 150 | ||
151 | static int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) | 151 | static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv) |
152 | { | 152 | { |
153 | int i, ret; | 153 | int i, ret; |
154 | 154 | ||
155 | ret = r128_do_wait_for_fifo( dev_priv, 64 ); | 155 | ret = r128_do_wait_for_fifo(dev_priv, 64); |
156 | if ( ret ) return ret; | 156 | if (ret) |
157 | return ret; | ||
157 | 158 | ||
158 | for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { | 159 | for (i = 0; i < dev_priv->usec_timeout; i++) { |
159 | if ( !(R128_READ( R128_GUI_STAT ) & R128_GUI_ACTIVE) ) { | 160 | if (!(R128_READ(R128_GUI_STAT) & R128_GUI_ACTIVE)) { |
160 | r128_do_pixcache_flush( dev_priv ); | 161 | r128_do_pixcache_flush(dev_priv); |
161 | return 0; | 162 | return 0; |
162 | } | 163 | } |
163 | DRM_UDELAY( 1 ); | 164 | DRM_UDELAY(1); |
164 | } | 165 | } |
165 | 166 | ||
166 | #if R128_FIFO_DEBUG | 167 | #if R128_FIFO_DEBUG |
167 | DRM_ERROR( "failed!\n" ); | 168 | DRM_ERROR("failed!\n"); |
168 | #endif | 169 | #endif |
169 | return DRM_ERR(EBUSY); | 170 | return DRM_ERR(EBUSY); |
170 | } | 171 | } |
171 | 172 | ||
172 | |||
173 | /* ================================================================ | 173 | /* ================================================================ |
174 | * CCE control, initialization | 174 | * CCE control, initialization |
175 | */ | 175 | */ |
176 | 176 | ||
177 | /* Load the microcode for the CCE */ | 177 | /* Load the microcode for the CCE */ |
178 | static void r128_cce_load_microcode( drm_r128_private_t *dev_priv ) | 178 | static void r128_cce_load_microcode(drm_r128_private_t * dev_priv) |
179 | { | 179 | { |
180 | int i; | 180 | int i; |
181 | 181 | ||
182 | DRM_DEBUG( "\n" ); | 182 | DRM_DEBUG("\n"); |
183 | 183 | ||
184 | r128_do_wait_for_idle( dev_priv ); | 184 | r128_do_wait_for_idle(dev_priv); |
185 | 185 | ||
186 | R128_WRITE( R128_PM4_MICROCODE_ADDR, 0 ); | 186 | R128_WRITE(R128_PM4_MICROCODE_ADDR, 0); |
187 | for ( i = 0 ; i < 256 ; i++ ) { | 187 | for (i = 0; i < 256; i++) { |
188 | R128_WRITE( R128_PM4_MICROCODE_DATAH, | 188 | R128_WRITE(R128_PM4_MICROCODE_DATAH, r128_cce_microcode[i * 2]); |
189 | r128_cce_microcode[i * 2] ); | 189 | R128_WRITE(R128_PM4_MICROCODE_DATAL, |
190 | R128_WRITE( R128_PM4_MICROCODE_DATAL, | 190 | r128_cce_microcode[i * 2 + 1]); |
191 | r128_cce_microcode[i * 2 + 1] ); | ||
192 | } | 191 | } |
193 | } | 192 | } |
194 | 193 | ||
@@ -196,51 +195,51 @@ static void r128_cce_load_microcode( drm_r128_private_t *dev_priv ) | |||
196 | * prior to a wait for idle, as it informs the engine that the command | 195 | * prior to a wait for idle, as it informs the engine that the command |
197 | * stream is ending. | 196 | * stream is ending. |
198 | */ | 197 | */ |
199 | static void r128_do_cce_flush( drm_r128_private_t *dev_priv ) | 198 | static void r128_do_cce_flush(drm_r128_private_t * dev_priv) |
200 | { | 199 | { |
201 | u32 tmp; | 200 | u32 tmp; |
202 | 201 | ||
203 | tmp = R128_READ( R128_PM4_BUFFER_DL_WPTR ) | R128_PM4_BUFFER_DL_DONE; | 202 | tmp = R128_READ(R128_PM4_BUFFER_DL_WPTR) | R128_PM4_BUFFER_DL_DONE; |
204 | R128_WRITE( R128_PM4_BUFFER_DL_WPTR, tmp ); | 203 | R128_WRITE(R128_PM4_BUFFER_DL_WPTR, tmp); |
205 | } | 204 | } |
206 | 205 | ||
207 | /* Wait for the CCE to go idle. | 206 | /* Wait for the CCE to go idle. |
208 | */ | 207 | */ |
209 | int r128_do_cce_idle( drm_r128_private_t *dev_priv ) | 208 | int r128_do_cce_idle(drm_r128_private_t * dev_priv) |
210 | { | 209 | { |
211 | int i; | 210 | int i; |
212 | 211 | ||
213 | for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { | 212 | for (i = 0; i < dev_priv->usec_timeout; i++) { |
214 | if ( GET_RING_HEAD( dev_priv ) == dev_priv->ring.tail ) { | 213 | if (GET_RING_HEAD(dev_priv) == dev_priv->ring.tail) { |
215 | int pm4stat = R128_READ( R128_PM4_STAT ); | 214 | int pm4stat = R128_READ(R128_PM4_STAT); |
216 | if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >= | 215 | if (((pm4stat & R128_PM4_FIFOCNT_MASK) >= |
217 | dev_priv->cce_fifo_size ) && | 216 | dev_priv->cce_fifo_size) && |
218 | !(pm4stat & (R128_PM4_BUSY | | 217 | !(pm4stat & (R128_PM4_BUSY | |
219 | R128_PM4_GUI_ACTIVE)) ) { | 218 | R128_PM4_GUI_ACTIVE))) { |
220 | return r128_do_pixcache_flush( dev_priv ); | 219 | return r128_do_pixcache_flush(dev_priv); |
221 | } | 220 | } |
222 | } | 221 | } |
223 | DRM_UDELAY( 1 ); | 222 | DRM_UDELAY(1); |
224 | } | 223 | } |
225 | 224 | ||
226 | #if R128_FIFO_DEBUG | 225 | #if R128_FIFO_DEBUG |
227 | DRM_ERROR( "failed!\n" ); | 226 | DRM_ERROR("failed!\n"); |
228 | r128_status( dev_priv ); | 227 | r128_status(dev_priv); |
229 | #endif | 228 | #endif |
230 | return DRM_ERR(EBUSY); | 229 | return DRM_ERR(EBUSY); |
231 | } | 230 | } |
232 | 231 | ||
233 | /* Start the Concurrent Command Engine. | 232 | /* Start the Concurrent Command Engine. |
234 | */ | 233 | */ |
235 | static void r128_do_cce_start( drm_r128_private_t *dev_priv ) | 234 | static void r128_do_cce_start(drm_r128_private_t * dev_priv) |
236 | { | 235 | { |
237 | r128_do_wait_for_idle( dev_priv ); | 236 | r128_do_wait_for_idle(dev_priv); |
238 | 237 | ||
239 | R128_WRITE( R128_PM4_BUFFER_CNTL, | 238 | R128_WRITE(R128_PM4_BUFFER_CNTL, |
240 | dev_priv->cce_mode | dev_priv->ring.size_l2qw | 239 | dev_priv->cce_mode | dev_priv->ring.size_l2qw |
241 | | R128_PM4_BUFFER_CNTL_NOUPDATE ); | 240 | | R128_PM4_BUFFER_CNTL_NOUPDATE); |
242 | R128_READ( R128_PM4_BUFFER_ADDR ); /* as per the sample code */ | 241 | R128_READ(R128_PM4_BUFFER_ADDR); /* as per the sample code */ |
243 | R128_WRITE( R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN ); | 242 | R128_WRITE(R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN); |
244 | 243 | ||
245 | dev_priv->cce_running = 1; | 244 | dev_priv->cce_running = 1; |
246 | } | 245 | } |
@@ -249,10 +248,10 @@ static void r128_do_cce_start( drm_r128_private_t *dev_priv ) | |||
249 | * commands, so you must wait for the CCE command stream to complete | 248 | * commands, so you must wait for the CCE command stream to complete |
250 | * before calling this routine. | 249 | * before calling this routine. |
251 | */ | 250 | */ |
252 | static void r128_do_cce_reset( drm_r128_private_t *dev_priv ) | 251 | static void r128_do_cce_reset(drm_r128_private_t * dev_priv) |
253 | { | 252 | { |
254 | R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); | 253 | R128_WRITE(R128_PM4_BUFFER_DL_WPTR, 0); |
255 | R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); | 254 | R128_WRITE(R128_PM4_BUFFER_DL_RPTR, 0); |
256 | dev_priv->ring.tail = 0; | 255 | dev_priv->ring.tail = 0; |
257 | } | 256 | } |
258 | 257 | ||
@@ -260,122 +259,120 @@ static void r128_do_cce_reset( drm_r128_private_t *dev_priv ) | |||
260 | * commands, so you must flush the command stream and wait for the CCE | 259 | * commands, so you must flush the command stream and wait for the CCE |
261 | * to go idle before calling this routine. | 260 | * to go idle before calling this routine. |
262 | */ | 261 | */ |
263 | static void r128_do_cce_stop( drm_r128_private_t *dev_priv ) | 262 | static void r128_do_cce_stop(drm_r128_private_t * dev_priv) |
264 | { | 263 | { |
265 | R128_WRITE( R128_PM4_MICRO_CNTL, 0 ); | 264 | R128_WRITE(R128_PM4_MICRO_CNTL, 0); |
266 | R128_WRITE( R128_PM4_BUFFER_CNTL, | 265 | R128_WRITE(R128_PM4_BUFFER_CNTL, |
267 | R128_PM4_NONPM4 | R128_PM4_BUFFER_CNTL_NOUPDATE ); | 266 | R128_PM4_NONPM4 | R128_PM4_BUFFER_CNTL_NOUPDATE); |
268 | 267 | ||
269 | dev_priv->cce_running = 0; | 268 | dev_priv->cce_running = 0; |
270 | } | 269 | } |
271 | 270 | ||
272 | /* Reset the engine. This will stop the CCE if it is running. | 271 | /* Reset the engine. This will stop the CCE if it is running. |
273 | */ | 272 | */ |
274 | static int r128_do_engine_reset( drm_device_t *dev ) | 273 | static int r128_do_engine_reset(drm_device_t * dev) |
275 | { | 274 | { |
276 | drm_r128_private_t *dev_priv = dev->dev_private; | 275 | drm_r128_private_t *dev_priv = dev->dev_private; |
277 | u32 clock_cntl_index, mclk_cntl, gen_reset_cntl; | 276 | u32 clock_cntl_index, mclk_cntl, gen_reset_cntl; |
278 | 277 | ||
279 | r128_do_pixcache_flush( dev_priv ); | 278 | r128_do_pixcache_flush(dev_priv); |
280 | 279 | ||
281 | clock_cntl_index = R128_READ( R128_CLOCK_CNTL_INDEX ); | 280 | clock_cntl_index = R128_READ(R128_CLOCK_CNTL_INDEX); |
282 | mclk_cntl = R128_READ_PLL( dev, R128_MCLK_CNTL ); | 281 | mclk_cntl = R128_READ_PLL(dev, R128_MCLK_CNTL); |
283 | 282 | ||
284 | R128_WRITE_PLL( R128_MCLK_CNTL, | 283 | R128_WRITE_PLL(R128_MCLK_CNTL, |
285 | mclk_cntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP ); | 284 | mclk_cntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP); |
286 | 285 | ||
287 | gen_reset_cntl = R128_READ( R128_GEN_RESET_CNTL ); | 286 | gen_reset_cntl = R128_READ(R128_GEN_RESET_CNTL); |
288 | 287 | ||
289 | /* Taken from the sample code - do not change */ | 288 | /* Taken from the sample code - do not change */ |
290 | R128_WRITE( R128_GEN_RESET_CNTL, | 289 | R128_WRITE(R128_GEN_RESET_CNTL, gen_reset_cntl | R128_SOFT_RESET_GUI); |
291 | gen_reset_cntl | R128_SOFT_RESET_GUI ); | 290 | R128_READ(R128_GEN_RESET_CNTL); |
292 | R128_READ( R128_GEN_RESET_CNTL ); | 291 | R128_WRITE(R128_GEN_RESET_CNTL, gen_reset_cntl & ~R128_SOFT_RESET_GUI); |
293 | R128_WRITE( R128_GEN_RESET_CNTL, | 292 | R128_READ(R128_GEN_RESET_CNTL); |
294 | gen_reset_cntl & ~R128_SOFT_RESET_GUI ); | ||
295 | R128_READ( R128_GEN_RESET_CNTL ); | ||
296 | 293 | ||
297 | R128_WRITE_PLL( R128_MCLK_CNTL, mclk_cntl ); | 294 | R128_WRITE_PLL(R128_MCLK_CNTL, mclk_cntl); |
298 | R128_WRITE( R128_CLOCK_CNTL_INDEX, clock_cntl_index ); | 295 | R128_WRITE(R128_CLOCK_CNTL_INDEX, clock_cntl_index); |
299 | R128_WRITE( R128_GEN_RESET_CNTL, gen_reset_cntl ); | 296 | R128_WRITE(R128_GEN_RESET_CNTL, gen_reset_cntl); |
300 | 297 | ||
301 | /* Reset the CCE ring */ | 298 | /* Reset the CCE ring */ |
302 | r128_do_cce_reset( dev_priv ); | 299 | r128_do_cce_reset(dev_priv); |
303 | 300 | ||
304 | /* The CCE is no longer running after an engine reset */ | 301 | /* The CCE is no longer running after an engine reset */ |
305 | dev_priv->cce_running = 0; | 302 | dev_priv->cce_running = 0; |
306 | 303 | ||
307 | /* Reset any pending vertex, indirect buffers */ | 304 | /* Reset any pending vertex, indirect buffers */ |
308 | r128_freelist_reset( dev ); | 305 | r128_freelist_reset(dev); |
309 | 306 | ||
310 | return 0; | 307 | return 0; |
311 | } | 308 | } |
312 | 309 | ||
313 | static void r128_cce_init_ring_buffer( drm_device_t *dev, | 310 | static void r128_cce_init_ring_buffer(drm_device_t * dev, |
314 | drm_r128_private_t *dev_priv ) | 311 | drm_r128_private_t * dev_priv) |
315 | { | 312 | { |
316 | u32 ring_start; | 313 | u32 ring_start; |
317 | u32 tmp; | 314 | u32 tmp; |
318 | 315 | ||
319 | DRM_DEBUG( "\n" ); | 316 | DRM_DEBUG("\n"); |
320 | 317 | ||
321 | /* The manual (p. 2) says this address is in "VM space". This | 318 | /* The manual (p. 2) says this address is in "VM space". This |
322 | * means it's an offset from the start of AGP space. | 319 | * means it's an offset from the start of AGP space. |
323 | */ | 320 | */ |
324 | #if __OS_HAS_AGP | 321 | #if __OS_HAS_AGP |
325 | if ( !dev_priv->is_pci ) | 322 | if (!dev_priv->is_pci) |
326 | ring_start = dev_priv->cce_ring->offset - dev->agp->base; | 323 | ring_start = dev_priv->cce_ring->offset - dev->agp->base; |
327 | else | 324 | else |
328 | #endif | 325 | #endif |
329 | ring_start = dev_priv->cce_ring->offset - | 326 | ring_start = dev_priv->cce_ring->offset - |
330 | (unsigned long)dev->sg->virtual; | 327 | (unsigned long)dev->sg->virtual; |
331 | 328 | ||
332 | R128_WRITE( R128_PM4_BUFFER_OFFSET, ring_start | R128_AGP_OFFSET ); | 329 | R128_WRITE(R128_PM4_BUFFER_OFFSET, ring_start | R128_AGP_OFFSET); |
333 | 330 | ||
334 | R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); | 331 | R128_WRITE(R128_PM4_BUFFER_DL_WPTR, 0); |
335 | R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); | 332 | R128_WRITE(R128_PM4_BUFFER_DL_RPTR, 0); |
336 | 333 | ||
337 | /* Set watermark control */ | 334 | /* Set watermark control */ |
338 | R128_WRITE( R128_PM4_BUFFER_WM_CNTL, | 335 | R128_WRITE(R128_PM4_BUFFER_WM_CNTL, |
339 | ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) | 336 | ((R128_WATERMARK_L / 4) << R128_WMA_SHIFT) |
340 | | ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) | 337 | | ((R128_WATERMARK_M / 4) << R128_WMB_SHIFT) |
341 | | ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) | 338 | | ((R128_WATERMARK_N / 4) << R128_WMC_SHIFT) |
342 | | ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT) ); | 339 | | ((R128_WATERMARK_K / 64) << R128_WB_WM_SHIFT)); |
343 | 340 | ||
344 | /* Force read. Why? Because it's in the examples... */ | 341 | /* Force read. Why? Because it's in the examples... */ |
345 | R128_READ( R128_PM4_BUFFER_ADDR ); | 342 | R128_READ(R128_PM4_BUFFER_ADDR); |
346 | 343 | ||
347 | /* Turn on bus mastering */ | 344 | /* Turn on bus mastering */ |
348 | tmp = R128_READ( R128_BUS_CNTL ) & ~R128_BUS_MASTER_DIS; | 345 | tmp = R128_READ(R128_BUS_CNTL) & ~R128_BUS_MASTER_DIS; |
349 | R128_WRITE( R128_BUS_CNTL, tmp ); | 346 | R128_WRITE(R128_BUS_CNTL, tmp); |
350 | } | 347 | } |
351 | 348 | ||
352 | static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) | 349 | static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init) |
353 | { | 350 | { |
354 | drm_r128_private_t *dev_priv; | 351 | drm_r128_private_t *dev_priv; |
355 | 352 | ||
356 | DRM_DEBUG( "\n" ); | 353 | DRM_DEBUG("\n"); |
357 | 354 | ||
358 | dev_priv = drm_alloc( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); | 355 | dev_priv = drm_alloc(sizeof(drm_r128_private_t), DRM_MEM_DRIVER); |
359 | if ( dev_priv == NULL ) | 356 | if (dev_priv == NULL) |
360 | return DRM_ERR(ENOMEM); | 357 | return DRM_ERR(ENOMEM); |
361 | 358 | ||
362 | memset( dev_priv, 0, sizeof(drm_r128_private_t) ); | 359 | memset(dev_priv, 0, sizeof(drm_r128_private_t)); |
363 | 360 | ||
364 | dev_priv->is_pci = init->is_pci; | 361 | dev_priv->is_pci = init->is_pci; |
365 | 362 | ||
366 | if ( dev_priv->is_pci && !dev->sg ) { | 363 | if (dev_priv->is_pci && !dev->sg) { |
367 | DRM_ERROR( "PCI GART memory not allocated!\n" ); | 364 | DRM_ERROR("PCI GART memory not allocated!\n"); |
368 | dev->dev_private = (void *)dev_priv; | 365 | dev->dev_private = (void *)dev_priv; |
369 | r128_do_cleanup_cce( dev ); | 366 | r128_do_cleanup_cce(dev); |
370 | return DRM_ERR(EINVAL); | 367 | return DRM_ERR(EINVAL); |
371 | } | 368 | } |
372 | 369 | ||
373 | dev_priv->usec_timeout = init->usec_timeout; | 370 | dev_priv->usec_timeout = init->usec_timeout; |
374 | if ( dev_priv->usec_timeout < 1 || | 371 | if (dev_priv->usec_timeout < 1 || |
375 | dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { | 372 | dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT) { |
376 | DRM_DEBUG( "TIMEOUT problem!\n" ); | 373 | DRM_DEBUG("TIMEOUT problem!\n"); |
377 | dev->dev_private = (void *)dev_priv; | 374 | dev->dev_private = (void *)dev_priv; |
378 | r128_do_cleanup_cce( dev ); | 375 | r128_do_cleanup_cce(dev); |
379 | return DRM_ERR(EINVAL); | 376 | return DRM_ERR(EINVAL); |
380 | } | 377 | } |
381 | 378 | ||
@@ -383,23 +380,23 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) | |||
383 | 380 | ||
384 | /* GH: Simple idle check. | 381 | /* GH: Simple idle check. |
385 | */ | 382 | */ |
386 | atomic_set( &dev_priv->idle_count, 0 ); | 383 | atomic_set(&dev_priv->idle_count, 0); |
387 | 384 | ||
388 | /* We don't support anything other than bus-mastering ring mode, | 385 | /* We don't support anything other than bus-mastering ring mode, |
389 | * but the ring can be in either AGP or PCI space for the ring | 386 | * but the ring can be in either AGP or PCI space for the ring |
390 | * read pointer. | 387 | * read pointer. |
391 | */ | 388 | */ |
392 | if ( ( init->cce_mode != R128_PM4_192BM ) && | 389 | if ((init->cce_mode != R128_PM4_192BM) && |
393 | ( init->cce_mode != R128_PM4_128BM_64INDBM ) && | 390 | (init->cce_mode != R128_PM4_128BM_64INDBM) && |
394 | ( init->cce_mode != R128_PM4_64BM_128INDBM ) && | 391 | (init->cce_mode != R128_PM4_64BM_128INDBM) && |
395 | ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { | 392 | (init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM)) { |
396 | DRM_DEBUG( "Bad cce_mode!\n" ); | 393 | DRM_DEBUG("Bad cce_mode!\n"); |
397 | dev->dev_private = (void *)dev_priv; | 394 | dev->dev_private = (void *)dev_priv; |
398 | r128_do_cleanup_cce( dev ); | 395 | r128_do_cleanup_cce(dev); |
399 | return DRM_ERR(EINVAL); | 396 | return DRM_ERR(EINVAL); |
400 | } | 397 | } |
401 | 398 | ||
402 | switch ( init->cce_mode ) { | 399 | switch (init->cce_mode) { |
403 | case R128_PM4_NONPM4: | 400 | case R128_PM4_NONPM4: |
404 | dev_priv->cce_fifo_size = 0; | 401 | dev_priv->cce_fifo_size = 0; |
405 | break; | 402 | break; |
@@ -420,7 +417,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) | |||
420 | break; | 417 | break; |
421 | } | 418 | } |
422 | 419 | ||
423 | switch ( init->fb_bpp ) { | 420 | switch (init->fb_bpp) { |
424 | case 16: | 421 | case 16: |
425 | dev_priv->color_fmt = R128_DATATYPE_RGB565; | 422 | dev_priv->color_fmt = R128_DATATYPE_RGB565; |
426 | break; | 423 | break; |
@@ -429,12 +426,12 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) | |||
429 | dev_priv->color_fmt = R128_DATATYPE_ARGB8888; | 426 | dev_priv->color_fmt = R128_DATATYPE_ARGB8888; |
430 | break; | 427 | break; |
431 | } | 428 | } |
432 | dev_priv->front_offset = init->front_offset; | 429 | dev_priv->front_offset = init->front_offset; |
433 | dev_priv->front_pitch = init->front_pitch; | 430 | dev_priv->front_pitch = init->front_pitch; |
434 | dev_priv->back_offset = init->back_offset; | 431 | dev_priv->back_offset = init->back_offset; |
435 | dev_priv->back_pitch = init->back_pitch; | 432 | dev_priv->back_pitch = init->back_pitch; |
436 | 433 | ||
437 | switch ( init->depth_bpp ) { | 434 | switch (init->depth_bpp) { |
438 | case 16: | 435 | case 16: |
439 | dev_priv->depth_fmt = R128_DATATYPE_RGB565; | 436 | dev_priv->depth_fmt = R128_DATATYPE_RGB565; |
440 | break; | 437 | break; |
@@ -444,218 +441,223 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) | |||
444 | dev_priv->depth_fmt = R128_DATATYPE_ARGB8888; | 441 | dev_priv->depth_fmt = R128_DATATYPE_ARGB8888; |
445 | break; | 442 | break; |
446 | } | 443 | } |
447 | dev_priv->depth_offset = init->depth_offset; | 444 | dev_priv->depth_offset = init->depth_offset; |
448 | dev_priv->depth_pitch = init->depth_pitch; | 445 | dev_priv->depth_pitch = init->depth_pitch; |
449 | dev_priv->span_offset = init->span_offset; | 446 | dev_priv->span_offset = init->span_offset; |
450 | 447 | ||
451 | dev_priv->front_pitch_offset_c = (((dev_priv->front_pitch/8) << 21) | | 448 | dev_priv->front_pitch_offset_c = (((dev_priv->front_pitch / 8) << 21) | |
452 | (dev_priv->front_offset >> 5)); | 449 | (dev_priv->front_offset >> 5)); |
453 | dev_priv->back_pitch_offset_c = (((dev_priv->back_pitch/8) << 21) | | 450 | dev_priv->back_pitch_offset_c = (((dev_priv->back_pitch / 8) << 21) | |
454 | (dev_priv->back_offset >> 5)); | 451 | (dev_priv->back_offset >> 5)); |
455 | dev_priv->depth_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | | 452 | dev_priv->depth_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) | |
456 | (dev_priv->depth_offset >> 5) | | 453 | (dev_priv->depth_offset >> 5) | |
457 | R128_DST_TILE); | 454 | R128_DST_TILE); |
458 | dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | | 455 | dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) | |
459 | (dev_priv->span_offset >> 5)); | 456 | (dev_priv->span_offset >> 5)); |
460 | 457 | ||
461 | DRM_GETSAREA(); | 458 | DRM_GETSAREA(); |
462 | 459 | ||
463 | if(!dev_priv->sarea) { | 460 | if (!dev_priv->sarea) { |
464 | DRM_ERROR("could not find sarea!\n"); | 461 | DRM_ERROR("could not find sarea!\n"); |
465 | dev->dev_private = (void *)dev_priv; | 462 | dev->dev_private = (void *)dev_priv; |
466 | r128_do_cleanup_cce( dev ); | 463 | r128_do_cleanup_cce(dev); |
467 | return DRM_ERR(EINVAL); | 464 | return DRM_ERR(EINVAL); |
468 | } | 465 | } |
469 | 466 | ||
470 | dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); | 467 | dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); |
471 | if(!dev_priv->mmio) { | 468 | if (!dev_priv->mmio) { |
472 | DRM_ERROR("could not find mmio region!\n"); | 469 | DRM_ERROR("could not find mmio region!\n"); |
473 | dev->dev_private = (void *)dev_priv; | 470 | dev->dev_private = (void *)dev_priv; |
474 | r128_do_cleanup_cce( dev ); | 471 | r128_do_cleanup_cce(dev); |
475 | return DRM_ERR(EINVAL); | 472 | return DRM_ERR(EINVAL); |
476 | } | 473 | } |
477 | dev_priv->cce_ring = drm_core_findmap(dev, init->ring_offset); | 474 | dev_priv->cce_ring = drm_core_findmap(dev, init->ring_offset); |
478 | if(!dev_priv->cce_ring) { | 475 | if (!dev_priv->cce_ring) { |
479 | DRM_ERROR("could not find cce ring region!\n"); | 476 | DRM_ERROR("could not find cce ring region!\n"); |
480 | dev->dev_private = (void *)dev_priv; | 477 | dev->dev_private = (void *)dev_priv; |
481 | r128_do_cleanup_cce( dev ); | 478 | r128_do_cleanup_cce(dev); |
482 | return DRM_ERR(EINVAL); | 479 | return DRM_ERR(EINVAL); |
483 | } | 480 | } |
484 | dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); | 481 | dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); |
485 | if(!dev_priv->ring_rptr) { | 482 | if (!dev_priv->ring_rptr) { |
486 | DRM_ERROR("could not find ring read pointer!\n"); | 483 | DRM_ERROR("could not find ring read pointer!\n"); |
487 | dev->dev_private = (void *)dev_priv; | 484 | dev->dev_private = (void *)dev_priv; |
488 | r128_do_cleanup_cce( dev ); | 485 | r128_do_cleanup_cce(dev); |
489 | return DRM_ERR(EINVAL); | 486 | return DRM_ERR(EINVAL); |
490 | } | 487 | } |
491 | dev->agp_buffer_token = init->buffers_offset; | 488 | dev->agp_buffer_token = init->buffers_offset; |
492 | dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); | 489 | dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); |
493 | if(!dev->agp_buffer_map) { | 490 | if (!dev->agp_buffer_map) { |
494 | DRM_ERROR("could not find dma buffer region!\n"); | 491 | DRM_ERROR("could not find dma buffer region!\n"); |
495 | dev->dev_private = (void *)dev_priv; | 492 | dev->dev_private = (void *)dev_priv; |
496 | r128_do_cleanup_cce( dev ); | 493 | r128_do_cleanup_cce(dev); |
497 | return DRM_ERR(EINVAL); | 494 | return DRM_ERR(EINVAL); |
498 | } | 495 | } |
499 | 496 | ||
500 | if ( !dev_priv->is_pci ) { | 497 | if (!dev_priv->is_pci) { |
501 | dev_priv->agp_textures = drm_core_findmap(dev, init->agp_textures_offset); | 498 | dev_priv->agp_textures = |
502 | if(!dev_priv->agp_textures) { | 499 | drm_core_findmap(dev, init->agp_textures_offset); |
500 | if (!dev_priv->agp_textures) { | ||
503 | DRM_ERROR("could not find agp texture region!\n"); | 501 | DRM_ERROR("could not find agp texture region!\n"); |
504 | dev->dev_private = (void *)dev_priv; | 502 | dev->dev_private = (void *)dev_priv; |
505 | r128_do_cleanup_cce( dev ); | 503 | r128_do_cleanup_cce(dev); |
506 | return DRM_ERR(EINVAL); | 504 | return DRM_ERR(EINVAL); |
507 | } | 505 | } |
508 | } | 506 | } |
509 | 507 | ||
510 | dev_priv->sarea_priv = | 508 | dev_priv->sarea_priv = |
511 | (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + | 509 | (drm_r128_sarea_t *) ((u8 *) dev_priv->sarea->handle + |
512 | init->sarea_priv_offset); | 510 | init->sarea_priv_offset); |
513 | 511 | ||
514 | #if __OS_HAS_AGP | 512 | #if __OS_HAS_AGP |
515 | if ( !dev_priv->is_pci ) { | 513 | if (!dev_priv->is_pci) { |
516 | drm_core_ioremap( dev_priv->cce_ring, dev ); | 514 | drm_core_ioremap(dev_priv->cce_ring, dev); |
517 | drm_core_ioremap( dev_priv->ring_rptr, dev ); | 515 | drm_core_ioremap(dev_priv->ring_rptr, dev); |
518 | drm_core_ioremap( dev->agp_buffer_map, dev ); | 516 | drm_core_ioremap(dev->agp_buffer_map, dev); |
519 | if(!dev_priv->cce_ring->handle || | 517 | if (!dev_priv->cce_ring->handle || |
520 | !dev_priv->ring_rptr->handle || | 518 | !dev_priv->ring_rptr->handle || |
521 | !dev->agp_buffer_map->handle) { | 519 | !dev->agp_buffer_map->handle) { |
522 | DRM_ERROR("Could not ioremap agp regions!\n"); | 520 | DRM_ERROR("Could not ioremap agp regions!\n"); |
523 | dev->dev_private = (void *)dev_priv; | 521 | dev->dev_private = (void *)dev_priv; |
524 | r128_do_cleanup_cce( dev ); | 522 | r128_do_cleanup_cce(dev); |
525 | return DRM_ERR(ENOMEM); | 523 | return DRM_ERR(ENOMEM); |
526 | } | 524 | } |
527 | } else | 525 | } else |
528 | #endif | 526 | #endif |
529 | { | 527 | { |
530 | dev_priv->cce_ring->handle = | 528 | dev_priv->cce_ring->handle = (void *)dev_priv->cce_ring->offset; |
531 | (void *)dev_priv->cce_ring->offset; | ||
532 | dev_priv->ring_rptr->handle = | 529 | dev_priv->ring_rptr->handle = |
533 | (void *)dev_priv->ring_rptr->offset; | 530 | (void *)dev_priv->ring_rptr->offset; |
534 | dev->agp_buffer_map->handle = (void *)dev->agp_buffer_map->offset; | 531 | dev->agp_buffer_map->handle = |
532 | (void *)dev->agp_buffer_map->offset; | ||
535 | } | 533 | } |
536 | 534 | ||
537 | #if __OS_HAS_AGP | 535 | #if __OS_HAS_AGP |
538 | if ( !dev_priv->is_pci ) | 536 | if (!dev_priv->is_pci) |
539 | dev_priv->cce_buffers_offset = dev->agp->base; | 537 | dev_priv->cce_buffers_offset = dev->agp->base; |
540 | else | 538 | else |
541 | #endif | 539 | #endif |
542 | dev_priv->cce_buffers_offset = (unsigned long)dev->sg->virtual; | 540 | dev_priv->cce_buffers_offset = (unsigned long)dev->sg->virtual; |
543 | 541 | ||
544 | dev_priv->ring.start = (u32 *)dev_priv->cce_ring->handle; | 542 | dev_priv->ring.start = (u32 *) dev_priv->cce_ring->handle; |
545 | dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle | 543 | dev_priv->ring.end = ((u32 *) dev_priv->cce_ring->handle |
546 | + init->ring_size / sizeof(u32)); | 544 | + init->ring_size / sizeof(u32)); |
547 | dev_priv->ring.size = init->ring_size; | 545 | dev_priv->ring.size = init->ring_size; |
548 | dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 ); | 546 | dev_priv->ring.size_l2qw = drm_order(init->ring_size / 8); |
549 | 547 | ||
550 | dev_priv->ring.tail_mask = | 548 | dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1; |
551 | (dev_priv->ring.size / sizeof(u32)) - 1; | ||
552 | 549 | ||
553 | dev_priv->ring.high_mark = 128; | 550 | dev_priv->ring.high_mark = 128; |
554 | 551 | ||
555 | dev_priv->sarea_priv->last_frame = 0; | 552 | dev_priv->sarea_priv->last_frame = 0; |
556 | R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame ); | 553 | R128_WRITE(R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame); |
557 | 554 | ||
558 | dev_priv->sarea_priv->last_dispatch = 0; | 555 | dev_priv->sarea_priv->last_dispatch = 0; |
559 | R128_WRITE( R128_LAST_DISPATCH_REG, | 556 | R128_WRITE(R128_LAST_DISPATCH_REG, dev_priv->sarea_priv->last_dispatch); |
560 | dev_priv->sarea_priv->last_dispatch ); | ||
561 | 557 | ||
562 | #if __OS_HAS_AGP | 558 | #if __OS_HAS_AGP |
563 | if ( dev_priv->is_pci ) { | 559 | if (dev_priv->is_pci) { |
564 | #endif | 560 | #endif |
565 | if (!drm_ati_pcigart_init( dev, &dev_priv->phys_pci_gart, | 561 | dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN; |
566 | &dev_priv->bus_pci_gart) ) { | 562 | dev_priv->gart_info.addr = dev_priv->gart_info.bus_addr = 0; |
567 | DRM_ERROR( "failed to init PCI GART!\n" ); | 563 | dev_priv->gart_info.is_pcie = 0; |
564 | if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { | ||
565 | DRM_ERROR("failed to init PCI GART!\n"); | ||
568 | dev->dev_private = (void *)dev_priv; | 566 | dev->dev_private = (void *)dev_priv; |
569 | r128_do_cleanup_cce( dev ); | 567 | r128_do_cleanup_cce(dev); |
570 | return DRM_ERR(ENOMEM); | 568 | return DRM_ERR(ENOMEM); |
571 | } | 569 | } |
572 | R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart ); | 570 | R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr); |
573 | #if __OS_HAS_AGP | 571 | #if __OS_HAS_AGP |
574 | } | 572 | } |
575 | #endif | 573 | #endif |
576 | 574 | ||
577 | r128_cce_init_ring_buffer( dev, dev_priv ); | 575 | r128_cce_init_ring_buffer(dev, dev_priv); |
578 | r128_cce_load_microcode( dev_priv ); | 576 | r128_cce_load_microcode(dev_priv); |
579 | 577 | ||
580 | dev->dev_private = (void *)dev_priv; | 578 | dev->dev_private = (void *)dev_priv; |
581 | 579 | ||
582 | r128_do_engine_reset( dev ); | 580 | r128_do_engine_reset(dev); |
583 | 581 | ||
584 | return 0; | 582 | return 0; |
585 | } | 583 | } |
586 | 584 | ||
587 | int r128_do_cleanup_cce( drm_device_t *dev ) | 585 | int r128_do_cleanup_cce(drm_device_t * dev) |
588 | { | 586 | { |
589 | 587 | ||
590 | /* Make sure interrupts are disabled here because the uninstall ioctl | 588 | /* Make sure interrupts are disabled here because the uninstall ioctl |
591 | * may not have been called from userspace and after dev_private | 589 | * may not have been called from userspace and after dev_private |
592 | * is freed, it's too late. | 590 | * is freed, it's too late. |
593 | */ | 591 | */ |
594 | if ( dev->irq_enabled ) drm_irq_uninstall(dev); | 592 | if (dev->irq_enabled) |
593 | drm_irq_uninstall(dev); | ||
595 | 594 | ||
596 | if ( dev->dev_private ) { | 595 | if (dev->dev_private) { |
597 | drm_r128_private_t *dev_priv = dev->dev_private; | 596 | drm_r128_private_t *dev_priv = dev->dev_private; |
598 | 597 | ||
599 | #if __OS_HAS_AGP | 598 | #if __OS_HAS_AGP |
600 | if ( !dev_priv->is_pci ) { | 599 | if (!dev_priv->is_pci) { |
601 | if ( dev_priv->cce_ring != NULL ) | 600 | if (dev_priv->cce_ring != NULL) |
602 | drm_core_ioremapfree( dev_priv->cce_ring, dev ); | 601 | drm_core_ioremapfree(dev_priv->cce_ring, dev); |
603 | if ( dev_priv->ring_rptr != NULL ) | 602 | if (dev_priv->ring_rptr != NULL) |
604 | drm_core_ioremapfree( dev_priv->ring_rptr, dev ); | 603 | drm_core_ioremapfree(dev_priv->ring_rptr, dev); |
605 | if ( dev->agp_buffer_map != NULL ) | 604 | if (dev->agp_buffer_map != NULL) |
606 | drm_core_ioremapfree( dev->agp_buffer_map, dev ); | 605 | drm_core_ioremapfree(dev->agp_buffer_map, dev); |
607 | } else | 606 | } else |
608 | #endif | 607 | #endif |
609 | { | 608 | { |
610 | if (!drm_ati_pcigart_cleanup( dev, | 609 | if (dev_priv->gart_info.bus_addr) |
611 | dev_priv->phys_pci_gart, | 610 | if (!drm_ati_pcigart_cleanup(dev, |
612 | dev_priv->bus_pci_gart )) | 611 | &dev_priv-> |
613 | DRM_ERROR( "failed to cleanup PCI GART!\n" ); | 612 | gart_info)) |
613 | DRM_ERROR | ||
614 | ("failed to cleanup PCI GART!\n"); | ||
614 | } | 615 | } |
615 | 616 | ||
616 | drm_free( dev->dev_private, sizeof(drm_r128_private_t), | 617 | drm_free(dev->dev_private, sizeof(drm_r128_private_t), |
617 | DRM_MEM_DRIVER ); | 618 | DRM_MEM_DRIVER); |
618 | dev->dev_private = NULL; | 619 | dev->dev_private = NULL; |
619 | } | 620 | } |
620 | 621 | ||
621 | return 0; | 622 | return 0; |
622 | } | 623 | } |
623 | 624 | ||
624 | int r128_cce_init( DRM_IOCTL_ARGS ) | 625 | int r128_cce_init(DRM_IOCTL_ARGS) |
625 | { | 626 | { |
626 | DRM_DEVICE; | 627 | DRM_DEVICE; |
627 | drm_r128_init_t init; | 628 | drm_r128_init_t init; |
628 | 629 | ||
629 | DRM_DEBUG( "\n" ); | 630 | DRM_DEBUG("\n"); |
630 | 631 | ||
631 | LOCK_TEST_WITH_RETURN( dev, filp ); | 632 | LOCK_TEST_WITH_RETURN(dev, filp); |
632 | 633 | ||
633 | DRM_COPY_FROM_USER_IOCTL( init, (drm_r128_init_t __user *)data, sizeof(init) ); | 634 | DRM_COPY_FROM_USER_IOCTL(init, (drm_r128_init_t __user *) data, |
635 | sizeof(init)); | ||
634 | 636 | ||
635 | switch ( init.func ) { | 637 | switch (init.func) { |
636 | case R128_INIT_CCE: | 638 | case R128_INIT_CCE: |
637 | return r128_do_init_cce( dev, &init ); | 639 | return r128_do_init_cce(dev, &init); |
638 | case R128_CLEANUP_CCE: | 640 | case R128_CLEANUP_CCE: |
639 | return r128_do_cleanup_cce( dev ); | 641 | return r128_do_cleanup_cce(dev); |
640 | } | 642 | } |
641 | 643 | ||
642 | return DRM_ERR(EINVAL); | 644 | return DRM_ERR(EINVAL); |
643 | } | 645 | } |
644 | 646 | ||
645 | int r128_cce_start( DRM_IOCTL_ARGS ) | 647 | int r128_cce_start(DRM_IOCTL_ARGS) |
646 | { | 648 | { |
647 | DRM_DEVICE; | 649 | DRM_DEVICE; |
648 | drm_r128_private_t *dev_priv = dev->dev_private; | 650 | drm_r128_private_t *dev_priv = dev->dev_private; |
649 | DRM_DEBUG( "\n" ); | 651 | DRM_DEBUG("\n"); |
650 | 652 | ||
651 | LOCK_TEST_WITH_RETURN( dev, filp ); | 653 | LOCK_TEST_WITH_RETURN(dev, filp); |
652 | 654 | ||
653 | if ( dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) { | 655 | if (dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4) { |
654 | DRM_DEBUG( "%s while CCE running\n", __FUNCTION__ ); | 656 | DRM_DEBUG("%s while CCE running\n", __FUNCTION__); |
655 | return 0; | 657 | return 0; |
656 | } | 658 | } |
657 | 659 | ||
658 | r128_do_cce_start( dev_priv ); | 660 | r128_do_cce_start(dev_priv); |
659 | 661 | ||
660 | return 0; | 662 | return 0; |
661 | } | 663 | } |
@@ -663,61 +665,63 @@ int r128_cce_start( DRM_IOCTL_ARGS ) | |||
663 | /* Stop the CCE. The engine must have been idled before calling this | 665 | /* Stop the CCE. The engine must have been idled before calling this |
664 | * routine. | 666 | * routine. |
665 | */ | 667 | */ |
666 | int r128_cce_stop( DRM_IOCTL_ARGS ) | 668 | int r128_cce_stop(DRM_IOCTL_ARGS) |
667 | { | 669 | { |
668 | DRM_DEVICE; | 670 | DRM_DEVICE; |
669 | drm_r128_private_t *dev_priv = dev->dev_private; | 671 | drm_r128_private_t *dev_priv = dev->dev_private; |
670 | drm_r128_cce_stop_t stop; | 672 | drm_r128_cce_stop_t stop; |
671 | int ret; | 673 | int ret; |
672 | DRM_DEBUG( "\n" ); | 674 | DRM_DEBUG("\n"); |
673 | 675 | ||
674 | LOCK_TEST_WITH_RETURN( dev, filp ); | 676 | LOCK_TEST_WITH_RETURN(dev, filp); |
675 | 677 | ||
676 | DRM_COPY_FROM_USER_IOCTL(stop, (drm_r128_cce_stop_t __user *)data, sizeof(stop) ); | 678 | DRM_COPY_FROM_USER_IOCTL(stop, (drm_r128_cce_stop_t __user *) data, |
679 | sizeof(stop)); | ||
677 | 680 | ||
678 | /* Flush any pending CCE commands. This ensures any outstanding | 681 | /* Flush any pending CCE commands. This ensures any outstanding |
679 | * commands are exectuted by the engine before we turn it off. | 682 | * commands are exectuted by the engine before we turn it off. |
680 | */ | 683 | */ |
681 | if ( stop.flush ) { | 684 | if (stop.flush) { |
682 | r128_do_cce_flush( dev_priv ); | 685 | r128_do_cce_flush(dev_priv); |
683 | } | 686 | } |
684 | 687 | ||
685 | /* If we fail to make the engine go idle, we return an error | 688 | /* If we fail to make the engine go idle, we return an error |
686 | * code so that the DRM ioctl wrapper can try again. | 689 | * code so that the DRM ioctl wrapper can try again. |
687 | */ | 690 | */ |
688 | if ( stop.idle ) { | 691 | if (stop.idle) { |
689 | ret = r128_do_cce_idle( dev_priv ); | 692 | ret = r128_do_cce_idle(dev_priv); |
690 | if ( ret ) return ret; | 693 | if (ret) |
694 | return ret; | ||
691 | } | 695 | } |
692 | 696 | ||
693 | /* Finally, we can turn off the CCE. If the engine isn't idle, | 697 | /* Finally, we can turn off the CCE. If the engine isn't idle, |
694 | * we will get some dropped triangles as they won't be fully | 698 | * we will get some dropped triangles as they won't be fully |
695 | * rendered before the CCE is shut down. | 699 | * rendered before the CCE is shut down. |
696 | */ | 700 | */ |
697 | r128_do_cce_stop( dev_priv ); | 701 | r128_do_cce_stop(dev_priv); |
698 | 702 | ||
699 | /* Reset the engine */ | 703 | /* Reset the engine */ |
700 | r128_do_engine_reset( dev ); | 704 | r128_do_engine_reset(dev); |
701 | 705 | ||
702 | return 0; | 706 | return 0; |
703 | } | 707 | } |
704 | 708 | ||
705 | /* Just reset the CCE ring. Called as part of an X Server engine reset. | 709 | /* Just reset the CCE ring. Called as part of an X Server engine reset. |
706 | */ | 710 | */ |
707 | int r128_cce_reset( DRM_IOCTL_ARGS ) | 711 | int r128_cce_reset(DRM_IOCTL_ARGS) |
708 | { | 712 | { |
709 | DRM_DEVICE; | 713 | DRM_DEVICE; |
710 | drm_r128_private_t *dev_priv = dev->dev_private; | 714 | drm_r128_private_t *dev_priv = dev->dev_private; |
711 | DRM_DEBUG( "\n" ); | 715 | DRM_DEBUG("\n"); |
712 | 716 | ||
713 | LOCK_TEST_WITH_RETURN( dev, filp ); | 717 | LOCK_TEST_WITH_RETURN(dev, filp); |
714 | 718 | ||
715 | if ( !dev_priv ) { | 719 | if (!dev_priv) { |
716 | DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); | 720 | DRM_DEBUG("%s called before init done\n", __FUNCTION__); |
717 | return DRM_ERR(EINVAL); | 721 | return DRM_ERR(EINVAL); |
718 | } | 722 | } |
719 | 723 | ||
720 | r128_do_cce_reset( dev_priv ); | 724 | r128_do_cce_reset(dev_priv); |
721 | 725 | ||
722 | /* The CCE is no longer running after an engine reset */ | 726 | /* The CCE is no longer running after an engine reset */ |
723 | dev_priv->cce_running = 0; | 727 | dev_priv->cce_running = 0; |
@@ -725,37 +729,36 @@ int r128_cce_reset( DRM_IOCTL_ARGS ) | |||
725 | return 0; | 729 | return 0; |
726 | } | 730 | } |
727 | 731 | ||
728 | int r128_cce_idle( DRM_IOCTL_ARGS ) | 732 | int r128_cce_idle(DRM_IOCTL_ARGS) |
729 | { | 733 | { |
730 | DRM_DEVICE; | 734 | DRM_DEVICE; |
731 | drm_r128_private_t *dev_priv = dev->dev_private; | 735 | drm_r128_private_t *dev_priv = dev->dev_private; |
732 | DRM_DEBUG( "\n" ); | 736 | DRM_DEBUG("\n"); |
733 | 737 | ||
734 | LOCK_TEST_WITH_RETURN( dev, filp ); | 738 | LOCK_TEST_WITH_RETURN(dev, filp); |
735 | 739 | ||
736 | if ( dev_priv->cce_running ) { | 740 | if (dev_priv->cce_running) { |
737 | r128_do_cce_flush( dev_priv ); | 741 | r128_do_cce_flush(dev_priv); |
738 | } | 742 | } |
739 | 743 | ||
740 | return r128_do_cce_idle( dev_priv ); | 744 | return r128_do_cce_idle(dev_priv); |
741 | } | 745 | } |
742 | 746 | ||
743 | int r128_engine_reset( DRM_IOCTL_ARGS ) | 747 | int r128_engine_reset(DRM_IOCTL_ARGS) |
744 | { | 748 | { |
745 | DRM_DEVICE; | 749 | DRM_DEVICE; |
746 | DRM_DEBUG( "\n" ); | 750 | DRM_DEBUG("\n"); |
747 | 751 | ||
748 | LOCK_TEST_WITH_RETURN( dev, filp ); | 752 | LOCK_TEST_WITH_RETURN(dev, filp); |
749 | 753 | ||
750 | return r128_do_engine_reset( dev ); | 754 | return r128_do_engine_reset(dev); |
751 | } | 755 | } |
752 | 756 | ||
753 | int r128_fullscreen( DRM_IOCTL_ARGS ) | 757 | int r128_fullscreen(DRM_IOCTL_ARGS) |
754 | { | 758 | { |
755 | return DRM_ERR(EINVAL); | 759 | return DRM_ERR(EINVAL); |
756 | } | 760 | } |
757 | 761 | ||
758 | |||
759 | /* ================================================================ | 762 | /* ================================================================ |
760 | * Freelist management | 763 | * Freelist management |
761 | */ | 764 | */ |
@@ -763,7 +766,7 @@ int r128_fullscreen( DRM_IOCTL_ARGS ) | |||
763 | #define R128_BUFFER_FREE 0 | 766 | #define R128_BUFFER_FREE 0 |
764 | 767 | ||
765 | #if 0 | 768 | #if 0 |
766 | static int r128_freelist_init( drm_device_t *dev ) | 769 | static int r128_freelist_init(drm_device_t * dev) |
767 | { | 770 | { |
768 | drm_device_dma_t *dma = dev->dma; | 771 | drm_device_dma_t *dma = dev->dma; |
769 | drm_r128_private_t *dev_priv = dev->dev_private; | 772 | drm_r128_private_t *dev_priv = dev->dev_private; |
@@ -772,27 +775,26 @@ static int r128_freelist_init( drm_device_t *dev ) | |||
772 | drm_r128_freelist_t *entry; | 775 | drm_r128_freelist_t *entry; |
773 | int i; | 776 | int i; |
774 | 777 | ||
775 | dev_priv->head = drm_alloc( sizeof(drm_r128_freelist_t), | 778 | dev_priv->head = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER); |
776 | DRM_MEM_DRIVER ); | 779 | if (dev_priv->head == NULL) |
777 | if ( dev_priv->head == NULL ) | ||
778 | return DRM_ERR(ENOMEM); | 780 | return DRM_ERR(ENOMEM); |
779 | 781 | ||
780 | memset( dev_priv->head, 0, sizeof(drm_r128_freelist_t) ); | 782 | memset(dev_priv->head, 0, sizeof(drm_r128_freelist_t)); |
781 | dev_priv->head->age = R128_BUFFER_USED; | 783 | dev_priv->head->age = R128_BUFFER_USED; |
782 | 784 | ||
783 | for ( i = 0 ; i < dma->buf_count ; i++ ) { | 785 | for (i = 0; i < dma->buf_count; i++) { |
784 | buf = dma->buflist[i]; | 786 | buf = dma->buflist[i]; |
785 | buf_priv = buf->dev_private; | 787 | buf_priv = buf->dev_private; |
786 | 788 | ||
787 | entry = drm_alloc( sizeof(drm_r128_freelist_t), | 789 | entry = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER); |
788 | DRM_MEM_DRIVER ); | 790 | if (!entry) |
789 | if ( !entry ) return DRM_ERR(ENOMEM); | 791 | return DRM_ERR(ENOMEM); |
790 | 792 | ||
791 | entry->age = R128_BUFFER_FREE; | 793 | entry->age = R128_BUFFER_FREE; |
792 | entry->buf = buf; | 794 | entry->buf = buf; |
793 | entry->prev = dev_priv->head; | 795 | entry->prev = dev_priv->head; |
794 | entry->next = dev_priv->head->next; | 796 | entry->next = dev_priv->head->next; |
795 | if ( !entry->next ) | 797 | if (!entry->next) |
796 | dev_priv->tail = entry; | 798 | dev_priv->tail = entry; |
797 | 799 | ||
798 | buf_priv->discard = 0; | 800 | buf_priv->discard = 0; |
@@ -801,7 +803,7 @@ static int r128_freelist_init( drm_device_t *dev ) | |||
801 | 803 | ||
802 | dev_priv->head->next = entry; | 804 | dev_priv->head->next = entry; |
803 | 805 | ||
804 | if ( dev_priv->head->next ) | 806 | if (dev_priv->head->next) |
805 | dev_priv->head->next->prev = entry; | 807 | dev_priv->head->next->prev = entry; |
806 | } | 808 | } |
807 | 809 | ||
@@ -810,7 +812,7 @@ static int r128_freelist_init( drm_device_t *dev ) | |||
810 | } | 812 | } |
811 | #endif | 813 | #endif |
812 | 814 | ||
813 | static drm_buf_t *r128_freelist_get( drm_device_t *dev ) | 815 | static drm_buf_t *r128_freelist_get(drm_device_t * dev) |
814 | { | 816 | { |
815 | drm_device_dma_t *dma = dev->dma; | 817 | drm_device_dma_t *dma = dev->dma; |
816 | drm_r128_private_t *dev_priv = dev->dev_private; | 818 | drm_r128_private_t *dev_priv = dev->dev_private; |
@@ -820,20 +822,20 @@ static drm_buf_t *r128_freelist_get( drm_device_t *dev ) | |||
820 | 822 | ||
821 | /* FIXME: Optimize -- use freelist code */ | 823 | /* FIXME: Optimize -- use freelist code */ |
822 | 824 | ||
823 | for ( i = 0 ; i < dma->buf_count ; i++ ) { | 825 | for (i = 0; i < dma->buf_count; i++) { |
824 | buf = dma->buflist[i]; | 826 | buf = dma->buflist[i]; |
825 | buf_priv = buf->dev_private; | 827 | buf_priv = buf->dev_private; |
826 | if ( buf->filp == 0 ) | 828 | if (buf->filp == 0) |
827 | return buf; | 829 | return buf; |
828 | } | 830 | } |
829 | 831 | ||
830 | for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { | 832 | for (t = 0; t < dev_priv->usec_timeout; t++) { |
831 | u32 done_age = R128_READ( R128_LAST_DISPATCH_REG ); | 833 | u32 done_age = R128_READ(R128_LAST_DISPATCH_REG); |
832 | 834 | ||
833 | for ( i = 0 ; i < dma->buf_count ; i++ ) { | 835 | for (i = 0; i < dma->buf_count; i++) { |
834 | buf = dma->buflist[i]; | 836 | buf = dma->buflist[i]; |
835 | buf_priv = buf->dev_private; | 837 | buf_priv = buf->dev_private; |
836 | if ( buf->pending && buf_priv->age <= done_age ) { | 838 | if (buf->pending && buf_priv->age <= done_age) { |
837 | /* The buffer has been processed, so it | 839 | /* The buffer has been processed, so it |
838 | * can now be used. | 840 | * can now be used. |
839 | */ | 841 | */ |
@@ -841,63 +843,63 @@ static drm_buf_t *r128_freelist_get( drm_device_t *dev ) | |||
841 | return buf; | 843 | return buf; |
842 | } | 844 | } |
843 | } | 845 | } |
844 | DRM_UDELAY( 1 ); | 846 | DRM_UDELAY(1); |
845 | } | 847 | } |
846 | 848 | ||
847 | DRM_DEBUG( "returning NULL!\n" ); | 849 | DRM_DEBUG("returning NULL!\n"); |
848 | return NULL; | 850 | return NULL; |
849 | } | 851 | } |
850 | 852 | ||
851 | void r128_freelist_reset( drm_device_t *dev ) | 853 | void r128_freelist_reset(drm_device_t * dev) |
852 | { | 854 | { |
853 | drm_device_dma_t *dma = dev->dma; | 855 | drm_device_dma_t *dma = dev->dma; |
854 | int i; | 856 | int i; |
855 | 857 | ||
856 | for ( i = 0 ; i < dma->buf_count ; i++ ) { | 858 | for (i = 0; i < dma->buf_count; i++) { |
857 | drm_buf_t *buf = dma->buflist[i]; | 859 | drm_buf_t *buf = dma->buflist[i]; |
858 | drm_r128_buf_priv_t *buf_priv = buf->dev_private; | 860 | drm_r128_buf_priv_t *buf_priv = buf->dev_private; |
859 | buf_priv->age = 0; | 861 | buf_priv->age = 0; |
860 | } | 862 | } |
861 | } | 863 | } |
862 | 864 | ||
863 | |||
864 | /* ================================================================ | 865 | /* ================================================================ |
865 | * CCE command submission | 866 | * CCE command submission |
866 | */ | 867 | */ |
867 | 868 | ||
868 | int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) | 869 | int r128_wait_ring(drm_r128_private_t * dev_priv, int n) |
869 | { | 870 | { |
870 | drm_r128_ring_buffer_t *ring = &dev_priv->ring; | 871 | drm_r128_ring_buffer_t *ring = &dev_priv->ring; |
871 | int i; | 872 | int i; |
872 | 873 | ||
873 | for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { | 874 | for (i = 0; i < dev_priv->usec_timeout; i++) { |
874 | r128_update_ring_snapshot( dev_priv ); | 875 | r128_update_ring_snapshot(dev_priv); |
875 | if ( ring->space >= n ) | 876 | if (ring->space >= n) |
876 | return 0; | 877 | return 0; |
877 | DRM_UDELAY( 1 ); | 878 | DRM_UDELAY(1); |
878 | } | 879 | } |
879 | 880 | ||
880 | /* FIXME: This is being ignored... */ | 881 | /* FIXME: This is being ignored... */ |
881 | DRM_ERROR( "failed!\n" ); | 882 | DRM_ERROR("failed!\n"); |
882 | return DRM_ERR(EBUSY); | 883 | return DRM_ERR(EBUSY); |
883 | } | 884 | } |
884 | 885 | ||
885 | static int r128_cce_get_buffers( DRMFILE filp, drm_device_t *dev, drm_dma_t *d ) | 886 | static int r128_cce_get_buffers(DRMFILE filp, drm_device_t * dev, drm_dma_t * d) |
886 | { | 887 | { |
887 | int i; | 888 | int i; |
888 | drm_buf_t *buf; | 889 | drm_buf_t *buf; |
889 | 890 | ||
890 | for ( i = d->granted_count ; i < d->request_count ; i++ ) { | 891 | for (i = d->granted_count; i < d->request_count; i++) { |
891 | buf = r128_freelist_get( dev ); | 892 | buf = r128_freelist_get(dev); |
892 | if ( !buf ) return DRM_ERR(EAGAIN); | 893 | if (!buf) |
894 | return DRM_ERR(EAGAIN); | ||
893 | 895 | ||
894 | buf->filp = filp; | 896 | buf->filp = filp; |
895 | 897 | ||
896 | if ( DRM_COPY_TO_USER( &d->request_indices[i], &buf->idx, | 898 | if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, |
897 | sizeof(buf->idx) ) ) | 899 | sizeof(buf->idx))) |
898 | return DRM_ERR(EFAULT); | 900 | return DRM_ERR(EFAULT); |
899 | if ( DRM_COPY_TO_USER( &d->request_sizes[i], &buf->total, | 901 | if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, |
900 | sizeof(buf->total) ) ) | 902 | sizeof(buf->total))) |
901 | return DRM_ERR(EFAULT); | 903 | return DRM_ERR(EFAULT); |
902 | 904 | ||
903 | d->granted_count++; | 905 | d->granted_count++; |
@@ -905,7 +907,7 @@ static int r128_cce_get_buffers( DRMFILE filp, drm_device_t *dev, drm_dma_t *d ) | |||
905 | return 0; | 907 | return 0; |
906 | } | 908 | } |
907 | 909 | ||
908 | int r128_cce_buffers( DRM_IOCTL_ARGS ) | 910 | int r128_cce_buffers(DRM_IOCTL_ARGS) |
909 | { | 911 | { |
910 | DRM_DEVICE; | 912 | DRM_DEVICE; |
911 | drm_device_dma_t *dma = dev->dma; | 913 | drm_device_dma_t *dma = dev->dma; |
@@ -913,33 +915,33 @@ int r128_cce_buffers( DRM_IOCTL_ARGS ) | |||
913 | drm_dma_t __user *argp = (void __user *)data; | 915 | drm_dma_t __user *argp = (void __user *)data; |
914 | drm_dma_t d; | 916 | drm_dma_t d; |
915 | 917 | ||
916 | LOCK_TEST_WITH_RETURN( dev, filp ); | 918 | LOCK_TEST_WITH_RETURN(dev, filp); |
917 | 919 | ||
918 | DRM_COPY_FROM_USER_IOCTL( d, argp, sizeof(d) ); | 920 | DRM_COPY_FROM_USER_IOCTL(d, argp, sizeof(d)); |
919 | 921 | ||
920 | /* Please don't send us buffers. | 922 | /* Please don't send us buffers. |
921 | */ | 923 | */ |
922 | if ( d.send_count != 0 ) { | 924 | if (d.send_count != 0) { |
923 | DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", | 925 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", |
924 | DRM_CURRENTPID, d.send_count ); | 926 | DRM_CURRENTPID, d.send_count); |
925 | return DRM_ERR(EINVAL); | 927 | return DRM_ERR(EINVAL); |
926 | } | 928 | } |
927 | 929 | ||
928 | /* We'll send you buffers. | 930 | /* We'll send you buffers. |
929 | */ | 931 | */ |
930 | if ( d.request_count < 0 || d.request_count > dma->buf_count ) { | 932 | if (d.request_count < 0 || d.request_count > dma->buf_count) { |
931 | DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", | 933 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", |
932 | DRM_CURRENTPID, d.request_count, dma->buf_count ); | 934 | DRM_CURRENTPID, d.request_count, dma->buf_count); |
933 | return DRM_ERR(EINVAL); | 935 | return DRM_ERR(EINVAL); |
934 | } | 936 | } |
935 | 937 | ||
936 | d.granted_count = 0; | 938 | d.granted_count = 0; |
937 | 939 | ||
938 | if ( d.request_count ) { | 940 | if (d.request_count) { |
939 | ret = r128_cce_get_buffers( filp, dev, &d ); | 941 | ret = r128_cce_get_buffers(filp, dev, &d); |
940 | } | 942 | } |
941 | 943 | ||
942 | DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d) ); | 944 | DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d)); |
943 | 945 | ||
944 | return ret; | 946 | return ret; |
945 | } | 947 | } |