gallium/u_queue: isolate util_queue_fence implementation
authorMarek Olšák <marek.olsak@amd.com>
Mon, 20 Feb 2017 17:42:41 +0000 (18:42 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Feb 2017 19:26:39 +0000 (20:26 +0100)
it's cleaner this way.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/util/u_queue.c
src/gallium/auxiliary/util/u_queue.h
src/gallium/drivers/freedreno/freedreno_batch.c
src/gallium/drivers/radeonsi/si_state_shaders.c
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
src/gallium/winsys/radeon/drm/radeon_drm_cs.c

index 52cfc0a4bf2820755861fffbaf92b9d6c82af097..386dc4a9946bcfc2e48caed106a32e84d78884de 100644 (file)
@@ -88,7 +88,7 @@ remove_from_atexit_list(struct util_queue *queue)
 }
 
 /****************************************************************************
- * util_queue implementation
+ * util_queue_fence
  */
 
 static void
@@ -101,7 +101,7 @@ util_queue_fence_signal(struct util_queue_fence *fence)
 }
 
 void
-util_queue_job_wait(struct util_queue_fence *fence)
+util_queue_fence_wait(struct util_queue_fence *fence)
 {
    pipe_mutex_lock(fence->mutex);
    while (!fence->signalled)
@@ -109,6 +109,27 @@ util_queue_job_wait(struct util_queue_fence *fence)
    pipe_mutex_unlock(fence->mutex);
 }
 
+void
+util_queue_fence_init(struct util_queue_fence *fence)
+{
+   memset(fence, 0, sizeof(*fence));
+   pipe_mutex_init(fence->mutex);
+   pipe_condvar_init(fence->cond);
+   fence->signalled = true;
+}
+
+void
+util_queue_fence_destroy(struct util_queue_fence *fence)
+{
+   assert(fence->signalled);
+   pipe_condvar_destroy(fence->cond);
+   pipe_mutex_destroy(fence->mutex);
+}
+
+/****************************************************************************
+ * util_queue implementation
+ */
+
 struct thread_input {
    struct util_queue *queue;
    int thread_index;
@@ -266,23 +287,6 @@ util_queue_destroy(struct util_queue *queue)
    FREE(queue->threads);
 }
 
-void
-util_queue_fence_init(struct util_queue_fence *fence)
-{
-   memset(fence, 0, sizeof(*fence));
-   pipe_mutex_init(fence->mutex);
-   pipe_condvar_init(fence->cond);
-   fence->signalled = true;
-}
-
-void
-util_queue_fence_destroy(struct util_queue_fence *fence)
-{
-   assert(fence->signalled);
-   pipe_condvar_destroy(fence->cond);
-   pipe_mutex_destroy(fence->mutex);
-}
-
 void
 util_queue_add_job(struct util_queue *queue,
                    void *job,
index 335813f63c1c23be824659e6ba13f2dbe16afd4c..2e0a5a36e269999d0ead0152098fd81d8d8793e5 100644 (file)
@@ -87,7 +87,7 @@ void util_queue_add_job(struct util_queue *queue,
                         util_queue_execute_func execute,
                         util_queue_execute_func cleanup);
 
-void util_queue_job_wait(struct util_queue_fence *fence);
+void util_queue_fence_wait(struct util_queue_fence *fence);
 int64_t util_queue_get_thread_time_nano(struct util_queue *queue,
                                         unsigned thread_index);
 
index f5a5c6a3cc933be60d2fbd4621cf0a77923ef3a5..c6dcf11aca5b8135eb12d2e48f2abed729ad48bd 100644 (file)
@@ -230,7 +230,7 @@ fd_batch_sync(struct fd_batch *batch)
 {
        if (!batch->ctx->screen->reorder)
                return;
-       util_queue_job_wait(&batch->flush_fence);
+       util_queue_fence_wait(&batch->flush_fence);
 }
 
 static void
index 0e85c129437e2beaaada7ab22e438d6646d6e725..f615aa84471371287ab8c9e9aa9a0360b3d03a5d 100644 (file)
@@ -1200,7 +1200,7 @@ again:
         * in a compiler thread.
         */
        if (thread_index < 0)
-               util_queue_job_wait(&sel->ready);
+               util_queue_fence_wait(&sel->ready);
 
        pipe_mutex_lock(sel->mutex);
 
@@ -1832,7 +1832,7 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
 static void si_delete_shader(struct si_context *sctx, struct si_shader *shader)
 {
        if (shader->is_optimized) {
-               util_queue_job_wait(&shader->optimized_ready);
+               util_queue_fence_wait(&shader->optimized_ready);
                util_queue_fence_destroy(&shader->optimized_ready);
        }
 
@@ -1884,7 +1884,7 @@ static void si_delete_shader_selector(struct pipe_context *ctx, void *state)
                [PIPE_SHADER_FRAGMENT] = &sctx->ps_shader,
        };
 
-       util_queue_job_wait(&sel->ready);
+       util_queue_fence_wait(&sel->ready);
 
        if (current_shader[sel->type]->cso == sel) {
                current_shader[sel->type]->cso = NULL;
index 9d5b0bde877f581b419be0a24c519d1fabd08db2..01f38d56b8392d4b019445f73dcc00624ee89436 100644 (file)
@@ -1118,7 +1118,7 @@ void amdgpu_cs_sync_flush(struct radeon_winsys_cs *rcs)
    struct amdgpu_cs *cs = amdgpu_cs(rcs);
 
    /* Wait for any pending ioctl of this CS to complete. */
-   util_queue_job_wait(&cs->flush_completed);
+   util_queue_fence_wait(&cs->flush_completed);
 }
 
 static int amdgpu_cs_flush(struct radeon_winsys_cs *rcs,
index 8f9e8a60593123d4be1fece3021d7e77665c9f84..fb6a6bb80708cd330fb8a770009781ae7932e9ea 100644 (file)
@@ -486,7 +486,7 @@ void radeon_drm_cs_sync_flush(struct radeon_winsys_cs *rcs)
 
     /* Wait for any pending ioctl of this CS to complete. */
     if (util_queue_is_initialized(&cs->ws->cs_queue))
-        util_queue_job_wait(&cs->flush_completed);
+        util_queue_fence_wait(&cs->flush_completed);
 }
 
 /* Add the given fence to a slab buffer fence list.