mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(video context drivers) Cleanups
This commit is contained in:
parent
e0c9781b50
commit
f96ff71416
@ -282,11 +282,12 @@ void gfx_ctx_wl_update_title_common(gfx_ctx_wayland_data_t *wl)
|
||||
}
|
||||
}
|
||||
|
||||
bool gfx_ctx_wl_get_metrics_common(gfx_ctx_wayland_data_t *wl,
|
||||
bool gfx_ctx_wl_get_metrics_common(void *data,
|
||||
enum display_metric_types type, float *value)
|
||||
{
|
||||
output_info_t *tmp;
|
||||
output_info_t *oi = wl->current_output;
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||
output_info_t *tmp = NULL;
|
||||
output_info_t *oi = wl ? wl->current_output : NULL;
|
||||
|
||||
if (!oi)
|
||||
wl_list_for_each_safe(oi, tmp, &wl->all_outputs, link)
|
||||
@ -340,10 +341,9 @@ static int create_shm_file(off_t size)
|
||||
for (retry_count = 0; retry_count < 100; retry_count++)
|
||||
{
|
||||
char *name;
|
||||
if (asprintf (&name, "%s-%02d", SPLASH_SHM_NAME, retry_count) < 0)
|
||||
if (asprintf(&name, "%s-%02d", SPLASH_SHM_NAME, retry_count) < 0)
|
||||
continue;
|
||||
fd = shm_open(name, O_RDWR | O_CREAT, 0600);
|
||||
if (fd >= 0)
|
||||
if ((fd = shm_open(name, O_RDWR | O_CREAT, 0600)) >= 0)
|
||||
{
|
||||
shm_unlink(name);
|
||||
free(name);
|
||||
@ -433,8 +433,7 @@ static void shm_buffer_paint_checkerboard(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool draw_splash_screen(gfx_ctx_wayland_data_t *wl)
|
||||
static bool wl_draw_splash_screen(gfx_ctx_wayland_data_t *wl)
|
||||
{
|
||||
shm_buffer_t *buffer = create_shm_buffer(wl,
|
||||
wl->width * wl->buffer_scale,
|
||||
@ -594,7 +593,7 @@ bool gfx_ctx_wl_init_common(
|
||||
/* Bind SHM based wl_buffer to wl_surface until the vulkan surface is ready.
|
||||
* This shows the window which assigns us a display (wl_output)
|
||||
* which is usefull for HiDPI and auto selecting a display for fullscreen. */
|
||||
if (!draw_splash_screen(wl))
|
||||
if (!wl_draw_splash_screen(wl))
|
||||
RARCH_ERR("[Wayland`]: Failed to draw splash screen\n");
|
||||
|
||||
wl_display_roundtrip(wl->input.dpy);
|
||||
@ -626,7 +625,6 @@ error:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool gfx_ctx_wl_set_video_mode_common_size(gfx_ctx_wayland_data_t *wl,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ void gfx_ctx_wl_destroy_resources_common(gfx_ctx_wayland_data_t *wl);
|
||||
|
||||
void gfx_ctx_wl_update_title_common(gfx_ctx_wayland_data_t *wl);
|
||||
|
||||
bool gfx_ctx_wl_get_metrics_common(gfx_ctx_wayland_data_t *wl,
|
||||
bool gfx_ctx_wl_get_metrics_common(void *data,
|
||||
enum display_metric_types type, float *value);
|
||||
|
||||
bool gfx_ctx_wl_init_common(
|
||||
|
@ -74,9 +74,9 @@ static void *android_gfx_ctx_init(void *video_driver)
|
||||
EGLint format;
|
||||
#if 0
|
||||
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
|
||||
bool debug = hwr->debug_context;
|
||||
bool debug = hwr->debug_context;
|
||||
#endif
|
||||
EGLint attribs[] = {
|
||||
EGLint attribs[] = {
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
@ -87,8 +87,8 @@ static void *android_gfx_ctx_init(void *video_driver)
|
||||
EGL_NONE
|
||||
};
|
||||
#endif
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)
|
||||
calloc(1, sizeof(*and));
|
||||
|
||||
if (!android_app || !and)
|
||||
@ -96,7 +96,7 @@ static void *android_gfx_ctx_init(void *video_driver)
|
||||
|
||||
#ifdef HAVE_OPENGLES
|
||||
if (g_es3)
|
||||
attribs[1] = EGL_OPENGL_ES3_BIT_KHR;
|
||||
attribs[1] = EGL_OPENGL_ES3_BIT_KHR;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
@ -108,7 +108,6 @@ static void *android_gfx_ctx_init(void *video_driver)
|
||||
egl_report_error();
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!egl_get_native_visual_id(&and->egl, &format))
|
||||
goto error;
|
||||
#endif
|
||||
@ -135,9 +134,8 @@ error:
|
||||
static void android_gfx_ctx_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
egl_get_video_size(&and->egl, width, height);
|
||||
#endif
|
||||
}
|
||||
@ -184,31 +182,19 @@ static bool android_gfx_ctx_set_video_mode(void *data,
|
||||
#endif
|
||||
EGL_NONE
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
switch (android_api)
|
||||
if (android_api == GFX_CTX_OPENGL_ES_API)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
break;
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
#if defined(HAVE_OPENGLES) && defined(HAVE_EGL)
|
||||
if (!egl_create_context(&and->egl, context_attributes))
|
||||
{
|
||||
egl_report_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!egl_create_surface(&and->egl, android_app->window))
|
||||
return false;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
if (!egl_create_context(&and->egl, context_attributes))
|
||||
{
|
||||
egl_report_error();
|
||||
return false;
|
||||
}
|
||||
if (!egl_create_surface(&and->egl, android_app->window))
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -236,7 +222,7 @@ static bool android_gfx_ctx_bind_api(void *data,
|
||||
#ifdef HAVE_OPENGLES
|
||||
version = major * 100 + minor;
|
||||
if (version >= 300)
|
||||
g_es3 = true;
|
||||
g_es3 = true;
|
||||
if (api == GFX_CTX_OPENGL_ES_API)
|
||||
return true;
|
||||
#endif
|
||||
@ -300,26 +286,24 @@ dpi_fallback:
|
||||
|
||||
static void android_gfx_ctx_swap_buffers(void *data)
|
||||
{
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
egl_swap_buffers(&and->egl);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void android_gfx_ctx_set_swap_interval(void *data, int swap_interval)
|
||||
{
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
egl_set_swap_interval(&and->egl, swap_interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void android_gfx_ctx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
#ifdef HAVE_EGL
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
egl_bind_hw_render(&and->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
@ -66,7 +66,10 @@ static void *android_gfx_ctx_vk_init(void *video_driver)
|
||||
return false;
|
||||
|
||||
if (!vulkan_context_init(&and->vk, VULKAN_WSI_ANDROID))
|
||||
goto error;
|
||||
{
|
||||
android_gfx_ctx_vk_destroy(and);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
slock_lock(android_app->mutex);
|
||||
if (!android_app->window)
|
||||
@ -78,11 +81,6 @@ static void *android_gfx_ctx_vk_init(void *video_driver)
|
||||
|
||||
slock_unlock(android_app->mutex);
|
||||
return and;
|
||||
|
||||
error:
|
||||
android_gfx_ctx_vk_destroy(and);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void android_gfx_ctx_vk_get_video_size(void *data,
|
||||
@ -97,13 +95,12 @@ static void android_gfx_ctx_vk_get_video_size(void *data,
|
||||
static void android_gfx_ctx_vk_check_window(void *data, bool *quit,
|
||||
bool *resize, unsigned *width, unsigned *height)
|
||||
{
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
unsigned new_width = 0;
|
||||
unsigned new_height = 0;
|
||||
android_ctx_data_vk_t *and = (android_ctx_data_vk_t*)data;
|
||||
|
||||
unsigned new_width = 0;
|
||||
unsigned new_height = 0;
|
||||
android_ctx_data_vk_t *and = (android_ctx_data_vk_t*)data;
|
||||
|
||||
*quit = false;
|
||||
*quit = false;
|
||||
|
||||
if (android_app->content_rect.changed)
|
||||
{
|
||||
@ -132,10 +129,10 @@ static bool android_gfx_ctx_vk_set_resize(void *data,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
android_ctx_data_vk_t *and = (android_ctx_data_vk_t*)data;
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
|
||||
and->width = android_app->content_rect.width;
|
||||
and->height = android_app->content_rect.height;
|
||||
and->width = android_app->content_rect.width;
|
||||
and->height = android_app->content_rect.height;
|
||||
RARCH_LOG("[Android]: Native window size: %u x %u.\n", and->width, and->height);
|
||||
if (!vulkan_create_swapchain(&and->vk, and->width, and->height, and->swap_interval))
|
||||
{
|
||||
@ -145,8 +142,8 @@ static bool android_gfx_ctx_vk_set_resize(void *data,
|
||||
|
||||
if (and->vk.flags & VK_DATA_FLAG_CREATED_NEW_SWAPCHAIN)
|
||||
vulkan_acquire_next_image(&and->vk);
|
||||
and->vk.context.flags |= VK_CTX_FLAG_INVALID_SWAPCHAIN;
|
||||
and->vk.flags &= ~VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
and->vk.context.flags |= VK_CTX_FLAG_INVALID_SWAPCHAIN;
|
||||
and->vk.flags &= ~VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -156,12 +153,9 @@ static bool android_gfx_ctx_vk_set_video_mode(void *data,
|
||||
bool fullscreen)
|
||||
{
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
android_ctx_data_vk_t *and = (android_ctx_data_vk_t*)data;
|
||||
|
||||
and->width = ANativeWindow_getWidth(android_app->window);
|
||||
and->height = ANativeWindow_getHeight(android_app->window);
|
||||
RARCH_LOG("[Android]: Native window size: %u x %u.\n",
|
||||
and->width, and->height);
|
||||
android_ctx_data_vk_t *and = (android_ctx_data_vk_t*)data;
|
||||
and->width = ANativeWindow_getWidth(android_app->window);
|
||||
and->height = ANativeWindow_getHeight(android_app->window);
|
||||
if (!vulkan_surface_create(&and->vk, VULKAN_WSI_ANDROID,
|
||||
NULL, android_app->window,
|
||||
and->width, and->height, and->swap_interval))
|
||||
@ -169,7 +163,8 @@ static bool android_gfx_ctx_vk_set_video_mode(void *data,
|
||||
RARCH_ERR("[Android]: Failed to create surface.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
RARCH_LOG("[Android]: Native window size: %u x %u.\n",
|
||||
and->width, and->height);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -191,9 +186,7 @@ static enum gfx_ctx_api android_gfx_ctx_vk_get_api(void *data)
|
||||
static bool android_gfx_ctx_vk_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
if (api == GFX_CTX_VULKAN_API)
|
||||
return true;
|
||||
return false;
|
||||
return (api == GFX_CTX_VULKAN_API);
|
||||
}
|
||||
|
||||
static bool android_gfx_ctx_vk_has_focus(void *data)
|
||||
@ -243,10 +236,10 @@ static bool android_gfx_ctx_vk_get_metrics(void *data,
|
||||
return true;
|
||||
|
||||
dpi_fallback:
|
||||
/* add a fallback in case the device doesn't report DPI.
|
||||
/* Add a fallback in case the device doesn't report DPI.
|
||||
* Hopefully fixes issues with the moto G2. */
|
||||
dpi = 90;
|
||||
*value = (float)dpi;
|
||||
dpi = 90;
|
||||
*value = (float)dpi;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -274,9 +267,9 @@ static void android_gfx_ctx_vk_set_swap_interval(void *data, int swap_interval)
|
||||
if (and->swap_interval != swap_interval)
|
||||
{
|
||||
RARCH_LOG("[Vulkan]: Setting swap interval: %u.\n", swap_interval);
|
||||
and->swap_interval = swap_interval;
|
||||
and->swap_interval = swap_interval;
|
||||
if (and->vk.swapchain)
|
||||
and->vk.flags |= VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
and->vk.flags |= VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ static void cocoa_gl_gfx_ctx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data;
|
||||
|
||||
cocoa_ctx->flags |= COCOA_CTX_FLAG_USE_HW_CTX;
|
||||
cocoa_ctx->flags |= COCOA_CTX_FLAG_USE_HW_CTX;
|
||||
|
||||
#ifdef OSX
|
||||
if (enable)
|
||||
@ -292,9 +292,9 @@ static void cocoa_gl_gfx_ctx_swap_interval(void *data, int i)
|
||||
/* < No way to disable Vsync on iOS? */
|
||||
/* Just skip presents so fast forward still works. */
|
||||
if (interval)
|
||||
cocoa_ctx->flags |= COCOA_CTX_FLAG_IS_SYNCING;
|
||||
cocoa_ctx->flags |= COCOA_CTX_FLAG_IS_SYNCING;
|
||||
else
|
||||
cocoa_ctx->flags &= ~COCOA_CTX_FLAG_IS_SYNCING;
|
||||
cocoa_ctx->flags &= ~COCOA_CTX_FLAG_IS_SYNCING;
|
||||
cocoa_ctx->fast_forward_skips = interval ? 0 : 3;
|
||||
#endif
|
||||
}
|
||||
@ -330,6 +330,7 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data,
|
||||
unsigned width, unsigned height, bool fullscreen)
|
||||
{
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
gfx_ctx_mode_t mode;
|
||||
NSView *g_view = apple_platform.renderView;
|
||||
#elif defined(HAVE_COCOA)
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
@ -365,7 +366,7 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data,
|
||||
{
|
||||
case 3:
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
if (g_gl_minor >= 1 && g_gl_minor <= 3)
|
||||
if (g_gl_minor >= 1 && g_gl_minor <= 3) /* OpenGL 3.2 Core */
|
||||
{
|
||||
attributes[6] = NSOpenGLPFAOpenGLProfile;
|
||||
attributes[7] = NSOpenGLProfileVersion3_2Core;
|
||||
@ -374,7 +375,7 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data,
|
||||
break;
|
||||
case 4:
|
||||
#if MAC_OS_X_VERSION_10_10
|
||||
if (g_gl_minor == 1)
|
||||
if (g_gl_minor == 1) /* OpenGL 4.1 Core */
|
||||
{
|
||||
attributes[6] = NSOpenGLPFAOpenGLProfile;
|
||||
attributes[7] = NSOpenGLProfileVersion4_1Core;
|
||||
@ -414,11 +415,9 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data,
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
gfx_ctx_mode_t mode = {
|
||||
.width = width,
|
||||
.height = height,
|
||||
.fullscreen = fullscreen,
|
||||
};
|
||||
mode.width = width;
|
||||
mode.height = height;
|
||||
mode.fullscreen = fullscreen;
|
||||
[apple_platform setVideoMode:mode];
|
||||
cocoa_show_mouse(data, !fullscreen);
|
||||
#else
|
||||
|
@ -171,14 +171,14 @@ static void cocoa_vk_gfx_ctx_check_window(void *data, bool *quit,
|
||||
|
||||
static void cocoa_vk_gfx_ctx_swap_interval(void *data, int i)
|
||||
{
|
||||
unsigned interval = (unsigned)i;
|
||||
unsigned interval = (unsigned)i;
|
||||
cocoa_vk_ctx_data_t *cocoa_ctx = (cocoa_vk_ctx_data_t*)data;
|
||||
|
||||
if (cocoa_ctx->swap_interval != interval)
|
||||
{
|
||||
cocoa_ctx->swap_interval = interval;
|
||||
cocoa_ctx->swap_interval = interval;
|
||||
if (cocoa_ctx->vk.swapchain)
|
||||
cocoa_ctx->vk.flags |= VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
cocoa_ctx->vk.flags |= VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,9 +194,7 @@ static void cocoa_vk_gfx_ctx_swap_buffers(void *data)
|
||||
retro_sleep(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vulkan_present(&cocoa_ctx->vk, cocoa_ctx->vk.context.current_swapchain_index);
|
||||
}
|
||||
}
|
||||
vulkan_acquire_next_image(&cocoa_ctx->vk);
|
||||
}
|
||||
@ -220,16 +218,17 @@ static void *cocoa_vk_gfx_ctx_get_context_data(void *data)
|
||||
static bool cocoa_vk_gfx_ctx_set_video_mode(void *data,
|
||||
unsigned width, unsigned height, bool fullscreen)
|
||||
{
|
||||
gfx_ctx_mode_t mode;
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
NSView *g_view = apple_platform.renderView;
|
||||
NSView *g_view = apple_platform.renderView;
|
||||
#elif defined(HAVE_COCOA)
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
#endif
|
||||
cocoa_vk_ctx_data_t *cocoa_ctx = (cocoa_vk_ctx_data_t*)data;
|
||||
static bool
|
||||
has_went_fullscreen = false;
|
||||
cocoa_ctx->width = width;
|
||||
cocoa_ctx->height = height;
|
||||
has_went_fullscreen = false;
|
||||
cocoa_ctx->width = width;
|
||||
cocoa_ctx->height = height;
|
||||
|
||||
RARCH_LOG("[macOS]: Native window size: %u x %u.\n",
|
||||
cocoa_ctx->width, cocoa_ctx->height);
|
||||
@ -247,15 +246,13 @@ static bool cocoa_vk_gfx_ctx_set_video_mode(void *data,
|
||||
return false;
|
||||
}
|
||||
|
||||
gfx_ctx_mode_t mode = {
|
||||
.width = width,
|
||||
.height = height,
|
||||
.fullscreen = fullscreen,
|
||||
};
|
||||
mode.width = width;
|
||||
mode.height = height;
|
||||
mode.fullscreen = fullscreen;
|
||||
[apple_platform setVideoMode:mode];
|
||||
cocoa_show_mouse(data, !fullscreen);
|
||||
|
||||
has_went_fullscreen = fullscreen;
|
||||
has_went_fullscreen = fullscreen;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -327,8 +324,8 @@ static bool cocoa_vk_gfx_ctx_set_resize(void *data, unsigned width, unsigned hei
|
||||
{
|
||||
cocoa_vk_ctx_data_t *cocoa_ctx = (cocoa_vk_ctx_data_t*)data;
|
||||
|
||||
cocoa_ctx->width = width;
|
||||
cocoa_ctx->height = height;
|
||||
cocoa_ctx->width = width;
|
||||
cocoa_ctx->height = height;
|
||||
|
||||
if (!vulkan_create_swapchain(&cocoa_ctx->vk,
|
||||
width, height, cocoa_ctx->swap_interval))
|
||||
@ -337,12 +334,10 @@ static bool cocoa_vk_gfx_ctx_set_resize(void *data, unsigned width, unsigned hei
|
||||
return false;
|
||||
}
|
||||
|
||||
cocoa_ctx->vk.context.flags |= VK_CTX_FLAG_INVALID_SWAPCHAIN;
|
||||
cocoa_ctx->vk.context.flags |= VK_CTX_FLAG_INVALID_SWAPCHAIN;
|
||||
if (cocoa_ctx->vk.flags & VK_DATA_FLAG_CREATED_NEW_SWAPCHAIN)
|
||||
vulkan_acquire_next_image(&cocoa_ctx->vk);
|
||||
|
||||
cocoa_ctx->vk.flags &= ~VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
|
||||
cocoa_ctx->vk.flags &= ~VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -68,17 +68,16 @@ typedef struct gfx_ctx_drm_data
|
||||
#ifdef HAVE_EGL
|
||||
egl_ctx_data_t egl;
|
||||
#endif
|
||||
int fd;
|
||||
int interval;
|
||||
unsigned fb_width;
|
||||
unsigned fb_height;
|
||||
|
||||
bool core_hw_context_enable;
|
||||
bool waiting_for_flip;
|
||||
struct gbm_bo *bo;
|
||||
struct gbm_bo *next_bo;
|
||||
struct gbm_surface *gbm_surface;
|
||||
struct gbm_device *gbm_dev;
|
||||
int fd;
|
||||
int interval;
|
||||
unsigned fb_width;
|
||||
unsigned fb_height;
|
||||
bool core_hw_context_enable;
|
||||
bool waiting_for_flip;
|
||||
} gfx_ctx_drm_data_t;
|
||||
|
||||
struct drm_fb
|
||||
@ -93,66 +92,67 @@ struct drm_fb
|
||||
*/
|
||||
typedef struct hdmi_timings
|
||||
{
|
||||
int h_active_pixels; /* horizontal pixels (width) */
|
||||
int h_sync_polarity; /* invert hsync polarity */
|
||||
int h_front_porch; /* horizontal forward padding from DE acitve edge */
|
||||
int h_sync_pulse; /* hsync pulse width in pixel clocks */
|
||||
int h_back_porch; /* vertical back padding from DE active edge */
|
||||
int v_active_lines; /* vertical pixels height (lines) */
|
||||
int v_sync_polarity; /* invert vsync polarity */
|
||||
int v_front_porch; /* vertical forward padding from DE active edge */
|
||||
int v_sync_pulse; /* vsync pulse width in pixel clocks */
|
||||
int v_back_porch; /* vertical back padding from DE active edge */
|
||||
int v_sync_offset_a; /* leave at zero */
|
||||
int v_sync_offset_b; /* leave at zero */
|
||||
int pixel_rep; /* leave at zero */
|
||||
int frame_rate; /* screen refresh rate in Hz */
|
||||
int interlaced; /* leave at zero */
|
||||
int pixel_freq; /* clock frequency (width*height*framerate) */
|
||||
int h_active_pixels; /* Horizontal pixels (width) */
|
||||
int h_sync_polarity; /* Invert HSync polarity */
|
||||
int h_front_porch; /* Horizontal forward padding from DE acitve edge */
|
||||
int h_sync_pulse; /* HSync pulse width in pixel clocks */
|
||||
int h_back_porch; /* Vertical back padding from DE active edge */
|
||||
int v_active_lines; /* Vertical pixels height (lines) */
|
||||
int v_sync_polarity; /* Invert vsync polarity */
|
||||
int v_front_porch; /* Vertical forward padding from DE active edge */
|
||||
int v_sync_pulse; /* VSync pulse width in pixel clocks */
|
||||
int v_back_porch; /* Vertical back padding from DE active edge */
|
||||
int v_sync_offset_a; /* Leave at zero */
|
||||
int v_sync_offset_b; /* Leave at zero */
|
||||
int pixel_rep; /* Leave at zero */
|
||||
int frame_rate; /* Screen refresh rate in Hz */
|
||||
int interlaced; /* Leave at zero */
|
||||
int pixel_freq; /* Clock frequency (width*height*framerate) */
|
||||
int aspect_ratio;
|
||||
} hdmi_timings_t;
|
||||
|
||||
static enum gfx_ctx_api drm_api = GFX_CTX_NONE;
|
||||
static drmModeModeInfo gfx_ctx_crt_switch_mode;
|
||||
|
||||
/* Load custom hdmi timings from config */
|
||||
bool gfx_ctx_drm_load_mode(drmModeModeInfoPtr modeInfo)
|
||||
/* Load custom HDMI timings from config */
|
||||
static bool gfx_ctx_drm_load_mode(drmModeModeInfoPtr modeInfo)
|
||||
{
|
||||
int ret;
|
||||
hdmi_timings_t timings;
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
char *crt_switch_timings = settings->arrays.crt_switch_timings;
|
||||
|
||||
if(modeInfo != NULL && !string_is_empty(crt_switch_timings)) {
|
||||
ret = sscanf(crt_switch_timings, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d",
|
||||
if (modeInfo && !string_is_empty(crt_switch_timings))
|
||||
{
|
||||
hdmi_timings_t timings;
|
||||
int ret = sscanf(crt_switch_timings, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d",
|
||||
&timings.h_active_pixels, &timings.h_sync_polarity, &timings.h_front_porch,
|
||||
&timings.h_sync_pulse, &timings.h_back_porch,
|
||||
&timings.v_active_lines, &timings.v_sync_polarity, &timings.v_front_porch,
|
||||
&timings.v_sync_pulse, &timings.v_back_porch,
|
||||
&timings.v_sync_offset_a, &timings.v_sync_offset_b, &timings.pixel_rep, &timings.frame_rate,
|
||||
&timings.interlaced, &timings.pixel_freq, &timings.aspect_ratio);
|
||||
if (ret != 17) {
|
||||
if (ret != 17)
|
||||
{
|
||||
RARCH_ERR("[DRM]: malformed mode requested: %s\n", crt_switch_timings);
|
||||
return false;
|
||||
}
|
||||
|
||||
memset(modeInfo, 0, sizeof(drmModeModeInfo));
|
||||
modeInfo->clock = timings.pixel_freq / 1000;
|
||||
modeInfo->hdisplay = timings.h_active_pixels;
|
||||
modeInfo->clock = timings.pixel_freq / 1000;
|
||||
modeInfo->hdisplay = timings.h_active_pixels;
|
||||
modeInfo->hsync_start = modeInfo->hdisplay + timings.h_front_porch;
|
||||
modeInfo->hsync_end = modeInfo->hsync_start + timings.h_sync_pulse;
|
||||
modeInfo->htotal = modeInfo->hsync_end + timings.h_back_porch;
|
||||
modeInfo->hskew = 0;
|
||||
modeInfo->vdisplay = timings.v_active_lines;
|
||||
modeInfo->hsync_end = modeInfo->hsync_start + timings.h_sync_pulse;
|
||||
modeInfo->htotal = modeInfo->hsync_end + timings.h_back_porch;
|
||||
modeInfo->hskew = 0;
|
||||
modeInfo->vdisplay = timings.v_active_lines;
|
||||
modeInfo->vsync_start = modeInfo->vdisplay + (timings.v_front_porch * (timings.interlaced ? 2 : 1));
|
||||
modeInfo->vsync_end = modeInfo->vsync_start + (timings.v_sync_pulse * (timings.interlaced ? 2 : 1));
|
||||
modeInfo->vtotal = modeInfo->vsync_end + (timings.v_back_porch * (timings.interlaced ? 2 : 1));
|
||||
modeInfo->vscan = 0; /* TODO: ?? */
|
||||
modeInfo->vrefresh = timings.frame_rate;
|
||||
modeInfo->flags = timings.interlaced ? DRM_MODE_FLAG_INTERLACE : 0;
|
||||
modeInfo->flags |= timings.v_sync_polarity ? DRM_MODE_FLAG_NVSYNC : DRM_MODE_FLAG_PVSYNC;
|
||||
modeInfo->flags |= timings.h_sync_polarity ? DRM_MODE_FLAG_NHSYNC : DRM_MODE_FLAG_PHSYNC;
|
||||
modeInfo->type = 0;
|
||||
modeInfo->vsync_end = modeInfo->vsync_start + (timings.v_sync_pulse * (timings.interlaced ? 2 : 1));
|
||||
modeInfo->vtotal = modeInfo->vsync_end + (timings.v_back_porch * (timings.interlaced ? 2 : 1));
|
||||
modeInfo->vscan = 0; /* TODO: ?? */
|
||||
modeInfo->vrefresh = timings.frame_rate;
|
||||
modeInfo->flags = timings.interlaced ? DRM_MODE_FLAG_INTERLACE : 0;
|
||||
modeInfo->flags |= timings.v_sync_polarity ? DRM_MODE_FLAG_NVSYNC : DRM_MODE_FLAG_PVSYNC;
|
||||
modeInfo->flags |= timings.h_sync_polarity ? DRM_MODE_FLAG_NHSYNC : DRM_MODE_FLAG_PHSYNC;
|
||||
modeInfo->type = 0;
|
||||
snprintf(modeInfo->name, DRM_DISPLAY_MODE_LEN, "CRT_%ux%u_%u",
|
||||
modeInfo->hdisplay, modeInfo->vdisplay, modeInfo->vrefresh);
|
||||
|
||||
@ -436,7 +436,7 @@ nextgpu:
|
||||
- custom timings from configuration
|
||||
- else the current video mode from the CRTC
|
||||
- otherwise pick first connector mode */
|
||||
if(gfx_ctx_drm_load_mode(&gfx_ctx_crt_switch_mode))
|
||||
if (gfx_ctx_drm_load_mode(&gfx_ctx_crt_switch_mode))
|
||||
{
|
||||
drm->fb_width = gfx_ctx_crt_switch_mode.hdisplay;
|
||||
drm->fb_height = gfx_ctx_crt_switch_mode.vdisplay;
|
||||
@ -692,12 +692,12 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
|
||||
bool fullscreen)
|
||||
{
|
||||
float refresh_mod;
|
||||
int i, ret = 0;
|
||||
struct drm_fb *fb = NULL;
|
||||
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
int i, ret = 0;
|
||||
struct drm_fb *fb = NULL;
|
||||
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned black_frame_insertion = settings->uints.video_black_frame_insertion;
|
||||
float video_refresh_rate = settings->floats.video_refresh_rate;
|
||||
float video_refresh_rate = settings->floats.video_refresh_rate;
|
||||
|
||||
if (!drm)
|
||||
return false;
|
||||
@ -707,20 +707,20 @@ 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 = 1.0f / (black_frame_insertion + 1.0f);
|
||||
refresh_mod = 1.0f / (black_frame_insertion + 1.0f);
|
||||
|
||||
/* Find desired video mode, and use that.
|
||||
* If not fullscreen, we get desired windowed size,
|
||||
* which is not appropriate. */
|
||||
if ((width == 0 && height == 0) || !fullscreen)
|
||||
g_drm_mode = &g_drm_connector->modes[0];
|
||||
g_drm_mode = &g_drm_connector->modes[0];
|
||||
else
|
||||
{
|
||||
/* check if custom hdmi timings were asked */
|
||||
if(gfx_ctx_crt_switch_mode.vdisplay > 0)
|
||||
/* check if custom HDMI timings were asked */
|
||||
if (gfx_ctx_crt_switch_mode.vdisplay > 0)
|
||||
{
|
||||
g_drm_mode = &gfx_ctx_crt_switch_mode;
|
||||
RARCH_LOG("[DRM]: custom mode requested: %s\n", gfx_ctx_crt_switch_mode.name);
|
||||
g_drm_mode = &gfx_ctx_crt_switch_mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -729,26 +729,27 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
|
||||
* Lower resolutions tend to have multiple supported
|
||||
* refresh rates as well.
|
||||
*/
|
||||
float minimum_fps_diff = 0.0f;
|
||||
float mode_vrefresh = 0.0f;
|
||||
drmModeModeInfo *mode;
|
||||
drmModeModeInfo *mode = NULL;
|
||||
float minimum_fps_diff = 0.0f;
|
||||
float mode_vrefresh = 0.0f;
|
||||
|
||||
/* Find best match. */
|
||||
for (i = 0; i < g_drm_connector->count_modes; i++) {
|
||||
for (i = 0; i < g_drm_connector->count_modes; i++)
|
||||
{
|
||||
float diff;
|
||||
mode = &g_drm_connector->modes[i];
|
||||
mode = &g_drm_connector->modes[i];
|
||||
|
||||
if (width != mode->hdisplay ||
|
||||
height != mode->vdisplay)
|
||||
if ( (width != mode->hdisplay)
|
||||
|| (height != mode->vdisplay))
|
||||
continue;
|
||||
|
||||
mode_vrefresh = drm_calc_refresh_rate(mode);
|
||||
mode_vrefresh = drm_calc_refresh_rate(mode);
|
||||
diff = fabsf(refresh_mod * mode_vrefresh - video_refresh_rate);
|
||||
|
||||
diff = fabsf(refresh_mod * mode_vrefresh - video_refresh_rate);
|
||||
|
||||
if (!g_drm_mode || diff < minimum_fps_diff) {
|
||||
g_drm_mode = mode;
|
||||
minimum_fps_diff = diff;
|
||||
if (!g_drm_mode || diff < minimum_fps_diff)
|
||||
{
|
||||
g_drm_mode = mode;
|
||||
minimum_fps_diff = diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -761,11 +762,11 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
|
||||
goto error;
|
||||
}
|
||||
|
||||
drm->fb_width = g_drm_mode->hdisplay;
|
||||
drm->fb_height = g_drm_mode->vdisplay;
|
||||
drm->fb_width = g_drm_mode->hdisplay;
|
||||
drm->fb_height = g_drm_mode->vdisplay;
|
||||
|
||||
/* Create GBM surface. */
|
||||
drm->gbm_surface = gbm_surface_create(
|
||||
drm->gbm_surface = gbm_surface_create(
|
||||
drm->gbm_dev,
|
||||
drm->fb_width,
|
||||
drm->fb_height,
|
||||
@ -785,14 +786,11 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
|
||||
|
||||
drm->bo = gbm_surface_lock_front_buffer(drm->gbm_surface);
|
||||
|
||||
fb = (struct drm_fb*)gbm_bo_get_user_data(drm->bo);
|
||||
if (!(fb = (struct drm_fb*)gbm_bo_get_user_data(drm->bo)))
|
||||
fb = drm_fb_get_from_bo(drm->bo);
|
||||
|
||||
if (!fb)
|
||||
fb = drm_fb_get_from_bo(drm->bo);
|
||||
|
||||
ret = drmModeSetCrtc(g_drm_fd,
|
||||
g_crtc_id, fb->fb_id, 0, 0, &g_connector_id, 1, g_drm_mode);
|
||||
if (ret < 0)
|
||||
if ((ret = drmModeSetCrtc(g_drm_fd,
|
||||
g_crtc_id, fb->fb_id, 0, 0, &g_connector_id, 1, g_drm_mode)) < 0)
|
||||
goto error;
|
||||
|
||||
return true;
|
||||
@ -911,9 +909,8 @@ static bool gfx_ctx_drm_bind_api(void *video_driver,
|
||||
|
||||
static void gfx_ctx_drm_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
|
||||
egl_bind_hw_render(&drm->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ static void gfx_ctx_go2_drm_input_driver(void *data,
|
||||
{
|
||||
#ifdef HAVE_UDEV
|
||||
/* Try to set it to udev instead */
|
||||
void *udev = input_driver_init_wrap(&input_udev, joypad_name);
|
||||
void *udev = input_driver_init_wrap(&input_udev, joypad_name);
|
||||
if (udev)
|
||||
{
|
||||
*input = &input_udev;
|
||||
@ -104,9 +104,8 @@ static void gfx_ctx_go2_drm_input_driver(void *data,
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
static void *gfx_ctx_go2_drm_init(void *video_driver)
|
||||
@ -160,8 +159,6 @@ static enum gfx_ctx_api gfx_ctx_go2_drm_get_api(void *data) { return drm_api; }
|
||||
static bool gfx_ctx_go2_drm_bind_api(void *video_driver,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)video_driver;
|
||||
|
||||
drm_api = api;
|
||||
#ifdef HAVE_EGL
|
||||
g_egl_major = major;
|
||||
@ -206,11 +203,10 @@ static bool gfx_ctx_go2_drm_bind_api(void *video_driver,
|
||||
|
||||
static void gfx_ctx_go2_drm_swap_interval(void *data, int interval)
|
||||
{
|
||||
(void)data;
|
||||
(void)interval;
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (interval > 1)
|
||||
RARCH_WARN("[KMS]: Swap intervals > 1 currently not supported. Will use swap interval of 1.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool gfx_ctx_go2_drm_set_video_mode(void *data,
|
||||
@ -223,7 +219,7 @@ static bool gfx_ctx_go2_drm_set_video_mode(void *data,
|
||||
if (!drm)
|
||||
return false;
|
||||
|
||||
av_info = video_viewport_get_system_av_info();
|
||||
av_info = video_viewport_get_system_av_info();
|
||||
|
||||
frontend_driver_install_signal_handler();
|
||||
|
||||
@ -231,14 +227,14 @@ static bool gfx_ctx_go2_drm_set_video_mode(void *data,
|
||||
if ( config_get_ptr()->bools.video_ctx_scaling
|
||||
&& !(menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE))
|
||||
{
|
||||
drm->fb_width = av_info->geometry.base_width;
|
||||
drm->fb_height = av_info->geometry.base_height;
|
||||
drm->fb_width = av_info->geometry.base_width;
|
||||
drm->fb_height = av_info->geometry.base_height;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
drm->fb_width = drm->native_width;
|
||||
drm->fb_height = drm->native_height;
|
||||
drm->fb_width = drm->native_width;
|
||||
drm->fb_height = drm->native_height;
|
||||
}
|
||||
|
||||
if (!drm->context)
|
||||
@ -294,25 +290,24 @@ static void gfx_ctx_go2_drm_check_window(void *data, bool *quit,
|
||||
&& !(menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE))
|
||||
{
|
||||
struct retro_system_av_info*
|
||||
av_info = video_viewport_get_system_av_info();
|
||||
w = av_info->geometry.base_width;
|
||||
h = av_info->geometry.base_height;
|
||||
av_info = video_viewport_get_system_av_info();
|
||||
w = av_info->geometry.base_width;
|
||||
h = av_info->geometry.base_height;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
w = drm->native_width;
|
||||
h = drm->native_height;
|
||||
w = drm->native_width;
|
||||
h = drm->native_height;
|
||||
}
|
||||
|
||||
if (*width != w || *height != h)
|
||||
{
|
||||
*width = drm->fb_width = w;
|
||||
*height = drm->fb_height = h;
|
||||
*resize = false;
|
||||
*width = drm->fb_width = w;
|
||||
*height = drm->fb_height = h;
|
||||
*resize = false;
|
||||
}
|
||||
|
||||
*quit = (bool)frontend_driver_get_signal_handler_state();
|
||||
*quit = (bool)frontend_driver_get_signal_handler_state();
|
||||
}
|
||||
|
||||
static bool gfx_ctx_go2_drm_has_focus(void *data) { return true; }
|
||||
@ -320,6 +315,10 @@ static bool gfx_ctx_go2_drm_suppress_screensaver(void *data, bool enable) { retu
|
||||
|
||||
static void gfx_ctx_go2_drm_swap_buffers(void *data)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
go2_surface_t*
|
||||
surf = NULL;
|
||||
#endif
|
||||
gfx_ctx_go2_drm_data_t
|
||||
*drm = (gfx_ctx_go2_drm_data_t*)data;
|
||||
|
||||
@ -344,14 +343,13 @@ static void gfx_ctx_go2_drm_swap_buffers(void *data)
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
go2_context_swap_buffers(drm->context);
|
||||
|
||||
go2_surface_t* surface = go2_context_surface_lock(drm->context);
|
||||
surf = go2_context_surface_lock(drm->context);
|
||||
go2_presenter_post(drm->presenter,
|
||||
surface,
|
||||
surf,
|
||||
src_x, src_y, src_w, src_h,
|
||||
out_y, out_x, out_h, out_w,
|
||||
GO2_ROTATION_DEGREES_270, 2);
|
||||
go2_context_surface_unlock(drm->context, surface);
|
||||
go2_context_surface_unlock(drm->context, surf);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -386,9 +384,8 @@ static void gfx_ctx_go2_drm_set_flags(void *data, uint32_t flags)
|
||||
|
||||
static void gfx_ctx_go2_drm_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
gfx_ctx_go2_drm_data_t *drm = (gfx_ctx_go2_drm_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
gfx_ctx_go2_drm_data_t *drm = (gfx_ctx_go2_drm_data_t*)data;
|
||||
egl_bind_hw_render(&drm->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
@ -74,10 +74,9 @@ static void gfx_ctx_emscripten_get_canvas_size(int *width, int *height)
|
||||
|
||||
if (r != EMSCRIPTEN_RESULT_SUCCESS)
|
||||
{
|
||||
RARCH_ERR("[EMSCRIPTEN/EGL]: Could not get screen dimensions: %d\n",
|
||||
r);
|
||||
*width = 800;
|
||||
*width = 800;
|
||||
*height = 600;
|
||||
RARCH_ERR("[EMSCRIPTEN/EGL]: Could not get screen dimensions: %d\n",r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,17 +93,17 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
|
||||
|
||||
if (input_width == 0 || input_height == 0)
|
||||
{
|
||||
input_width = emscripten->initial_width;
|
||||
input_height = emscripten->initial_height;
|
||||
emscripten->fb_width = emscripten->fb_height = 0;
|
||||
input_width = emscripten->initial_width;
|
||||
input_height = emscripten->initial_height;
|
||||
emscripten->fb_width = emscripten->fb_height = 0;
|
||||
}
|
||||
|
||||
*width = (unsigned)input_width;
|
||||
*height = (unsigned)input_height;
|
||||
*resize = false;
|
||||
*width = (unsigned)input_width;
|
||||
*height = (unsigned)input_height;
|
||||
*resize = false;
|
||||
|
||||
if (input_width != emscripten->fb_width ||
|
||||
input_height != emscripten->fb_height)
|
||||
if ( (input_width != emscripten->fb_width)
|
||||
|| (input_height != emscripten->fb_height))
|
||||
{
|
||||
r = emscripten_set_canvas_element_size("#canvas",
|
||||
input_width, input_height);
|
||||
@ -124,16 +123,15 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
|
||||
|
||||
emscripten->fb_width = (unsigned)input_width;
|
||||
emscripten->fb_height = (unsigned)input_height;
|
||||
*quit = false;
|
||||
*quit = false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_emscripten_swap_buffers(void *data)
|
||||
{
|
||||
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
|
||||
|
||||
/* doesn't really do anything in WebGL, but it might
|
||||
* if we use WebGL workers in the future */
|
||||
#ifdef HAVE_EGL
|
||||
/* Doesn't really do anything in WebGL, but it might
|
||||
* if we use WebGL workers in the future */
|
||||
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
|
||||
egl_swap_buffers(&emscripten->egl);
|
||||
#endif
|
||||
}
|
||||
@ -192,12 +190,10 @@ static void *gfx_ctx_emscripten_init(void *video_driver)
|
||||
if (!emscripten)
|
||||
return NULL;
|
||||
|
||||
(void)video_driver;
|
||||
|
||||
/* TODO/FIXME - why is this conditional here - shouldn't these always
|
||||
* be grabbed? */
|
||||
if ( emscripten->initial_width == 0 ||
|
||||
emscripten->initial_height == 0)
|
||||
if ( (emscripten->initial_width == 0)
|
||||
|| (emscripten->initial_height == 0))
|
||||
emscripten_get_canvas_element_size("#canvas",
|
||||
&emscripten->initial_width,
|
||||
&emscripten->initial_height);
|
||||
@ -259,7 +255,6 @@ static bool gfx_ctx_emscripten_bind_api(void *data,
|
||||
if (api == GFX_CTX_OPENGL_ES_API)
|
||||
return egl_bind_api(EGL_OPENGL_ES_API);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -268,9 +263,8 @@ static void gfx_ctx_emscripten_input_driver(void *data,
|
||||
input_driver_t **input, void **input_data)
|
||||
{
|
||||
void *rwebinput = input_driver_init_wrap(&input_rwebinput, name);
|
||||
|
||||
*input = rwebinput ? &input_rwebinput : NULL;
|
||||
*input_data = rwebinput;
|
||||
*input = rwebinput ? &input_rwebinput : NULL;
|
||||
*input_data = rwebinput;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_emscripten_has_focus(void *data) { return g_egl_inited; }
|
||||
@ -289,9 +283,8 @@ static bool gfx_ctx_emscripten_write_egl_image(void *data,
|
||||
|
||||
static void gfx_ctx_emscripten_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
|
||||
egl_bind_hw_render(&emscripten->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
static void gfx_ctx_null_get_video_size(
|
||||
void *data, unsigned *width, unsigned *height)
|
||||
{
|
||||
(void)data;
|
||||
#ifdef VITA
|
||||
*width = 960;
|
||||
*height = 544;
|
||||
|
@ -52,9 +52,8 @@ static void gfx_ctx_khr_display_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
|
||||
|
||||
*width = khr->width;
|
||||
*height = khr->height;
|
||||
*width = khr->width;
|
||||
*height = khr->height;
|
||||
}
|
||||
|
||||
static void *gfx_ctx_khr_display_init(void *video_driver)
|
||||
@ -83,18 +82,17 @@ static void gfx_ctx_khr_display_check_window(void *data, bool *quit,
|
||||
bool *resize, unsigned *width, unsigned *height)
|
||||
{
|
||||
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
|
||||
|
||||
*resize = khr->vk.flags & VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
*resize = khr->vk.flags & VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
|
||||
if (khr->width != *width || khr->height != *height)
|
||||
{
|
||||
*width = khr->width;
|
||||
*height = khr->height;
|
||||
*resize = true;
|
||||
*width = khr->width;
|
||||
*height = khr->height;
|
||||
*resize = true;
|
||||
}
|
||||
|
||||
if ((bool)frontend_driver_get_signal_handler_state())
|
||||
*quit = true;
|
||||
*quit = true;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_khr_display_set_resize(void *data,
|
||||
@ -115,8 +113,8 @@ static bool gfx_ctx_khr_display_set_resize(void *data,
|
||||
if (khr->vk.flags & VK_DATA_FLAG_CREATED_NEW_SWAPCHAIN)
|
||||
vulkan_acquire_next_image(&khr->vk);
|
||||
|
||||
khr->vk.context.flags |= VK_CTX_FLAG_INVALID_SWAPCHAIN;
|
||||
khr->vk.flags &= ~VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
khr->vk.context.flags |= VK_CTX_FLAG_INVALID_SWAPCHAIN;
|
||||
khr->vk.flags &= ~VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -143,17 +141,14 @@ static bool gfx_ctx_khr_display_set_video_mode(void *data,
|
||||
0, 0, khr->swap_interval))
|
||||
{
|
||||
RARCH_ERR("[Vulkan]: Failed to create KHR_display surface.\n");
|
||||
goto error;
|
||||
gfx_ctx_khr_display_destroy(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
khr->width = khr->vk.context.swapchain_width;
|
||||
khr->height = khr->vk.context.swapchain_height;
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
gfx_ctx_khr_display_destroy(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_khr_display_input_driver(void *data,
|
||||
@ -205,9 +200,7 @@ static enum gfx_ctx_api gfx_ctx_khr_display_get_api(void *data)
|
||||
static bool gfx_ctx_khr_display_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
if (api == GFX_CTX_VULKAN_API)
|
||||
return true;
|
||||
return false;
|
||||
return (api == GFX_CTX_VULKAN_API);
|
||||
}
|
||||
|
||||
static void gfx_ctx_khr_display_set_flags(void *data, uint32_t flags) { }
|
||||
|
@ -46,13 +46,14 @@ typedef struct
|
||||
egl_ctx_data_t egl;
|
||||
#endif
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
} native_window;
|
||||
bool resize;
|
||||
unsigned width, height;
|
||||
float refresh_rate;
|
||||
bool resize;
|
||||
} mali_ctx_data_t;
|
||||
|
||||
#ifndef EGL_OPENGL_ES3_BIT
|
||||
@ -85,9 +86,7 @@ static int gfx_ctx_mali_fbdev_get_vinfo(void *data)
|
||||
{
|
||||
vinfo.yoffset = 0;
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo))
|
||||
{
|
||||
RARCH_ERR("Error resetting yoffset to 0.\n");
|
||||
}
|
||||
RARCH_ERR("Error resetting yoffset to 0.\n");
|
||||
}
|
||||
|
||||
close(fd);
|
||||
@ -104,22 +103,28 @@ static int gfx_ctx_mali_fbdev_get_vinfo(void *data)
|
||||
mali->refresh_rate = 1000000.0f / vinfo.pixclock * 1000000.0f /
|
||||
(vinfo.yres + vinfo.upper_margin + vinfo.lower_margin + vinfo.vsync_len) /
|
||||
(vinfo.xres + vinfo.left_margin + vinfo.right_margin + vinfo.hsync_len);
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Workaround to retrieve current refresh rate if no info is available from IOCTL.
|
||||
If this fails as well, 60Hz is assumed... */
|
||||
int j=0;
|
||||
float k=60.0;
|
||||
char temp[32];
|
||||
RFILE *fr = filestream_open("/sys/class/display/mode", RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
if (fr){
|
||||
if (filestream_gets(fr, temp, sizeof(temp))){
|
||||
for (int i=0;i<sizeof(temp);i++){
|
||||
if (fr)
|
||||
{
|
||||
if (filestream_gets(fr, temp, sizeof(temp)))
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<sizeof(temp);i++)
|
||||
{
|
||||
if (*(temp+i)=='p' || *(temp+i)=='i')
|
||||
j=i;
|
||||
else if (*(temp+i)=='h')
|
||||
*(temp+i)='\0';
|
||||
}
|
||||
k = j ? atof(temp+j+1) : k;
|
||||
k = j ? atof(temp + j + 1) : k;
|
||||
}
|
||||
filestream_close(fr);
|
||||
}
|
||||
@ -136,25 +141,26 @@ error:
|
||||
|
||||
static void gfx_ctx_mali_fbdev_clear_screen(void)
|
||||
{
|
||||
long buffer_size;
|
||||
struct fb_var_screeninfo vinfo;
|
||||
void *buffer = NULL;
|
||||
void *buffer = NULL;
|
||||
int fd = open("/dev/fb0", O_RDWR);
|
||||
ioctl (fd, FBIOGET_VSCREENINFO, &vinfo);
|
||||
long buffer_size = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
|
||||
buffer = calloc(1, buffer_size);
|
||||
buffer_size = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
|
||||
buffer = calloc(1, buffer_size);
|
||||
write(fd,buffer,buffer_size);
|
||||
free(buffer);
|
||||
close(fd);
|
||||
|
||||
/* Clear framebuffer and set cursor on again */
|
||||
if (!system(NULL) && !system("which setterm > /dev/null 2>&1"))
|
||||
{
|
||||
int fd = open("/dev/tty", O_RDWR);
|
||||
ioctl(fd, VT_ACTIVATE, 5);
|
||||
ioctl(fd, VT_ACTIVATE, 1);
|
||||
close(fd);
|
||||
system("setterm -cursor on");
|
||||
}
|
||||
{
|
||||
int fd = open("/dev/tty", O_RDWR);
|
||||
ioctl(fd, VT_ACTIVATE, 5);
|
||||
ioctl(fd, VT_ACTIVATE, 1);
|
||||
close(fd);
|
||||
system("setterm -cursor on");
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_ctx_mali_fbdev_destroy_really(void)
|
||||
@ -176,13 +182,16 @@ static void gfx_ctx_mali_fbdev_maybe_restart(void)
|
||||
frontend_driver_set_fork(FRONTEND_FORK_RESTART);
|
||||
}
|
||||
|
||||
/*TODO FIXME
|
||||
As egl_destroy does not work properly with libmali (big fps drop after destroy and initialization/creation of new context/surface), it is not used.
|
||||
A global pointer is initialized at startup in gfx_ctx_mali_fbdev_init, and returned each time gfx_ctx_mali_fbdev_init is called.
|
||||
Originally gfx_ctx_mali_fbdev_init initialized a new pointer each time (destroyed each time with egl_destroy), and context/surface creation occurred in gfx_ctx_mali_fbdev_set_video_mode.
|
||||
With this workaround it's all created once in gfx_ctx_mali_fbdev_init and never destroyed.
|
||||
Additional workarounds (RA restart) are applied in gfx_ctx_mali_fbdev_destroy in order to avoid segmentation fault when video threaded switch is activated or on exit from cores checking GFX_CTX_MALI_FBDEV_FLAG_HW_CTX_TRIGGER flag.
|
||||
All these workarounds should be reverted when and if egl_destroy issues in libmali blobs are fixed.
|
||||
/* TODO/FIXME:
|
||||
As egl_destroy does not work properly with libmali (big fps drop after destroy and initialization/creation of new context/surface), it is not used.
|
||||
A global pointer is initialized at startup in gfx_ctx_mali_fbdev_init, and returned each time gfx_ctx_mali_fbdev_init is called.
|
||||
Originally gfx_ctx_mali_fbdev_init initialized a new pointer each time (destroyed each time with egl_destroy),
|
||||
and context/surface creation occurred in gfx_ctx_mali_fbdev_set_video_mode.
|
||||
With this workaround it's all created once in gfx_ctx_mali_fbdev_init and never destroyed.
|
||||
|
||||
Additional workarounds (RA restart) are applied in gfx_ctx_mali_fbdev_destroy in order to avoid
|
||||
segmentation fault when video threaded switch is activated or on exit from cores checking GFX_CTX_MALI_FBDEV_FLAG_HW_CTX_TRIGGER flag.
|
||||
All these workarounds should be reverted when and if egl_destroy issues in libmali blobs are fixed.
|
||||
*/
|
||||
static void gfx_ctx_mali_fbdev_destroy(void *data)
|
||||
{
|
||||
@ -210,13 +219,13 @@ static void gfx_ctx_mali_fbdev_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
|
||||
*width = mali->width;
|
||||
*height = mali->height;
|
||||
*width = mali->width;
|
||||
*height = mali->height;
|
||||
}
|
||||
|
||||
static void *gfx_ctx_mali_fbdev_init(void *video_driver)
|
||||
{
|
||||
mali_ctx_data_t *mali = NULL;
|
||||
if (gfx_ctx_mali_fbdev_global)
|
||||
return gfx_ctx_mali_fbdev_global;
|
||||
|
||||
@ -233,29 +242,23 @@ static void *gfx_ctx_mali_fbdev_init(void *video_driver)
|
||||
EGL_ALPHA_SIZE, 8,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
if (mali_flags & GFX_CTX_MALI_FBDEV_FLAG_GLES3){
|
||||
attribs_init[1] = EGL_OPENGL_ES3_BIT;
|
||||
}
|
||||
RARCH_LOG("GLES version = %d.\n", (mali_flags & GFX_CTX_MALI_FBDEV_FLAG_GLES3) ? 3 : 2);
|
||||
|
||||
EGLint attribs_create[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, (mali_flags & GFX_CTX_MALI_FBDEV_FLAG_GLES3) ? 3 : 2,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
if (mali_flags & GFX_CTX_MALI_FBDEV_FLAG_GLES3)
|
||||
attribs_init[1] = EGL_OPENGL_ES3_BIT;
|
||||
RARCH_LOG("GLES version = %d.\n", (mali_flags & GFX_CTX_MALI_FBDEV_FLAG_GLES3) ? 3 : 2);
|
||||
#endif
|
||||
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)calloc(1, sizeof(*mali));
|
||||
|
||||
if (!mali)
|
||||
if (!(mali = (mali_ctx_data_t*)calloc(1, sizeof(*mali))))
|
||||
return NULL;
|
||||
if (gfx_ctx_mali_fbdev_get_vinfo(mali))
|
||||
goto error;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
frontend_driver_install_signal_handler();
|
||||
mali->egl.use_hw_ctx=true;
|
||||
mali->egl.use_hw_ctx = true;
|
||||
if (!egl_init_context(&mali->egl, EGL_NONE, EGL_DEFAULT_DISPLAY,
|
||||
&major, &minor, &n, attribs_init, NULL) ||
|
||||
!egl_create_context(&mali->egl, attribs_create) ||
|
||||
@ -263,11 +266,11 @@ static void *gfx_ctx_mali_fbdev_init(void *video_driver)
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
gfx_ctx_mali_fbdev_global=mali;
|
||||
gfx_ctx_mali_fbdev_global = mali;
|
||||
if (*video_driver_get_threaded())
|
||||
mali_flags |= GFX_CTX_MALI_FBDEV_FLAG_WAS_THREADED;
|
||||
mali_flags |= GFX_CTX_MALI_FBDEV_FLAG_WAS_THREADED;
|
||||
else
|
||||
mali_flags &= ~GFX_CTX_MALI_FBDEV_FLAG_WAS_THREADED;
|
||||
mali_flags &= ~GFX_CTX_MALI_FBDEV_FLAG_WAS_THREADED;
|
||||
return mali;
|
||||
|
||||
error:
|
||||
@ -300,22 +303,21 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
|
||||
if (video_driver_is_hw_context())
|
||||
mali_flags |= GFX_CTX_MALI_FBDEV_FLAG_HW_CTX_TRIGGER;
|
||||
mali_flags |= GFX_CTX_MALI_FBDEV_FLAG_HW_CTX_TRIGGER;
|
||||
|
||||
if (gfx_ctx_mali_fbdev_get_vinfo(mali))
|
||||
goto error;
|
||||
{
|
||||
gfx_ctx_mali_fbdev_destroy(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
width = mali->width;
|
||||
height = mali->height;
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
gfx_ctx_mali_fbdev_destroy(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_mali_fbdev_input_driver(void *data,
|
||||
@ -334,15 +336,10 @@ static enum gfx_ctx_api gfx_ctx_mali_fbdev_get_api(void *data)
|
||||
static bool gfx_ctx_mali_fbdev_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
unsigned version;
|
||||
version = major * 100 + minor;
|
||||
|
||||
unsigned version = major * 100 + minor;
|
||||
if (version >= 300)
|
||||
mali_flags |= GFX_CTX_MALI_FBDEV_FLAG_GLES3;
|
||||
|
||||
if (api == GFX_CTX_OPENGL_ES_API)
|
||||
return true;
|
||||
return false;
|
||||
return (api == GFX_CTX_OPENGL_ES_API);
|
||||
}
|
||||
|
||||
static bool gfx_ctx_mali_fbdev_has_focus(void *data) { return true; }
|
||||
@ -352,22 +349,22 @@ static bool gfx_ctx_mali_fbdev_suppress_screensaver(void *data, bool enable) { r
|
||||
static void gfx_ctx_mali_fbdev_set_swap_interval(void *data,
|
||||
int swap_interval)
|
||||
{
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
#ifdef HAVE_EGL
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
egl_set_swap_interval(&mali->egl, swap_interval);
|
||||
#endif
|
||||
}
|
||||
static void gfx_ctx_mali_fbdev_swap_buffers(void *data)
|
||||
{
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
#ifdef HAVE_EGL
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
egl_swap_buffers(&mali->egl);
|
||||
#endif
|
||||
}
|
||||
static void gfx_ctx_mali_fbdev_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
#ifdef HAVE_EGL
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
egl_bind_hw_render(&mali->egl, enable);
|
||||
#endif
|
||||
}
|
||||
@ -385,7 +382,6 @@ static void gfx_ctx_mali_fbdev_set_flags(void *data, uint32_t flags) { }
|
||||
static float gfx_ctx_mali_fbdev_get_refresh_rate(void *data)
|
||||
{
|
||||
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
|
||||
|
||||
return mali->refresh_rate;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ static void *gfx_ctx_opendingux_init(void *video_driver)
|
||||
EGL_NONE
|
||||
};
|
||||
#endif
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)
|
||||
calloc(1, sizeof(*viv));
|
||||
|
||||
if (!viv)
|
||||
@ -101,9 +101,8 @@ static void gfx_ctx_opendingux_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
|
||||
*width = viv->width;
|
||||
*height = viv->height;
|
||||
*width = viv->width;
|
||||
*height = viv->height;
|
||||
}
|
||||
|
||||
static void gfx_ctx_opendingux_check_window(void *data, bool *quit,
|
||||
@ -136,21 +135,20 @@ static bool gfx_ctx_opendingux_set_video_mode(void *data,
|
||||
EGL_NONE
|
||||
};
|
||||
#endif
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
|
||||
/* Pick some arbitrary default. */
|
||||
if (!width || !fullscreen)
|
||||
width = 1280;
|
||||
width = 1280;
|
||||
if (!height || !fullscreen)
|
||||
height = 1024;
|
||||
height = 1024;
|
||||
|
||||
viv->width = width;
|
||||
viv->height = height;
|
||||
viv->width = width;
|
||||
viv->height = height;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_context(&viv->egl, attribs))
|
||||
goto error;
|
||||
|
||||
viv->native_window = 0;
|
||||
if (!egl_create_surface(&viv->egl, viv->native_window))
|
||||
goto error;
|
||||
@ -191,9 +189,8 @@ static bool gfx_ctx_opendingux_suppress_screensaver(void *data, bool enable) { r
|
||||
|
||||
static void gfx_ctx_opendingux_swap_buffers(void *data)
|
||||
{
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
egl_swap_buffers(&viv->egl);
|
||||
#endif
|
||||
}
|
||||
@ -201,18 +198,16 @@ static void gfx_ctx_opendingux_swap_buffers(void *data)
|
||||
static void gfx_ctx_opendingux_set_swap_interval(
|
||||
void *data, int swap_interval)
|
||||
{
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
egl_set_swap_interval(&viv->egl, swap_interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_opendingux_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
|
||||
egl_bind_hw_render(&viv->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
@ -91,8 +91,7 @@ static void *orbis_ctx_init(void *video_driver)
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_NONE};
|
||||
#endif
|
||||
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)
|
||||
calloc(1, sizeof(*ctx_orbis));
|
||||
|
||||
if (!ctx_orbis)
|
||||
@ -102,31 +101,28 @@ static void *orbis_ctx_init(void *video_driver)
|
||||
|
||||
memset(&ctx_orbis->pgl_config, 0, sizeof(ctx_orbis->pgl_config));
|
||||
|
||||
{
|
||||
ctx_orbis->pgl_config.size =
|
||||
sizeof(ctx_orbis->pgl_config);
|
||||
ctx_orbis->pgl_config.flags =
|
||||
SCE_PGL_FLAGS_USE_COMPOSITE_EXT
|
||||
| SCE_PGL_FLAGS_USE_FLEXIBLE_MEMORY
|
||||
| 0x60;
|
||||
ctx_orbis->pgl_config.processOrder = 1;
|
||||
ctx_orbis->pgl_config.systemSharedMemorySize = 0x1000000;
|
||||
ctx_orbis->pgl_config.videoSharedMemorySize = 0x3000000;
|
||||
ctx_orbis->pgl_config.maxMappedFlexibleMemory = 0xFFFFFFFF;
|
||||
ctx_orbis->pgl_config.drawCommandBufferSize = 0x100000;
|
||||
ctx_orbis->pgl_config.lcueResourceBufferSize = 0x1000000;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x40 = ATTR_ORBISGL_WIDTH;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x44 = ATTR_ORBISGL_HEIGHT;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x48 = 0;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x4C = 0;
|
||||
ctx_orbis->pgl_config.unk_0x5C = 2;
|
||||
}
|
||||
ret = scePigletSetConfigurationVSH(&ctx_orbis->pgl_config);
|
||||
if (!ret)
|
||||
ctx_orbis->pgl_config.size = sizeof(ctx_orbis->pgl_config);
|
||||
ctx_orbis->pgl_config.flags =
|
||||
SCE_PGL_FLAGS_USE_COMPOSITE_EXT
|
||||
| SCE_PGL_FLAGS_USE_FLEXIBLE_MEMORY
|
||||
| 0x60;
|
||||
ctx_orbis->pgl_config.processOrder = 1;
|
||||
ctx_orbis->pgl_config.systemSharedMemorySize = 0x1000000;
|
||||
ctx_orbis->pgl_config.videoSharedMemorySize = 0x3000000;
|
||||
ctx_orbis->pgl_config.maxMappedFlexibleMemory = 0xFFFFFFFF;
|
||||
ctx_orbis->pgl_config.drawCommandBufferSize = 0x100000;
|
||||
ctx_orbis->pgl_config.lcueResourceBufferSize = 0x1000000;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x40 = ATTR_ORBISGL_WIDTH;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x44 = ATTR_ORBISGL_HEIGHT;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x48 = 0;
|
||||
ctx_orbis->pgl_config.dbgPosCmd_0x4C = 0;
|
||||
ctx_orbis->pgl_config.unk_0x5C = 2;
|
||||
|
||||
if (!(ret = scePigletSetConfigurationVSH(&ctx_orbis->pgl_config)))
|
||||
goto error;
|
||||
|
||||
#if defined(HAVE_OOSDK)
|
||||
shdr_cache_dir = "/data/retroarch/temp/";
|
||||
shdr_cache_dir = "/data/retroarch/temp/";
|
||||
memset(&ctx_orbis->shdr_cache_config, 0, sizeof(ctx_orbis->shdr_cache_config));
|
||||
ctx_orbis->shdr_cache_config.ver = 0x00010064;
|
||||
snprintf(ctx_orbis->shdr_cache_config.cache_dir,
|
||||
@ -167,7 +163,7 @@ static void orbis_ctx_check_window(void *data, bool *quit,
|
||||
*resize = true;
|
||||
}
|
||||
|
||||
*quit = (bool)false;
|
||||
*quit = (bool)false;
|
||||
}
|
||||
|
||||
static bool orbis_ctx_set_video_mode(void *data,
|
||||
@ -198,9 +194,6 @@ static bool orbis_ctx_set_video_mode(void *data,
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_context(&ctx_orbis->egl, contextAttributeList))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_surface(&ctx_orbis->egl, &ctx_orbis->native_window))
|
||||
goto error;
|
||||
#endif
|
||||
@ -224,10 +217,7 @@ static void orbis_ctx_input_driver(void *data,
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
static enum gfx_ctx_api orbis_ctx_get_api(void *data)
|
||||
{
|
||||
return ctx_orbis_api;
|
||||
}
|
||||
static enum gfx_ctx_api orbis_ctx_get_api(void *data) { return ctx_orbis_api; }
|
||||
|
||||
static bool orbis_ctx_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
@ -266,19 +256,19 @@ static void orbis_ctx_swap_buffers(void *data)
|
||||
|
||||
static gfx_ctx_proc_t orbis_ctx_get_proc_address(const char *symbol)
|
||||
{
|
||||
gfx_ctx_proc_t ptr_sym = NULL;
|
||||
gfx_ctx_proc_t ptr_sym = NULL;
|
||||
#ifdef HAVE_EGL
|
||||
ptr_sym = egl_get_proc_address(symbol);
|
||||
ptr_sym = egl_get_proc_address(symbol);
|
||||
#endif
|
||||
if (!ptr_sym && s_piglet_module > 0)
|
||||
sceKernelDlsym(s_piglet_module, symbol, (void **)&ptr_sym);
|
||||
return ptr_sym;
|
||||
if (!ptr_sym && s_piglet_module > 0)
|
||||
sceKernelDlsym(s_piglet_module, symbol, (void **)&ptr_sym);
|
||||
return ptr_sym;
|
||||
}
|
||||
|
||||
static void orbis_ctx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
egl_bind_hw_render(&ctx_orbis->egl, enable);
|
||||
#endif
|
||||
}
|
||||
@ -306,7 +296,6 @@ static void orbis_ctx_set_flags(void *data, uint32_t flags) { }
|
||||
static float orbis_ctx_get_refresh_rate(void *data)
|
||||
{
|
||||
orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *)data;
|
||||
|
||||
return ctx_orbis->refresh_rate;
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,10 @@ static int g_osmesa_minor = 1;
|
||||
typedef struct gfx_osmesa_ctx_data
|
||||
{
|
||||
uint8_t *screen;
|
||||
OSMesaContext ctx;
|
||||
int width;
|
||||
int height;
|
||||
int pixsize;
|
||||
|
||||
OSMesaContext ctx;
|
||||
int socket;
|
||||
int client;
|
||||
} gfx_ctx_osmesa_data_t;
|
||||
@ -105,15 +104,13 @@ static void osmesa_fifo_accept(gfx_ctx_osmesa_data_t *osmesa)
|
||||
{
|
||||
int res;
|
||||
struct pollfd fds;
|
||||
fds.fd = osmesa->socket;
|
||||
fds.fd = osmesa->socket;
|
||||
fds.events = POLLIN;
|
||||
|
||||
if (osmesa->client >= 0)
|
||||
return;
|
||||
|
||||
res = poll(&fds, 1, 0);
|
||||
|
||||
if (res < 0)
|
||||
if ((res = poll(&fds, 1, 0)) < 0)
|
||||
perror("[osmesa] poll() error");
|
||||
else if (res > 0)
|
||||
{
|
||||
@ -147,7 +144,7 @@ static void osmesa_fifo_write(gfx_ctx_osmesa_data_t *osmesa)
|
||||
static void *osmesa_ctx_init(void *video_driver)
|
||||
{
|
||||
#ifdef HAVE_OSMESA_CREATE_CONTEXT_ATTRIBS
|
||||
const int attribs[] = {
|
||||
const int attribs[] = {
|
||||
OSMESA_FORMAT, OSMESA_DEFAULT_FORMAT,
|
||||
OSMESA_DEPTH_BITS, 0,
|
||||
OSMESA_STENCIL_BITS, 0,
|
||||
@ -162,10 +159,10 @@ static void *osmesa_ctx_init(void *video_driver)
|
||||
calloc(1, sizeof(gfx_ctx_osmesa_data_t));
|
||||
|
||||
if (!osmesa)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
#ifdef HAVE_OSMESA_CREATE_CONTEXT_ATTRIBS
|
||||
osmesa->ctx = OSMesaCreateContextAttribs(attribs, NULL);
|
||||
osmesa->ctx = OSMesaCreateContextAttribs(attribs, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OSMESA_CREATE_CONTEXT_EXT
|
||||
@ -182,17 +179,14 @@ static void *osmesa_ctx_init(void *video_driver)
|
||||
}
|
||||
|
||||
if (!osmesa->ctx)
|
||||
goto error;
|
||||
{
|
||||
free(osmesa);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osmesa->pixsize = OSMESA_BPP;
|
||||
|
||||
return osmesa;
|
||||
|
||||
error:
|
||||
if (osmesa)
|
||||
free(osmesa);
|
||||
RARCH_WARN("[omesa]: Failed to initialize the context driver.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void osmesa_ctx_destroy(void *data)
|
||||
@ -239,11 +233,7 @@ static bool osmesa_ctx_bind_api(void *data,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void osmesa_ctx_swap_interval(void *data, int interval)
|
||||
{
|
||||
(void)data;
|
||||
(void)interval;
|
||||
}
|
||||
static void osmesa_ctx_swap_interval(void *data, int interval) { }
|
||||
|
||||
static bool osmesa_ctx_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
@ -254,7 +244,7 @@ static bool osmesa_ctx_set_video_mode(void *data,
|
||||
bool size_changed = (width * height) != (osmesa->width * osmesa->height);
|
||||
|
||||
if (!osmesa->screen || size_changed)
|
||||
screen = (uint8_t*)calloc(1, (width * height) * osmesa->pixsize);
|
||||
screen = (uint8_t*)calloc(1, (width * height) * osmesa->pixsize);
|
||||
|
||||
if (!screen)
|
||||
return false;
|
||||
@ -298,11 +288,10 @@ static void osmesa_ctx_check_window(void *data, bool *quit,
|
||||
unsigned *height)
|
||||
{
|
||||
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
|
||||
|
||||
*width = osmesa->width;
|
||||
*height = osmesa->height;
|
||||
*resize = false;
|
||||
*quit = false;
|
||||
*width = osmesa->width;
|
||||
*height = osmesa->height;
|
||||
*resize = false;
|
||||
*quit = false;
|
||||
}
|
||||
|
||||
static bool osmesa_ctx_has_focus(void *data) { return true; }
|
||||
|
@ -165,9 +165,8 @@ static void gfx_ctx_ps3_swap_buffers(void *data)
|
||||
static void gfx_ctx_ps3_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)data;
|
||||
|
||||
#if defined(HAVE_PSGL)
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)data;
|
||||
if (ps3)
|
||||
psglGetDeviceDimensions(ps3->gl_device, width, height);
|
||||
#endif
|
||||
@ -179,17 +178,17 @@ static void *gfx_ctx_ps3_init(void *video_driver)
|
||||
PSGLdeviceParameters params;
|
||||
PSGLinitOptions options;
|
||||
#endif
|
||||
global_t *global = global_get_ptr();
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)
|
||||
global_t *global = global_get_ptr();
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)
|
||||
calloc(1, sizeof(gfx_ctx_ps3_data_t));
|
||||
|
||||
if (!ps3)
|
||||
return NULL;
|
||||
|
||||
#if defined(HAVE_PSGL)
|
||||
options.enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS;
|
||||
options.maxSPUs = 1;
|
||||
options.initializeSPUs = GL_FALSE;
|
||||
options.enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS;
|
||||
options.maxSPUs = 1;
|
||||
options.initializeSPUs = GL_FALSE;
|
||||
|
||||
/* Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL. */
|
||||
sys_spu_initialize(6, 1);
|
||||
@ -205,7 +204,7 @@ static void *gfx_ctx_ps3_init(void *video_driver)
|
||||
|
||||
if (global->console.screen.resolutions.current.id)
|
||||
{
|
||||
params.enable |= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT;
|
||||
params.enable |= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT;
|
||||
|
||||
gfx_ctx_ps3_get_resolution(
|
||||
global->console.screen.resolutions.current.id,
|
||||
@ -223,15 +222,14 @@ static void *gfx_ctx_ps3_init(void *video_driver)
|
||||
if (global->console.screen.pal60_enable)
|
||||
{
|
||||
RARCH_LOG("[PSGL Context]: Setting temporal PAL60 mode.\n");
|
||||
params.enable |= PSGL_DEVICE_PARAMETERS_RESC_PAL_TEMPORAL_MODE;
|
||||
params.enable |= PSGL_DEVICE_PARAMETERS_RESC_RATIO_MODE;
|
||||
params.enable |= PSGL_DEVICE_PARAMETERS_RESC_PAL_TEMPORAL_MODE;
|
||||
params.enable |= PSGL_DEVICE_PARAMETERS_RESC_RATIO_MODE;
|
||||
params.rescPalTemporalMode = RESC_PAL_TEMPORAL_MODE_60_INTERPOLATE;
|
||||
params.rescRatioMode = RESC_RATIO_MODE_FULLSCREEN;
|
||||
params.rescRatioMode = RESC_RATIO_MODE_FULLSCREEN;
|
||||
}
|
||||
|
||||
ps3->gl_device = psglCreateDeviceExtended(¶ms);
|
||||
ps3->gl_context = psglCreateContext();
|
||||
|
||||
ps3->gl_device = psglCreateDeviceExtended(¶ms);
|
||||
ps3->gl_context = psglCreateContext();
|
||||
psglMakeCurrent(ps3->gl_context, ps3->gl_device);
|
||||
psglResetCurrentContext();
|
||||
#endif
|
||||
@ -247,15 +245,13 @@ static void *gfx_ctx_ps3_init(void *video_driver)
|
||||
}
|
||||
|
||||
static bool gfx_ctx_ps3_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen) { return true; }
|
||||
unsigned width, unsigned height, bool fullscreen) { return true; }
|
||||
|
||||
static void gfx_ctx_ps3_destroy_resources(gfx_ctx_ps3_data_t *ps3)
|
||||
{
|
||||
#if defined(HAVE_PSGL)
|
||||
if (!ps3)
|
||||
return;
|
||||
|
||||
#if defined(HAVE_PSGL)
|
||||
psglDestroyContext(ps3->gl_context);
|
||||
psglDestroyDevice(ps3->gl_device);
|
||||
|
||||
|
@ -55,7 +55,7 @@ static void gfx_ctx_psl1ght_get_resolution(unsigned idx,
|
||||
static void gfx_ctx_psl1ght_get_available_resolutions(void)
|
||||
{
|
||||
unsigned i;
|
||||
uint32_t videomode[] = {
|
||||
uint32_t videomode[] = {
|
||||
CELL_VIDEO_OUT_RESOLUTION_480,
|
||||
CELL_VIDEO_OUT_RESOLUTION_576,
|
||||
CELL_VIDEO_OUT_RESOLUTION_960x1080,
|
||||
@ -176,15 +176,13 @@ static void *gfx_ctx_psl1ght_init(void *video_driver)
|
||||
}
|
||||
|
||||
static bool gfx_ctx_psl1ght_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen) { return true; }
|
||||
unsigned width, unsigned height, bool fullscreen) { return true; }
|
||||
|
||||
static void gfx_ctx_psl1ght_destroy_resources(gfx_ctx_psl1ght_data_t *ps3)
|
||||
{
|
||||
#if defined(HAVE_PSGL)
|
||||
if (!ps3)
|
||||
return;
|
||||
|
||||
#if defined(HAVE_PSGL)
|
||||
psglDestroyContext(ps3->gl_context);
|
||||
psglDestroyDevice(ps3->gl_device);
|
||||
|
||||
|
@ -82,7 +82,7 @@ static void *gfx_ctx_qnx_init(void *video_driver)
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
const EGLint attribs[] = {
|
||||
const EGLint attribs[] = {
|
||||
#ifdef HAVE_OPENGLES2
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
#elif HAVE_OPENGLES3
|
||||
@ -94,8 +94,8 @@ static void *gfx_ctx_qnx_init(void *video_driver)
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)calloc(1, sizeof(*qnx));
|
||||
int screen_resolution[2];
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)calloc(1, sizeof(*qnx));
|
||||
|
||||
if (!qnx)
|
||||
goto screen_error;
|
||||
@ -107,19 +107,16 @@ static void *gfx_ctx_qnx_init(void *video_driver)
|
||||
if (!screen_ctx)
|
||||
{
|
||||
screen_create_context(&screen_ctx, 0);
|
||||
|
||||
if (screen_request_events(screen_ctx) != BPS_SUCCESS)
|
||||
{
|
||||
RARCH_ERR("screen_request_events failed.\n");
|
||||
goto screen_error;
|
||||
}
|
||||
|
||||
if (navigator_request_events(0) != BPS_SUCCESS)
|
||||
{
|
||||
RARCH_ERR("navigator_request_events failed.\n");
|
||||
goto screen_error;
|
||||
}
|
||||
|
||||
if (navigator_rotation_lock(false) != BPS_SUCCESS)
|
||||
{
|
||||
RARCH_ERR("navigator_location_lock failed.\n");
|
||||
@ -131,7 +128,6 @@ static void *gfx_ctx_qnx_init(void *video_driver)
|
||||
if (!egl_init_context(&qnx->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, &major, &minor,
|
||||
&n, attribs, NULL))
|
||||
goto error;
|
||||
|
||||
if (!egl_create_context(&qnx->egl, context_attributes))
|
||||
goto error;
|
||||
#endif
|
||||
@ -140,8 +136,8 @@ static void *gfx_ctx_qnx_init(void *video_driver)
|
||||
{
|
||||
if (screen_create_window(&screen_win, screen_ctx))
|
||||
{
|
||||
RARCH_ERR("screen_create_window failed:.\n");
|
||||
goto error;
|
||||
RARCH_ERR("screen_create_window failed:.\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,8 +168,6 @@ static void *gfx_ctx_qnx_init(void *video_driver)
|
||||
goto error;
|
||||
}
|
||||
|
||||
int screen_resolution[2];
|
||||
|
||||
if (screen_get_display_property_iv(qnx->screen_disp,
|
||||
SCREEN_PROPERTY_SIZE, screen_resolution))
|
||||
{
|
||||
@ -202,8 +196,8 @@ static void *gfx_ctx_qnx_init(void *video_driver)
|
||||
|
||||
if ((angle == 0) || (angle == 180))
|
||||
{
|
||||
if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
|
||||
((screen_mode.width < screen_mode.height) && (size[0] > size[1])))
|
||||
if ( ((screen_mode.width > screen_mode.height) && (size[0] < size[1]))
|
||||
|| ((screen_mode.width < screen_mode.height) && (size[0] > size[1])))
|
||||
{
|
||||
buffer_size[1] = size[0];
|
||||
buffer_size[0] = size[1];
|
||||
@ -211,8 +205,8 @@ static void *gfx_ctx_qnx_init(void *video_driver)
|
||||
}
|
||||
else if ((angle == 90) || (angle == 270))
|
||||
{
|
||||
if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
|
||||
((screen_mode.width < screen_mode.height && size[0] < size[1])))
|
||||
if ( ((screen_mode.width > screen_mode.height) && (size[0] > size[1]))
|
||||
|| ((screen_mode.width < screen_mode.height && size[0] < size[1])))
|
||||
{
|
||||
buffer_size[1] = size[0];
|
||||
buffer_size[0] = size[1];
|
||||
@ -261,9 +255,8 @@ screen_error:
|
||||
static void gfx_ctx_qnx_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
egl_get_video_size(&qnx->egl, width, height);
|
||||
#endif
|
||||
}
|
||||
@ -273,24 +266,21 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit,
|
||||
{
|
||||
unsigned new_width, new_height;
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
|
||||
*quit = false;
|
||||
|
||||
*quit = false;
|
||||
#ifdef HAVE_EGL
|
||||
egl_get_video_size(&qnx->egl, &new_width, &new_height);
|
||||
#endif
|
||||
|
||||
if (new_width != *width || new_height != *height)
|
||||
{
|
||||
*width = new_width;
|
||||
*height = new_height;
|
||||
*resize = true;
|
||||
*width = new_width;
|
||||
*height = new_height;
|
||||
*resize = true;
|
||||
}
|
||||
}
|
||||
|
||||
static bool gfx_ctx_qnx_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen) { return true; }
|
||||
unsigned width, unsigned height, bool fullscreen) { return true; }
|
||||
|
||||
static void gfx_ctx_qnx_input_driver(void *data,
|
||||
const char *joypad_name,
|
||||
@ -307,9 +297,7 @@ static enum gfx_ctx_api gfx_ctx_qnx_get_api(void *data) { return GFX_CTX_OPENGL_
|
||||
static bool gfx_ctx_qnx_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
if (api == GFX_CTX_OPENGL_ES_API)
|
||||
return true;
|
||||
return false;
|
||||
return (api == GFX_CTX_OPENGL_ES_API);
|
||||
}
|
||||
|
||||
static bool gfx_ctx_qnx_has_focus(void *data) { return true; }
|
||||
@ -336,21 +324,26 @@ static int dpi_get_density(qnx_ctx_data_t *qnx)
|
||||
static bool gfx_ctx_qnx__get_metrics(void *data,
|
||||
enum display_metric_types type, float *value)
|
||||
{
|
||||
static int dpi = -1;
|
||||
static int dpi = -1;
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DISPLAY_METRIC_MM_WIDTH:
|
||||
return false;
|
||||
case DISPLAY_METRIC_MM_HEIGHT:
|
||||
return false;
|
||||
case DISPLAY_METRIC_DPI:
|
||||
if (dpi == -1)
|
||||
{
|
||||
dpi = dpi_get_density(qnx);
|
||||
dpi = dpi_get_density(qnx);
|
||||
if (dpi <= 0)
|
||||
goto dpi_fallback;
|
||||
{
|
||||
/* Add a fallback in case the device doesn't report DPI.
|
||||
* Calculated as an average of all BB10 device DPIs circa 2016. */
|
||||
dpi = 345;
|
||||
*value = (float)dpi;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*value = (float)dpi;
|
||||
break;
|
||||
@ -361,38 +354,28 @@ static bool gfx_ctx_qnx__get_metrics(void *data,
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
dpi_fallback:
|
||||
/* Add a fallback in case the device doesn't report DPI.
|
||||
* Calculated as an average of all BB10 device DPIs circa 2016. */
|
||||
dpi = 345;
|
||||
*value = (float)dpi;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void gfx_ctx_qnx_set_swap_interval(void *data, int swap_interval)
|
||||
{
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
egl_set_swap_interval(&qnx->egl, swap_interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_qnx_swap_buffers(void *data)
|
||||
{
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
egl_swap_buffers(&qnx->egl);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_qnx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
|
||||
egl_bind_hw_render(&qnx->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
@ -39,6 +39,12 @@
|
||||
|
||||
typedef struct gfx_ctx_sdl_data
|
||||
{
|
||||
#ifdef HAVE_SDL2
|
||||
SDL_Window *win;
|
||||
SDL_GLContext ctx;
|
||||
#else
|
||||
SDL_Surface *win;
|
||||
#endif
|
||||
int width;
|
||||
int height;
|
||||
int new_width;
|
||||
@ -47,13 +53,6 @@ typedef struct gfx_ctx_sdl_data
|
||||
bool full;
|
||||
bool resized;
|
||||
bool subsystem_inited;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
SDL_Window *win;
|
||||
SDL_GLContext ctx;
|
||||
#else
|
||||
SDL_Surface *win;
|
||||
#endif
|
||||
} gfx_ctx_sdl_data_t;
|
||||
|
||||
/* TODO/FIXME - static global */
|
||||
@ -200,9 +199,9 @@ static bool sdl_ctx_set_video_mode(void *data,
|
||||
if (fullscreen)
|
||||
{
|
||||
if (windowed_fullscreen)
|
||||
fsflag = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
fsflag = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
else
|
||||
fsflag = SDL_WINDOW_FULLSCREEN;
|
||||
fsflag = SDL_WINDOW_FULLSCREEN;
|
||||
}
|
||||
|
||||
if (sdl->win)
|
||||
@ -214,18 +213,18 @@ static bool sdl_ctx_set_video_mode(void *data,
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned display = video_monitor_index;
|
||||
|
||||
sdl->win = SDL_CreateWindow("RetroArch",
|
||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
|
||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
|
||||
width, height, SDL_WINDOW_OPENGL | fsflag);
|
||||
unsigned display = video_monitor_index;
|
||||
sdl->win = SDL_CreateWindow("RetroArch",
|
||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
|
||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
|
||||
width, height,
|
||||
SDL_WINDOW_OPENGL | fsflag);
|
||||
}
|
||||
#else
|
||||
if (fullscreen)
|
||||
fsflag = SDL_FULLSCREEN;
|
||||
fsflag = SDL_FULLSCREEN;
|
||||
|
||||
sdl->win = SDL_SetVideoMode(width, height, 0, SDL_OPENGL | fsflag);
|
||||
sdl->win = SDL_SetVideoMode(width, height, 0, SDL_OPENGL | fsflag);
|
||||
#endif
|
||||
|
||||
if (!sdl->win)
|
||||
@ -252,9 +251,9 @@ static bool sdl_ctx_set_video_mode(void *data,
|
||||
}
|
||||
#endif
|
||||
|
||||
sdl->full = fullscreen;
|
||||
sdl->width = width;
|
||||
sdl->height = height;
|
||||
sdl->full = fullscreen;
|
||||
sdl->width = width;
|
||||
sdl->height = height;
|
||||
|
||||
return true;
|
||||
|
||||
@ -272,31 +271,28 @@ static void sdl_ctx_get_video_size(void *data,
|
||||
if (!sdl)
|
||||
return;
|
||||
|
||||
*width = sdl->width;
|
||||
*height = sdl->height;
|
||||
*width = sdl->width;
|
||||
*height = sdl->height;
|
||||
|
||||
if (!sdl->win)
|
||||
{
|
||||
#ifdef HAVE_SDL2
|
||||
SDL_DisplayMode mode = {0};
|
||||
int i = settings->uints.video_monitor_index;
|
||||
|
||||
int i = settings->uints.video_monitor_index;
|
||||
if (SDL_GetCurrentDisplayMode(i, &mode) < 0)
|
||||
RARCH_WARN("[SDL_GL]: Failed to get display #%i mode: %s\n", i,
|
||||
SDL_GetError());
|
||||
#else
|
||||
SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
|
||||
SDL_Rect mode = {0};
|
||||
|
||||
SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
|
||||
SDL_Rect mode = {0};
|
||||
if (!modes)
|
||||
RARCH_WARN("[SDL_GL]: Failed to detect available video modes: %s\n",
|
||||
SDL_GetError());
|
||||
else if (*modes)
|
||||
mode = **modes;
|
||||
mode = **modes;
|
||||
#endif
|
||||
|
||||
*width = mode.w;
|
||||
*height = mode.h;
|
||||
*width = mode.w;
|
||||
*height = mode.h;
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,19 +370,17 @@ static void sdl_ctx_check_window(void *data, bool *quit,
|
||||
|
||||
static bool sdl_ctx_has_focus(void *data)
|
||||
{
|
||||
unsigned flags;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
|
||||
#ifdef WEBOS
|
||||
// We do not receive mouse focus when non-magic remote is used.
|
||||
flags = (SDL_WINDOW_INPUT_FOCUS);
|
||||
/* We do not receive mouse focus when non-magic remote is used. */
|
||||
unsigned flags = (SDL_WINDOW_INPUT_FOCUS);
|
||||
#else
|
||||
flags = (SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS);
|
||||
unsigned flags = (SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS);
|
||||
#endif
|
||||
return (SDL_GetWindowFlags(sdl->win) & flags) == flags;
|
||||
#else
|
||||
flags = (SDL_APPINPUTFOCUS | SDL_APPACTIVE);
|
||||
unsigned flags = (SDL_APPINPUTFOCUS | SDL_APPACTIVE);
|
||||
return (SDL_GetAppState() & flags) == flags;
|
||||
#endif
|
||||
}
|
||||
|
@ -48,17 +48,17 @@ static void switch_ctx_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
switch (appletGetOperationMode())
|
||||
{
|
||||
default:
|
||||
case AppletOperationMode_Handheld:
|
||||
*width = 1280;
|
||||
*height = 720;
|
||||
break;
|
||||
case AppletOperationMode_Console:
|
||||
*width = 1920;
|
||||
*height = 1080;
|
||||
break;
|
||||
}
|
||||
{
|
||||
default:
|
||||
case AppletOperationMode_Handheld:
|
||||
*width = 1280;
|
||||
*height = 720;
|
||||
break;
|
||||
case AppletOperationMode_Console:
|
||||
*width = 1920;
|
||||
*height = 1080;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void *switch_ctx_init(void *video_driver)
|
||||
@ -94,9 +94,9 @@ static void *switch_ctx_init(void *video_driver)
|
||||
setenv("NV50_PROG_CHIPSET", "0x120", 1);
|
||||
#endif
|
||||
|
||||
// Needs to be here
|
||||
ctx_nx->win = nwindowGetDefault();
|
||||
nwindowSetDimensions(ctx_nx->win, 1920, 1080);
|
||||
/* Needs to be here */
|
||||
ctx_nx->win = nwindowGetDefault();
|
||||
nwindowSetDimensions(ctx_nx->win, 1920, 1080);
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_init_context(&ctx_nx->egl, EGL_NONE, EGL_DEFAULT_DISPLAY,
|
||||
@ -110,7 +110,6 @@ static void *switch_ctx_init(void *video_driver)
|
||||
return ctx_nx;
|
||||
|
||||
error:
|
||||
printf("[NXGL]: EGL error: %d.\n", eglGetError());
|
||||
switch_ctx_destroy(video_driver);
|
||||
return NULL;
|
||||
}
|
||||
@ -136,7 +135,6 @@ static void switch_ctx_check_window(void *data, bool *quit,
|
||||
ctx_nx->resize = true;
|
||||
|
||||
*resize = true;
|
||||
printf("[NXGL]: Resizing to %dx%d\n", *width, *height);
|
||||
nwindowSetCrop(ctx_nx->win, 0, 1080 - ctx_nx->height, ctx_nx->width, 1080);
|
||||
}
|
||||
|
||||
@ -180,9 +178,7 @@ static bool switch_ctx_set_video_mode(void *data,
|
||||
return true;
|
||||
|
||||
error:
|
||||
printf("[NXGL]: EGL error: %d.\n", eglGetError());
|
||||
switch_ctx_destroy(data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -194,10 +190,7 @@ static void switch_ctx_input_driver(void *data,
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
static enum gfx_ctx_api switch_ctx_get_api(void *data)
|
||||
{
|
||||
return GFX_CTX_OPENGL_API;
|
||||
}
|
||||
static enum gfx_ctx_api switch_ctx_get_api(void *data) { return GFX_CTX_OPENGL_API; }
|
||||
|
||||
static bool switch_ctx_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
@ -205,44 +198,39 @@ static bool switch_ctx_bind_api(void *data,
|
||||
if (api == GFX_CTX_OPENGL_API)
|
||||
if (egl_bind_api(EGL_OPENGL_API))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool switch_ctx_has_focus(void *data) { return platform_switch_has_focus; }
|
||||
static bool switch_ctx_suppress_screensaver(void *data, bool enable) { return false; }
|
||||
|
||||
static void switch_ctx_set_swap_interval(void *data,
|
||||
int swap_interval)
|
||||
static void switch_ctx_set_swap_interval(void *data, int swap_interval)
|
||||
{
|
||||
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data;
|
||||
egl_set_swap_interval(&ctx_nx->egl, swap_interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void switch_ctx_swap_buffers(void *data)
|
||||
{
|
||||
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t*)data;
|
||||
egl_swap_buffers(&ctx_nx->egl);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void switch_ctx_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data;
|
||||
egl_bind_hw_render(&ctx_nx->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint32_t switch_ctx_get_flags(void *data)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (string_is_equal(video_driver_get_ident(), "glcore"))
|
||||
{
|
||||
@ -265,7 +253,6 @@ static void switch_ctx_set_flags(void *data, uint32_t flags) { }
|
||||
static float switch_ctx_get_refresh_rate(void *data)
|
||||
{
|
||||
switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data;
|
||||
|
||||
return ctx_nx->refresh_rate;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
/* TODO/FIXME - static globals */
|
||||
static egl_ctx_data_t uwp_egl;
|
||||
#ifdef HAVE_DYLIB
|
||||
static dylib_t dll_handle = NULL; /* Handle to libGLESv2.dll */
|
||||
static dylib_t dll_handle = NULL; /* Handle to libGLESv2.dll */
|
||||
#endif
|
||||
|
||||
typedef struct gfx_ctx_cgl_data
|
||||
@ -68,7 +68,7 @@ bool create_gles_context(void* corewindow)
|
||||
{
|
||||
EGLint n, major, minor;
|
||||
EGLint format;
|
||||
EGLint attribs[] = {
|
||||
EGLint attribs[] = {
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
@ -93,25 +93,22 @@ bool create_gles_context(void* corewindow)
|
||||
#endif
|
||||
{
|
||||
egl_report_error();
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!egl_get_native_visual_id(&uwp_egl, &format))
|
||||
goto error;
|
||||
return false;
|
||||
|
||||
if (!egl_create_context(&uwp_egl, context_attributes))
|
||||
{
|
||||
egl_report_error();
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!egl_create_surface(&uwp_egl, uwp_get_corewindow()))
|
||||
goto error;
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_uwp_swap_interval(void *data, int interval)
|
||||
@ -143,14 +140,14 @@ static bool gfx_ctx_uwp_set_resize(void *data,
|
||||
static void gfx_ctx_uwp_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
bool quit;
|
||||
bool resize;
|
||||
bool quit = false;
|
||||
bool resize = false;
|
||||
win32_check_window(NULL, &quit, &resize, width, height);
|
||||
if (is_running_on_xbox())
|
||||
{
|
||||
//match the output res to the display res
|
||||
width = uwp_get_width();
|
||||
height = uwp_get_height();
|
||||
/* Match the output res to the display resolution */
|
||||
width = uwp_get_width();
|
||||
height = uwp_get_height();
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,15 +193,12 @@ static bool gfx_ctx_uwp_set_video_mode(void *data,
|
||||
if (!create_gles_context(uwp_get_corewindow()))
|
||||
{
|
||||
RARCH_ERR("[UWP EGL]: create_gles_context failed.\n");
|
||||
goto error;
|
||||
gfx_ctx_uwp_destroy(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
gfx_ctx_uwp_swap_interval(data, uwp->interval);
|
||||
return true;
|
||||
|
||||
error:
|
||||
gfx_ctx_uwp_destroy(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_uwp_input_driver(void *data,
|
||||
@ -237,9 +231,7 @@ static enum gfx_ctx_api gfx_ctx_uwp_get_api(void *data)
|
||||
static bool gfx_ctx_uwp_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
if (api == GFX_CTX_OPENGL_ES_API)
|
||||
return true;
|
||||
return false;
|
||||
return (api == GFX_CTX_OPENGL_ES_API);
|
||||
}
|
||||
|
||||
static void gfx_ctx_uwp_bind_hw_render(void *data, bool enable)
|
||||
|
@ -263,20 +263,18 @@ static void gfx_ctx_vc_destroy(void *data)
|
||||
|
||||
static void *gfx_ctx_vc_init(void *video_driver)
|
||||
{
|
||||
VC_RECT_T dst_rect;
|
||||
VC_RECT_T src_rect;
|
||||
VC_DISPMANX_ALPHA_T alpha;
|
||||
EGLint n, major, minor;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned max_swapchain_images = settings->uints.video_max_swapchain_images;
|
||||
|
||||
DISPMANX_ELEMENT_HANDLE_T dispman_element;
|
||||
DISPMANX_DISPLAY_HANDLE_T dispman_display;
|
||||
DISPMANX_UPDATE_HANDLE_T dispman_update;
|
||||
DISPMANX_MODEINFO_T dispman_modeinfo;
|
||||
VC_RECT_T dst_rect;
|
||||
VC_RECT_T src_rect;
|
||||
|
||||
EGLint n, major, minor;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned max_swapchain_images = settings->uints.video_max_swapchain_images;
|
||||
#ifdef HAVE_EGL
|
||||
static const EGLint attribute_list[] =
|
||||
static const EGLint attribute_list[] =
|
||||
{
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
@ -287,15 +285,15 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
static const EGLint context_attributes[] =
|
||||
static const EGLint context_attributes[] =
|
||||
{
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
#endif
|
||||
vc_ctx_data_t *vc = NULL;
|
||||
unsigned fullscreen_x = settings->uints.video_fullscreen_x;
|
||||
unsigned fullscreen_y = settings->uints.video_fullscreen_y;
|
||||
vc_ctx_data_t *vc = NULL;
|
||||
unsigned fullscreen_x = settings->uints.video_fullscreen_x;
|
||||
unsigned fullscreen_y = settings->uints.video_fullscreen_y;
|
||||
|
||||
if (g_egl_inited)
|
||||
{
|
||||
@ -303,9 +301,7 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vc = (vc_ctx_data_t*)calloc(1, sizeof(*vc));
|
||||
|
||||
if (!vc)
|
||||
if (!(vc = (vc_ctx_data_t*)calloc(1, sizeof(*vc))))
|
||||
return NULL;
|
||||
|
||||
bcm_host_init();
|
||||
@ -331,50 +327,50 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||
&vc->fb_width, &vc->fb_height) < 0)
|
||||
goto error;
|
||||
|
||||
dst_rect.x = 0;
|
||||
dst_rect.y = 0;
|
||||
dst_rect.width = vc->fb_width;
|
||||
dst_rect.height = vc->fb_height;
|
||||
dst_rect.x = 0;
|
||||
dst_rect.y = 0;
|
||||
dst_rect.width = vc->fb_width;
|
||||
dst_rect.height = vc->fb_height;
|
||||
|
||||
src_rect.x = 0;
|
||||
src_rect.y = 0;
|
||||
src_rect.x = 0;
|
||||
src_rect.y = 0;
|
||||
|
||||
/* Use dispmanx upscaling if fullscreen_x
|
||||
* and fullscreen_y are set. */
|
||||
if ((fullscreen_x != 0) &&
|
||||
(fullscreen_y != 0))
|
||||
if ( (fullscreen_x != 0)
|
||||
&& (fullscreen_y != 0))
|
||||
{
|
||||
/* Keep input and output aspect ratio equal.
|
||||
* There are other aspect ratio settings which can be used to stretch video output. */
|
||||
|
||||
/* Calculate source and destination aspect ratios. */
|
||||
float src_aspect = (float)fullscreen_x / (float)fullscreen_y;
|
||||
float dst_aspect = (float)vc->fb_width / (float)vc->fb_height;
|
||||
float src_aspect = (float)fullscreen_x / (float)fullscreen_y;
|
||||
float dst_aspect = (float)vc->fb_width / (float)vc->fb_height;
|
||||
/* If source and destination aspect ratios are not equal correct source width. */
|
||||
if (src_aspect != dst_aspect)
|
||||
src_rect.width = (unsigned)(fullscreen_y * dst_aspect) << 16;
|
||||
src_rect.width = (unsigned)(fullscreen_y * dst_aspect) << 16;
|
||||
else
|
||||
src_rect.width = fullscreen_x << 16;
|
||||
src_rect.height = fullscreen_y << 16;
|
||||
src_rect.width = fullscreen_x << 16;
|
||||
src_rect.height = fullscreen_y << 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
src_rect.width = vc->fb_width << 16;
|
||||
src_rect.height = vc->fb_height << 16;
|
||||
src_rect.width = vc->fb_width << 16;
|
||||
src_rect.height = vc->fb_height << 16;
|
||||
}
|
||||
|
||||
dispman_display = vc_dispmanx_display_open(0 /* LCD */);
|
||||
vc->dispman_display = dispman_display;
|
||||
dispman_display = vc_dispmanx_display_open(0 /* LCD */);
|
||||
vc->dispman_display = dispman_display;
|
||||
|
||||
vc_dispmanx_display_get_info(dispman_display, &dispman_modeinfo);
|
||||
|
||||
dispman_update = vc_dispmanx_update_start(0);
|
||||
dispman_update = vc_dispmanx_update_start(0);
|
||||
|
||||
alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
|
||||
alpha.opacity = 255;
|
||||
alpha.mask = 0;
|
||||
alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
|
||||
alpha.opacity = 255;
|
||||
alpha.mask = 0;
|
||||
|
||||
dispman_element = vc_dispmanx_element_add(
|
||||
dispman_element = vc_dispmanx_element_add(
|
||||
dispman_update,
|
||||
dispman_display,
|
||||
0 /*layer*/,
|
||||
@ -386,32 +382,32 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||
0 /*clamp*/,
|
||||
DISPMANX_NO_ROTATE);
|
||||
|
||||
vc->native_window.element = dispman_element;
|
||||
vc->native_window.element = dispman_element;
|
||||
|
||||
/* Use dispmanx upscaling if fullscreen_x and fullscreen_y are set. */
|
||||
|
||||
if (fullscreen_x != 0 &&
|
||||
fullscreen_y != 0)
|
||||
if ( (fullscreen_x != 0)
|
||||
&& (fullscreen_y != 0))
|
||||
{
|
||||
/* Keep input and output aspect ratio equal.
|
||||
* There are other aspect ratio settings which
|
||||
* can be used to stretch video output. */
|
||||
|
||||
/* Calculate source and destination aspect ratios. */
|
||||
float srcAspect = (float)fullscreen_x / (float)fullscreen_y;
|
||||
float dstAspect = (float)vc->fb_width / (float)vc->fb_height;
|
||||
float srcAspect = (float)fullscreen_x / (float)fullscreen_y;
|
||||
float dstAspect = (float)vc->fb_width / (float)vc->fb_height;
|
||||
|
||||
/* If source and destination aspect ratios are not equal correct source width. */
|
||||
if (srcAspect != dstAspect)
|
||||
vc->native_window.width = (unsigned)(fullscreen_y * dstAspect);
|
||||
vc->native_window.width = (unsigned)(fullscreen_y * dstAspect);
|
||||
else
|
||||
vc->native_window.width = fullscreen_x;
|
||||
vc->native_window.height = fullscreen_y;
|
||||
vc->native_window.width = fullscreen_x;
|
||||
vc->native_window.height = fullscreen_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
vc->native_window.width = vc->fb_width;
|
||||
vc->native_window.height = vc->fb_height;
|
||||
vc->native_window.width = vc->fb_width;
|
||||
vc->native_window.height = vc->fb_height;
|
||||
}
|
||||
vc_dispmanx_update_submit_sync(dispman_update);
|
||||
|
||||
@ -420,10 +416,10 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
/* For vsync after eglSwapBuffers when max_swapchain < 3 */
|
||||
vc->vsync_condition = scond_new();
|
||||
vc->vsync_condition_mutex = slock_new();
|
||||
vc->vsync_callback_set = false;
|
||||
/* For VSync after eglSwapBuffers when max_swapchain < 3 */
|
||||
vc->vsync_condition = scond_new();
|
||||
vc->vsync_condition_mutex = slock_new();
|
||||
vc->vsync_callback_set = false;
|
||||
|
||||
if (max_swapchain_images <= 2)
|
||||
{
|
||||
@ -468,10 +464,7 @@ static bool gfx_ctx_vc_set_video_mode(void *data,
|
||||
return true;
|
||||
}
|
||||
|
||||
static enum gfx_ctx_api gfx_ctx_vc_get_api(void *data)
|
||||
{
|
||||
return vc_api;
|
||||
}
|
||||
static enum gfx_ctx_api gfx_ctx_vc_get_api(void *data) { return vc_api; }
|
||||
|
||||
static void gfx_ctx_vc_input_driver(void *data,
|
||||
const char *name,
|
||||
@ -497,7 +490,7 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
|
||||
const video_info_t *video)
|
||||
{
|
||||
EGLBoolean result;
|
||||
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
|
||||
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
|
||||
EGLint pbufsurface_list[] =
|
||||
{
|
||||
EGL_WIDTH, vc->res,
|
||||
@ -509,19 +502,19 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
|
||||
if (vc_api == GFX_CTX_OPENVG_API)
|
||||
return false;
|
||||
|
||||
vc->peglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)egl_get_proc_address("eglCreateImageKHR");
|
||||
vc->peglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)egl_get_proc_address("eglDestroyImageKHR");
|
||||
vc->peglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)egl_get_proc_address("eglCreateImageKHR");
|
||||
vc->peglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)egl_get_proc_address("eglDestroyImageKHR");
|
||||
|
||||
if ( !vc->peglCreateImageKHR ||
|
||||
!vc->peglDestroyImageKHR ||
|
||||
!gfx_ctx_vc_egl_query_extension(vc, "KHR_image")
|
||||
if ( !vc->peglCreateImageKHR
|
||||
|| !vc->peglDestroyImageKHR
|
||||
|| !gfx_ctx_vc_egl_query_extension(vc, "KHR_image")
|
||||
)
|
||||
return false;
|
||||
|
||||
vc->res = video->input_scale * RARCH_SCALE_BASE;
|
||||
vc->res = video->input_scale * RARCH_SCALE_BASE;
|
||||
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
vc->pbuff_surf = eglCreatePbufferSurface(
|
||||
vc->pbuff_surf = eglCreatePbufferSurface(
|
||||
vc->egl.dpy, vc->egl.config, pbufsurface_list);
|
||||
|
||||
if (vc->pbuff_surf == EGL_NO_SURFACE)
|
||||
@ -530,7 +523,7 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
vc->eglimage_ctx = eglCreateContext(vc->egl.dpy, vc->egl.config, NULL, NULL);
|
||||
vc->eglimage_ctx = eglCreateContext(vc->egl.dpy, vc->egl.config, NULL, NULL);
|
||||
if (vc->eglimage_ctx == EGL_NO_CONTEXT)
|
||||
{
|
||||
RARCH_ERR("[VideoCore:EGLImage] failed to create context\n");
|
||||
@ -538,7 +531,7 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
|
||||
}
|
||||
|
||||
/* Test to make sure we can switch context. */
|
||||
result = eglMakeCurrent(vc->egl.dpy, vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
result = eglMakeCurrent(vc->egl.dpy, vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
if (result == EGL_FALSE)
|
||||
{
|
||||
RARCH_ERR("[VideoCore:EGLImage] failed to make context current\n");
|
||||
@ -548,7 +541,7 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
|
||||
gfx_ctx_vc_bind_api(NULL, vc_api, 0, 0);
|
||||
eglMakeCurrent(vc->egl.dpy, vc->egl.surf, vc->egl.surf, vc->egl.ctx);
|
||||
|
||||
vc->smooth = video->smooth;
|
||||
vc->smooth = video->smooth;
|
||||
return true;
|
||||
|
||||
fail:
|
||||
|
@ -52,8 +52,8 @@ static void vita_swap_interval(void *data, int interval)
|
||||
|
||||
static void vita_get_video_size(void *data, unsigned *width, unsigned *height)
|
||||
{
|
||||
*width = ATTR_VITA_WIDTH;
|
||||
*height = ATTR_VITA_HEIGHT;
|
||||
*width = ATTR_VITA_WIDTH;
|
||||
*height = ATTR_VITA_HEIGHT;
|
||||
}
|
||||
|
||||
static void vita_check_window(void *data, bool *quit,
|
||||
@ -65,12 +65,12 @@ static void vita_check_window(void *data, bool *quit,
|
||||
|
||||
if (new_width != *width || new_height != *height)
|
||||
{
|
||||
*width = new_width;
|
||||
*width = new_width;
|
||||
*height = new_height;
|
||||
*resize = true;
|
||||
}
|
||||
|
||||
*quit = (bool)false;
|
||||
*quit = (bool)false;
|
||||
}
|
||||
|
||||
static void vita_swap_buffers(void *data)
|
||||
@ -110,24 +110,20 @@ static bool vita_set_video_mode(void *data,
|
||||
{
|
||||
#if defined(HAVE_VITAGLES)
|
||||
/* Create an EGL rendering context */
|
||||
static const EGLint contextAttributeList[] = {
|
||||
static const EGLint
|
||||
ctx_attr_list[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
vita_ctx_data_t *ctx_vita = (vita_ctx_data_t *)data;
|
||||
|
||||
ctx_vita->width = ATTR_VITA_WIDTH;
|
||||
ctx_vita->height = ATTR_VITA_HEIGHT;
|
||||
|
||||
ctx_vita->native_window = VITA_WINDOW_960X544;
|
||||
|
||||
ctx_vita->refresh_rate = 60;
|
||||
ctx_vita->width = ATTR_VITA_WIDTH;
|
||||
ctx_vita->height = ATTR_VITA_HEIGHT;
|
||||
ctx_vita->native_window = VITA_WINDOW_960X544;
|
||||
ctx_vita->refresh_rate = 60;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_context(&ctx_vita->egl, contextAttributeList))
|
||||
if (!egl_create_context(&ctx_vita->egl, ctx_attr_list))
|
||||
goto error;
|
||||
|
||||
if (!egl_create_surface(&ctx_vita->egl, ctx_vita->native_window))
|
||||
goto error;
|
||||
#endif
|
||||
@ -178,9 +174,8 @@ static void vita_show_mouse(void *data, bool state) { }
|
||||
static void vita_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
#if defined(HAVE_VITAGLES)
|
||||
vita_ctx_data_t *ctx_vita = (vita_ctx_data_t *)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
vita_ctx_data_t *ctx_vita = (vita_ctx_data_t *)data;
|
||||
egl_bind_hw_render(&ctx_vita->egl, enable);
|
||||
#endif
|
||||
#endif
|
||||
@ -245,28 +240,17 @@ static uint32_t vita_get_flags(void *data)
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void vita_set_flags(void *data, uint32_t flags) { }
|
||||
|
||||
#if defined(HAVE_VITAGLES)
|
||||
static float vita_get_refresh_rate(void *data)
|
||||
{
|
||||
vita_ctx_data_t *ctx_vita = (vita_ctx_data_t *)data;
|
||||
|
||||
return ctx_vita->refresh_rate;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_VITAGLES)
|
||||
static gfx_ctx_proc_t vita_get_proc_address(const char *symbol)
|
||||
{
|
||||
gfx_ctx_proc_t ptr_sym = NULL;
|
||||
#ifdef HAVE_EGL
|
||||
ptr_sym = egl_get_proc_address(symbol);
|
||||
#endif
|
||||
return ptr_sym;
|
||||
}
|
||||
#endif
|
||||
|
||||
const gfx_ctx_driver_t vita_ctx = {
|
||||
vita_init,
|
||||
vita_destroy,
|
||||
@ -294,7 +278,7 @@ const gfx_ctx_driver_t vita_ctx = {
|
||||
vita_swap_buffers,
|
||||
vita_input_driver,
|
||||
#if defined(HAVE_VITAGLES)
|
||||
vita_get_proc_address,
|
||||
egl_get_proc_address,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
|
@ -122,12 +122,12 @@ static void gfx_ctx_vivante_check_window(void *data, bool *quit,
|
||||
|
||||
if (new_width != *width || new_height != *height)
|
||||
{
|
||||
*width = new_width;
|
||||
*height = new_height;
|
||||
*resize = true;
|
||||
*width = new_width;
|
||||
*height = new_height;
|
||||
*resize = true;
|
||||
}
|
||||
|
||||
*quit = (bool)frontend_driver_get_signal_handler_state();
|
||||
*quit = (bool)frontend_driver_get_signal_handler_state();
|
||||
}
|
||||
|
||||
static bool gfx_ctx_vivante_set_video_mode(void *data,
|
||||
@ -140,24 +140,22 @@ static bool gfx_ctx_vivante_set_video_mode(void *data,
|
||||
EGL_NONE
|
||||
};
|
||||
#endif
|
||||
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
|
||||
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
|
||||
|
||||
/* Pick some arbitrary default. */
|
||||
if (!width || !fullscreen)
|
||||
width = 1280;
|
||||
width = 1280;
|
||||
if (!height || !fullscreen)
|
||||
height = 1024;
|
||||
height = 1024;
|
||||
|
||||
viv->width = width;
|
||||
viv->height = height;
|
||||
viv->width = width;
|
||||
viv->height = height;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_context(&viv->egl, attribs))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
viv->native_window = fbCreateWindow(fbGetDisplayByIndex(0), 0, 0, 0, 0);
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_surface(&viv->egl, viv->native_window))
|
||||
goto error;
|
||||
@ -187,9 +185,7 @@ static enum gfx_ctx_api gfx_ctx_vivante_get_api(void *data)
|
||||
static bool gfx_ctx_vivante_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
if (api == GFX_CTX_OPENGL_ES_API)
|
||||
return true;
|
||||
return false;
|
||||
return (api == GFX_CTX_OPENGL_ES_API);
|
||||
}
|
||||
|
||||
static void gfx_ctx_vivante_set_flags(void *data, uint32_t flags) { }
|
||||
@ -198,27 +194,24 @@ static bool gfx_ctx_vivante_suppress_screensaver(void *data, bool enable) { retu
|
||||
|
||||
static void gfx_ctx_vivante_set_swap_interval(void *data, int swap_interval)
|
||||
{
|
||||
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
|
||||
egl_set_swap_interval(&viv->egl, swap_interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_vivante_swap_buffers(void *data)
|
||||
{
|
||||
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
|
||||
egl_swap_buffers(&viv->egl);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_vivante_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
|
||||
egl_bind_hw_render(&viv->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ static void gfx_ctx_w_vk_check_window(void *data, bool *quit,
|
||||
win32_check_window(NULL, quit, resize, width, height);
|
||||
|
||||
if (win32_vk.flags & VK_DATA_FLAG_NEED_NEW_SWAPCHAIN)
|
||||
*resize = true;
|
||||
*resize = true;
|
||||
|
||||
/* Trigger video driver init when changing refresh rate
|
||||
* in fullscreen while dimensions stay the same.
|
||||
@ -174,24 +174,24 @@ static void gfx_ctx_w_vk_update_title(void *data)
|
||||
static void gfx_ctx_w_vk_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
HWND window = win32_get_window();
|
||||
HWND window = win32_get_window();
|
||||
|
||||
if (!window)
|
||||
{
|
||||
RECT mon_rect;
|
||||
MONITORINFOEX current_mon;
|
||||
unsigned mon_id = 0;
|
||||
HMONITOR hm_to_use = NULL;
|
||||
unsigned mon_id = 0;
|
||||
HMONITOR hm_to_use = NULL;
|
||||
|
||||
win32_monitor_info(¤t_mon, &hm_to_use, &mon_id);
|
||||
mon_rect = current_mon.rcMonitor;
|
||||
*width = mon_rect.right - mon_rect.left;
|
||||
*height = mon_rect.bottom - mon_rect.top;
|
||||
mon_rect = current_mon.rcMonitor;
|
||||
*width = mon_rect.right - mon_rect.left;
|
||||
*height = mon_rect.bottom - mon_rect.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
*width = g_win32_resize_width;
|
||||
*height = g_win32_resize_height;
|
||||
*width = g_win32_resize_width;
|
||||
*height = g_win32_resize_height;
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,12 +322,7 @@ static void gfx_ctx_w_vk_input_driver(void *data,
|
||||
static enum gfx_ctx_api gfx_ctx_w_vk_get_api(void *data) { return GFX_CTX_VULKAN_API; }
|
||||
|
||||
static bool gfx_ctx_w_vk_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
if (api == GFX_CTX_VULKAN_API)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor) { return (api == GFX_CTX_VULKAN_API); }
|
||||
|
||||
static void gfx_ctx_w_vk_bind_hw_render(void *data, bool enable) { }
|
||||
|
||||
|
@ -116,13 +116,6 @@ static void gfx_ctx_wl_update_title(void *data)
|
||||
gfx_ctx_wl_update_title_common(wl);
|
||||
}
|
||||
|
||||
static bool gfx_ctx_wl_get_metrics(void *data,
|
||||
enum display_metric_types type, float *value)
|
||||
{
|
||||
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
|
||||
return gfx_ctx_wl_get_metrics_common(wl, type, value);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
static void
|
||||
libdecor_frame_handle_configure(struct libdecor_frame *frame,
|
||||
@ -258,9 +251,7 @@ static enum gfx_ctx_api gfx_ctx_wl_get_api(void *data)
|
||||
static bool gfx_ctx_wl_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
if (api == GFX_CTX_VULKAN_API)
|
||||
return true;
|
||||
return false;
|
||||
return (api == GFX_CTX_VULKAN_API);
|
||||
}
|
||||
|
||||
static void *gfx_ctx_wl_get_context_data(void *data)
|
||||
@ -287,11 +278,7 @@ static void gfx_ctx_wl_swap_buffers(void *data)
|
||||
flush_wayland_fd(&wl->input);
|
||||
}
|
||||
|
||||
static gfx_ctx_proc_t gfx_ctx_wl_get_proc_address(const char *symbol)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gfx_ctx_proc_t gfx_ctx_wl_get_proc_address(const char *symbol) { return NULL; }
|
||||
static void gfx_ctx_wl_bind_hw_render(void *data, bool enable) { }
|
||||
|
||||
static uint32_t gfx_ctx_wl_get_flags(void *data)
|
||||
@ -320,7 +307,7 @@ const gfx_ctx_driver_t gfx_ctx_vk_wayland = {
|
||||
NULL, /* get_video_output_size */
|
||||
NULL, /* get_video_output_prev */
|
||||
NULL, /* get_video_output_next */
|
||||
gfx_ctx_wl_get_metrics,
|
||||
gfx_ctx_wl_get_metrics_common,
|
||||
NULL,
|
||||
gfx_ctx_wl_update_title,
|
||||
gfx_ctx_wl_check_window,
|
||||
|
@ -117,21 +117,14 @@ typedef struct gfx_ctx_cgl_data
|
||||
|
||||
static gfx_ctx_proc_t gfx_ctx_wgl_get_proc_address(const char *symbol)
|
||||
{
|
||||
switch (win32_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
#if (defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE)) && !defined(HAVE_OPENGLES)
|
||||
{
|
||||
gfx_ctx_proc_t func = (gfx_ctx_proc_t)wglGetProcAddress(symbol);
|
||||
if (func)
|
||||
return func;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (win32_api == GFX_CTX_OPENGL_API)
|
||||
{
|
||||
gfx_ctx_proc_t func = (gfx_ctx_proc_t)wglGetProcAddress(symbol);
|
||||
if (func)
|
||||
return func;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef HAVE_DYLIB
|
||||
return (gfx_ctx_proc_t)GetProcAddress((HINSTANCE)dll_handle, symbol);
|
||||
#else
|
||||
@ -156,8 +149,7 @@ static bool wgl_has_extension(const char *extension, const char *extensions)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
where = strstr(start, extension);
|
||||
if (!where)
|
||||
if (!(where = strstr(start, extension)))
|
||||
break;
|
||||
|
||||
terminator = where + strlen(extension);
|
||||
@ -191,22 +183,21 @@ static void create_gl_context(HWND hwnd, bool *quit)
|
||||
}
|
||||
else
|
||||
{
|
||||
win32_hrc = wglCreateContext(win32_hdc);
|
||||
|
||||
win32_hrc = wglCreateContext(win32_hdc);
|
||||
/* We'll create shared context later if not. */
|
||||
if (win32_hrc && !core_context && !debug)
|
||||
{
|
||||
win32_hw_hrc = wglCreateContext(win32_hdc);
|
||||
win32_hw_hrc = wglCreateContext(win32_hdc);
|
||||
if (win32_hw_hrc)
|
||||
{
|
||||
if (!wglShareLists(win32_hrc, win32_hw_hrc))
|
||||
{
|
||||
RARCH_LOG("[WGL]: Failed to share contexts.\n");
|
||||
*quit = true;
|
||||
*quit = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
*quit = true;
|
||||
*quit = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,7 +210,7 @@ static void create_gl_context(HWND hwnd, bool *quit)
|
||||
}
|
||||
else
|
||||
{
|
||||
*quit = true;
|
||||
*quit = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -281,11 +272,11 @@ static void create_gl_context(HWND hwnd, bool *quit)
|
||||
int version_rows = gl_version_rows;
|
||||
int (*versions)[2] = gl_versions;
|
||||
|
||||
/* only try higher versions when core_context is true */
|
||||
/* Only try higher versions when core_context is true */
|
||||
if (!core_context)
|
||||
version_rows = 1;
|
||||
|
||||
/* try versions from highest down to requested version */
|
||||
/* Try versions from highest down to requested version */
|
||||
for (i = 0; i < version_rows; i++)
|
||||
{
|
||||
if (core_context)
|
||||
@ -320,7 +311,7 @@ static void create_gl_context(HWND hwnd, bool *quit)
|
||||
}
|
||||
}
|
||||
|
||||
/* found a suitable version that is high enough, we can stop now */
|
||||
/* Found a suitable version that is high enough, we can stop now */
|
||||
break;
|
||||
}
|
||||
else if (
|
||||
@ -345,12 +336,12 @@ static void create_gl_context(HWND hwnd, bool *quit)
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
const char *(WINAPI * wglGetExtensionsStringARB) (HDC) = 0;
|
||||
const char *extensions = NULL;
|
||||
wglGetExtensionsStringARB =
|
||||
(const char *(WINAPI *) (HDC))
|
||||
gfx_ctx_wgl_get_proc_address("wglGetExtensionsStringARB");
|
||||
|
||||
wglGetExtensionsStringARB = (const char *(WINAPI *) (HDC))
|
||||
gfx_ctx_wgl_get_proc_address("wglGetExtensionsStringARB");
|
||||
if (wglGetExtensionsStringARB)
|
||||
{
|
||||
extensions = wglGetExtensionsStringARB(win32_hdc);
|
||||
@ -442,8 +433,6 @@ void create_wgl_context(HWND hwnd, bool *quit)
|
||||
|
||||
static void gfx_ctx_wgl_swap_interval(void *data, int interval)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
switch (win32_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
@ -476,8 +465,6 @@ static void gfx_ctx_wgl_swap_interval(void *data, int interval)
|
||||
|
||||
static void gfx_ctx_wgl_swap_buffers(void *data)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
switch (win32_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
@ -617,6 +604,7 @@ static void *gfx_ctx_wgl_init(void *video_driver)
|
||||
WNDCLASSEX wndclass = {0};
|
||||
gfx_ctx_wgl_data_t *wgl = (gfx_ctx_wgl_data_t*)calloc(1, sizeof(*wgl));
|
||||
uint8_t win32_flags = win32_get_flags();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!wgl)
|
||||
return NULL;
|
||||
@ -635,28 +623,23 @@ static void *gfx_ctx_wgl_init(void *video_driver)
|
||||
win32_window_reset();
|
||||
win32_monitor_init();
|
||||
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
wndclass.lpfnWndProc = wnd_proc_wgl_common;
|
||||
wndclass.lpfnWndProc = wnd_proc_wgl_common;
|
||||
#ifdef HAVE_DINPUT
|
||||
if (string_is_equal(settings->arrays.input_driver, "dinput"))
|
||||
wndclass.lpfnWndProc = wnd_proc_wgl_dinput;
|
||||
if (string_is_equal(settings->arrays.input_driver, "dinput"))
|
||||
wndclass.lpfnWndProc = wnd_proc_wgl_dinput;
|
||||
#endif
|
||||
#ifdef HAVE_WINRAWINPUT
|
||||
if (string_is_equal(settings->arrays.input_driver, "raw"))
|
||||
wndclass.lpfnWndProc = wnd_proc_wgl_winraw;
|
||||
if (string_is_equal(settings->arrays.input_driver, "raw"))
|
||||
wndclass.lpfnWndProc = wnd_proc_wgl_winraw;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!win32_window_init(&wndclass, true, NULL))
|
||||
goto error;
|
||||
{
|
||||
free(wgl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wgl;
|
||||
|
||||
error:
|
||||
if (wgl)
|
||||
free(wgl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_wgl_set_video_mode(void *data,
|
||||
@ -666,25 +649,15 @@ static bool gfx_ctx_wgl_set_video_mode(void *data,
|
||||
if (!win32_set_video_mode(NULL, width, height, fullscreen))
|
||||
{
|
||||
RARCH_ERR("[WGL]: win32_set_video_mode failed.\n");
|
||||
goto error;
|
||||
gfx_ctx_wgl_destroy(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (win32_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
p_swap_interval = (BOOL (APIENTRY *)(int))gfx_ctx_wgl_get_proc_address("wglSwapIntervalEXT");
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (win32_api == GFX_CTX_OPENGL_API)
|
||||
p_swap_interval = (BOOL (APIENTRY *)(int))gfx_ctx_wgl_get_proc_address("wglSwapIntervalEXT");
|
||||
|
||||
gfx_ctx_wgl_swap_interval(data, win32_interval);
|
||||
return true;
|
||||
|
||||
error:
|
||||
gfx_ctx_wgl_destroy(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_wgl_input_driver(void *data,
|
||||
@ -718,16 +691,11 @@ static void gfx_ctx_wgl_input_driver(void *data,
|
||||
#endif
|
||||
}
|
||||
|
||||
static enum gfx_ctx_api gfx_ctx_wgl_get_api(void *data)
|
||||
{
|
||||
return win32_api;
|
||||
}
|
||||
static enum gfx_ctx_api gfx_ctx_wgl_get_api(void *data) { return win32_api; }
|
||||
|
||||
static bool gfx_ctx_wgl_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
win32_major = major;
|
||||
win32_minor = minor;
|
||||
win32_api = api;
|
||||
|
@ -139,7 +139,7 @@ static void gfx_ctx_x_vk_swap_interval(void *data, int interval)
|
||||
|
||||
if (x->interval != interval)
|
||||
{
|
||||
x->interval = interval;
|
||||
x->interval = interval;
|
||||
if (x->vk.swapchain)
|
||||
x->vk.flags |= VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
}
|
||||
@ -184,7 +184,8 @@ static bool gfx_ctx_x_vk_set_resize(void *data,
|
||||
* X11 loses focus on monitor/resolution swap and exits fullscreen.
|
||||
* Set window on top again to maintain both fullscreen and resolution.
|
||||
*/
|
||||
if (x->is_fullscreen) {
|
||||
if (x->is_fullscreen)
|
||||
{
|
||||
XMapRaised(g_x11_dpy, g_x11_win);
|
||||
RARCH_LOG("[X/Vulkan]: Resized fullscreen resolution to %dx%d.\n", width, height);
|
||||
}
|
||||
@ -194,7 +195,7 @@ static bool gfx_ctx_x_vk_set_resize(void *data,
|
||||
if (!vulkan_create_swapchain(&x->vk, width, height, x->interval))
|
||||
{
|
||||
RARCH_ERR("[X/Vulkan]: Failed to update swapchain.\n");
|
||||
x->vk.swapchain = VK_NULL_HANDLE;
|
||||
x->vk.swapchain = VK_NULL_HANDLE;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -210,7 +211,7 @@ static void *gfx_ctx_x_vk_init(void *data)
|
||||
int nelements = 0;
|
||||
int major = 0;
|
||||
int minor = 0;
|
||||
gfx_ctx_x_vk_data_t *x = (gfx_ctx_x_vk_data_t*)
|
||||
gfx_ctx_x_vk_data_t *x = (gfx_ctx_x_vk_data_t*)
|
||||
calloc(1, sizeof(gfx_ctx_x_vk_data_t));
|
||||
|
||||
if (!x)
|
||||
@ -275,19 +276,23 @@ static bool gfx_ctx_x_vk_set_video_mode(void *data,
|
||||
|
||||
memset(&vi_template, 0, sizeof(vi_template));
|
||||
vi_template.screen = DefaultScreen(g_x11_dpy);
|
||||
vi = XGetVisualInfo(g_x11_dpy, VisualScreenMask, &vi_template, &nvisuals);
|
||||
vi = XGetVisualInfo(g_x11_dpy, VisualScreenMask, &vi_template, &nvisuals);
|
||||
if (!vi || nvisuals < 1)
|
||||
goto error;
|
||||
}
|
||||
|
||||
swa.colormap = g_x11_cmap = XCreateColormap(g_x11_dpy,
|
||||
RootWindow(g_x11_dpy, vi->screen), vi->visual, AllocNone);
|
||||
swa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
|
||||
LeaveWindowMask | EnterWindowMask |
|
||||
ButtonReleaseMask | ButtonPressMask;
|
||||
swa.override_redirect = False;
|
||||
swa.event_mask = StructureNotifyMask
|
||||
| KeyPressMask
|
||||
| KeyReleaseMask
|
||||
| LeaveWindowMask
|
||||
| EnterWindowMask
|
||||
| ButtonReleaseMask
|
||||
| ButtonPressMask;
|
||||
swa.override_redirect = False;
|
||||
|
||||
x->is_fullscreen = fullscreen;
|
||||
x->is_fullscreen = fullscreen;
|
||||
|
||||
#ifdef HAVE_XF86VM
|
||||
if (fullscreen && !windowed_full)
|
||||
@ -519,26 +524,14 @@ static enum gfx_ctx_api gfx_ctx_x_vk_get_api(void *data)
|
||||
}
|
||||
|
||||
static bool gfx_ctx_x_vk_bind_api(void *data, enum gfx_ctx_api api,
|
||||
unsigned major, unsigned minor)
|
||||
{
|
||||
if (api == GFX_CTX_VULKAN_API)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
unsigned major, unsigned minor) { return (api == GFX_CTX_VULKAN_API); }
|
||||
|
||||
static void gfx_ctx_x_vk_show_mouse(void *data, bool state)
|
||||
{
|
||||
x11_show_mouse(g_x11_dpy, g_x11_win, state);
|
||||
}
|
||||
|
||||
static void gfx_ctx_x_vk_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
gfx_ctx_x_vk_data_t *x = (gfx_ctx_x_vk_data_t*)data;
|
||||
|
||||
if (!x)
|
||||
return;
|
||||
}
|
||||
static void gfx_ctx_x_vk_bind_hw_render(void *data, bool enable) { }
|
||||
|
||||
static void *gfx_ctx_x_vk_get_context_data(void *data)
|
||||
{
|
||||
@ -548,7 +541,7 @@ static void *gfx_ctx_x_vk_get_context_data(void *data)
|
||||
|
||||
static uint32_t gfx_ctx_x_vk_get_flags(void *data)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
uint32_t flags = 0;
|
||||
gfx_ctx_x_vk_data_t *x = (gfx_ctx_x_vk_data_t*)data;
|
||||
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
|
@ -107,13 +107,13 @@ EGL_DEPTH_SIZE, 0
|
||||
static void *gfx_ctx_xegl_init(void *video_driver)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
static const EGLint egl_attribs_gl[] = {
|
||||
static const EGLint egl_attribs_gl[] = {
|
||||
XEGL_ATTRIBS_BASE,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
||||
static const EGLint egl_attribs_gles[] = {
|
||||
static const EGLint egl_attribs_gles[] = {
|
||||
XEGL_ATTRIBS_BASE,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_NONE,
|
||||
@ -127,25 +127,24 @@ static void *gfx_ctx_xegl_init(void *video_driver)
|
||||
};
|
||||
#endif
|
||||
#ifdef HAVE_VG
|
||||
static const EGLint egl_attribs_vg[] = {
|
||||
static const EGLint egl_attribs_vg[] = {
|
||||
XEGL_ATTRIBS_BASE,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
|
||||
EGL_NONE,
|
||||
};
|
||||
#endif
|
||||
const EGLint *attrib_ptr = NULL;
|
||||
EGLint major, minor;
|
||||
EGLint n;
|
||||
EGLint major, minor;
|
||||
const EGLint *attrib_ptr = NULL;
|
||||
#endif
|
||||
xegl_ctx_data_t *xegl;
|
||||
xegl_ctx_data_t *xegl = NULL;
|
||||
|
||||
if (g_egl_inited)
|
||||
return NULL;
|
||||
|
||||
XInitThreads();
|
||||
|
||||
xegl = (xegl_ctx_data_t*)calloc(1, sizeof(xegl_ctx_data_t));
|
||||
if (!xegl)
|
||||
if (!(xegl = (xegl_ctx_data_t*)calloc(1, sizeof(xegl_ctx_data_t))))
|
||||
return NULL;
|
||||
|
||||
switch (xegl_api)
|
||||
@ -175,7 +174,8 @@ static void *gfx_ctx_xegl_init(void *video_driver)
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_init_context(&xegl->egl, EGL_PLATFORM_X11_KHR,
|
||||
(EGLNativeDisplayType)g_x11_dpy, &major, &minor, &n, attrib_ptr, egl_default_accept_config_cb))
|
||||
(EGLNativeDisplayType)g_x11_dpy, &major, &minor, &n,
|
||||
attrib_ptr, egl_default_accept_config_cb))
|
||||
{
|
||||
egl_report_error();
|
||||
goto error;
|
||||
@ -199,21 +199,23 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
|
||||
#ifdef EGL_KHR_create_context
|
||||
case GFX_CTX_OPENGL_API:
|
||||
{
|
||||
unsigned version = xegl->egl.major * 1000 + xegl->egl.minor;
|
||||
bool core = version >= 3001;
|
||||
unsigned
|
||||
version = xegl->egl.major * 1000 + xegl->egl.minor;
|
||||
bool core = version >= 3001;
|
||||
#ifdef GL_DEBUG
|
||||
bool debug = true;
|
||||
bool debug = true;
|
||||
#else
|
||||
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
|
||||
bool debug = hwr->debug_context;
|
||||
struct retro_hw_render_callback
|
||||
*hwr = video_driver_get_hw_context();
|
||||
bool debug = hwr->debug_context;
|
||||
#endif
|
||||
|
||||
if (core)
|
||||
{
|
||||
*attr++ = EGL_CONTEXT_MAJOR_VERSION_KHR;
|
||||
*attr++ = xegl->egl.major;
|
||||
*attr++ = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
*attr++ = xegl->egl.minor;
|
||||
*attr++ = EGL_CONTEXT_MAJOR_VERSION_KHR;
|
||||
*attr++ = xegl->egl.major;
|
||||
*attr++ = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
*attr++ = xegl->egl.minor;
|
||||
|
||||
/* Technically, we don't have core/compat until 3.2.
|
||||
* Version 3.1 is either compat or not depending
|
||||
@ -228,8 +230,8 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
|
||||
|
||||
if (debug)
|
||||
{
|
||||
*attr++ = EGL_CONTEXT_FLAGS_KHR;
|
||||
*attr++ = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
*attr++ = EGL_CONTEXT_FLAGS_KHR;
|
||||
*attr++ = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -238,13 +240,13 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
|
||||
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
/* Same as EGL_CONTEXT_MAJOR_VERSION. */
|
||||
*attr++ = EGL_CONTEXT_CLIENT_VERSION;
|
||||
*attr++ = xegl->egl.major ? (EGLint)xegl->egl.major : 2;
|
||||
*attr++ = EGL_CONTEXT_CLIENT_VERSION;
|
||||
*attr++ = xegl->egl.major ? (EGLint)xegl->egl.major : 2;
|
||||
#ifdef EGL_KHR_create_context
|
||||
if (xegl->egl.minor > 0)
|
||||
{
|
||||
*attr++ = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
*attr++ = xegl->egl.minor;
|
||||
*attr++ = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
*attr++ = xegl->egl.minor;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -253,7 +255,7 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
|
||||
break;
|
||||
}
|
||||
|
||||
*attr = EGL_NONE;
|
||||
*attr = EGL_NONE;
|
||||
return attr;
|
||||
}
|
||||
|
||||
@ -267,55 +269,58 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
XEvent event;
|
||||
EGLint egl_attribs[16];
|
||||
EGLint vid, num_visuals;
|
||||
EGLint *attr = NULL;
|
||||
EGLint *attr = NULL;
|
||||
#ifdef HAVE_XF86VM
|
||||
bool true_full = false;
|
||||
bool true_full = false;
|
||||
#endif
|
||||
int x_off = 0;
|
||||
int y_off = 0;
|
||||
XVisualInfo temp = {0};
|
||||
XSetWindowAttributes swa = {0};
|
||||
XVisualInfo *vi = NULL;
|
||||
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool video_disable_composition = settings->bools.video_disable_composition;
|
||||
bool windowed_fullscreen = settings->bools.video_windowed_fullscreen;
|
||||
unsigned video_monitor_index = settings->uints.video_monitor_index;
|
||||
int x_off = 0;
|
||||
int y_off = 0;
|
||||
XVisualInfo temp = {0};
|
||||
XSetWindowAttributes swa = {0};
|
||||
XVisualInfo *vi = NULL;
|
||||
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool video_disable_composition = settings->bools.video_disable_composition;
|
||||
bool windowed_fullscreen = settings->bools.video_windowed_fullscreen;
|
||||
unsigned video_monitor_index = settings->uints.video_monitor_index;
|
||||
|
||||
int (*old_handler)(Display*, XErrorEvent*) = NULL;
|
||||
|
||||
frontend_driver_install_signal_handler();
|
||||
|
||||
attr = egl_attribs;
|
||||
attr = xegl_fill_attribs(xegl, attr);
|
||||
attr = egl_attribs;
|
||||
attr = xegl_fill_attribs(xegl, attr);
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_get_native_visual_id(&xegl->egl, &vid))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
temp.visualid = vid;
|
||||
temp.visualid = vid;
|
||||
|
||||
vi = XGetVisualInfo(g_x11_dpy, VisualIDMask, &temp, &num_visuals);
|
||||
if (!vi)
|
||||
if (!(vi = XGetVisualInfo(g_x11_dpy, VisualIDMask, &temp, &num_visuals)))
|
||||
goto error;
|
||||
|
||||
swa.colormap = g_x11_cmap = XCreateColormap(
|
||||
g_x11_dpy, RootWindow(g_x11_dpy, vi->screen),
|
||||
vi->visual, AllocNone);
|
||||
swa.event_mask = StructureNotifyMask | KeyPressMask |
|
||||
ButtonPressMask | ButtonReleaseMask | KeyReleaseMask |
|
||||
EnterWindowMask | LeaveWindowMask;
|
||||
swa.override_redirect = False;
|
||||
swa.colormap = g_x11_cmap = XCreateColormap(
|
||||
g_x11_dpy, RootWindow(g_x11_dpy, vi->screen),
|
||||
vi->visual, AllocNone);
|
||||
swa.event_mask = StructureNotifyMask
|
||||
| KeyPressMask
|
||||
| ButtonPressMask
|
||||
| ButtonReleaseMask
|
||||
| KeyReleaseMask
|
||||
| EnterWindowMask
|
||||
| LeaveWindowMask;
|
||||
swa.override_redirect = False;
|
||||
|
||||
#ifdef HAVE_XF86VM
|
||||
if (fullscreen && !windowed_fullscreen)
|
||||
{
|
||||
if (x11_enter_fullscreen(g_x11_dpy, width, height))
|
||||
{
|
||||
char *wm_name = x11_get_wm_name(g_x11_dpy);
|
||||
xegl->should_reset_mode = true;
|
||||
true_full = true;
|
||||
char *wm_name = x11_get_wm_name(g_x11_dpy);
|
||||
xegl->should_reset_mode = true;
|
||||
true_full = true;
|
||||
|
||||
if (wm_name)
|
||||
{
|
||||
@ -329,7 +334,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
free(wm_name);
|
||||
}
|
||||
if (!x11_has_net_wm_fullscreen(g_x11_dpy))
|
||||
swa.override_redirect = True;
|
||||
swa.override_redirect = True;
|
||||
}
|
||||
else
|
||||
RARCH_ERR("[X/EGL]: Entering true fullscreen failed. Will attempt windowed mode.\n");
|
||||
@ -338,13 +343,13 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
|
||||
|
||||
if (video_monitor_index)
|
||||
g_x11_screen = video_monitor_index - 1;
|
||||
g_x11_screen = video_monitor_index - 1;
|
||||
|
||||
#ifdef HAVE_XINERAMA
|
||||
if (fullscreen || g_x11_screen != 0)
|
||||
{
|
||||
unsigned new_width = width;
|
||||
unsigned new_height = height;
|
||||
unsigned new_width = width;
|
||||
unsigned new_height = height;
|
||||
|
||||
if (xinerama_get_coord(g_x11_dpy, g_x11_screen,
|
||||
&x_off, &y_off, &new_width, &new_height))
|
||||
@ -354,8 +359,8 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
width = new_width;
|
||||
height = new_height;
|
||||
width = new_width;
|
||||
height = new_height;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -372,9 +377,9 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
|
||||
if (fullscreen && video_disable_composition)
|
||||
{
|
||||
uint32_t value = 1;
|
||||
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);
|
||||
Atom net_wm_bypass_compositor = XInternAtom(g_x11_dpy, "_NET_WM_BYPASS_COMPOSITOR", False);
|
||||
uint32_t value = 1;
|
||||
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);
|
||||
Atom net_wm_bypass_compositor = XInternAtom(g_x11_dpy, "_NET_WM_BYPASS_COMPOSITOR", False);
|
||||
|
||||
RARCH_LOG("[X/EGL]: Requesting compositor bypass.\n");
|
||||
XChangeProperty(g_x11_dpy, g_x11_win, net_wm_bypass_compositor, cardinal, 32, PropModeReplace, (const unsigned char*)&value, 1);
|
||||
@ -538,18 +543,16 @@ static void gfx_ctx_xegl_swap_buffers(void *data)
|
||||
|
||||
static void gfx_ctx_xegl_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
|
||||
egl_bind_hw_render(&xegl->egl, enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_xegl_set_swap_interval(void *data, int swap_interval)
|
||||
{
|
||||
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
|
||||
egl_set_swap_interval(&xegl->egl, swap_interval);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user