Get rid of video_info dependency for set_video_mode
This commit is contained in:
parent
e20151a048
commit
4d7b627421
|
@ -49,8 +49,8 @@
|
|||
#include "../../input/input_driver.h"
|
||||
#include "../../input/input_keymaps.h"
|
||||
#include "../../input/common/input_x11_common.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define _NET_WM_STATE_ADD 1
|
||||
#define MOVERESIZE_GRAVITY_CENTER 5
|
||||
|
@ -267,7 +267,7 @@ float x11_get_refresh_rate(void *data)
|
|||
return refresh;
|
||||
}
|
||||
|
||||
static bool get_video_mode(video_frame_info_t *video_info,
|
||||
static bool get_video_mode(
|
||||
Display *dpy, unsigned width, unsigned height,
|
||||
XF86VidModeModeInfo *mode, XF86VidModeModeInfo *desktop_mode)
|
||||
{
|
||||
|
@ -276,6 +276,9 @@ static bool get_video_mode(video_frame_info_t *video_info,
|
|||
float refresh_mod = 0.0f;
|
||||
float minimum_fps_diff = 0.0f;
|
||||
XF86VidModeModeInfo **modes = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool black_frame_insertion = settings->bools.black_frame_insertion;
|
||||
float video_refresh_rate = settings->floats.video_refresh_rate;
|
||||
|
||||
XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &num_modes, &modes);
|
||||
|
||||
|
@ -289,7 +292,7 @@ static bool get_video_mode(video_frame_info_t *video_info,
|
|||
|
||||
/* If we use black frame insertion, we fake a 60 Hz monitor
|
||||
* for 120 Hz one, etc, so try to match that. */
|
||||
refresh_mod = video_info->black_frame_insertion ? 0.5f : 1.0f;
|
||||
refresh_mod = black_frame_insertion ? 0.5f : 1.0f;
|
||||
|
||||
for (i = 0; i < num_modes; i++)
|
||||
{
|
||||
|
@ -305,7 +308,7 @@ static bool get_video_mode(video_frame_info_t *video_info,
|
|||
continue;
|
||||
|
||||
refresh = refresh_mod * m->dotclock * 1000.0f / (m->htotal * m->vtotal);
|
||||
diff = fabsf(refresh - video_info->refresh_rate);
|
||||
diff = fabsf(refresh - video_refresh_rate);
|
||||
|
||||
if (!ret || diff < minimum_fps_diff)
|
||||
{
|
||||
|
@ -319,13 +322,13 @@ static bool get_video_mode(video_frame_info_t *video_info,
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool x11_enter_fullscreen(video_frame_info_t *video_info,
|
||||
bool x11_enter_fullscreen(
|
||||
Display *dpy, unsigned width,
|
||||
unsigned height)
|
||||
{
|
||||
XF86VidModeModeInfo mode;
|
||||
|
||||
if (!get_video_mode(video_info, dpy, width, height, &mode, &desktop_mode))
|
||||
if (!get_video_mode(dpy, width, height, &mode, &desktop_mode))
|
||||
return false;
|
||||
|
||||
if (!XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), &mode))
|
||||
|
|
|
@ -31,9 +31,7 @@ extern unsigned g_x11_screen;
|
|||
void x11_show_mouse(Display *dpy, Window win, bool state);
|
||||
void x11_set_net_wm_fullscreen(Display *dpy, Window win);
|
||||
void x11_suspend_screensaver(Window win, bool enable);
|
||||
bool x11_enter_fullscreen(video_frame_info_t *video_info,
|
||||
Display *dpy, unsigned width,
|
||||
unsigned height);
|
||||
bool x11_enter_fullscreen(Display *dpy, unsigned width, unsigned height);
|
||||
|
||||
void x11_exit_fullscreen(Display *dpy);
|
||||
void x11_move_window(Display *dpy, Window win,
|
||||
|
|
|
@ -306,7 +306,6 @@ static bool android_gfx_ctx_set_resize(void *data,
|
|||
}
|
||||
|
||||
static bool android_gfx_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -105,7 +105,6 @@ static void gfx_ctx_cgl_swap_buffers(void *data)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_cgl_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -689,7 +689,6 @@ static void *cocoagl_gfx_ctx_get_context_data(void *data)
|
|||
#endif
|
||||
|
||||
static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height, bool fullscreen)
|
||||
{
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
|
|
|
@ -697,7 +697,6 @@ error:
|
|||
#endif
|
||||
|
||||
static bool gfx_ctx_drm_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
@ -707,6 +706,9 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
|
|||
struct drm_fb *fb = NULL;
|
||||
#endif
|
||||
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool black_frame_insertion = settings->bools.black_frame_insertion;
|
||||
float video_refresh_rate = settings->floats.video_refresh_rate;
|
||||
|
||||
if (!drm)
|
||||
return false;
|
||||
|
@ -717,7 +719,7 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
|
|||
/* If we use black frame insertion,
|
||||
* we fake a 60 Hz monitor for 120 Hz one,
|
||||
* etc, so try to match that. */
|
||||
refresh_mod = video_info->black_frame_insertion
|
||||
refresh_mod = black_frame_insertion
|
||||
? 0.5f : 1.0f;
|
||||
|
||||
/* Find desired video mode, and use that.
|
||||
|
@ -743,7 +745,7 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
|
|||
continue;
|
||||
|
||||
diff = fabsf(refresh_mod * g_drm_connector->modes[i].vrefresh
|
||||
- video_info->refresh_rate);
|
||||
- video_refresh_rate);
|
||||
|
||||
if (!g_drm_mode || diff < minimum_fps_diff)
|
||||
{
|
||||
|
|
|
@ -245,12 +245,9 @@ error:
|
|||
}
|
||||
|
||||
static bool gfx_ctx_emscripten_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
if (g_egl_inited)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ static void gfx_ctx_fpga_destroy(void *data)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_fpga_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -166,7 +166,6 @@ static void gfx_ctx_gdi_destroy(void *data)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_gdi_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,6 @@ static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *h
|
|||
}
|
||||
|
||||
static bool gfx_ctx_null_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -121,12 +121,13 @@ static bool gfx_ctx_khr_display_set_resize(void *data,
|
|||
}
|
||||
|
||||
static bool gfx_ctx_khr_display_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
struct vulkan_display_surface_info info;
|
||||
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
|
||||
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned video_monitor_index = settings->uints.video_monitor_index;
|
||||
|
||||
if (!fullscreen)
|
||||
{
|
||||
|
@ -136,7 +137,7 @@ static bool gfx_ctx_khr_display_set_video_mode(void *data,
|
|||
|
||||
info.width = width;
|
||||
info.height = height;
|
||||
info.monitor_index = video_info->monitor_index;
|
||||
info.monitor_index = video_monitor_index;
|
||||
|
||||
if (!vulkan_surface_create(&khr->vk, VULKAN_WSI_DISPLAY, &info, NULL,
|
||||
0, 0, khr->swap_interval))
|
||||
|
|
|
@ -151,7 +151,6 @@ static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit,
|
|||
}
|
||||
|
||||
static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,6 @@ static void gfx_ctx_network_destroy(void *data)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_network_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -133,7 +133,6 @@ static void gfx_ctx_opendingux_check_window(void *data, bool *quit,
|
|||
}
|
||||
|
||||
static bool gfx_ctx_opendingux_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -141,9 +141,8 @@ static void orbis_ctx_check_window(void *data, bool *quit,
|
|||
}
|
||||
|
||||
static bool orbis_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
/* Create an EGL rendering context */
|
||||
static const EGLint contextAttributeList[] =
|
||||
|
|
|
@ -247,7 +247,6 @@ static void osmesa_ctx_swap_interval(void *data, int interval)
|
|||
}
|
||||
|
||||
static bool osmesa_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -272,7 +272,6 @@ static void *gfx_ctx_ps3_init(video_frame_info_t *video_info, void *video_driver
|
|||
}
|
||||
|
||||
static bool gfx_ctx_ps3_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -298,7 +298,6 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit,
|
|||
}
|
||||
|
||||
static bool gfx_ctx_qnx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -172,21 +172,23 @@ static void sdl_ctx_swap_interval(void *data, int interval)
|
|||
}
|
||||
|
||||
static bool sdl_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
unsigned fsflag = 0;
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool windowed_fullscreen= settings->bools.video_windowed_fullscreen;
|
||||
unsigned video_monitor_index = settings->uints.video_monitor_index;
|
||||
|
||||
sdl->g_new_width = width;
|
||||
sdl->g_new_height = height;
|
||||
sdl->g_new_width = width;
|
||||
sdl->g_new_height = height;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
if (video_info->windowed_fullscreen)
|
||||
if (windowed_fullscreen)
|
||||
fsflag = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
else
|
||||
fsflag = SDL_WINDOW_FULLSCREEN;
|
||||
|
@ -201,7 +203,7 @@ static bool sdl_ctx_set_video_mode(void *data,
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned display = video_info->monitor_index;
|
||||
unsigned display = video_monitor_index;
|
||||
|
||||
sdl->g_win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
|
||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
|
||||
|
|
|
@ -68,7 +68,6 @@ static void gfx_ctx_sixel_destroy(void *data)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_sixel_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -148,9 +148,8 @@ static void switch_ctx_check_window(void *data, bool *quit,
|
|||
}
|
||||
|
||||
static bool switch_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
/* Create an EGL rendering context */
|
||||
static const EGLint contextAttributeList[] =
|
||||
|
|
|
@ -223,7 +223,6 @@ static void gfx_ctx_uwp_destroy(void *data)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_uwp_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -336,7 +336,6 @@ static void gfx_ctx_vc_set_swap_interval(void *data, int swap_interval)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_vc_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -56,7 +56,6 @@ static void vita_swap_buffers(void *data)
|
|||
}
|
||||
|
||||
static bool vita_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -138,7 +138,6 @@ static void gfx_ctx_vivante_check_window(void *data, bool *quit,
|
|||
}
|
||||
|
||||
static bool gfx_ctx_vivante_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -1540,7 +1540,6 @@ static void gfx_ctx_wl_set_swap_interval(void *data, int swap_interval)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_wl_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -764,7 +764,6 @@ static void gfx_ctx_wgl_destroy(void *data)
|
|||
}
|
||||
|
||||
static bool gfx_ctx_wgl_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
|
|
@ -609,13 +609,11 @@ error:
|
|||
}
|
||||
|
||||
static bool gfx_ctx_x_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
XEvent event;
|
||||
bool true_full = false;
|
||||
bool windowed_full = false;
|
||||
int val = 0;
|
||||
int x_off = 0;
|
||||
int y_off = 0;
|
||||
|
@ -631,14 +629,14 @@ static bool gfx_ctx_x_set_video_mode(void *data,
|
|||
* ((unsigned)-1 / 100.0);
|
||||
bool disable_composition = settings->bools.video_disable_composition;
|
||||
bool show_decorations = settings->bools.video_window_show_decorations;
|
||||
bool windowed_full = settings->bools.video_windowed_fullscreen;
|
||||
unsigned video_monitor_index = settings->uints.video_monitor_index;
|
||||
|
||||
frontend_driver_install_signal_handler();
|
||||
|
||||
if (!x)
|
||||
return false;
|
||||
|
||||
windowed_full = video_info->windowed_fullscreen;
|
||||
true_full = false;
|
||||
|
||||
switch (x_api)
|
||||
{
|
||||
|
@ -676,7 +674,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
|
|||
|
||||
if (fullscreen && !windowed_full)
|
||||
{
|
||||
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height))
|
||||
if (x11_enter_fullscreen(g_x11_dpy, width, height))
|
||||
{
|
||||
x->g_should_reset_mode = true;
|
||||
true_full = true;
|
||||
|
@ -700,8 +698,8 @@ static bool gfx_ctx_x_set_video_mode(void *data,
|
|||
if (!x11_has_net_wm_fullscreen(g_x11_dpy) && true_full)
|
||||
swa.override_redirect = True;
|
||||
|
||||
if (video_info->monitor_index)
|
||||
g_x11_screen = video_info->monitor_index - 1;
|
||||
if (video_monitor_index)
|
||||
g_x11_screen = video_monitor_index - 1;
|
||||
|
||||
#ifdef HAVE_XINERAMA
|
||||
if (fullscreen || g_x11_screen != 0)
|
||||
|
|
|
@ -262,7 +262,6 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
|
|||
static void gfx_ctx_xegl_set_swap_interval(void *data, int swap_interval);
|
||||
|
||||
static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
|
@ -279,7 +278,9 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
|||
char *wm_name = NULL;
|
||||
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool video_disable_composition = settings ? settings->bools.video_disable_composition : false;
|
||||
bool video_disable_composition = settings->bools.video_disable_composition;
|
||||
bool windowed_full = settings->bools.video_windowed_fullscreen;
|
||||
unsigned video_monitor_index = settings->uints.video_monitor_index;
|
||||
|
||||
int (*old_handler)(Display*, XErrorEvent*) = NULL;
|
||||
|
||||
|
@ -306,9 +307,9 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
|||
ButtonPressMask | ButtonReleaseMask | KeyReleaseMask;
|
||||
swa.override_redirect = False;
|
||||
|
||||
if (fullscreen && !video_info->windowed_fullscreen)
|
||||
if (fullscreen && !windowed_fullscreen)
|
||||
{
|
||||
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height))
|
||||
if (x11_enter_fullscreen(g_x11_dpy, width, height))
|
||||
{
|
||||
xegl->should_reset_mode = true;
|
||||
true_full = true;
|
||||
|
@ -332,8 +333,8 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
|||
if (!x11_has_net_wm_fullscreen(g_x11_dpy) && true_full)
|
||||
swa.override_redirect = True;
|
||||
|
||||
if (video_info->monitor_index)
|
||||
g_x11_screen = video_info->monitor_index - 1;
|
||||
if (video_monitor_index)
|
||||
g_x11_screen = video_monitor_index - 1;
|
||||
|
||||
#ifdef HAVE_XINERAMA
|
||||
if (fullscreen || g_x11_screen != 0)
|
||||
|
|
|
@ -24341,15 +24341,10 @@ bool video_context_driver_get_ident(gfx_ctx_ident_t *ident)
|
|||
|
||||
bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info)
|
||||
{
|
||||
video_frame_info_t video_info;
|
||||
|
||||
if (!current_video_context.set_video_mode)
|
||||
return false;
|
||||
|
||||
video_driver_build_info(&video_info);
|
||||
|
||||
return current_video_context.set_video_mode(
|
||||
video_context_data, &video_info, mode_info->width,
|
||||
video_context_data, mode_info->width,
|
||||
mode_info->height, mode_info->fullscreen);
|
||||
}
|
||||
|
||||
|
|
|
@ -1222,7 +1222,7 @@ typedef struct gfx_ctx_driver
|
|||
void (*swap_interval)(void *data, int);
|
||||
|
||||
/* Sets video mode. Creates a window, etc. */
|
||||
bool (*set_video_mode)(void*, video_frame_info_t *video_info, unsigned, unsigned, bool);
|
||||
bool (*set_video_mode)(void*, unsigned, unsigned, bool);
|
||||
|
||||
/* Gets current window size.
|
||||
* If not initialized yet, it returns current screen size. */
|
||||
|
|
Loading…
Reference in New Issue