aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r300.c
diff options
context:
space:
mode:
authorChristian König <deathsimple@vodafone.de>2011-09-23 09:11:23 -0400
committerDave Airlie <airlied@redhat.com>2011-12-20 14:49:46 -0500
commit7b1f2485db253aaa0081e1c5213533e166130732 (patch)
tree77f7e6517d67501108feedfa029f4ea8549a9642 /drivers/gpu/drm/radeon/r300.c
parent15d3332f31afd571a6d23971dbc8d8db2856e661 (diff)
drm/radeon: make all functions work with multiple rings.
Give all asic and radeon_ring_* functions a radeon_cp parameter, so they know the ring to work with. Signed-off-by: Christian König <deathsimple@vodafone.de> Reviewed-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r300.c')
-rw-r--r--drivers/gpu/drm/radeon/r300.c127
1 files changed, 65 insertions, 62 deletions
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index b04731206460..cbb62fc3f2e9 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -175,37 +175,40 @@ void rv370_pcie_gart_fini(struct radeon_device *rdev)
175void r300_fence_ring_emit(struct radeon_device *rdev, 175void r300_fence_ring_emit(struct radeon_device *rdev,
176 struct radeon_fence *fence) 176 struct radeon_fence *fence)
177{ 177{
178 struct radeon_cp *cp = &rdev->cp;
179
178 /* Who ever call radeon_fence_emit should call ring_lock and ask 180 /* Who ever call radeon_fence_emit should call ring_lock and ask
179 * for enough space (today caller are ib schedule and buffer move) */ 181 * for enough space (today caller are ib schedule and buffer move) */
180 /* Write SC register so SC & US assert idle */ 182 /* Write SC register so SC & US assert idle */
181 radeon_ring_write(rdev, PACKET0(R300_RE_SCISSORS_TL, 0)); 183 radeon_ring_write(cp, PACKET0(R300_RE_SCISSORS_TL, 0));
182 radeon_ring_write(rdev, 0); 184 radeon_ring_write(cp, 0);
183 radeon_ring_write(rdev, PACKET0(R300_RE_SCISSORS_BR, 0)); 185 radeon_ring_write(cp, PACKET0(R300_RE_SCISSORS_BR, 0));
184 radeon_ring_write(rdev, 0); 186 radeon_ring_write(cp, 0);
185 /* Flush 3D cache */ 187 /* Flush 3D cache */
186 radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); 188 radeon_ring_write(cp, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
187 radeon_ring_write(rdev, R300_RB3D_DC_FLUSH); 189 radeon_ring_write(cp, R300_RB3D_DC_FLUSH);
188 radeon_ring_write(rdev, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0)); 190 radeon_ring_write(cp, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0));
189 radeon_ring_write(rdev, R300_ZC_FLUSH); 191 radeon_ring_write(cp, R300_ZC_FLUSH);
190 /* Wait until IDLE & CLEAN */ 192 /* Wait until IDLE & CLEAN */
191 radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0)); 193 radeon_ring_write(cp, PACKET0(RADEON_WAIT_UNTIL, 0));
192 radeon_ring_write(rdev, (RADEON_WAIT_3D_IDLECLEAN | 194 radeon_ring_write(cp, (RADEON_WAIT_3D_IDLECLEAN |
193 RADEON_WAIT_2D_IDLECLEAN | 195 RADEON_WAIT_2D_IDLECLEAN |
194 RADEON_WAIT_DMA_GUI_IDLE)); 196 RADEON_WAIT_DMA_GUI_IDLE));
195 radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); 197 radeon_ring_write(cp, PACKET0(RADEON_HOST_PATH_CNTL, 0));
196 radeon_ring_write(rdev, rdev->config.r300.hdp_cntl | 198 radeon_ring_write(cp, rdev->config.r300.hdp_cntl |
197 RADEON_HDP_READ_BUFFER_INVALIDATE); 199 RADEON_HDP_READ_BUFFER_INVALIDATE);
198 radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); 200 radeon_ring_write(cp, PACKET0(RADEON_HOST_PATH_CNTL, 0));
199 radeon_ring_write(rdev, rdev->config.r300.hdp_cntl); 201 radeon_ring_write(cp, rdev->config.r300.hdp_cntl);
200 /* Emit fence sequence & fire IRQ */ 202 /* Emit fence sequence & fire IRQ */
201 radeon_ring_write(rdev, PACKET0(rdev->fence_drv[fence->ring].scratch_reg, 0)); 203 radeon_ring_write(cp, PACKET0(rdev->fence_drv[fence->ring].scratch_reg, 0));
202 radeon_ring_write(rdev, fence->seq); 204 radeon_ring_write(cp, fence->seq);
203 radeon_ring_write(rdev, PACKET0(RADEON_GEN_INT_STATUS, 0)); 205 radeon_ring_write(cp, PACKET0(RADEON_GEN_INT_STATUS, 0));
204 radeon_ring_write(rdev, RADEON_SW_INT_FIRE); 206 radeon_ring_write(cp, RADEON_SW_INT_FIRE);
205} 207}
206 208
207void r300_ring_start(struct radeon_device *rdev) 209void r300_ring_start(struct radeon_device *rdev)
208{ 210{
211 struct radeon_cp *cp = &rdev->cp;
209 unsigned gb_tile_config; 212 unsigned gb_tile_config;
210 int r; 213 int r;
211 214
@@ -227,44 +230,44 @@ void r300_ring_start(struct radeon_device *rdev)
227 break; 230 break;
228 } 231 }
229 232
230 r = radeon_ring_lock(rdev, 64); 233 r = radeon_ring_lock(rdev, cp, 64);
231 if (r) { 234 if (r) {
232 return; 235 return;
233 } 236 }
234 radeon_ring_write(rdev, PACKET0(RADEON_ISYNC_CNTL, 0)); 237 radeon_ring_write(cp, PACKET0(RADEON_ISYNC_CNTL, 0));
235 radeon_ring_write(rdev, 238 radeon_ring_write(cp,
236 RADEON_ISYNC_ANY2D_IDLE3D | 239 RADEON_ISYNC_ANY2D_IDLE3D |
237 RADEON_ISYNC_ANY3D_IDLE2D | 240 RADEON_ISYNC_ANY3D_IDLE2D |
238 RADEON_ISYNC_WAIT_IDLEGUI | 241 RADEON_ISYNC_WAIT_IDLEGUI |
239 RADEON_ISYNC_CPSCRATCH_IDLEGUI); 242 RADEON_ISYNC_CPSCRATCH_IDLEGUI);
240 radeon_ring_write(rdev, PACKET0(R300_GB_TILE_CONFIG, 0)); 243 radeon_ring_write(cp, PACKET0(R300_GB_TILE_CONFIG, 0));
241 radeon_ring_write(rdev, gb_tile_config); 244 radeon_ring_write(cp, gb_tile_config);
242 radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0)); 245 radeon_ring_write(cp, PACKET0(RADEON_WAIT_UNTIL, 0));
243 radeon_ring_write(rdev, 246 radeon_ring_write(cp,
244 RADEON_WAIT_2D_IDLECLEAN | 247 RADEON_WAIT_2D_IDLECLEAN |
245 RADEON_WAIT_3D_IDLECLEAN); 248 RADEON_WAIT_3D_IDLECLEAN);
246 radeon_ring_write(rdev, PACKET0(R300_DST_PIPE_CONFIG, 0)); 249 radeon_ring_write(cp, PACKET0(R300_DST_PIPE_CONFIG, 0));
247 radeon_ring_write(rdev, R300_PIPE_AUTO_CONFIG); 250 radeon_ring_write(cp, R300_PIPE_AUTO_CONFIG);
248 radeon_ring_write(rdev, PACKET0(R300_GB_SELECT, 0)); 251 radeon_ring_write(cp, PACKET0(R300_GB_SELECT, 0));
249 radeon_ring_write(rdev, 0); 252 radeon_ring_write(cp, 0);
250 radeon_ring_write(rdev, PACKET0(R300_GB_ENABLE, 0)); 253 radeon_ring_write(cp, PACKET0(R300_GB_ENABLE, 0));
251 radeon_ring_write(rdev, 0); 254 radeon_ring_write(cp, 0);
252 radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); 255 radeon_ring_write(cp, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
253 radeon_ring_write(rdev, R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE); 256 radeon_ring_write(cp, R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE);
254 radeon_ring_write(rdev, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0)); 257 radeon_ring_write(cp, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0));
255 radeon_ring_write(rdev, R300_ZC_FLUSH | R300_ZC_FREE); 258 radeon_ring_write(cp, R300_ZC_FLUSH | R300_ZC_FREE);
256 radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0)); 259 radeon_ring_write(cp, PACKET0(RADEON_WAIT_UNTIL, 0));
257 radeon_ring_write(rdev, 260 radeon_ring_write(cp,
258 RADEON_WAIT_2D_IDLECLEAN | 261 RADEON_WAIT_2D_IDLECLEAN |
259 RADEON_WAIT_3D_IDLECLEAN); 262 RADEON_WAIT_3D_IDLECLEAN);
260 radeon_ring_write(rdev, PACKET0(R300_GB_AA_CONFIG, 0)); 263 radeon_ring_write(cp, PACKET0(R300_GB_AA_CONFIG, 0));
261 radeon_ring_write(rdev, 0); 264 radeon_ring_write(cp, 0);
262 radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); 265 radeon_ring_write(cp, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
263 radeon_ring_write(rdev, R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE); 266 radeon_ring_write(cp, R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE);
264 radeon_ring_write(rdev, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0)); 267 radeon_ring_write(cp, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0));
265 radeon_ring_write(rdev, R300_ZC_FLUSH | R300_ZC_FREE); 268 radeon_ring_write(cp, R300_ZC_FLUSH | R300_ZC_FREE);
266 radeon_ring_write(rdev, PACKET0(R300_GB_MSPOS0, 0)); 269 radeon_ring_write(cp, PACKET0(R300_GB_MSPOS0, 0));
267 radeon_ring_write(rdev, 270 radeon_ring_write(cp,
268 ((6 << R300_MS_X0_SHIFT) | 271 ((6 << R300_MS_X0_SHIFT) |
269 (6 << R300_MS_Y0_SHIFT) | 272 (6 << R300_MS_Y0_SHIFT) |
270 (6 << R300_MS_X1_SHIFT) | 273 (6 << R300_MS_X1_SHIFT) |
@@ -273,8 +276,8 @@ void r300_ring_start(struct radeon_device *rdev)
273 (6 << R300_MS_Y2_SHIFT) | 276 (6 << R300_MS_Y2_SHIFT) |
274 (6 << R300_MSBD0_Y_SHIFT) | 277 (6 << R300_MSBD0_Y_SHIFT) |
275 (6 << R300_MSBD0_X_SHIFT))); 278 (6 << R300_MSBD0_X_SHIFT)));
276 radeon_ring_write(rdev, PACKET0(R300_GB_MSPOS1, 0)); 279 radeon_ring_write(cp, PACKET0(R300_GB_MSPOS1, 0));
277 radeon_ring_write(rdev, 280 radeon_ring_write(cp,
278 ((6 << R300_MS_X3_SHIFT) | 281 ((6 << R300_MS_X3_SHIFT) |
279 (6 << R300_MS_Y3_SHIFT) | 282 (6 << R300_MS_Y3_SHIFT) |
280 (6 << R300_MS_X4_SHIFT) | 283 (6 << R300_MS_X4_SHIFT) |
@@ -282,16 +285,16 @@ void r300_ring_start(struct radeon_device *rdev)
282 (6 << R300_MS_X5_SHIFT) | 285 (6 << R300_MS_X5_SHIFT) |
283 (6 << R300_MS_Y5_SHIFT) | 286 (6 << R300_MS_Y5_SHIFT) |
284 (6 << R300_MSBD1_SHIFT))); 287 (6 << R300_MSBD1_SHIFT)));
285 radeon_ring_write(rdev, PACKET0(R300_GA_ENHANCE, 0)); 288 radeon_ring_write(cp, PACKET0(R300_GA_ENHANCE, 0));
286 radeon_ring_write(rdev, R300_GA_DEADLOCK_CNTL | R300_GA_FASTSYNC_CNTL); 289 radeon_ring_write(cp, R300_GA_DEADLOCK_CNTL | R300_GA_FASTSYNC_CNTL);
287 radeon_ring_write(rdev, PACKET0(R300_GA_POLY_MODE, 0)); 290 radeon_ring_write(cp, PACKET0(R300_GA_POLY_MODE, 0));
288 radeon_ring_write(rdev, 291 radeon_ring_write(cp,
289 R300_FRONT_PTYPE_TRIANGE | R300_BACK_PTYPE_TRIANGE); 292 R300_FRONT_PTYPE_TRIANGE | R300_BACK_PTYPE_TRIANGE);
290 radeon_ring_write(rdev, PACKET0(R300_GA_ROUND_MODE, 0)); 293 radeon_ring_write(cp, PACKET0(R300_GA_ROUND_MODE, 0));
291 radeon_ring_write(rdev, 294 radeon_ring_write(cp,
292 R300_GEOMETRY_ROUND_NEAREST | 295 R300_GEOMETRY_ROUND_NEAREST |
293 R300_COLOR_ROUND_NEAREST); 296 R300_COLOR_ROUND_NEAREST);
294 radeon_ring_unlock_commit(rdev); 297 radeon_ring_unlock_commit(rdev, cp);
295} 298}
296 299
297void r300_errata(struct radeon_device *rdev) 300void r300_errata(struct radeon_device *rdev)
@@ -375,26 +378,26 @@ void r300_gpu_init(struct radeon_device *rdev)
375 rdev->num_gb_pipes, rdev->num_z_pipes); 378 rdev->num_gb_pipes, rdev->num_z_pipes);
376} 379}
377 380
378bool r300_gpu_is_lockup(struct radeon_device *rdev) 381bool r300_gpu_is_lockup(struct radeon_device *rdev, struct radeon_cp *cp)
379{ 382{
380 u32 rbbm_status; 383 u32 rbbm_status;
381 int r; 384 int r;
382 385
383 rbbm_status = RREG32(R_000E40_RBBM_STATUS); 386 rbbm_status = RREG32(R_000E40_RBBM_STATUS);
384 if (!G_000E40_GUI_ACTIVE(rbbm_status)) { 387 if (!G_000E40_GUI_ACTIVE(rbbm_status)) {
385 r100_gpu_lockup_update(&rdev->config.r300.lockup, &rdev->cp); 388 r100_gpu_lockup_update(&rdev->config.r300.lockup, cp);
386 return false; 389 return false;
387 } 390 }
388 /* force CP activities */ 391 /* force CP activities */
389 r = radeon_ring_lock(rdev, 2); 392 r = radeon_ring_lock(rdev, cp, 2);
390 if (!r) { 393 if (!r) {
391 /* PACKET2 NOP */ 394 /* PACKET2 NOP */
392 radeon_ring_write(rdev, 0x80000000); 395 radeon_ring_write(cp, 0x80000000);
393 radeon_ring_write(rdev, 0x80000000); 396 radeon_ring_write(cp, 0x80000000);
394 radeon_ring_unlock_commit(rdev); 397 radeon_ring_unlock_commit(rdev, cp);
395 } 398 }
396 rdev->cp.rptr = RREG32(RADEON_CP_RB_RPTR); 399 cp->rptr = RREG32(RADEON_CP_RB_RPTR);
397 return r100_gpu_cp_is_lockup(rdev, &rdev->config.r300.lockup, &rdev->cp); 400 return r100_gpu_cp_is_lockup(rdev, &rdev->config.r300.lockup, cp);
398} 401}
399 402
400int r300_asic_reset(struct radeon_device *rdev) 403int r300_asic_reset(struct radeon_device *rdev)