static void engine_term_display(struct engine* engine) { if (engine->display != EGL_NO_DISPLAY) { eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (engine->context != EGL_NO_CONTEXT) { eglDestroyContext(engine->display, engine->context); } if (engine->surface != EGL_NO_SURFACE) { eglDestroySurface(engine->display, engine->surface); } eglTerminate(engine->display); } engine->animating = 0; engine->display = EGL_NO_DISPLAY; engine->context = EGL_NO_CONTEXT; engine->surface = EGL_NO_SURFACE; renderer_destroy_callback(); }
void EglManager::destroy() { if (mEglDisplay == EGL_NO_DISPLAY) return; usePBufferSurface(); if (Caches::hasInstance()) { Caches::getInstance().terminate(); } mRenderThread.renderState().onGLContextDestroyed(); TIME_LOG("eglDestroyContext", eglDestroyContext(mEglDisplay, mEglContext)); EGL_LOGD("Destroyed EGL context (%p)", mEglContext); TIME_LOG("eglDestroySurface", eglDestroySurface(mEglDisplay, mPBufferSurface)); TIME_LOG("eglMakeCurrent", eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)); TIME_LOG("eglTerminate", eglTerminate(mEglDisplay)); EGL_LOGD("Terminated EGL display (%p)", mEglDisplay); TIME_LOG("eglReleaseThread", eglReleaseThread()); mEglDisplay = EGL_NO_DISPLAY; mEglContext = EGL_NO_CONTEXT; mPBufferSurface = EGL_NO_SURFACE; mCurrentSurface = EGL_NO_SURFACE; }
int main () { display = wl_display_connect (NULL); struct wl_registry *registry = wl_display_get_registry (display); wl_registry_add_listener (registry, ®istry_listener, NULL); wl_display_roundtrip (display); egl_display = eglGetDisplay (display); eglInitialize (egl_display, NULL, NULL); struct window window; create_window (&window, WIDTH, HEIGHT); while (running) { wl_display_dispatch_pending (display); draw_window (&window); } delete_window (&window); eglTerminate (egl_display); wl_display_disconnect (display); return 0; }
static void drm_egl_uninit(MPGLContext *ctx) { struct priv *p = ctx->priv; crtc_release(ctx); if (p->vt_switcher_active) vt_switcher_destroy(&p->vt_switcher); eglMakeCurrent(p->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroyContext(p->egl.display, p->egl.context); eglDestroySurface(p->egl.display, p->egl.surface); gbm_surface_destroy(p->gbm.surface); eglTerminate(p->egl.display); gbm_device_destroy(p->gbm.device); p->egl.context = EGL_NO_CONTEXT; eglDestroyContext(p->egl.display, p->egl.context); if (p->kms) { kms_destroy(p->kms); p->kms = 0; } }
static void exit_func(void) // Function to be passed to atexit(). { if (eglImage != 0) { if (!eglDestroyImageKHR(state->display, (EGLImageKHR) eglImage)) printf("eglDestroyImageKHR failed."); } // clear screen glClear( GL_COLOR_BUFFER_BIT ); eglSwapBuffers(state->display, state->surface); // Release OpenGL resources eglMakeCurrent( state->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); eglDestroySurface( state->display, state->surface ); eglDestroyContext( state->display, state->context ); eglTerminate( state->display ); printf("\ncube closed\n"); } // exit_func()
static DFBResult system_leave( bool emergency ) { DFBResult ret; AndroidDataShared *shared; D_ASSERT( m_data != NULL ); shared = m_data->shared; D_ASSERT( shared != NULL ); dfb_surface_pool_leave( shared->pool ); /* cleanup EGL related stuff */ eglDestroyContext( m_data->dpy, m_data->ctx ); eglTerminate( m_data->dpy ); D_FREE( m_data ); m_data = NULL; return DFB_OK; }
void gl_terminate(screen_window_t *screen_win) { // Borrowed from bbutil.c // EGL cleanup if (egl_disp != EGL_NO_DISPLAY) { eglMakeCurrent(egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (egl_surf != EGL_NO_SURFACE) { eglDestroySurface(egl_disp, egl_surf); egl_surf = EGL_NO_SURFACE; } if (egl_ctx != EGL_NO_CONTEXT) { eglDestroyContext(egl_disp, egl_ctx); egl_ctx = EGL_NO_CONTEXT; } if (screen_win != NULL) { screen_destroy_window(*screen_win); screen_win = NULL; } eglTerminate(egl_disp); egl_disp = EGL_NO_DISPLAY; } eglReleaseThread(); }
QOpenWFDDevice::~QOpenWFDDevice() { delete mEventSocketNotifier; wfdDestroyEvent(mDevice,mEvent); for (int i = 0; i < mPorts.size(); i++) { //probably don't need to remove them from the list QList <WFDint> keys = mUsedPipelines.keys(mPorts.at(i)); for (int keyIndex = 0; keyIndex < keys.size(); keyIndex++) { mUsedPipelines.remove(keys.at(keyIndex)); } //but we have to delete them :) delete mPorts[i]; } eglDestroyContext(mEglDisplay,mEglContext); eglTerminate(mEglDisplay); gbm_device_destroy(mGbmDevice); wfdDestroyDevice(mDevice); }
void closeOpenGL() { if (!is_initialized) return; EGLDisplay eglDpy = eglGetCurrentDisplay(); if( eglDpy==EGL_NO_DISPLAY ) return; // get current context EGLContext eglCtx = eglGetCurrentContext(); // release context eglMakeCurrent(eglDpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); // destroy context if valid if( eglCtx!=EGL_NO_CONTEXT ) eglDestroyContext(eglDpy, eglCtx); // terminate display eglTerminate(eglDpy); }
void IJK_EGL_terminate(IJK_EGL* egl) { if (!IJK_EGL_isValid(egl)) return; if (egl->opaque) IJK_GLES2_Renderer_freeP(&egl->opaque->renderer); if (egl->display) { eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (egl->context) eglDestroyContext(egl->display, egl->context); if (egl->surface) eglDestroySurface(egl->display, egl->surface); eglTerminate(egl->display); eglReleaseThread(); // FIXME: call at thread exit } egl->context = EGL_NO_CONTEXT; egl->surface = EGL_NO_SURFACE; egl->display = EGL_NO_DISPLAY; }
static void _DestroyThreadData( gcsTLS_PTR TLS ) { gcmHEADER_ARG("TLS=0x%x", TLS); if (TLS->context != gcvNULL) { /*VEGLThreadData thread;*/ VEGLDisplay head; /*thread = (VEGLThreadData) TLS->context;*/ head = (VEGLDisplay) gcoOS_GetPLSValue(gcePLS_VALUE_EGL_DISPLAY_INFO); while (head != EGL_NO_DISPLAY) { VEGLDisplay display = head; if (display->ownerThread == gcoOS_GetCurrentThreadID()) { /* This thread has not eglTerminated the display.*/ eglTerminate(display); } head = display->next; if (TLS->ProcessExiting) { gcmVERIFY_OK(gcmOS_SAFE_FREE(gcvNULL, display)); gcoOS_SetPLSValue(gcePLS_VALUE_EGL_DISPLAY_INFO, (gctPOINTER) head); } } TLS->context = gcvNULL; } gcmFOOTER_NO(); }
void eng_window_free(Outbuf *gw) { int ref = 0; if (!gw) return; win_count--; eng_window_use(gw); if (gw == _evas_gl_wl_window) _evas_gl_wl_window = NULL; if (gw->gl_context) { ref = gw->gl_context->references - 1; glsym_evas_gl_common_context_free(gw->gl_context); } eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (gw->egl_context != context) eglDestroyContext(gw->egl_disp, gw->egl_context); if (gw->egl_surface != EGL_NO_SURFACE) eglDestroySurface(gw->egl_disp, gw->egl_surface); if (gw->win) wl_egl_window_destroy(gw->win); if (ref == 0) { if (context) eglDestroyContext(gw->egl_disp, context); eglTerminate(gw->egl_disp); eglReleaseThread(); context = EGL_NO_CONTEXT; } free(gw); }
void GLContext::Terminate() { if( display_ != EGL_NO_DISPLAY ) { eglMakeCurrent( display_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); if( context_ != EGL_NO_CONTEXT ) { eglDestroyContext( display_, context_ ); } if( surface_ != EGL_NO_SURFACE ) { eglDestroySurface( display_, surface_ ); } eglTerminate( display_ ); } display_ = EGL_NO_DISPLAY; context_ = EGL_NO_CONTEXT; surface_ = EGL_NO_SURFACE; context_valid_ = false; }
static void gdk_wayland_display_dispose (GObject *object) { GdkDisplayWayland *display_wayland = GDK_DISPLAY_WAYLAND (object); _gdk_wayland_display_manager_remove_display (gdk_display_manager_get (), GDK_DISPLAY (display_wayland)); g_list_foreach (display_wayland->input_devices, (GFunc) g_object_run_dispose, NULL); _gdk_screen_close (display_wayland->screen); if (display_wayland->event_source) { g_source_destroy (display_wayland->event_source); g_source_unref (display_wayland->event_source); display_wayland->event_source = NULL; } eglTerminate(display_wayland->egl_display); G_OBJECT_CLASS (_gdk_display_wayland_parent_class)->dispose (object); }
// Tear down the EGL context currently associated with the display. static void engine_term_display(struct engine* engine) { glDeleteTextures(1, &g_img); if (engine->display != EGL_NO_DISPLAY) { eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (engine->context != EGL_NO_CONTEXT) { eglDestroyContext(engine->display, engine->context); } if (engine->surface != EGL_NO_SURFACE) { eglDestroySurface(engine->display, engine->surface); } eglTerminate(engine->display); } engine->animating = 0; engine->display = EGL_NO_DISPLAY; engine->context = EGL_NO_CONTEXT; engine->surface = EGL_NO_SURFACE; }
// EGL情報を破棄する static void engine_term_display(struct engine* engine) { if (engine->display != EGL_NO_DISPLAY) { // EGLレンダリングコンテキストとEGLサーフェイスの関連を外す eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); // EGLレンダリングコンテキストを破棄する if (engine->context != EGL_NO_CONTEXT) eglDestroyContext(engine->display, engine->context); // EGLサーフェイスを破棄する if (engine->surface != EGL_NO_SURFACE) eglDestroySurface(engine->display, engine->surface); // EGLディスプレイを破棄する eglTerminate(engine->display); } // アニメーション停止 engine->animating = 0; // EGL関連データを破棄 engine->display = EGL_NO_DISPLAY; engine->context = EGL_NO_CONTEXT; engine->surface = EGL_NO_SURFACE; }
SkOSWindow::~SkOSWindow() { #if SK_SUPPORT_GPU if (NULL != fHGLRC) { wglDeleteContext((HGLRC)fHGLRC); } #if SK_ANGLE if (EGL_NO_CONTEXT != fContext) { eglDestroyContext(fDisplay, fContext); fContext = EGL_NO_CONTEXT; } if (EGL_NO_SURFACE != fSurface) { eglDestroySurface(fDisplay, fSurface); fSurface = EGL_NO_SURFACE; } if (EGL_NO_DISPLAY != fDisplay) { eglTerminate(fDisplay); fDisplay = EGL_NO_DISPLAY; } #endif // SK_ANGLE #endif // SK_SUPPORT_GPU }
gboolean gst_imx_egl_viv_sink_egl_platform_shutdown_window(GstImxEglVivSinkEGLPlatform *platform) { if (platform->native_window == 0) return TRUE; eglMakeCurrent(platform->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (platform->egl_context != EGL_NO_CONTEXT) eglDestroyContext(platform->egl_display, platform->egl_context); if (platform->egl_surface != EGL_NO_SURFACE) eglDestroySurface(platform->egl_display, platform->egl_surface); if (platform->egl_display != EGL_NO_DISPLAY) eglTerminate(platform->egl_display); platform->egl_display = EGL_NO_DISPLAY; platform->egl_context = EGL_NO_CONTEXT; platform->egl_surface = EGL_NO_SURFACE; platform->native_window = 0; return TRUE; }
void EGLWindow::destroyGL() { if (mSurface != EGL_NO_SURFACE) { assert(mDisplay != EGL_NO_DISPLAY); eglDestroySurface(mDisplay, mSurface); mSurface = EGL_NO_SURFACE; } if (mContext != EGL_NO_CONTEXT) { assert(mDisplay != EGL_NO_DISPLAY); eglDestroyContext(mDisplay, mContext); mContext = EGL_NO_CONTEXT; } if (mDisplay != EGL_NO_DISPLAY) { eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglTerminate(mDisplay); mDisplay = EGL_NO_DISPLAY; } }
void QEglFSWindow::create() { if (m_window) return; if (window()->windowType() == Qt::Desktop) { QRect rect(QPoint(), hooks->screenSize()); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); return; } EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display(); QSurfaceFormat platformFormat = hooks->surfaceFormatFor(window()->requestedFormat()); EGLConfig config = q_configFromGLFormat(display, platformFormat); m_format = q_glFormatFromConfig(display, config); m_window = hooks->createNativeWindow(hooks->screenSize(), m_format); m_surface = eglCreateWindowSurface(display, config, m_window, NULL); if (m_surface == EGL_NO_SURFACE) { eglTerminate(display); qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", eglGetError()); } }
void X11Window::internalDestroyGLContext() { #ifdef OPENGL_ES if(m_eglDisplay) { if(m_eglContext) { eglDestroyContext(m_eglDisplay, m_eglContext); m_eglContext = 0; } if(m_eglSurface) { eglDestroySurface(m_eglDisplay, m_eglSurface); m_eglSurface = 0; } eglTerminate(m_eglDisplay); m_eglDisplay = 0; } #else if(m_glxContext) { glXMakeCurrent(m_display, None, NULL); glXDestroyContext(m_display, m_glxContext); m_glxContext = 0; } #endif }
void terminate_egl_window() { // Typical EGL cleanup if (g_egl_disp != EGL_NO_DISPLAY) { eglMakeCurrent(g_egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (g_egl_surf != EGL_NO_SURFACE) { eglDestroySurface(g_egl_disp, g_egl_surf); g_egl_surf = EGL_NO_SURFACE; } if (g_egl_ctx != EGL_NO_CONTEXT) { eglDestroyContext(g_egl_disp, g_egl_ctx); g_egl_ctx = EGL_NO_CONTEXT; } if (g_screen_win != NULL) { screen_destroy_window(g_screen_win); g_screen_win = NULL; } eglTerminate(g_egl_disp); g_egl_disp = EGL_NO_DISPLAY; } eglReleaseThread(); }
int main(int /*argc*/, char** /*argv*/) { EGLConfig* configs; EGLint n; EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(dpy, 0, 0); eglGetConfigs(dpy, NULL, 0, &n); configs = new EGLConfig[n]; eglGetConfigs(dpy, configs, n, &n); for (EGLint i=0 ; i<n ; i++) { printf("EGLConfig[%d]\n", i); for (unsigned attr = 0 ; attr<sizeof(attributes)/sizeof(Attribute) ; attr++) { EGLint value; eglGetConfigAttrib(dpy, configs[i], attributes[attr].attribute, &value); printf("\t%-32s: %10d (0x%08x)\n", attributes[attr].name, value, value); } } delete [] configs; eglTerminate(dpy); return 0; }
bool EglData::destroy() { if (this->display != NULL) { eglMakeCurrent(this->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } if (this->context != NULL) { eglDestroyContext(this->display, this->context); this->context = NULL; } if (this->surface != NULL) { eglDestroySurface(this->display, this->surface); this->surface = NULL; } if (this->display != NULL) { eglTerminate(this->display); this->display = NULL; } return true; }
void android_destroy_display(AInstance* a) { a->director.reset(); if (a->display != EGL_NO_DISPLAY) { eglMakeCurrent( a->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (a->context != EGL_NO_CONTEXT) { eglDestroyContext(a->display, a->context); a->context = EGL_NO_CONTEXT; } if (a->surface != EGL_NO_SURFACE) { eglDestroySurface(a->display, a->surface); a->surface = EGL_NO_SURFACE; } eglTerminate(a->display); a->display = EGL_NO_DISPLAY; } a->initialised = false; a->active = false; }
KDint initEGLConfig(void) { EGLint majorVersion; EGLint minorVersion; EGLint numConfigs; /* Set the attributes for EGLConfig. */ static const EGLint s_configAttribs[] = { #ifdef TEST_LOCKSURFACE EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_LOCK_SURFACE_BIT_KHR | EGL_OPTIMAL_FORMAT_BIT_KHR, EGL_MATCH_FORMAT_KHR, EGL_FORMAT_RGB_565_EXACT_KHR, #else EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, #endif EGL_NONE }; EGLConfig eglConfig; GLOBALS->eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if(!GLOBALS->eglDisplay) return -1; if(eglInitialize (GLOBALS->eglDisplay, &majorVersion, &minorVersion) == EGL_FALSE) return -1; eglChooseConfig(GLOBALS->eglDisplay, s_configAttribs, &eglConfig, 1, &numConfigs); if(numConfigs == 0) { eglTerminate(GLOBALS->eglDisplay); return -1; } GLOBALS->eglConfig = eglConfig; return 0; }
unsigned int Renderer::Shutdown() { if (!m_initialized) return CS_ERR_NONE; unsigned int err = CS_ERR_NONE; #ifdef PLATFORM_WINDOWS if (m_window != nullptr) { glfwDestroyWindow(m_window); m_window = nullptr; } #else Engine* engine = System::GetInstance()->GetEngineData(); if (engine->display != EGL_NO_DISPLAY) { eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (engine->context != EGL_NO_CONTEXT) { eglDestroyContext(engine->display, engine->context); } if (engine->surface != EGL_NO_SURFACE) { eglDestroySurface(engine->display, engine->surface); } eglTerminate(engine->display); } engine->animating = 0; engine->display = EGL_NO_DISPLAY; engine->context = EGL_NO_CONTEXT; engine->surface = EGL_NO_SURFACE; #endif m_initialized = false; return err; }
static enum piglit_result init_display(EGLenum platform, EGLDisplay *out_dpy) { enum piglit_result result = PIGLIT_PASS; EGLDisplay dpy; EGLint egl_major, egl_minor; bool ok; dpy = piglit_egl_get_default_display(platform); if (!dpy) { result = PIGLIT_SKIP; goto error; } ok = eglInitialize(dpy, &egl_major, &egl_minor); if (!ok) { result = PIGLIT_SKIP; goto error; } if (!piglit_is_egl_extension_supported(dpy, "EGL_KHR_fence_sync")) { piglit_loge("display does not support EGL_KHR_fence_sync"); result = PIGLIT_SKIP; goto error; } *out_dpy = dpy; return result; error: if (dpy) { eglTerminate(dpy); } return result; }
void TizenGraphicsManager::unloadGFXMode() { logEntered(); if (_eglDisplay != EGL_NO_DISPLAY) { eglMakeCurrent(_eglDisplay, NULL, NULL, NULL); if (_eglContext != EGL_NO_CONTEXT) { eglDestroyContext(_eglDisplay, _eglContext); _eglContext = EGL_NO_CONTEXT; } if (_eglSurface != EGL_NO_SURFACE) { eglDestroySurface(_eglDisplay, _eglSurface); _eglSurface = EGL_NO_SURFACE; } eglTerminate(_eglDisplay); _eglDisplay = EGL_NO_DISPLAY; } _eglConfig = NULL; OpenGLGraphicsManager::unloadGFXMode(); logLeaving(); }
void GLimp_Shutdown( void ) { if (!eglContext || !eglDisplay) return; IN_DeactivateMouse(); // bk001206 - replaced with H2/Fakk2 solution // XAutoRepeatOn(dpy); // autorepeaton = qfalse; // bk001130 - from cvs1.17 (mkv) screen_destroy_event(screen_ev); eglMakeCurrent(eglDisplay, NULL, NULL, NULL); eglDestroySurface(eglDisplay, eglSurface); screen_destroy_window(screen_win); screen_destroy_context(screen_ctx); eglDestroyContext(eglDisplay, eglContext); eglTerminate(eglDisplay); eglReleaseThread(); eglDisplay = NULL; eglContext = NULL; eglSurface = NULL; memset( &glConfig, 0, sizeof( glConfig ) ); memset( &glState, 0, sizeof( glState ) ); }