aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r300.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-02-05 01:58:28 -0500
committerDave Airlie <airlied@redhat.com>2010-02-08 18:31:20 -0500
commit4612dc97991a09e1a9e4d5d981e16589d7cb150c (patch)
treebd307eed8985ad4e445b0b43ece3f0e076aaa86b /drivers/gpu/drm/radeon/r300.c
parent3c537889e17232e9073f75ae8710ea0f008c5a29 (diff)
drm/radeon/kms: clean up some low-hanging magic numbers
Switch some magic numbers to their proper defines. The register header madness needs to be cleaned up at some point. Signed-off-by: Alex Deucher <alexdeucher@gmail.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.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 43b55a030b4d..748335c5fa84 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -174,18 +174,20 @@ void r300_fence_ring_emit(struct radeon_device *rdev,
174 /* Who ever call radeon_fence_emit should call ring_lock and ask 174 /* Who ever call radeon_fence_emit should call ring_lock and ask
175 * for enough space (today caller are ib schedule and buffer move) */ 175 * for enough space (today caller are ib schedule and buffer move) */
176 /* Write SC register so SC & US assert idle */ 176 /* Write SC register so SC & US assert idle */
177 radeon_ring_write(rdev, PACKET0(0x43E0, 0)); 177 radeon_ring_write(rdev, PACKET0(R300_RE_SCISSORS_TL, 0));
178 radeon_ring_write(rdev, 0); 178 radeon_ring_write(rdev, 0);
179 radeon_ring_write(rdev, PACKET0(0x43E4, 0)); 179 radeon_ring_write(rdev, PACKET0(R300_RE_SCISSORS_BR, 0));
180 radeon_ring_write(rdev, 0); 180 radeon_ring_write(rdev, 0);
181 /* Flush 3D cache */ 181 /* Flush 3D cache */
182 radeon_ring_write(rdev, PACKET0(0x4E4C, 0)); 182 radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
183 radeon_ring_write(rdev, (2 << 0)); 183 radeon_ring_write(rdev, R300_RB3D_DC_FLUSH);
184 radeon_ring_write(rdev, PACKET0(0x4F18, 0)); 184 radeon_ring_write(rdev, PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0));
185 radeon_ring_write(rdev, (1 << 0)); 185 radeon_ring_write(rdev, R300_ZC_FLUSH);
186 /* Wait until IDLE & CLEAN */ 186 /* Wait until IDLE & CLEAN */
187 radeon_ring_write(rdev, PACKET0(0x1720, 0)); 187 radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0));
188 radeon_ring_write(rdev, (1 << 17) | (1 << 16) | (1 << 9)); 188 radeon_ring_write(rdev, (RADEON_WAIT_3D_IDLECLEAN |
189 RADEON_WAIT_2D_IDLECLEAN |
190 RADEON_WAIT_DMA_GUI_IDLE));
189 radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); 191 radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0));
190 radeon_ring_write(rdev, rdev->config.r300.hdp_cntl | 192 radeon_ring_write(rdev, rdev->config.r300.hdp_cntl |
191 RADEON_HDP_READ_BUFFER_INVALIDATE); 193 RADEON_HDP_READ_BUFFER_INVALIDATE);
@@ -219,7 +221,7 @@ int r300_copy_dma(struct radeon_device *rdev,
219 } 221 }
220 /* Must wait for 2D idle & clean before DMA or hangs might happen */ 222 /* Must wait for 2D idle & clean before DMA or hangs might happen */
221 radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0 )); 223 radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0 ));
222 radeon_ring_write(rdev, (1 << 16)); 224 radeon_ring_write(rdev, RADEON_WAIT_2D_IDLECLEAN);
223 for (i = 0; i < num_loops; i++) { 225 for (i = 0; i < num_loops; i++) {
224 cur_size = size; 226 cur_size = size;
225 if (cur_size > 0x1FFFFF) { 227 if (cur_size > 0x1FFFFF) {
@@ -281,8 +283,8 @@ void r300_ring_start(struct radeon_device *rdev)
281 radeon_ring_write(rdev, 283 radeon_ring_write(rdev,
282 RADEON_WAIT_2D_IDLECLEAN | 284 RADEON_WAIT_2D_IDLECLEAN |
283 RADEON_WAIT_3D_IDLECLEAN); 285 RADEON_WAIT_3D_IDLECLEAN);
284 radeon_ring_write(rdev, PACKET0(0x170C, 0)); 286 radeon_ring_write(rdev, PACKET0(R300_DST_PIPE_CONFIG, 0));
285 radeon_ring_write(rdev, 1 << 31); 287 radeon_ring_write(rdev, R300_PIPE_AUTO_CONFIG);
286 radeon_ring_write(rdev, PACKET0(R300_GB_SELECT, 0)); 288 radeon_ring_write(rdev, PACKET0(R300_GB_SELECT, 0));
287 radeon_ring_write(rdev, 0); 289 radeon_ring_write(rdev, 0);
288 radeon_ring_write(rdev, PACKET0(R300_GB_ENABLE, 0)); 290 radeon_ring_write(rdev, PACKET0(R300_GB_ENABLE, 0));
@@ -349,8 +351,8 @@ int r300_mc_wait_for_idle(struct radeon_device *rdev)
349 351
350 for (i = 0; i < rdev->usec_timeout; i++) { 352 for (i = 0; i < rdev->usec_timeout; i++) {
351 /* read MC_STATUS */ 353 /* read MC_STATUS */
352 tmp = RREG32(0x0150); 354 tmp = RREG32(RADEON_MC_STATUS);
353 if (tmp & (1 << 4)) { 355 if (tmp & R300_MC_IDLE) {
354 return 0; 356 return 0;
355 } 357 }
356 DRM_UDELAY(1); 358 DRM_UDELAY(1);
@@ -395,8 +397,8 @@ void r300_gpu_init(struct radeon_device *rdev)
395 "programming pipes. Bad things might happen.\n"); 397 "programming pipes. Bad things might happen.\n");
396 } 398 }
397 399
398 tmp = RREG32(0x170C); 400 tmp = RREG32(R300_DST_PIPE_CONFIG);
399 WREG32(0x170C, tmp | (1 << 31)); 401 WREG32(R300_DST_PIPE_CONFIG, tmp | R300_PIPE_AUTO_CONFIG);
400 402
401 WREG32(R300_RB2D_DSTCACHE_MODE, 403 WREG32(R300_RB2D_DSTCACHE_MODE,
402 R300_DC_AUTOFLUSH_ENABLE | 404 R300_DC_AUTOFLUSH_ENABLE |
@@ -437,8 +439,8 @@ int r300_ga_reset(struct radeon_device *rdev)
437 /* GA still busy soft reset it */ 439 /* GA still busy soft reset it */
438 WREG32(0x429C, 0x200); 440 WREG32(0x429C, 0x200);
439 WREG32(R300_VAP_PVS_STATE_FLUSH_REG, 0); 441 WREG32(R300_VAP_PVS_STATE_FLUSH_REG, 0);
440 WREG32(0x43E0, 0); 442 WREG32(R300_RE_SCISSORS_TL, 0);
441 WREG32(0x43E4, 0); 443 WREG32(R300_RE_SCISSORS_BR, 0);
442 WREG32(0x24AC, 0); 444 WREG32(0x24AC, 0);
443 } 445 }
444 /* Wait to prevent race in RBBM_STATUS */ 446 /* Wait to prevent race in RBBM_STATUS */
@@ -488,7 +490,7 @@ int r300_gpu_reset(struct radeon_device *rdev)
488 } 490 }
489 /* Check if GPU is idle */ 491 /* Check if GPU is idle */
490 status = RREG32(RADEON_RBBM_STATUS); 492 status = RREG32(RADEON_RBBM_STATUS);
491 if (status & (1 << 31)) { 493 if (status & RADEON_RBBM_ACTIVE) {
492 DRM_ERROR("Failed to reset GPU (RBBM_STATUS=0x%08X)\n", status); 494 DRM_ERROR("Failed to reset GPU (RBBM_STATUS=0x%08X)\n", status);
493 return -1; 495 return -1;
494 } 496 }