This commit is contained in:
twinaphex 2017-01-13 16:57:57 +01:00
parent 1fa3475d79
commit 23017e0b45
7 changed files with 19 additions and 17 deletions

View File

@ -15,7 +15,8 @@
#include <compat/strl.h>
#include "../../configuration.h"
#include <retro_miscellaneous.h>
#include "../../verbosity.h"
#include "drm_common.h"
@ -63,12 +64,11 @@ bool drm_get_resources(int fd)
return true;
}
bool drm_get_connector(int fd)
bool drm_get_connector(int fd, unsigned video_monitor_index)
{
unsigned i;
unsigned monitor_index = 0;
settings_t *settings = config_get_ptr();
unsigned monitor = MAX(settings->video.monitor_index, 1);
unsigned monitor = MAX(video_monitor_index, 1);
/* Enumerate all connectors. */

View File

@ -47,12 +47,12 @@ void drm_restore_crtc(void);
bool drm_get_resources(int fd);
bool drm_get_connector(int id);
void drm_setup(int fd);
void drm_free(void);
bool drm_get_connector(int fd, unsigned video_monitor_index);
static INLINE bool drm_wait_flip(int timeout)
{
g_drm_fds.revents = 0;

View File

@ -30,7 +30,6 @@
#include "x11_common.h"
#include "../../frontend/frontend_driver.h"
#include "../../input/common/input_x11_common.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../../runloop.h"
@ -324,7 +323,8 @@ void x11_suspend_screensaver(Window wnd, bool enable)
x11_suspend_screensaver_xdg_screensaver(wnd, enable);
}
static bool get_video_mode(Display *dpy, unsigned width, unsigned height,
static bool get_video_mode(video_frame_info_t video_info,
Display *dpy, unsigned width, unsigned height,
XF86VidModeModeInfo *mode, XF86VidModeModeInfo *desktop_mode)
{
float refresh_mod;
@ -332,7 +332,6 @@ static bool get_video_mode(Display *dpy, unsigned width, unsigned height,
bool ret = false;
float minimum_fps_diff = 0.0f;
XF86VidModeModeInfo **modes = NULL;
settings_t *settings = config_get_ptr();
XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &num_modes, &modes);
@ -346,7 +345,7 @@ static bool get_video_mode(Display *dpy, unsigned width, unsigned height,
/* If we use black frame insertion, we fake a 60 Hz monitor
* for 120 Hz one, etc, so try to match that. */
refresh_mod = settings->video.black_frame_insertion ? 0.5f : 1.0f;
refresh_mod = video_info.black_frame_insertion ? 0.5f : 1.0f;
for (i = 0; i < num_modes; i++)
{
@ -362,7 +361,7 @@ static bool get_video_mode(Display *dpy, unsigned width, unsigned height,
continue;
refresh = refresh_mod * m->dotclock * 1000.0f / (m->htotal * m->vtotal);
diff = fabsf(refresh - settings->video.refresh_rate);
diff = fabsf(refresh - video_info.refresh_rate);
if (!ret || diff < minimum_fps_diff)
{
@ -376,12 +375,13 @@ static bool get_video_mode(Display *dpy, unsigned width, unsigned height,
return ret;
}
bool x11_enter_fullscreen(Display *dpy, unsigned width,
bool x11_enter_fullscreen(video_frame_info_t video_info,
Display *dpy, unsigned width,
unsigned height, XF86VidModeModeInfo *desktop_mode)
{
XF86VidModeModeInfo mode;
if (!get_video_mode(dpy, width, height, &mode, desktop_mode))
if (!get_video_mode(video_info, dpy, width, height, &mode, desktop_mode))
return false;
if (!XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), &mode))

View File

@ -33,6 +33,7 @@
#include <boolean.h>
#include "../video_driver.h"
#include "../video_context_driver.h"
extern Window g_x11_win;
@ -44,7 +45,8 @@ void x11_save_last_used_monitor(Window win);
void x11_show_mouse(Display *dpy, Window win, bool state);
void x11_windowed_fullscreen(Display *dpy, Window win);
void x11_suspend_screensaver(Window win, bool enable);
bool x11_enter_fullscreen(Display *dpy, unsigned width,
bool x11_enter_fullscreen(video_frame_info_t video_info,
Display *dpy, unsigned width,
unsigned height, XF86VidModeModeInfo *desktop_mode);
void x11_exit_fullscreen(Display *dpy, XF86VidModeModeInfo *desktop_mode);

View File

@ -393,7 +393,7 @@ nextgpu:
if (!drm_get_resources(fd))
goto nextgpu;
if (!drm_get_connector(fd))
if (!drm_get_connector(video_info.monitor_index, fd))
goto nextgpu;
if (!drm_get_encoder(fd))

View File

@ -507,7 +507,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
if (fullscreen && !windowed_full)
{
if (x11_enter_fullscreen(g_x11_dpy, width, height, &x->g_desktop_mode))
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height, &x->g_desktop_mode))
{
x->g_should_reset_mode = true;
true_full = true;

View File

@ -301,7 +301,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
if (fullscreen && !video_info.windowed_fullscreen)
{
if (x11_enter_fullscreen(g_x11_dpy, width, height, &xegl->desktop_mode))
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height, &xegl->desktop_mode))
{
xegl->should_reset_mode = true;
true_full = true;