Module: Mesa
Branch: master
Commit: 1ef9658906655edb6b2beaf2951a9dc81d93b827
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ef9658906655edb6b2beaf2951a9dc81d93b827

Author: Rhys Perry <[email protected]>
Date:   Thu Mar 26 15:50:31 2020 +0000

util/u_queue: fix race in total_jobs_size access

Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
CC: <[email protected]>
Tested-by: Marge Bot 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335>

---

 src/util/u_queue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/u_queue.c b/src/util/u_queue.c
index 97d674ce431..4049a4c7692 100644
--- a/src/util/u_queue.c
+++ b/src/util/u_queue.c
@@ -286,6 +286,8 @@ util_queue_thread_func(void *input)
 
       queue->num_queued--;
       cnd_signal(&queue->has_space_cond);
+      if (job.job)
+         queue->total_jobs_size -= job.job_size;
       mtx_unlock(&queue->lock);
 
       if (job.job) {
@@ -293,8 +295,6 @@ util_queue_thread_func(void *input)
          util_queue_fence_signal(job.fence);
          if (job.cleanup)
             job.cleanup(job.job, thread_index);
-
-         queue->total_jobs_size -= job.job_size;
       }
    }
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to