From b7f7b1f3b7710a5c7c5f8f38d9d1676415e56d47 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 2 Dec 2015 01:01:27 +0100 Subject: [PATCH] video_thread_wrapper.c - cleanups --- gfx/video_thread_wrapper.c | 18 ++++++------------ gfx/video_thread_wrapper.h | 2 -- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index c989f53452..883f27c262 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -360,8 +360,6 @@ static bool thread_handle_packet(thread_video_t *thr, const thread_packet_t *inc static void thread_loop(void *data) { thread_video_t *thr = (thread_video_t*)data; - unsigned i = 0; - (void)i; for (;;) { @@ -427,9 +425,6 @@ static void thread_loop(void *data) } } - - - static bool thread_alive(void *data) { bool ret; @@ -613,24 +608,22 @@ static bool thread_init(thread_video_t *thr, const video_info_t *info, max_size = info->input_scale * RARCH_SCALE_BASE; max_size *= max_size; max_size *= info->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t); - thr->frame.buffer = (uint8_t*)malloc(max_size); + thr->frame.buffer = (uint8_t*)malloc(max_size); if (!thr->frame.buffer) return false; memset(thr->frame.buffer, 0x80, max_size); - thr->last_time = retro_get_time_usec(); - thr->thread = sthread_create(thread_loop, thr); + thr->last_time = retro_get_time_usec(); + thr->thread = sthread_create(thread_loop, thr); + if (!thr->thread) return false; thread_send_and_wait(thr, &pkt); -/* thr->send_cmd_func = thread_send_cmd; */ -/* thr->wait_reply_func = thread_wait_reply; */ - - thr->send_and_wait = thread_send_and_wait; + thr->send_and_wait = thread_send_and_wait; return pkt.data.b; } @@ -823,6 +816,7 @@ static void thread_overlay_set_alpha(void *data, unsigned idx, float mod) if (!thr) return; + slock_lock(thr->alpha_lock); thr->alpha_mod[idx] = mod; thr->alpha_update = true; diff --git a/gfx/video_thread_wrapper.h b/gfx/video_thread_wrapper.h index 22d7ff756d..3054432aa9 100644 --- a/gfx/video_thread_wrapper.h +++ b/gfx/video_thread_wrapper.h @@ -199,8 +199,6 @@ typedef struct thread_video bool alpha_update; slock_t *alpha_lock; -/* void (*send_cmd_func)(struct thread_video *, enum thread_cmd); */ -/* void (*wait_reply_func)(struct thread_video *, enum thread_cmd); */ void (*send_and_wait)(struct thread_video *, thread_packet_t*); enum thread_cmd send_cmd; enum thread_cmd reply_cmd;