static void gfx_ctx_xegl_destroy(void *data) { xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data; x11_input_ctx_destroy(); #ifdef HAVE_EGL egl_destroy(&xegl->egl); #endif if (g_x11_win) { #ifdef HAVE_XINERAMA /* Save last used monitor for later. */ xinerama_save_last_used_monitor(RootWindow( g_x11_dpy, DefaultScreen(g_x11_dpy))); #endif x11_window_destroy(false); } x11_colormap_destroy(); if (xegl->should_reset_mode) { x11_exit_fullscreen(g_x11_dpy); xegl->should_reset_mode = false; } free(data); /* Do not close g_x11_dpy. We'll keep one for the entire application * lifecycle to work-around nVidia EGL limitations. */ }
static void gfx_ctx_x_destroy_resources(gfx_ctx_x_data_t *x) { x11_input_ctx_destroy(); if (g_x11_dpy) { switch (x_api) { case GFX_CTX_OPENGL_API: case GFX_CTX_OPENGL_ES_API: #ifdef HAVE_OPENGL if (x->g_ctx) { if (x->swap_mode) glXSwapBuffersMscOML(g_x11_dpy, x->g_glx_win, 0, x->divisor, x->remainder); else glXSwapBuffers(g_x11_dpy, x->g_glx_win); glFinish(); glXMakeContextCurrent(g_x11_dpy, None, None, NULL); if (!video_driver_is_video_cache_context()) { if (x->g_hw_ctx) glXDestroyContext(g_x11_dpy, x->g_hw_ctx); if (x->g_ctx) glXDestroyContext(g_x11_dpy, x->g_ctx); x->g_ctx = NULL; x->g_hw_ctx = NULL; } } if (g_x11_win) { if (x->g_glx_win) glXDestroyWindow(g_x11_dpy, x->g_glx_win); x->g_glx_win = 0; } #endif break; case GFX_CTX_VULKAN_API: #ifdef HAVE_VULKAN vulkan_context_destroy(&x->vk, g_x11_win != 0); #endif break; case GFX_CTX_NONE: default: break; } } if (g_x11_win && g_x11_dpy) { #ifdef HAVE_XINERAMA /* Save last used monitor for later. */ xinerama_save_last_used_monitor(DefaultRootWindow(g_x11_dpy)); #endif x11_window_destroy(false); } x11_colormap_destroy(); if (g_x11_dpy) { if (x->g_should_reset_mode) { x11_exit_fullscreen(g_x11_dpy); x->g_should_reset_mode = false; } if (!video_driver_is_video_cache_context()) { XCloseDisplay(g_x11_dpy); g_x11_dpy = NULL; } } #ifdef HAVE_OPENGL g_pglSwapInterval = NULL; g_pglSwapIntervalSGI = NULL; g_pglSwapIntervalEXT = NULL; #endif g_major = 0; g_minor = 0; x->g_core_es = false; }