Force fullscreen in case of KMS display
Change GL2, GL3 and Vulkan drivers to behave as fullscreen if context driver (such as KMS/DRM or KHR) does not support windowed mode at all. Take it into account also for refresh rate switch.
This commit is contained in:
parent
6068799080
commit
926ba5c843
|
@ -4258,6 +4258,7 @@ static void *gl2_init(const video_info_t *video,
|
||||||
unsigned temp_width = 0;
|
unsigned temp_width = 0;
|
||||||
unsigned temp_height = 0;
|
unsigned temp_height = 0;
|
||||||
bool force_smooth = false;
|
bool force_smooth = false;
|
||||||
|
bool force_fullscreen = false;
|
||||||
const char *vendor = NULL;
|
const char *vendor = NULL;
|
||||||
const char *renderer = NULL;
|
const char *renderer = NULL;
|
||||||
const char *version = NULL;
|
const char *version = NULL;
|
||||||
|
@ -4281,6 +4282,13 @@ static void *gl2_init(const video_info_t *video,
|
||||||
gl->ctx_driver->get_video_size(gl->ctx_data,
|
gl->ctx_driver->get_video_size(gl->ctx_data,
|
||||||
&mode_width, &mode_height);
|
&mode_width, &mode_height);
|
||||||
|
|
||||||
|
if (!video->fullscreen && !gl->ctx_driver->has_windowed)
|
||||||
|
{
|
||||||
|
RARCH_DBG("[GL]: Config requires windowed mode, but context driver does not support it. "
|
||||||
|
"Forcing fullscreen for this session.\n");
|
||||||
|
force_fullscreen = true;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(DINGUX)
|
#if defined(DINGUX)
|
||||||
mode_width = 320;
|
mode_width = 320;
|
||||||
mode_height = 240;
|
mode_height = 240;
|
||||||
|
@ -4311,17 +4319,23 @@ static void *gl2_init(const video_info_t *video,
|
||||||
win_width = full_x;
|
win_width = full_x;
|
||||||
win_height = full_y;
|
win_height = full_y;
|
||||||
}
|
}
|
||||||
|
/* If fullscreen had to be forced, video->width/height is incorrect */
|
||||||
|
else if (force_fullscreen)
|
||||||
|
{
|
||||||
|
win_width = settings->uints.video_fullscreen_x;
|
||||||
|
win_height = settings->uints.video_fullscreen_y;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !gl->ctx_driver->set_video_mode
|
if ( !gl->ctx_driver->set_video_mode
|
||||||
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
|
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
|
||||||
win_width, win_height, video->fullscreen))
|
win_width, win_height, (video->fullscreen || force_fullscreen)))
|
||||||
goto error;
|
goto error;
|
||||||
#if defined(__APPLE__) && !defined(IOS) && !defined(HAVE_COCOA_METAL)
|
#if defined(__APPLE__) && !defined(IOS) && !defined(HAVE_COCOA_METAL)
|
||||||
/* This is a hack for now to work around a very annoying
|
/* This is a hack for now to work around a very annoying
|
||||||
* issue that currently eludes us. */
|
* issue that currently eludes us. */
|
||||||
if ( !gl->ctx_driver->set_video_mode
|
if ( !gl->ctx_driver->set_video_mode
|
||||||
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
|
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
|
||||||
win_width, win_height, video->fullscreen))
|
win_width, win_height, (video->fullscreen || force_fullscreen)))
|
||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4446,7 +4460,7 @@ static void *gl2_init(const video_info_t *video,
|
||||||
gl2_begin_debug(gl);
|
gl2_begin_debug(gl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (video->fullscreen)
|
if (video->fullscreen || force_fullscreen)
|
||||||
gl->flags |= GL2_FLAG_FULLSCREEN;
|
gl->flags |= GL2_FLAG_FULLSCREEN;
|
||||||
|
|
||||||
mode_width = 0;
|
mode_width = 0;
|
||||||
|
|
|
@ -1770,6 +1770,7 @@ static void *gl3_init(const video_info_t *video,
|
||||||
unsigned full_x, full_y;
|
unsigned full_x, full_y;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool video_gpu_record = settings->bools.video_gpu_record;
|
bool video_gpu_record = settings->bools.video_gpu_record;
|
||||||
|
bool force_fullscreen = false;
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
unsigned mode_width = 0;
|
unsigned mode_width = 0;
|
||||||
unsigned mode_height = 0;
|
unsigned mode_height = 0;
|
||||||
|
@ -1799,6 +1800,13 @@ static void *gl3_init(const video_info_t *video,
|
||||||
gl->ctx_driver->get_video_size(gl->ctx_data,
|
gl->ctx_driver->get_video_size(gl->ctx_data,
|
||||||
&mode_width, &mode_height);
|
&mode_width, &mode_height);
|
||||||
|
|
||||||
|
if (!video->fullscreen && !gl->ctx_driver->has_windowed)
|
||||||
|
{
|
||||||
|
RARCH_DBG("[GLCore]: Config requires windowed mode, but context driver does not support it. "
|
||||||
|
"Forcing fullscreen for this session.\n");
|
||||||
|
force_fullscreen = true;
|
||||||
|
}
|
||||||
|
|
||||||
full_x = mode_width;
|
full_x = mode_width;
|
||||||
full_y = mode_height;
|
full_y = mode_height;
|
||||||
mode_width = 0;
|
mode_width = 0;
|
||||||
|
@ -1827,10 +1835,16 @@ static void *gl3_init(const video_info_t *video,
|
||||||
win_width = full_x;
|
win_width = full_x;
|
||||||
win_height = full_y;
|
win_height = full_y;
|
||||||
}
|
}
|
||||||
|
/* If fullscreen had to be forced, video->width/height is incorrect */
|
||||||
|
else if (force_fullscreen)
|
||||||
|
{
|
||||||
|
win_width = settings->uints.video_fullscreen_x;
|
||||||
|
win_height = settings->uints.video_fullscreen_y;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !gl->ctx_driver->set_video_mode
|
if ( !gl->ctx_driver->set_video_mode
|
||||||
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
|
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
|
||||||
win_width, win_height, video->fullscreen))
|
win_width, win_height, (video->fullscreen || force_fullscreen)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (gl->flags & GL3_FLAG_USE_SHARED_CONTEXT)
|
if (gl->flags & GL3_FLAG_USE_SHARED_CONTEXT)
|
||||||
|
@ -1889,7 +1903,7 @@ static void *gl3_init(const video_info_t *video,
|
||||||
|
|
||||||
if (video->vsync)
|
if (video->vsync)
|
||||||
gl->flags |= GL3_FLAG_VSYNC;
|
gl->flags |= GL3_FLAG_VSYNC;
|
||||||
if (video->fullscreen)
|
if (video->fullscreen || force_fullscreen)
|
||||||
gl->flags |= GL3_FLAG_FULLSCREEN;
|
gl->flags |= GL3_FLAG_FULLSCREEN;
|
||||||
if (video->force_aspect)
|
if (video->force_aspect)
|
||||||
gl->flags |= GL3_FLAG_KEEP_ASPECT;
|
gl->flags |= GL3_FLAG_KEEP_ASPECT;
|
||||||
|
|
|
@ -3318,6 +3318,7 @@ static void *vulkan_init(const video_info_t *video,
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
unsigned temp_width = 0;
|
unsigned temp_width = 0;
|
||||||
unsigned temp_height = 0;
|
unsigned temp_height = 0;
|
||||||
|
bool force_fullscreen = false;
|
||||||
const gfx_ctx_driver_t *ctx_driver = NULL;
|
const gfx_ctx_driver_t *ctx_driver = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
#ifdef VULKAN_HDR_SWAPCHAIN
|
#ifdef VULKAN_HDR_SWAPCHAIN
|
||||||
|
@ -3351,6 +3352,13 @@ static void *vulkan_init(const video_info_t *video,
|
||||||
vk->ctx_driver->get_video_size(vk->ctx_data,
|
vk->ctx_driver->get_video_size(vk->ctx_data,
|
||||||
&mode_width, &mode_height);
|
&mode_width, &mode_height);
|
||||||
|
|
||||||
|
if (!video->fullscreen && !vk->ctx_driver->has_windowed)
|
||||||
|
{
|
||||||
|
RARCH_DBG("[Vulkan]: Config requires windowed mode, but context driver does not support it. "
|
||||||
|
"Forcing fullscreen for this session.\n");
|
||||||
|
force_fullscreen = true;
|
||||||
|
}
|
||||||
|
|
||||||
full_x = mode_width;
|
full_x = mode_width;
|
||||||
full_y = mode_height;
|
full_y = mode_height;
|
||||||
mode_width = 0;
|
mode_width = 0;
|
||||||
|
@ -3376,10 +3384,16 @@ static void *vulkan_init(const video_info_t *video,
|
||||||
win_width = full_x;
|
win_width = full_x;
|
||||||
win_height = full_y;
|
win_height = full_y;
|
||||||
}
|
}
|
||||||
|
/* If fullscreen had to be forced, video->width/height is incorrect */
|
||||||
|
else if (force_fullscreen)
|
||||||
|
{
|
||||||
|
win_width = settings->uints.video_fullscreen_x;
|
||||||
|
win_height = settings->uints.video_fullscreen_y;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !vk->ctx_driver->set_video_mode
|
if ( !vk->ctx_driver->set_video_mode
|
||||||
|| !vk->ctx_driver->set_video_mode(vk->ctx_data,
|
|| !vk->ctx_driver->set_video_mode(vk->ctx_data,
|
||||||
win_width, win_height, video->fullscreen))
|
win_width, win_height, (video->fullscreen || force_fullscreen)))
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Vulkan]: Failed to set video mode.\n");
|
RARCH_ERR("[Vulkan]: Failed to set video mode.\n");
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -3412,7 +3426,7 @@ static void *vulkan_init(const video_info_t *video,
|
||||||
vk->flags |= VK_FLAG_VSYNC;
|
vk->flags |= VK_FLAG_VSYNC;
|
||||||
else
|
else
|
||||||
vk->flags &= ~VK_FLAG_VSYNC;
|
vk->flags &= ~VK_FLAG_VSYNC;
|
||||||
if (video->fullscreen)
|
if (video->fullscreen || force_fullscreen)
|
||||||
vk->flags |= VK_FLAG_FULLSCREEN;
|
vk->flags |= VK_FLAG_FULLSCREEN;
|
||||||
else
|
else
|
||||||
vk->flags &= ~VK_FLAG_FULLSCREEN;
|
vk->flags &= ~VK_FLAG_FULLSCREEN;
|
||||||
|
|
|
@ -1243,7 +1243,8 @@ void video_switch_refresh_rate_maybe(
|
||||||
unsigned video_bfi = settings->uints.video_black_frame_insertion;
|
unsigned video_bfi = settings->uints.video_black_frame_insertion;
|
||||||
unsigned shader_subframes = settings->uints.video_shader_subframes;
|
unsigned shader_subframes = settings->uints.video_shader_subframes;
|
||||||
bool vrr_runloop_enable = settings->bools.vrr_runloop_enable;
|
bool vrr_runloop_enable = settings->bools.vrr_runloop_enable;
|
||||||
bool exclusive_fullscreen = settings->bools.video_fullscreen && !settings->bools.video_windowed_fullscreen;
|
bool exclusive_fullscreen = (video_st->flags | VIDEO_FLAG_FORCE_FULLSCREEN) || (
|
||||||
|
settings->bools.video_fullscreen && !settings->bools.video_windowed_fullscreen);
|
||||||
bool windowed_fullscreen = settings->bools.video_fullscreen && settings->bools.video_windowed_fullscreen;
|
bool windowed_fullscreen = settings->bools.video_fullscreen && settings->bools.video_windowed_fullscreen;
|
||||||
bool all_fullscreen = settings->bools.video_fullscreen || settings->bools.video_windowed_fullscreen;
|
bool all_fullscreen = settings->bools.video_fullscreen || settings->bools.video_windowed_fullscreen;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue