summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-02-07 17:08:07 +0100
committerNicolai Hähnle <[email protected]>2017-04-05 10:37:17 +0200
commit0e476f6c03d6273247c3d67484d5ca09f3782225 (patch)
tree3e2ff52825ad5edb12cfd83a25033ae57dc11291 /src/gallium
parent1c125fdef0417fc86bcb041784234f030a8dc48f (diff)
winsys/amdgpu: share common code in amdgpu_add_fence_dependencies
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_cs.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 0381359ab79..2520affc1e4 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -994,36 +994,32 @@ static void amdgpu_add_fence(struct amdgpu_winsys_bo *bo,
bo->num_fences++;
}
+static void amdgpu_add_fence_dependencies_list(struct amdgpu_cs *acs,
+ struct pipe_fence_handle *fence,
+ unsigned num_buffers,
+ struct amdgpu_cs_buffer *buffers)
+{
+ for (unsigned i = 0; i < num_buffers; i++) {
+ struct amdgpu_cs_buffer *buffer = &buffers[i];
+ struct amdgpu_winsys_bo *bo = buffer->bo;
+
+ amdgpu_add_fence_dependency(acs, buffer);
+ p_atomic_inc(&bo->num_active_ioctls);
+ amdgpu_add_fence(bo, fence);
+ }
+}
+
/* Since the kernel driver doesn't synchronize execution between different
* rings automatically, we have to add fence dependencies manually.
*/
static void amdgpu_add_fence_dependencies(struct amdgpu_cs *acs)
{
struct amdgpu_cs_context *cs = acs->csc;
- unsigned num_buffers;
- int i;
cs->request.number_of_dependencies = 0;
- num_buffers = cs->num_real_buffers;
- for (i = 0; i < num_buffers; i++) {
- struct amdgpu_cs_buffer *buffer = &cs->real_buffers[i];
- struct amdgpu_winsys_bo *bo = buffer->bo;
-
- amdgpu_add_fence_dependency(acs, buffer);
- p_atomic_inc(&bo->num_active_ioctls);
- amdgpu_add_fence(bo, cs->fence);
- }
-
- num_buffers = cs->num_slab_buffers;
- for (i = 0; i < num_buffers; i++) {
- struct amdgpu_cs_buffer *buffer = &cs->slab_buffers[i];
- struct amdgpu_winsys_bo *bo = buffer->bo;
-
- amdgpu_add_fence_dependency(acs, buffer);
- p_atomic_inc(&bo->num_active_ioctls);
- amdgpu_add_fence(bo, cs->fence);
- }
+ amdgpu_add_fence_dependencies_list(acs, cs->fence, cs->num_real_buffers, cs->real_buffers);
+ amdgpu_add_fence_dependencies_list(acs, cs->fence, cs->num_slab_buffers, cs->slab_buffers);
}
void amdgpu_cs_submit_ib(void *job, int thread_index)