mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 15:32:59 +00:00
(DRM) Cleanups
This commit is contained in:
parent
f707994cb8
commit
014d0fafb4
@ -235,18 +235,9 @@ static void gfx_ctx_drm_swap_buffers(void *data)
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned max_swapchain_images = settings->uints.video_max_swapchain_images;
|
||||
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
egl_swap_buffers(&drm->egl);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* I guess we have to wait for flip to have taken
|
||||
* place before another flip can be queued up.
|
||||
@ -316,19 +307,9 @@ static void gfx_ctx_drm_destroy_resources(gfx_ctx_drm_data_t *drm)
|
||||
/* Make sure we acknowledge all page-flips. */
|
||||
gfx_ctx_drm_wait_flip(true);
|
||||
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
egl_destroy(&drm->egl);
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
free_drm_resources(drm);
|
||||
|
||||
@ -600,11 +581,6 @@ static bool gfx_ctx_drm_egl_set_video_mode(gfx_ctx_drm_data_t *drm)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_init_context(&drm->egl, EGL_PLATFORM_GBM_KHR,
|
||||
(EGLNativeDisplayType)g_gbm_dev, &major,
|
||||
@ -624,11 +600,6 @@ static bool gfx_ctx_drm_egl_set_video_mode(gfx_ctx_drm_data_t *drm)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
egl_swap_buffers(drm);
|
||||
|
||||
@ -720,20 +691,10 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
|
||||
goto error;
|
||||
}
|
||||
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
if (!gfx_ctx_drm_egl_set_video_mode(drm))
|
||||
goto error;
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_bo = gbm_surface_lock_front_buffer(g_gbm_surface);
|
||||
|
||||
@ -865,39 +826,20 @@ static bool gfx_ctx_drm_bind_api(void *video_driver,
|
||||
|
||||
static gfx_ctx_proc_t gfx_ctx_drm_get_proc_address(const char *symbol)
|
||||
{
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
return egl_get_proc_address(symbol);
|
||||
#endif
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gfx_ctx_drm_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
|
||||
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
egl_bind_hw_render(&drm->egl, enable);
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t gfx_ctx_drm_get_flags(void *data)
|
||||
|
@ -117,20 +117,11 @@ static void gfx_ctx_go2_drm_input_driver(void *data,
|
||||
|
||||
static gfx_ctx_proc_t gfx_ctx_go2_drm_get_proc_address(const char *symbol)
|
||||
{
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
return egl_get_proc_address(symbol);
|
||||
#endif
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void *gfx_ctx_go2_drm_init(void *video_driver)
|
||||
@ -227,8 +218,10 @@ static bool gfx_ctx_go2_drm_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct retro_system_av_info *av_info = NULL;
|
||||
gfx_ctx_go2_drm_data_t *drm = (gfx_ctx_go2_drm_data_t*)data;
|
||||
bool use_ctx_scaling = settings->bools.video_ctx_scaling;
|
||||
|
||||
if (!drm)
|
||||
return false;
|
||||
@ -237,9 +230,6 @@ static bool gfx_ctx_go2_drm_set_video_mode(void *data,
|
||||
|
||||
frontend_driver_install_signal_handler();
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool use_ctx_scaling = settings->bools.video_ctx_scaling;
|
||||
|
||||
if (use_ctx_scaling && !menu_driver_is_alive())
|
||||
{
|
||||
drm->fb_width = av_info->geometry.base_width;
|
||||
@ -266,7 +256,8 @@ static bool gfx_ctx_go2_drm_set_video_mode(void *data,
|
||||
drm->ctx_w = MAX(av_info->geometry.max_width, native_width);
|
||||
drm->ctx_h = MAX(av_info->geometry.max_height, native_height);
|
||||
|
||||
drm->context = go2_context_create(drm->display, drm->ctx_w, drm->ctx_h, &attr);
|
||||
drm->context = go2_context_create(
|
||||
drm->display, drm->ctx_w, drm->ctx_h, &attr);
|
||||
}
|
||||
|
||||
go2_context_make_current(drm->context);
|
||||
@ -314,7 +305,8 @@ static bool gfx_ctx_go2_drm_suppress_screensaver(void *data, bool enable) { retu
|
||||
|
||||
static void gfx_ctx_go2_drm_swap_buffers(void *data)
|
||||
{
|
||||
gfx_ctx_go2_drm_data_t *drm = (gfx_ctx_go2_drm_data_t*)data;
|
||||
gfx_ctx_go2_drm_data_t
|
||||
*drm = (gfx_ctx_go2_drm_data_t*)data;
|
||||
|
||||
int out_w = native_width;
|
||||
int out_h = native_height;
|
||||
@ -335,11 +327,6 @@ static void gfx_ctx_go2_drm_swap_buffers(void *data)
|
||||
out_x = 0;
|
||||
}
|
||||
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
go2_context_swap_buffers(drm->context);
|
||||
|
||||
@ -351,11 +338,6 @@ static void gfx_ctx_go2_drm_swap_buffers(void *data)
|
||||
GO2_ROTATION_DEGREES_270, 2);
|
||||
go2_context_surface_unlock(drm->context, surface);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
printf("unhandled gfx_ctx_go2_drm_swap_buffers\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t gfx_ctx_go2_drm_get_flags(void *data)
|
||||
@ -391,19 +373,9 @@ 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;
|
||||
|
||||
switch (drm_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_EGL
|
||||
egl_bind_hw_render(&drm->egl, enable);
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const gfx_ctx_driver_t gfx_ctx_go2_drm = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user