Implement set_video_mode in video poke interface

This commit is contained in:
twinaphex 2015-02-24 21:57:51 +01:00
parent 88137521c4
commit f80e3740aa
13 changed files with 74 additions and 29 deletions

View File

@ -1917,6 +1917,7 @@ static void d3d_set_menu_texture_enable(void *data,
#endif
static const video_poke_interface_t d3d_poke_interface = {
NULL,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */

View File

@ -1613,6 +1613,7 @@ static void exynos_show_mouse(void *data, bool state)
}
static const video_poke_interface_t exynos_poke_interface = {
NULL, /* set_video_mode */
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */

View File

@ -861,6 +861,15 @@ static void gl_set_rotation(void *data, unsigned rotation)
gl_set_projection(gl, &ortho, true);
}
static void gl_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen)
{
gl_t *gl = (gl_t*)data;
if (gl && gl->ctx_driver && gl->ctx_driver->set_video_mode)
gl->ctx_driver->set_video_mode(gl, width, height, fullscreen);
}
#ifdef HAVE_FBO
static inline void gl_start_frame_fbo(gl_t *gl)
{
@ -3114,6 +3123,7 @@ static void gl_get_video_output_next(void *data)
static const video_poke_interface_t gl_poke_interface = {
gl_set_video_mode,
NULL,
gl_get_video_output_size,
gl_get_video_output_prev,

View File

@ -138,6 +138,8 @@ enum
GX_RESOLUTIONS_LAST,
};
static unsigned menu_current_gx_resolution = GX_RESOLUTIONS_640_480;
unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2] = {
{ 512, 192 },
{ 598, 200 },
@ -200,7 +202,8 @@ static void gx_free_overlay(gx_video_t *gx)
}
#endif
void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines)
static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
bool fullscreen)
{
unsigned modetype, level, viHeightMultiplier, viWidth, tvmode,
max_width, max_height, i;
@ -433,7 +436,7 @@ static void setup_video_mode(void *data)
OSInitThreadQueue(&g_video_cond);
VIDEO_GetPreferredMode(&gx_mode);
gx_set_video_mode(data, 0, 0);
gx_set_video_mode(data, 0, 0, true);
}
static void init_texture(void *data, unsigned width, unsigned height)
@ -1241,13 +1244,13 @@ static void gx_get_video_output_size(void *data, unsigned *width, unsigned *heig
*height = menu_gx_resolutions[menu_current_gx_resolution][1];
}
static void gx_video_output_get_prev(void *data)
static void gx_get_video_output_prev(void *data)
{
if (menu_current_gx_resolution > 0)
menu_current_gx_resolution--;
}
static void gx_video_output_get_next(void *data)
static void gx_get_video_output_next(void *data)
{
if (menu_current_gx_resolution < GX_RESOLUTIONS_LAST - 1)
{
@ -1262,6 +1265,7 @@ static void gx_video_output_get_next(void *data)
}
static const video_poke_interface_t gx_poke_interface = {
gx_set_video_mode,
NULL,
gx_get_video_output_size,
gx_get_video_output_prev,

View File

@ -46,8 +46,5 @@ typedef struct gx_video
#endif
} gx_video_t;
void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines);
const char *gx_get_video_mode(void);
#endif

View File

@ -840,6 +840,7 @@ static void psp_viewport_info(void *data, struct video_viewport *vp)
}
static const video_poke_interface_t psp_poke_interface = {
NULL,
psp_set_filtering,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */

View File

@ -717,6 +717,7 @@ void sdl2_grab_mouse_toggle(void *data)
}
static video_poke_interface_t sdl2_video_poke_interface = {
NULL,
sdl2_poke_set_filtering,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */

View File

@ -506,6 +506,7 @@ static void sdl_grab_mouse_toggle(void *data)
}
static const video_poke_interface_t sdl_poke_interface = {
NULL,
sdl_set_filtering,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */

View File

@ -315,6 +315,21 @@ static bool gfx_ctx_ps3_set_video_mode(void *data,
bool fullscreen)
{
(void)data;
if (g_extern.console.screen.resolutions.list[
g_extern.console.screen.resolutions.current.idx] ==
CELL_VIDEO_OUT_RESOLUTION_576)
{
if (g_extern.console.screen.pal_enable)
g_extern.console.screen.pal60_enable = true;
}
else
{
g_extern.console.screen.pal_enable = false;
g_extern.console.screen.pal60_enable = false;
}
rarch_main_command(RARCH_CMD_REINIT);
return true;
}

View File

@ -92,6 +92,7 @@ enum texture_filter_type
typedef struct video_poke_interface
{
void (*set_video_mode)(void *data, unsigned width, unsigned height, bool fullscreen);
void (*set_filtering)(void *data, unsigned index, bool smooth);
void (*get_video_output_size)(void *data, unsigned *width, unsigned *height);
void (*get_video_output_prev)(void *data);

View File

@ -249,6 +249,14 @@ static void thread_loop(void *data)
break;
#endif
case CMD_POKE_SET_VIDEO_MODE:
if (thr->poke && thr->poke->set_video_mode)
thr->poke->set_video_mode(thr->driver_data,
thr->cmd_data.new_mode.width,
thr->cmd_data.new_mode.height,
thr->cmd_data.new_mode.fullscreen);
thread_reply(thr, CMD_POKE_SET_VIDEO_MODE);
break;
case CMD_POKE_SET_FILTERING:
if (thr->poke && thr->poke->set_filtering)
thr->poke->set_filtering(thr->driver_data,
@ -767,6 +775,20 @@ static void thread_get_overlay_interface(void *data,
}
#endif
static void thread_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen)
{
thread_video_t *thr = (thread_video_t*)data;
if (!thr)
return;
thr->cmd_data.new_mode.width = width;
thr->cmd_data.new_mode.height = height;
thr->cmd_data.new_mode.fullscreen = fullscreen;
thread_send_cmd(thr, CMD_POKE_SET_VIDEO_MODE);
thread_wait_reply(thr, CMD_POKE_SET_VIDEO_MODE);
}
static void thread_set_filtering(void *data, unsigned idx, bool smooth)
{
thread_video_t *thr = (thread_video_t*)data;
@ -904,6 +926,7 @@ static struct video_shader *thread_get_current_shader(void *data)
}
static const video_poke_interface_t thread_poke = {
thread_set_video_mode,
thread_set_filtering,
thread_get_video_output_size,
thread_get_video_output_prev,

View File

@ -41,6 +41,7 @@ enum thread_cmd
CMD_OVERLAY_FULL_SCREEN,
#endif
CMD_POKE_SET_VIDEO_MODE,
CMD_POKE_SET_FILTERING,
CMD_POKE_GET_VIDEO_OUTPUT_SIZE,
CMD_POKE_GET_VIDEO_OUTPUT_PREV,
@ -143,6 +144,13 @@ typedef struct thread_video
unsigned height;
} output;
struct
{
unsigned width;
unsigned height;
bool fullscreen;
} new_mode;
struct
{
unsigned index;

View File

@ -45,10 +45,6 @@
#include "../gfx/video_viewport.h"
#ifdef GEKKO
unsigned menu_current_gx_resolution = GX_RESOLUTIONS_640_480;
#endif
static unsigned rdb_entry_start_game_selection_ptr;
static int archive_open(void)
@ -2376,7 +2372,6 @@ static int action_toggle_shader_num_passes(unsigned type, const char *label,
static int action_ok_video_resolution(const char *path,
const char *label, unsigned type, size_t idx)
{
#ifdef GEKKO
if (driver.video_data && driver.video_poke &&
driver.video_poke->get_video_output_size)
{
@ -2384,24 +2379,11 @@ static int action_ok_video_resolution(const char *path,
driver.video_poke->get_video_output_size(driver.video_data,
&width, &height);
gx_set_video_mode(driver.video_data, width, height);
if (driver.video_data && driver.video_poke &&
driver.video_poke->set_video_mode)
driver.video_poke->set_video_mode(driver.video_data,
width, height, true);
}
#elif defined(__CELLOS_LV2__)
if (g_extern.console.screen.resolutions.list[
g_extern.console.screen.resolutions.current.idx] ==
CELL_VIDEO_OUT_RESOLUTION_576)
{
if (g_extern.console.screen.pal_enable)
g_extern.console.screen.pal60_enable = true;
}
else
{
g_extern.console.screen.pal_enable = false;
g_extern.console.screen.pal60_enable = false;
}
rarch_main_command(RARCH_CMD_REINIT);
#endif
return 0;
}