aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
authorChristian König <deathsimple@vodafone.de>2012-07-13 07:06:00 -0400
committerChristian König <deathsimple@vodafone.de>2012-07-18 07:17:49 -0400
commit4ef72566f1035fef5abd0913100d13746e066ee3 (patch)
tree48aa82020454839b036e9fe48e969027d322dc87 /drivers/gpu/drm/radeon
parentbfb38d35c1cacb182d8bbda23379397bffeafc8c (diff)
drm/radeon: fix const IB handling v2
Const IBs are executed on the CE not the CP, so we can't fence them in the normal way. So submit them directly before the IB instead, just as the documentation says. v2: keep the extra documentation Signed-off-by: Christian König <deathsimple@vodafone.de> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/r100.c2
-rw-r--r--drivers/gpu/drm/radeon/r600.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c25
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c10
5 files changed, 25 insertions, 17 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index e0f5ae895f07..4ee5a74dac22 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -3693,7 +3693,7 @@ int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
3693 ib.ptr[6] = PACKET2(0); 3693 ib.ptr[6] = PACKET2(0);
3694 ib.ptr[7] = PACKET2(0); 3694 ib.ptr[7] = PACKET2(0);
3695 ib.length_dw = 8; 3695 ib.length_dw = 8;
3696 r = radeon_ib_schedule(rdev, &ib); 3696 r = radeon_ib_schedule(rdev, &ib, NULL);
3697 if (r) { 3697 if (r) {
3698 radeon_scratch_free(rdev, scratch); 3698 radeon_scratch_free(rdev, scratch);
3699 radeon_ib_free(rdev, &ib); 3699 radeon_ib_free(rdev, &ib);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 3156d251b3c2..c2e506919995 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2619,7 +2619,7 @@ int r600_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
2619 ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); 2619 ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2);
2620 ib.ptr[2] = 0xDEADBEEF; 2620 ib.ptr[2] = 0xDEADBEEF;
2621 ib.length_dw = 3; 2621 ib.length_dw = 3;
2622 r = radeon_ib_schedule(rdev, &ib); 2622 r = radeon_ib_schedule(rdev, &ib, NULL);
2623 if (r) { 2623 if (r) {
2624 radeon_scratch_free(rdev, scratch); 2624 radeon_scratch_free(rdev, scratch);
2625 radeon_ib_free(rdev, &ib); 2625 radeon_ib_free(rdev, &ib);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 2cb355bf2725..2d7f06c85336 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -751,7 +751,8 @@ struct si_rlc {
751int radeon_ib_get(struct radeon_device *rdev, int ring, 751int radeon_ib_get(struct radeon_device *rdev, int ring,
752 struct radeon_ib *ib, unsigned size); 752 struct radeon_ib *ib, unsigned size);
753void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib); 753void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib);
754int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); 754int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib,
755 struct radeon_ib *const_ib);
755int radeon_ib_pool_init(struct radeon_device *rdev); 756int radeon_ib_pool_init(struct radeon_device *rdev);
756void radeon_ib_pool_fini(struct radeon_device *rdev); 757void radeon_ib_pool_fini(struct radeon_device *rdev);
757int radeon_ib_ring_tests(struct radeon_device *rdev); 758int radeon_ib_ring_tests(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 553da67a4cdd..8a4c49ef0cc4 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -354,7 +354,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev,
354 } 354 }
355 radeon_cs_sync_rings(parser); 355 radeon_cs_sync_rings(parser);
356 parser->ib.vm_id = 0; 356 parser->ib.vm_id = 0;
357 r = radeon_ib_schedule(rdev, &parser->ib); 357 r = radeon_ib_schedule(rdev, &parser->ib, NULL);
358 if (r) { 358 if (r) {
359 DRM_ERROR("Failed to schedule IB !\n"); 359 DRM_ERROR("Failed to schedule IB !\n");
360 } 360 }
@@ -452,25 +452,24 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev,
452 } 452 }
453 radeon_cs_sync_rings(parser); 453 radeon_cs_sync_rings(parser);
454 454
455 parser->ib.vm_id = vm->id;
456 /* ib pool is bind at 0 in virtual address space,
457 * so gpu_addr is the offset inside the pool bo
458 */
459 parser->ib.gpu_addr = parser->ib.sa_bo->soffset;
460
455 if ((rdev->family >= CHIP_TAHITI) && 461 if ((rdev->family >= CHIP_TAHITI) &&
456 (parser->chunk_const_ib_idx != -1)) { 462 (parser->chunk_const_ib_idx != -1)) {
457 parser->const_ib.vm_id = vm->id; 463 parser->const_ib.vm_id = vm->id;
458 /* ib pool is bind at 0 in virtual address space to gpu_addr is the 464 /* ib pool is bind at 0 in virtual address space,
459 * offset inside the pool bo 465 * so gpu_addr is the offset inside the pool bo
460 */ 466 */
461 parser->const_ib.gpu_addr = parser->const_ib.sa_bo->soffset; 467 parser->const_ib.gpu_addr = parser->const_ib.sa_bo->soffset;
462 r = radeon_ib_schedule(rdev, &parser->const_ib); 468 r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib);
463 if (r) 469 } else {
464 goto out; 470 r = radeon_ib_schedule(rdev, &parser->ib, NULL);
465 } 471 }
466 472
467 parser->ib.vm_id = vm->id;
468 /* ib pool is bind at 0 in virtual address space to gpu_addr is the
469 * offset inside the pool bo
470 */
471 parser->ib.gpu_addr = parser->ib.sa_bo->soffset;
472 parser->ib.is_const_ib = false;
473 r = radeon_ib_schedule(rdev, &parser->ib);
474out: 473out:
475 if (!r) { 474 if (!r) {
476 if (vm->fence) { 475 if (vm->fence) {
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index 75cbe4641138..c48c35403774 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -74,7 +74,8 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib)
74 radeon_fence_unref(&ib->fence); 74 radeon_fence_unref(&ib->fence);
75} 75}
76 76
77int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib) 77int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib,
78 struct radeon_ib *const_ib)
78{ 79{
79 struct radeon_ring *ring = &rdev->ring[ib->ring]; 80 struct radeon_ring *ring = &rdev->ring[ib->ring];
80 bool need_sync = false; 81 bool need_sync = false;
@@ -105,6 +106,10 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib)
105 if (!need_sync) { 106 if (!need_sync) {
106 radeon_semaphore_free(rdev, &ib->semaphore, NULL); 107 radeon_semaphore_free(rdev, &ib->semaphore, NULL);
107 } 108 }
109 if (const_ib) {
110 radeon_ring_ib_execute(rdev, const_ib->ring, const_ib);
111 radeon_semaphore_free(rdev, &const_ib->semaphore, NULL);
112 }
108 radeon_ring_ib_execute(rdev, ib->ring, ib); 113 radeon_ring_ib_execute(rdev, ib->ring, ib);
109 r = radeon_fence_emit(rdev, &ib->fence, ib->ring); 114 r = radeon_fence_emit(rdev, &ib->fence, ib->ring);
110 if (r) { 115 if (r) {
@@ -112,6 +117,9 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib)
112 radeon_ring_unlock_undo(rdev, ring); 117 radeon_ring_unlock_undo(rdev, ring);
113 return r; 118 return r;
114 } 119 }
120 if (const_ib) {
121 const_ib->fence = radeon_fence_ref(ib->fence);
122 }
115 radeon_ring_unlock_commit(rdev, ring); 123 radeon_ring_unlock_commit(rdev, ring);
116 return 0; 124 return 0;
117} 125}