summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/til.c2
-rw-r--r--src/til_threads.c15
2 files changed, 5 insertions, 12 deletions
diff --git a/src/til.c b/src/til.c
index ce63b59..56944cb 100644
--- a/src/til.c
+++ b/src/til.c
@@ -188,6 +188,8 @@ static void module_render_fragment(const til_module_t *module, void *context, ti
if (module->finish_frame)
module->finish_frame(context, ticks, fragment);
+
+ fragment->cleared = 1;
}
diff --git a/src/til_threads.c b/src/til_threads.c
index bb19b05..9f5c191 100644
--- a/src/til_threads.c
+++ b/src/til_threads.c
@@ -18,8 +18,6 @@ typedef struct til_threads_t {
pthread_mutex_t idle_mutex;
pthread_cond_t idle_cond;
- unsigned idle_n_fragments;
- unsigned idle_n_cleared;
unsigned n_idle;
pthread_mutex_t frame_mutex;
@@ -47,7 +45,7 @@ static void * thread_func(void *_thread)
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
for (;;) {
- unsigned n_fragments = 0, n_cleared = 0;
+ unsigned n_fragments = 0;
/* wait for a new frame */
pthread_mutex_lock(&threads->frame_mutex);
@@ -68,22 +66,15 @@ static void * thread_func(void *_thread)
break;
threads->render_fragment_func(threads->context, threads->ticks, thread->id, &fragment);
- n_cleared += fragment.cleared;
n_fragments++;
}
/* report as idle */
pthread_mutex_lock(&threads->idle_mutex);
pthread_cleanup_push((void (*)(void *))pthread_mutex_unlock, &threads->idle_mutex);
- threads->idle_n_fragments += n_fragments;
- threads->idle_n_cleared += n_cleared;
threads->n_idle++;
- if (threads->n_idle == threads->n_threads) { /* Frame finished! Notify potential waiter. */
- if (threads->idle_n_cleared == threads->idle_n_fragments)
- threads->fragment->cleared = 1;
-
+ if (threads->n_idle == threads->n_threads) /* Frame finished! Notify potential waiter. */
pthread_cond_signal(&threads->idle_cond);
- }
pthread_cleanup_pop(1);
}
@@ -115,7 +106,7 @@ void til_threads_frame_submit(til_threads_t *threads, til_fb_fragment_t *fragmen
threads->context = context;
threads->ticks = ticks;
threads->frame_num++;
- threads->n_idle = threads->idle_n_cleared = threads->idle_n_fragments = threads->next_fragment = 0;
+ threads->n_idle = threads->next_fragment = 0;
pthread_cond_broadcast(&threads->frame_cond);
pthread_cleanup_pop(1);
}
© All Rights Reserved