Create rarch_threaded_video_send_and_wait
This commit is contained in:
parent
37286ca894
commit
9b65988682
|
@ -284,7 +284,7 @@ bool font_driver_init_first(const void **font_driver, void **font_handle,
|
||||||
pkt.data.font_init.font_size = font_size;
|
pkt.data.font_init.font_size = font_size;
|
||||||
pkt.data.font_init.api = api;
|
pkt.data.font_init.api = api;
|
||||||
|
|
||||||
thr->send_and_wait(thr, &pkt);
|
rarch_threaded_video_send_and_wait(thr, &pkt);
|
||||||
|
|
||||||
return pkt.data.font_init.return_value;
|
return pkt.data.font_init.return_value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ unsigned video_texture_load(void *data,
|
||||||
|
|
||||||
pkt.data.custom_command.data = (void*)data;
|
pkt.data.custom_command.data = (void*)data;
|
||||||
|
|
||||||
thr->send_and_wait(thr, &pkt);
|
rarch_threaded_video_send_and_wait(thr, &pkt);
|
||||||
|
|
||||||
return pkt.data.custom_command.return_value;
|
return pkt.data.custom_command.return_value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,81 @@
|
||||||
#include "../runloop.h"
|
#include "../runloop.h"
|
||||||
#include "../verbosity.h"
|
#include "../verbosity.h"
|
||||||
|
|
||||||
|
struct thread_video
|
||||||
|
{
|
||||||
|
slock_t *lock;
|
||||||
|
scond_t *cond_cmd;
|
||||||
|
scond_t *cond_thread;
|
||||||
|
sthread_t *thread;
|
||||||
|
|
||||||
|
video_info_t info;
|
||||||
|
const video_driver_t *driver;
|
||||||
|
|
||||||
|
#ifdef HAVE_OVERLAY
|
||||||
|
const video_overlay_interface_t *overlay;
|
||||||
|
#endif
|
||||||
|
const video_poke_interface_t *poke;
|
||||||
|
|
||||||
|
void *driver_data;
|
||||||
|
const input_driver_t **input;
|
||||||
|
void **input_data;
|
||||||
|
|
||||||
|
#if defined(HAVE_MENU)
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
void *frame;
|
||||||
|
size_t frame_cap;
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
float alpha;
|
||||||
|
bool frame_updated;
|
||||||
|
bool rgb32;
|
||||||
|
bool enable;
|
||||||
|
bool full_screen;
|
||||||
|
} texture;
|
||||||
|
#endif
|
||||||
|
bool apply_state_changes;
|
||||||
|
|
||||||
|
bool alive;
|
||||||
|
bool focus;
|
||||||
|
bool suppress_screensaver;
|
||||||
|
bool has_windowed;
|
||||||
|
bool nonblock;
|
||||||
|
|
||||||
|
retro_time_t last_time;
|
||||||
|
unsigned hit_count;
|
||||||
|
unsigned miss_count;
|
||||||
|
|
||||||
|
float *alpha_mod;
|
||||||
|
unsigned alpha_mods;
|
||||||
|
bool alpha_update;
|
||||||
|
slock_t *alpha_lock;
|
||||||
|
|
||||||
|
void (*send_and_wait)(struct thread_video *, thread_packet_t*);
|
||||||
|
enum thread_cmd send_cmd;
|
||||||
|
enum thread_cmd reply_cmd;
|
||||||
|
thread_packet_t cmd_data;
|
||||||
|
|
||||||
|
struct video_viewport vp;
|
||||||
|
struct video_viewport read_vp; /* Last viewport reported to caller. */
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
slock_t *lock;
|
||||||
|
uint8_t *buffer;
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
unsigned pitch;
|
||||||
|
bool updated;
|
||||||
|
bool within_thread;
|
||||||
|
uint64_t count;
|
||||||
|
char msg[PATH_MAX_LENGTH];
|
||||||
|
} frame;
|
||||||
|
|
||||||
|
video_driver_t video_thread;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
static void *thread_init_never_call(const video_info_t *video,
|
static void *thread_init_never_call(const video_info_t *video,
|
||||||
const input_driver_t **input, void **input_data)
|
const input_driver_t **input, void **input_data)
|
||||||
{
|
{
|
||||||
|
@ -1142,3 +1217,10 @@ const char *rarch_threaded_video_get_ident(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
return thr->driver->ident;
|
return thr->driver->ident;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rarch_threaded_video_send_and_wait(thread_video_t *thr, thread_packet_t *pkt)
|
||||||
|
{
|
||||||
|
if (!thr || !pkt)
|
||||||
|
return;
|
||||||
|
thr->send_and_wait(thr, pkt);
|
||||||
|
}
|
||||||
|
|
|
@ -150,80 +150,9 @@ typedef struct
|
||||||
} data;
|
} data;
|
||||||
} thread_packet_t;
|
} thread_packet_t;
|
||||||
|
|
||||||
typedef struct thread_video
|
typedef struct thread_video thread_video_t;
|
||||||
{
|
|
||||||
slock_t *lock;
|
|
||||||
scond_t *cond_cmd;
|
|
||||||
scond_t *cond_thread;
|
|
||||||
sthread_t *thread;
|
|
||||||
|
|
||||||
video_info_t info;
|
void rarch_threaded_video_send_and_wait(thread_video_t *thr, thread_packet_t *pkt);
|
||||||
const video_driver_t *driver;
|
|
||||||
|
|
||||||
#ifdef HAVE_OVERLAY
|
|
||||||
const video_overlay_interface_t *overlay;
|
|
||||||
#endif
|
|
||||||
const video_poke_interface_t *poke;
|
|
||||||
|
|
||||||
void *driver_data;
|
|
||||||
const input_driver_t **input;
|
|
||||||
void **input_data;
|
|
||||||
|
|
||||||
#if defined(HAVE_MENU)
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
void *frame;
|
|
||||||
size_t frame_cap;
|
|
||||||
unsigned width;
|
|
||||||
unsigned height;
|
|
||||||
float alpha;
|
|
||||||
bool frame_updated;
|
|
||||||
bool rgb32;
|
|
||||||
bool enable;
|
|
||||||
bool full_screen;
|
|
||||||
} texture;
|
|
||||||
#endif
|
|
||||||
bool apply_state_changes;
|
|
||||||
|
|
||||||
bool alive;
|
|
||||||
bool focus;
|
|
||||||
bool suppress_screensaver;
|
|
||||||
bool has_windowed;
|
|
||||||
bool nonblock;
|
|
||||||
|
|
||||||
retro_time_t last_time;
|
|
||||||
unsigned hit_count;
|
|
||||||
unsigned miss_count;
|
|
||||||
|
|
||||||
float *alpha_mod;
|
|
||||||
unsigned alpha_mods;
|
|
||||||
bool alpha_update;
|
|
||||||
slock_t *alpha_lock;
|
|
||||||
|
|
||||||
void (*send_and_wait)(struct thread_video *, thread_packet_t*);
|
|
||||||
enum thread_cmd send_cmd;
|
|
||||||
enum thread_cmd reply_cmd;
|
|
||||||
thread_packet_t cmd_data;
|
|
||||||
|
|
||||||
struct video_viewport vp;
|
|
||||||
struct video_viewport read_vp; /* Last viewport reported to caller. */
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
slock_t *lock;
|
|
||||||
uint8_t *buffer;
|
|
||||||
unsigned width;
|
|
||||||
unsigned height;
|
|
||||||
unsigned pitch;
|
|
||||||
bool updated;
|
|
||||||
bool within_thread;
|
|
||||||
uint64_t count;
|
|
||||||
char msg[PATH_MAX_LENGTH];
|
|
||||||
} frame;
|
|
||||||
|
|
||||||
video_driver_t video_thread;
|
|
||||||
|
|
||||||
} thread_video_t;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rarch_threaded_video_init:
|
* rarch_threaded_video_init:
|
||||||
|
|
Loading…
Reference in New Issue