summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-02-04 15:27:27 -0500
committerMarek Olšák <[email protected]>2019-02-11 12:35:48 -0500
commit881ef14b320188af6f6403f5765a6490ed3d386a (patch)
treec0121f4034af14220f4111a18040eb9a0dc797a7 /src/gallium
parent9f00123d5189bc8b88616b77fccc11119a49b5f6 (diff)
winsys/amdgpu: use a separate fence list for syncobjs
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_cs.c31
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_cs.h1
2 files changed, 15 insertions, 17 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index b202ce21cf9..a059a3958d4 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -891,6 +891,7 @@ static void amdgpu_cs_context_cleanup(struct amdgpu_cs_context *cs)
amdgpu_winsys_bo_reference(&cs->sparse_buffers[i].bo, NULL);
}
cleanup_fence_list(&cs->fence_dependencies);
+ cleanup_fence_list(&cs->syncobj_dependencies);
cleanup_fence_list(&cs->syncobj_to_signal);
cs->num_real_buffers = 0;
@@ -909,6 +910,7 @@ static void amdgpu_destroy_cs_context(struct amdgpu_cs_context *cs)
FREE(cs->slab_buffers);
FREE(cs->sparse_buffers);
FREE(cs->fence_dependencies.list);
+ FREE(cs->syncobj_dependencies.list);
FREE(cs->syncobj_to_signal.list);
}
@@ -1118,7 +1120,10 @@ static void amdgpu_cs_add_fence_dependency(struct radeon_cmdbuf *rws,
if (is_noop_fence_dependency(acs, fence))
return;
- add_fence_to_list(&cs->fence_dependencies, fence);
+ if (amdgpu_fence_is_syncobj(fence))
+ add_fence_to_list(&cs->syncobj_dependencies, fence);
+ else
+ add_fence_to_list(&cs->fence_dependencies, fence);
}
static void amdgpu_add_bo_fence_dependencies(struct amdgpu_cs *acs,
@@ -1367,53 +1372,45 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
num_chunks++;
}
- /* Dependencies */
+ /* Fence dependencies. */
unsigned num_dependencies = cs->fence_dependencies.num;
- unsigned num_syncobj_dependencies = 0;
-
if (num_dependencies) {
struct drm_amdgpu_cs_chunk_dep *dep_chunk =
alloca(num_dependencies * sizeof(*dep_chunk));
- unsigned num = 0;
for (unsigned i = 0; i < num_dependencies; i++) {
struct amdgpu_fence *fence =
(struct amdgpu_fence*)cs->fence_dependencies.list[i];
- if (amdgpu_fence_is_syncobj(fence)) {
- num_syncobj_dependencies++;
- continue;
- }
-
assert(util_queue_fence_is_signalled(&fence->submitted));
- amdgpu_cs_chunk_fence_to_dep(&fence->fence, &dep_chunk[num++]);
+ amdgpu_cs_chunk_fence_to_dep(&fence->fence, &dep_chunk[i]);
}
chunks[num_chunks].chunk_id = AMDGPU_CHUNK_ID_DEPENDENCIES;
- chunks[num_chunks].length_dw = sizeof(dep_chunk[0]) / 4 * num;
+ chunks[num_chunks].length_dw = sizeof(dep_chunk[0]) / 4 * num_dependencies;
chunks[num_chunks].chunk_data = (uintptr_t)dep_chunk;
num_chunks++;
}
/* Syncobj dependencies. */
+ unsigned num_syncobj_dependencies = cs->syncobj_dependencies.num;
if (num_syncobj_dependencies) {
struct drm_amdgpu_cs_chunk_sem *sem_chunk =
alloca(num_syncobj_dependencies * sizeof(sem_chunk[0]));
- unsigned num = 0;
- for (unsigned i = 0; i < num_dependencies; i++) {
+ for (unsigned i = 0; i < num_syncobj_dependencies; i++) {
struct amdgpu_fence *fence =
- (struct amdgpu_fence*)cs->fence_dependencies.list[i];
+ (struct amdgpu_fence*)cs->syncobj_dependencies.list[i];
if (!amdgpu_fence_is_syncobj(fence))
continue;
assert(util_queue_fence_is_signalled(&fence->submitted));
- sem_chunk[num++].handle = fence->syncobj;
+ sem_chunk[i].handle = fence->syncobj;
}
chunks[num_chunks].chunk_id = AMDGPU_CHUNK_ID_SYNCOBJ_IN;
- chunks[num_chunks].length_dw = sizeof(sem_chunk[0]) / 4 * num;
+ chunks[num_chunks].length_dw = sizeof(sem_chunk[0]) / 4 * num_syncobj_dependencies;
chunks[num_chunks].chunk_data = (uintptr_t)sem_chunk;
num_chunks++;
}
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
index 60b05910c71..17c0581b6f4 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
@@ -103,6 +103,7 @@ struct amdgpu_cs_context {
uint32_t last_added_bo_priority_usage;
struct amdgpu_fence_list fence_dependencies;
+ struct amdgpu_fence_list syncobj_dependencies;
struct amdgpu_fence_list syncobj_to_signal;
struct pipe_fence_handle *fence;