diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2014-01-09 16:18:11 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2014-01-20 12:05:13 -0500 |
commit | 780f5dddaeb8e5950d8ecf2e7565a35bf5d5be36 (patch) | |
tree | 844bec40eb137f059f8bf95b592cc8eb178d970e /drivers/gpu/drm/radeon/cik.c | |
parent | 8158eb9e32c4c98c7dd152207fd70f747ef81a9a (diff) |
drm/radeon: consolidate cp hdp flushing code for CIK
It's used in several places so move to a common shared
function.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/cik.c')
-rw-r--r-- | drivers/gpu/drm/radeon/cik.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index dc6d5f58018d..c6e31b8f8983 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -3487,6 +3487,30 @@ int cik_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
3487 | } | 3487 | } |
3488 | 3488 | ||
3489 | /** | 3489 | /** |
3490 | * cik_hdp_flush_cp_ring_emit - emit an hdp flush on the cp | ||
3491 | * | ||
3492 | * @rdev: radeon_device pointer | ||
3493 | * @ridx: radeon ring index | ||
3494 | * | ||
3495 | * Emits an hdp flush on the cp. | ||
3496 | */ | ||
3497 | static void cik_hdp_flush_cp_ring_emit(struct radeon_device *rdev, | ||
3498 | int ridx) | ||
3499 | { | ||
3500 | struct radeon_ring *ring = &rdev->ring[ridx]; | ||
3501 | |||
3502 | /* We should be using the new WAIT_REG_MEM special op packet here | ||
3503 | * but it causes the CP to hang | ||
3504 | */ | ||
3505 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | ||
3506 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | ||
3507 | WRITE_DATA_DST_SEL(0))); | ||
3508 | radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2); | ||
3509 | radeon_ring_write(ring, 0); | ||
3510 | radeon_ring_write(ring, 0); | ||
3511 | } | ||
3512 | |||
3513 | /** | ||
3490 | * cik_fence_gfx_ring_emit - emit a fence on the gfx ring | 3514 | * cik_fence_gfx_ring_emit - emit a fence on the gfx ring |
3491 | * | 3515 | * |
3492 | * @rdev: radeon_device pointer | 3516 | * @rdev: radeon_device pointer |
@@ -3512,15 +3536,7 @@ void cik_fence_gfx_ring_emit(struct radeon_device *rdev, | |||
3512 | radeon_ring_write(ring, fence->seq); | 3536 | radeon_ring_write(ring, fence->seq); |
3513 | radeon_ring_write(ring, 0); | 3537 | radeon_ring_write(ring, 0); |
3514 | /* HDP flush */ | 3538 | /* HDP flush */ |
3515 | /* We should be using the new WAIT_REG_MEM special op packet here | 3539 | cik_hdp_flush_cp_ring_emit(rdev, fence->ring); |
3516 | * but it causes the CP to hang | ||
3517 | */ | ||
3518 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | ||
3519 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | ||
3520 | WRITE_DATA_DST_SEL(0))); | ||
3521 | radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2); | ||
3522 | radeon_ring_write(ring, 0); | ||
3523 | radeon_ring_write(ring, 0); | ||
3524 | } | 3540 | } |
3525 | 3541 | ||
3526 | /** | 3542 | /** |
@@ -3550,15 +3566,7 @@ void cik_fence_compute_ring_emit(struct radeon_device *rdev, | |||
3550 | radeon_ring_write(ring, fence->seq); | 3566 | radeon_ring_write(ring, fence->seq); |
3551 | radeon_ring_write(ring, 0); | 3567 | radeon_ring_write(ring, 0); |
3552 | /* HDP flush */ | 3568 | /* HDP flush */ |
3553 | /* We should be using the new WAIT_REG_MEM special op packet here | 3569 | cik_hdp_flush_cp_ring_emit(rdev, fence->ring); |
3554 | * but it causes the CP to hang | ||
3555 | */ | ||
3556 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | ||
3557 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | ||
3558 | WRITE_DATA_DST_SEL(0))); | ||
3559 | radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2); | ||
3560 | radeon_ring_write(ring, 0); | ||
3561 | radeon_ring_write(ring, 0); | ||
3562 | } | 3570 | } |
3563 | 3571 | ||
3564 | bool cik_semaphore_ring_emit(struct radeon_device *rdev, | 3572 | bool cik_semaphore_ring_emit(struct radeon_device *rdev, |
@@ -5553,16 +5561,7 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
5553 | radeon_ring_write(ring, VMID(0)); | 5561 | radeon_ring_write(ring, VMID(0)); |
5554 | 5562 | ||
5555 | /* HDP flush */ | 5563 | /* HDP flush */ |
5556 | /* We should be using the WAIT_REG_MEM packet here like in | 5564 | cik_hdp_flush_cp_ring_emit(rdev, ridx); |
5557 | * cik_fence_ring_emit(), but it causes the CP to hang in this | ||
5558 | * context... | ||
5559 | */ | ||
5560 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | ||
5561 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | ||
5562 | WRITE_DATA_DST_SEL(0))); | ||
5563 | radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2); | ||
5564 | radeon_ring_write(ring, 0); | ||
5565 | radeon_ring_write(ring, 0); | ||
5566 | 5565 | ||
5567 | /* bits 0-15 are the VM contexts0-15 */ | 5566 | /* bits 0-15 are the VM contexts0-15 */ |
5568 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | 5567 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |