diff options
author | Christian König <deathsimple@vodafone.de> | 2012-05-10 10:46:43 -0400 |
---|---|---|
committer | Christian König <deathsimple@vodafone.de> | 2012-06-21 03:38:40 -0400 |
commit | 220907d9835ce5181b9f782c862b1ee7a4d24c23 (patch) | |
tree | 0b06da4048162f72b2bb677d3a9686571f7be26d /drivers/gpu/drm/radeon/radeon_cs.c | |
parent | 68e250b7c281dbb75ea2a892a7d4ca27f974fc91 (diff) |
drm/radeon: rework ring syncing code
Move inter ring syncing with semaphores into the
existing ring allocations, with that we need to
lock the ring mutex only once.
Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_cs.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_cs.c | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 142f89462aa..dd3e234294e 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -115,36 +115,20 @@ static int radeon_cs_get_ring(struct radeon_cs_parser *p, u32 ring, s32 priority | |||
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | static int radeon_cs_sync_rings(struct radeon_cs_parser *p) | 118 | static void radeon_cs_sync_rings(struct radeon_cs_parser *p) |
119 | { | 119 | { |
120 | bool sync_to_ring[RADEON_NUM_RINGS] = { }; | 120 | int i; |
121 | bool need_sync = false; | ||
122 | int i, r; | ||
123 | 121 | ||
124 | for (i = 0; i < p->nrelocs; i++) { | 122 | for (i = 0; i < p->nrelocs; i++) { |
125 | struct radeon_fence *fence; | 123 | struct radeon_fence *a, *b; |
126 | 124 | ||
127 | if (!p->relocs[i].robj || !p->relocs[i].robj->tbo.sync_obj) | 125 | if (!p->relocs[i].robj || !p->relocs[i].robj->tbo.sync_obj) |
128 | continue; | 126 | continue; |
129 | 127 | ||
130 | fence = p->relocs[i].robj->tbo.sync_obj; | 128 | a = p->relocs[i].robj->tbo.sync_obj; |
131 | if (fence->ring != p->ring && !radeon_fence_signaled(fence)) { | 129 | b = p->ib.sync_to[a->ring]; |
132 | sync_to_ring[fence->ring] = true; | 130 | p->ib.sync_to[a->ring] = radeon_fence_later(a, b); |
133 | need_sync = true; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | if (!need_sync) { | ||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | r = radeon_semaphore_create(p->rdev, &p->ib.semaphore); | ||
142 | if (r) { | ||
143 | return r; | ||
144 | } | 131 | } |
145 | |||
146 | return radeon_semaphore_sync_rings(p->rdev, p->ib.semaphore, | ||
147 | sync_to_ring, p->ring); | ||
148 | } | 132 | } |
149 | 133 | ||
150 | /* XXX: note that this is called from the legacy UMS CS ioctl as well */ | 134 | /* XXX: note that this is called from the legacy UMS CS ioctl as well */ |
@@ -368,10 +352,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev, | |||
368 | DRM_ERROR("Invalid command stream !\n"); | 352 | DRM_ERROR("Invalid command stream !\n"); |
369 | return r; | 353 | return r; |
370 | } | 354 | } |
371 | r = radeon_cs_sync_rings(parser); | 355 | radeon_cs_sync_rings(parser); |
372 | if (r) { | ||
373 | DRM_ERROR("Failed to synchronize rings !\n"); | ||
374 | } | ||
375 | parser->ib.vm_id = 0; | 356 | parser->ib.vm_id = 0; |
376 | r = radeon_ib_schedule(rdev, &parser->ib); | 357 | r = radeon_ib_schedule(rdev, &parser->ib); |
377 | if (r) { | 358 | if (r) { |
@@ -468,10 +449,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, | |||
468 | if (r) { | 449 | if (r) { |
469 | goto out; | 450 | goto out; |
470 | } | 451 | } |
471 | r = radeon_cs_sync_rings(parser); | 452 | radeon_cs_sync_rings(parser); |
472 | if (r) { | ||
473 | DRM_ERROR("Failed to synchronize rings !\n"); | ||
474 | } | ||
475 | 453 | ||
476 | if ((rdev->family >= CHIP_TAHITI) && | 454 | if ((rdev->family >= CHIP_TAHITI) && |
477 | (parser->chunk_const_ib_idx != -1)) { | 455 | (parser->chunk_const_ib_idx != -1)) { |