Cut down on amount of times video_driver_build_info is called

This commit is contained in:
twinaphex 2017-04-23 22:20:11 +02:00
parent 08bbc8199f
commit 34852e159a
15 changed files with 60 additions and 51 deletions

View File

@ -295,12 +295,12 @@ static void caca_set_texture_frame(void *data,
memcpy(caca_menu_frame, frame, pitch * height); memcpy(caca_menu_frame, frame, pitch * height);
} }
static void caca_set_osd_msg(void *data, const char *msg, static void caca_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
video_frame_info_t video_info; font_driver_render_msg(video_info, font, msg, params);
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
} }
static const video_poke_interface_t caca_poke_interface = { static const video_poke_interface_t caca_poke_interface = {

View File

@ -1122,16 +1122,15 @@ static void ctr_unload_texture(void *data, uintptr_t handle)
free(texture); free(texture);
} }
static void ctr_set_osd_msg(void *data, const char *msg, static void ctr_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
video_frame_info_t video_info;
ctr_video_t* ctr = (ctr_video_t*)data; ctr_video_t* ctr = (ctr_video_t*)data;
video_driver_build_info(&video_info);
if (ctr && ctr->msg_rendering_enabled) if (ctr && ctr->msg_rendering_enabled)
font_driver_render_msg(&video_info, font, msg, params); font_driver_render_msg(video_info, font, msg, params);
} }
static const video_poke_interface_t ctr_poke_interface = { static const video_poke_interface_t ctr_poke_interface = {

View File

@ -960,18 +960,17 @@ static void d3d_apply_state_changes(void *data)
d3d->should_resize = true; d3d->should_resize = true;
} }
static void d3d_set_osd_msg(void *data, const char *msg, static void d3d_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
video_frame_info_t video_info;
d3d_video_t *d3d = (d3d_video_t*)data; d3d_video_t *d3d = (d3d_video_t*)data;
video_driver_build_info(&video_info);
if (d3d->renderchain_driver->set_font_rect && params) if (d3d->renderchain_driver->set_font_rect && params)
d3d->renderchain_driver->set_font_rect(d3d, params); d3d->renderchain_driver->set_font_rect(d3d, params);
font_driver_render_msg(&video_info, NULL, msg, params); font_driver_render_msg(video_info, NULL, msg, params);
} }
/* Delay constructor due to lack of exceptions. */ /* Delay constructor due to lack of exceptions. */

View File

@ -403,12 +403,12 @@ static void gdi_set_texture_frame(void *data,
} }
} }
static void gdi_set_osd_msg(void *data, const char *msg, static void gdi_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
video_frame_info_t video_info; font_driver_render_msg(video_info, font, msg, params);
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
} }
static void gdi_get_video_output_size(void *data, static void gdi_get_video_output_size(void *data,

View File

@ -962,12 +962,12 @@ static void gl_set_texture_enable(void *data, bool state, bool full_screen)
gl->menu_texture_full_screen = full_screen; gl->menu_texture_full_screen = full_screen;
} }
static void gl_set_osd_msg(void *data, const char *msg, static void gl_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
video_frame_info_t video_info; font_driver_render_msg(video_info, font, msg, params);
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
} }
static void gl_show_mouse(void *data, bool state) static void gl_show_mouse(void *data, bool state)

View File

@ -707,7 +707,9 @@ static void sdl2_poke_texture_enable(void *data, bool enable, bool full_screen)
vid->menu.active = enable; vid->menu.active = enable;
} }
static void sdl2_poke_set_osd_msg(void *data, const char *msg, static void sdl2_poke_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
sdl2_video_t *vid = (sdl2_video_t*)data; sdl2_video_t *vid = (sdl2_video_t*)data;

View File

@ -387,12 +387,12 @@ static void vga_set_texture_frame(void *data,
} }
} }
static void vga_set_osd_msg(void *data, const char *msg, static void vga_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
video_frame_info_t video_info; font_driver_render_msg(video_info, font, msg, params);
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
} }
static const video_poke_interface_t vga_poke_interface = { static const video_poke_interface_t vga_poke_interface = {

View File

@ -748,12 +748,12 @@ static void vita_unload_texture(void *data, uintptr_t handle)
//free(texture); //free(texture);
} }
static void vita_set_osd_msg(void *data, const char *msg, static void vita_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
video_frame_info_t video_info; font_driver_render_msg(video_info, font, msg, params);
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
} }
static bool vita_get_current_sw_framebuffer(void *data, static bool vita_get_current_sw_framebuffer(void *data,

View File

@ -2227,12 +2227,12 @@ static void vulkan_set_texture_enable(void *data, bool state, bool full_screen)
vk->menu.full_screen = full_screen; vk->menu.full_screen = full_screen;
} }
static void vulkan_set_osd_msg(void *data, const char *msg, static void vulkan_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
video_frame_info_t video_info; font_driver_render_msg(video_info, font, msg, params);
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
} }
#endif #endif

View File

@ -851,13 +851,13 @@ static void wiiu_gfx_set_texture_enable(void* data, bool state, bool full_screen
} }
static void wiiu_gfx_set_osd_msg(void* data, const char* msg, static void wiiu_gfx_set_osd_msg(void* data,
const void* params, void* font) video_frame_info_t *video_info,
const char* msg,
const void* params, void* font)
{ {
} }
static const video_poke_interface_t wiiu_poke_interface = static const video_poke_interface_t wiiu_poke_interface =
{ {
wiiu_gfx_load_texture, wiiu_gfx_load_texture,

View File

@ -190,7 +190,9 @@ static void xshm_poke_texture_enable(void *data, bool enable, bool full_screen)
} }
static void xshm_poke_set_osd_msg(void *data, const char *msg, static void xshm_poke_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const struct font_params *params, void *font) const struct font_params *params, void *font)
{ {

View File

@ -421,7 +421,6 @@ static void *xv_init(const video_info_t *video,
{ {
unsigned i; unsigned i;
XWindowAttributes target; XWindowAttributes target;
video_frame_info_t video_info;
char buf[128] = {0}; char buf[128] = {0};
char title[128] = {0}; char title[128] = {0};
XSetWindowAttributes attributes = {0}; XSetWindowAttributes attributes = {0};
@ -538,8 +537,6 @@ static void *xv_init(const video_info_t *video,
XMapWindow(g_x11_dpy, g_x11_win); XMapWindow(g_x11_dpy, g_x11_win);
video_driver_build_info(&video_info);
video_driver_get_window_title(title, sizeof(title)); video_driver_get_window_title(title, sizeof(title));
if (title[0]) if (title[0])

View File

@ -912,8 +912,10 @@ bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
void video_driver_set_osd_msg(const char *msg, const void *data, void *font) void video_driver_set_osd_msg(const char *msg, const void *data, void *font)
{ {
video_frame_info_t video_info;
video_driver_build_info(&video_info);
if (video_driver_poke && video_driver_poke->set_osd_msg) if (video_driver_poke && video_driver_poke->set_osd_msg)
video_driver_poke->set_osd_msg(video_driver_data, msg, data, font); video_driver_poke->set_osd_msg(video_driver_data, &video_info, msg, data, font);
} }
void video_driver_set_texture_enable(bool enable, bool fullscreen) void video_driver_set_texture_enable(bool enable, bool fullscreen)

View File

@ -193,7 +193,8 @@ typedef struct video_poke_interface
#endif #endif
/* Enable or disable rendering. */ /* Enable or disable rendering. */
void (*set_texture_enable)(void *data, bool enable, bool full_screen); void (*set_texture_enable)(void *data, bool enable, bool full_screen);
void (*set_osd_msg)(void *data, const char *msg, void (*set_osd_msg)(void *data, video_frame_info_t *video_info,
const char *msg,
const void *params, void *font); const void *params, void *font);
void (*show_mouse)(void *data, bool state); void (*show_mouse)(void *data, bool state);

View File

@ -532,10 +532,15 @@ static bool video_thread_handle_packet(
break; break;
case CMD_POKE_SET_OSD_MSG: case CMD_POKE_SET_OSD_MSG:
if (thr->poke && thr->poke->set_osd_msg) {
thr->poke->set_osd_msg(thr->driver_data, video_frame_info_t video_info;
pkt.data.osd_message.msg, video_driver_build_info(&video_info);
&pkt.data.osd_message.params, NULL); if (thr->poke && thr->poke->set_osd_msg)
thr->poke->set_osd_msg(thr->driver_data,
&video_info,
pkt.data.osd_message.msg,
&pkt.data.osd_message.params, NULL);
}
video_thread_reply(thr, &pkt); video_thread_reply(thr, &pkt);
break; break;
@ -1205,7 +1210,9 @@ static void thread_set_texture_enable(void *data, bool state, bool full_screen)
slock_unlock(thr->frame.lock); slock_unlock(thr->frame.lock);
} }
static void thread_set_osd_msg(void *data, const char *msg, static void thread_set_osd_msg(void *data,
video_frame_info_t *video_info,
const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
thread_video_t *thr = (thread_video_t*)data; thread_video_t *thr = (thread_video_t*)data;
@ -1216,7 +1223,7 @@ static void thread_set_osd_msg(void *data, const char *msg,
/* TODO : find a way to determine if the calling /* TODO : find a way to determine if the calling
* thread is the driver thread or not. */ * thread is the driver thread or not. */
if (thr->poke && thr->poke->set_osd_msg) if (thr->poke && thr->poke->set_osd_msg)
thr->poke->set_osd_msg(thr->driver_data, msg, params, font); thr->poke->set_osd_msg(thr->driver_data, video_info, msg, params, font);
} }
#endif #endif