diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 2352bee33c..96fa6da99b 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1918,6 +1918,7 @@ static void d3d_set_menu_texture_enable(void *data, static const video_poke_interface_t d3d_poke_interface = { NULL, + NULL, /* get_video_output_size */ #ifdef HAVE_FBO NULL, #endif diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index 5fcb98ee5f..45bcdf10d6 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -1614,6 +1614,7 @@ static void exynos_show_mouse(void *data, bool state) static const video_poke_interface_t exynos_poke_interface = { NULL, /* set_filtering */ + NULL, /* get_video_output_size */ #ifdef HAVE_FBO NULL, /* get_current_framebuffer */ #endif diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 15364005e4..0199bd7a9c 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -3090,6 +3090,7 @@ static struct video_shader *gl_get_current_shader(void *data) static const video_poke_interface_t gl_poke_interface = { NULL, + NULL, /* get_video_output_size */ #ifdef HAVE_FBO gl_get_current_framebuffer, #endif diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index a8413b04c2..b0217504c7 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -1150,6 +1150,7 @@ static bool gx_read_viewport(void *data, uint8_t *buffer) static const video_poke_interface_t gx_poke_interface = { NULL, + NULL, /* get_video_output_size */ NULL, gx_set_aspect_ratio, gx_apply_state_changes, diff --git a/gfx/drivers/psp1_gfx.c b/gfx/drivers/psp1_gfx.c index a8c6e8b292..3fd995a03e 100644 --- a/gfx/drivers/psp1_gfx.c +++ b/gfx/drivers/psp1_gfx.c @@ -841,6 +841,7 @@ static void psp_viewport_info(void *data, struct video_viewport *vp) static const video_poke_interface_t psp_poke_interface = { psp_set_filtering, + NULL, /* get_video_output_size */ NULL, NULL, psp_set_aspect_ratio, diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 878fad3d2f..cfd66c4d4f 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -718,6 +718,7 @@ void sdl2_grab_mouse_toggle(void *data) static video_poke_interface_t sdl2_video_poke_interface = { sdl2_poke_set_filtering, + NULL, /* get_video_output_size */ #ifdef HAVE_FBO NULL, #endif diff --git a/gfx/drivers/sdl_gfx.c b/gfx/drivers/sdl_gfx.c index 2a01f82d50..f3205d811f 100644 --- a/gfx/drivers/sdl_gfx.c +++ b/gfx/drivers/sdl_gfx.c @@ -507,6 +507,7 @@ static void sdl_grab_mouse_toggle(void *data) static const video_poke_interface_t sdl_poke_interface = { sdl_set_filtering, + NULL, /* get_video_output_size */ #ifdef HAVE_FBO NULL, NULL, diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 7a2a94f060..e6491c0763 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -93,6 +93,7 @@ enum texture_filter_type typedef struct video_poke_interface { void (*set_filtering)(void *data, unsigned index, bool smooth); + void (*get_video_output_size)(void *data, unsigned *width, unsigned *height); #ifdef HAVE_FBO uintptr_t (*get_current_framebuffer)(void *data); #endif diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index 94dd197f51..fbdcdef31c 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -257,6 +257,14 @@ static void thread_loop(void *data) thread_reply(thr, CMD_POKE_SET_FILTERING); break; + case CMD_POKE_GET_VIDEO_OUTPUT_SIZE: + if (thr->poke && thr->poke->get_video_output_size) + thr->poke->get_video_output_size(thr->driver_data, + &thr->cmd_data.output.width, + &thr->cmd_data.output.height); + thread_reply(thr, CMD_POKE_GET_VIDEO_OUTPUT_SIZE); + break; + case CMD_POKE_SET_ASPECT_RATIO: thr->poke->set_aspect_ratio(thr->driver_data, thr->cmd_data.i); @@ -759,6 +767,19 @@ static void thread_set_filtering(void *data, unsigned idx, bool smooth) thread_wait_reply(thr, CMD_POKE_SET_FILTERING); } +static void thread_get_video_output_size(void *data, + unsigned *width, unsigned *height) +{ + thread_video_t *thr = (thread_video_t*)data; + + if (!thr) + return; + thread_send_cmd(thr, CMD_POKE_GET_VIDEO_OUTPUT_SIZE); + thread_wait_reply(thr, CMD_POKE_GET_VIDEO_OUTPUT_SIZE); + *width = thr->cmd_data.output.width; + *height = thr->cmd_data.output.width; +} + static void thread_set_aspect_ratio(void *data, unsigned aspectratio_idx) { thread_video_t *thr = (thread_video_t*)data; @@ -852,6 +873,7 @@ static struct video_shader *thread_get_current_shader(void *data) static const video_poke_interface_t thread_poke = { thread_set_filtering, + thread_get_video_output_size, #ifdef HAVE_FBO NULL, #endif diff --git a/gfx/video_thread_wrapper.h b/gfx/video_thread_wrapper.h index e4014ad34a..6dabe403dd 100644 --- a/gfx/video_thread_wrapper.h +++ b/gfx/video_thread_wrapper.h @@ -42,6 +42,7 @@ enum thread_cmd #endif CMD_POKE_SET_FILTERING, + CMD_POKE_GET_VIDEO_OUTPUT_SIZE, #ifdef HAVE_FBO CMD_POKE_SET_FBO_STATE, CMD_POKE_GET_FBO_STATE, @@ -134,6 +135,12 @@ typedef struct thread_video unsigned num; } image; + struct + { + unsigned width; + unsigned height; + } output; + struct { unsigned index;