summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe
diff options
context:
space:
mode:
authorMichal Krol <michal@ubuntu-vbox.(none)>2008-09-08 23:04:17 +0200
committerMichal Krol <michal@ubuntu-vbox.(none)>2008-09-08 23:04:17 +0200
commit56e7c5522e37508d8ca83410479d09f1eddfac15 (patch)
tree305e9e099c02dbafe129e0ddbad108316b568989 /src/gallium/drivers/softpipe
parent68e672a86468be3dfa5b09fa71152d7134d62fb3 (diff)
softpipe: Protect pipe_condvar_signal/broadcast calls with a mutex.
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 98b46b4552c..fe88d8f1408 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -121,6 +121,7 @@ add_quad_job( struct quad_job_que *que, struct quad_header *quad, quad_job_routi
#if INSTANT_NOTEMPTY_NOTIFY
empty = que->last == que->first;
#endif
+ que->jobs_added++;
pipe_mutex_unlock( que->que_mutex );
/* Submit new job.
@@ -129,13 +130,15 @@ add_quad_job( struct quad_job_que *que, struct quad_header *quad, quad_job_routi
que->jobs[que->last].inout = quad->inout;
que->jobs[que->last].routine = routine;
que->last = (que->last + 1) % NUM_QUAD_JOBS;
- que->jobs_added++;
#if INSTANT_NOTEMPTY_NOTIFY
/* If the que was empty, notify consumers there's a job to be done.
*/
- if (empty)
+ if (empty) {
+ pipe_mutex_lock( que->que_mutex );
pipe_condvar_broadcast( que->que_notempty_condvar );
+ pipe_mutex_unlock( que->que_mutex );
+ }
#endif
}
@@ -213,12 +216,12 @@ static PIPE_THREAD_ROUTINE( quad_thread, param )
*/
job = que->jobs[que->first];
que->first = (que->first + 1) % NUM_QUAD_JOBS;
- pipe_mutex_unlock( que->que_mutex );
/* Notify the producer if the que is not full.
*/
if (full)
pipe_condvar_signal( que->que_notfull_condvar );
+ pipe_mutex_unlock( que->que_mutex );
job.routine( info->setup, info->id, &job );
@@ -236,9 +239,9 @@ static PIPE_THREAD_ROUTINE( quad_thread, param )
#define WAIT_FOR_COMPLETION(setup) \
do {\
+ pipe_mutex_lock( setup->que.que_mutex );\
if (!INSTANT_NOTEMPTY_NOTIFY)\
pipe_condvar_broadcast( setup->que.que_notempty_condvar );\
- pipe_mutex_lock( setup->que.que_mutex );\
while (setup->que.jobs_added != setup->que.jobs_done)\
pipe_condvar_wait( setup->que.que_done_condvar, setup->que.que_mutex );\
pipe_mutex_unlock( setup->que.que_mutex );\