mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 13:20:52 +00:00
Create egl_init_context
This commit is contained in:
parent
7cee03af72
commit
ad260fcb7b
@ -173,11 +173,32 @@ static void egl_sighandler(int sig)
|
||||
|
||||
void egl_install_sighandlers(void)
|
||||
{
|
||||
struct sigaction sa = {{0}};
|
||||
struct sigaction sa;
|
||||
|
||||
sa.sa_handler = egl_sighandler;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sa.sa_sigaction = NULL;
|
||||
sa.sa_handler = egl_sighandler;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
}
|
||||
|
||||
bool egl_init_context(NativeDisplayType display,
|
||||
EGLint *major, EGLint *minor,
|
||||
EGLint *n, const EGLint *attrib_ptr)
|
||||
{
|
||||
g_egl_dpy = eglGetDisplay(display);
|
||||
if (!g_egl_dpy)
|
||||
{
|
||||
RARCH_ERR("[KMS/EGL]: Couldn't get EGL display.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!eglInitialize(g_egl_dpy, major, minor))
|
||||
return false;
|
||||
|
||||
if (!eglChooseConfig(g_egl_dpy, attrib_ptr, &g_egl_config, 1, n) || *n != 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -51,4 +51,8 @@ void egl_get_video_size(void *data, unsigned *width, unsigned *height);
|
||||
|
||||
void egl_install_sighandlers(void);
|
||||
|
||||
bool egl_init_context(NativeDisplayType display,
|
||||
EGLint *major, EGLint *minor,
|
||||
EGLint *n, const EGLint *attrib_ptr);
|
||||
|
||||
#endif
|
||||
|
@ -722,17 +722,8 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data,
|
||||
goto error;
|
||||
}
|
||||
|
||||
g_egl_dpy = eglGetDisplay((EGLNativeDisplayType)drm->g_gbm_dev);
|
||||
if (!g_egl_dpy)
|
||||
{
|
||||
RARCH_ERR("[KMS/EGL]: Couldn't get EGL display.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!eglInitialize(g_egl_dpy, &major, &minor))
|
||||
goto error;
|
||||
|
||||
if (!eglChooseConfig(g_egl_dpy, attrib_ptr, &g_egl_config, 1, &n) || n != 1)
|
||||
if (!egl_init_context((EGLNativeDisplayType)drm->g_gbm_dev, &major,
|
||||
&minor, &n, attrib_ptr))
|
||||
goto error;
|
||||
|
||||
attr = egl_fill_attribs(egl_attribs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user