Esempio n. 1
0
static void
_cogl_winsys_egl_cleanup_context (CoglDisplay *display)
{
  CoglRenderer *renderer = display->renderer;
  CoglRendererEGL *egl_renderer = renderer->winsys;
  CoglDisplayEGL *egl_display = display->winsys;
  CoglDisplayWayland *wayland_display = egl_display->platform;

  if (egl_display->dummy_surface != EGL_NO_SURFACE)
    {
      eglDestroySurface (egl_renderer->edpy, egl_display->dummy_surface);
      egl_display->dummy_surface = EGL_NO_SURFACE;
    }

  if (wayland_display->dummy_wayland_egl_native_window)
    {
      wl_egl_window_destroy (wayland_display->dummy_wayland_egl_native_window);
      wayland_display->dummy_wayland_egl_native_window = NULL;
    }

  if (wayland_display->dummy_wayland_surface)
    {
      wl_surface_destroy (wayland_display->dummy_wayland_surface);
      wayland_display->dummy_wayland_surface = NULL;
    }
}
Esempio n. 2
0
NativeStateWayland::~NativeStateWayland()
{
    if (window_) {
        if (window_->shell_surface)
            wl_shell_surface_destroy(window_->shell_surface);
        if (window_->opaque_reqion)
            wl_region_destroy(window_->opaque_reqion);
        if (window_->surface)
            wl_surface_destroy(window_->surface);
        if (window_->native)
            wl_egl_window_destroy(window_->native);
        delete window_;
    }

    if (display_) {
        if (display_->shell)
            wl_shell_destroy(display_->shell);

        for (OutputsVector::iterator it = display_->outputs.begin();
             it != display_->outputs.end(); ++it) {

            wl_output_destroy((*it)->output);
            delete *it;
        }
        if (display_->compositor)
            wl_compositor_destroy(display_->compositor);
        if (display_->registry)
            wl_registry_destroy(display_->registry);
        if (display_->display) {
            wl_display_flush(display_->display);
            wl_display_disconnect(display_->display);
        }
        delete display_;
    }
}
Esempio n. 3
0
std::unique_ptr<GLContextEGL> GLContextEGL::createWaylandContext(PlatformDisplay& platformDisplay, EGLContext sharingContext)
{
    EGLDisplay display = platformDisplay.eglDisplay();
    EGLConfig config;
    if (!getEGLConfig(display, &config, WindowSurface))
        return nullptr;

    EGLContext context = eglCreateContext(display, config, sharingContext, gContextAttributes);
    if (context == EGL_NO_CONTEXT)
        return nullptr;

    WlUniquePtr<struct wl_surface> wlSurface(downcast<PlatformDisplayWayland>(platformDisplay).createSurface());
    if (!wlSurface) {
        eglDestroyContext(display, context);
        return nullptr;
    }

    EGLNativeWindowType window = wl_egl_window_create(wlSurface.get(), 1, 1);
    EGLSurface surface = eglCreateWindowSurface(display, config, window, 0);
    if (surface == EGL_NO_SURFACE) {
        eglDestroyContext(display, context);
        wl_egl_window_destroy(window);
        return nullptr;
    }

    return std::unique_ptr<GLContextEGL>(new GLContextEGL(platformDisplay, context, surface, WTFMove(wlSurface), window));
}
Esempio n. 4
0
static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl)
{
   if (!wl)
      return;

   switch (wl_api)
   {
      case GFX_CTX_OPENGL_API:
      case GFX_CTX_OPENGL_ES_API:
      case GFX_CTX_OPENVG_API:
#ifdef HAVE_EGL
         egl_destroy(&wl->egl);

         if (wl->win)
            wl_egl_window_destroy(wl->win);
#endif
         break;
      case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
         vulkan_context_destroy(&wl->vk, wl->surface);

         if (wl->fd >= 0)
            close(wl->fd);
#endif
         break;
      case GFX_CTX_NONE:
      default:
         break;
   }

   if (wl->shell)
      wl_shell_destroy(wl->shell);
   if (wl->compositor)
      wl_compositor_destroy(wl->compositor);
   if (wl->registry)
      wl_registry_destroy(wl->registry);
   if (wl->shell_surf)
      wl_shell_surface_destroy(wl->shell_surf);
   if (wl->surface)
      wl_surface_destroy(wl->surface);

   if (wl->dpy)
   {
      wl_display_flush(wl->dpy);
      wl_display_disconnect(wl->dpy);
   }

#ifdef HAVE_EGL
   wl->win        = NULL;
#endif
   wl->shell      = NULL;
   wl->compositor = NULL;
   wl->registry   = NULL;
   wl->dpy        = NULL;
   wl->shell_surf = NULL;
   wl->surface    = NULL;

   wl->width      = 0;
   wl->height     = 0;
}
Esempio n. 5
0
void cWaylandInterface::DestroyWindow(void)
{
	wl_egl_window_destroy(GLWin.wl_egl_native);

	wl_shell_surface_destroy(GLWin.wl_shell_surface);
	wl_surface_destroy(GLWin.wl_surface);
}
Esempio n. 6
0
static void delete_window (struct window *window) {
	eglDestroySurface (egl_display, window->egl_surface);
	wl_egl_window_destroy (window->egl_window);
	wl_shell_surface_destroy (window->shell_surface);
	wl_surface_destroy (window->surface);
	eglDestroyContext (egl_display, window->egl_context);
}
Esempio n. 7
0
WaylandSurface::~WaylandSurface()
{
    // The surface couldn't have been created in the first place if WaylandDisplay wasn't properly initialized.
    ASSERT(WaylandDisplay::instance());
    eglMakeCurrent(WaylandDisplay::instance()->eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

    wl_egl_window_destroy(m_nativeWindow);
    wl_surface_destroy(m_wlSurface);
}
	xdl_int XdevLWindowWayland::shutdown() {

		if(m_egl.m_eglWindow != nullptr) {
			wl_egl_window_destroy(m_egl.m_eglWindow);
			m_egl.m_eglWindow = nullptr;
		}

		return ERR_OK;
	}
void destroySubWindow(EGLNativeDisplayType dis,EGLNativeWindowType win){
    /* krnlyng hmm */
#ifndef X11
    //wl_surface_destroy(win);
    wl_egl_window_destroy((struct wl_egl_window*)win);
#else
    XDestroyWindow(dis, win);
#endif
}
Esempio n. 10
0
void GLESV2API::Destroy() {
  if (nullptr != p_->egl_surface) {
    _ASSERT(nullptr != p_->wl_egl_window);
    Display *display = Application::GetInstance()->GetDisplay();
    eglDestroySurface(Display::Proxy::egl_display(display), p_->egl_surface);
    wl_egl_window_destroy(p_->wl_egl_window);
    p_->wl_egl_window = nullptr;
    p_->egl_surface = nullptr;
  }
}
Esempio n. 11
0
void
WindowEGLImpl::DestroySurface()
{
	eglMakeCurrent(m_egl.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

	eglDestroySurface(m_egl.dpy, m_eglSurface);
	wl_egl_window_destroy(m_native);

	if (m_callback)
		wl_callback_destroy(m_callback);
}
Esempio n. 12
0
static void
destroy_surface(struct window *window)
{
	wl_egl_window_destroy(window->native);

	wl_shell_surface_destroy(window->shell_surface);
	wl_surface_destroy(window->surface);

	if (window->callback)
		wl_callback_destroy(window->callback);
}
Esempio n. 13
0
QWaylandEglWindow::~QWaylandEglWindow()
{
    if (m_eglSurface) {
        eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface);
        m_eglSurface = 0;
    }

    wl_egl_window_destroy(m_waylandEglWindow);

    delete m_contentFBO;
}
Esempio n. 14
0
static void
wayland_output_destroy(struct weston_output *output_base)
{
	struct wayland_output *output = (struct wayland_output *) output_base;

	gl_renderer_output_destroy(output_base);

	wl_egl_window_destroy(output->parent.egl_window);
	free(output);

	return;
}
Esempio n. 15
0
static void
triangle_destroy(struct triangle *tri)
{
	if (tri->egl_surface)
		eglDestroySurface(tri->egl->dpy, tri->egl_surface);

	if (tri->egl_window)
		wl_egl_window_destroy(tri->egl_window);

	widget_destroy(tri->widget);
	free(tri);
}
Esempio n. 16
0
EglWaylandBackend::~EglWaylandBackend()
{
    cleanupGL();
    checkGLError("Cleanup");
    doneCurrent();
    eglDestroyContext(m_display, m_context);
    eglDestroySurface(m_display, m_surface);
    eglTerminate(m_display);
    eglReleaseThread();
    if (m_overlay) {
        wl_egl_window_destroy(m_overlay);
    }
}
Esempio n. 17
0
/*
 * Closes a window, destroying the frame and OpenGL context
 */
void fgPlatformCloseWindow( SFG_Window* window )
{
    fghPlatformCloseWindowEGL(window);

    if ( window->Window.pContext.egl_window )
      wl_egl_window_destroy( window->Window.pContext.egl_window );
    if ( window->Window.pContext.shsurface )
      wl_shell_surface_destroy( window->Window.pContext.shsurface );
    if ( window->Window.pContext.surface )
      wl_surface_destroy( window->Window.pContext.surface );
    if ( window->Window.pContext.cursor_surface )
      wl_surface_destroy( window->Window.pContext.cursor_surface );
}
Esempio n. 18
0
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
{
    if (window->wl.native)
        wl_egl_window_destroy(window->wl.native);

    _glfwDestroyContext(window);

    if (window->wl.shell_surface)
        wl_shell_surface_destroy(window->wl.shell_surface);

    if (window->wl.surface)
        wl_surface_destroy(window->wl.surface);
}
Esempio n. 19
0
static int 
evgl_eng_native_window_destroy(void *data, void *win)
{
   Render_Engine *re;

   if (!(re = (Render_Engine *)data)) return 0;
   if (!win) return 0;

   wl_egl_window_destroy((struct wl_egl_window *)win);
   win = NULL;

   return 1;
}
Esempio n. 20
0
static void releaseGlContext_wayland(MPGLContext *ctx)
{
    GL *gl = ctx->gl;
    struct egl_context * egl_ctx = ctx->priv;

    gl->Finish();
    eglMakeCurrent(egl_ctx->egl.dpy, NULL, NULL, EGL_NO_CONTEXT);
    eglDestroyContext(egl_ctx->egl.dpy, egl_ctx->egl.ctx);
    eglTerminate(egl_ctx->egl.dpy);
    eglReleaseThread();
    wl_egl_window_destroy(egl_ctx->egl_window);
    egl_ctx->egl.ctx = NULL;
}
Esempio n. 21
0
    void destroy_surface(struct display *display)
    {
      /* Required, otherwise segfault in egl_dri2.c: dri2_make_current()
       * on eglReleaseThread(). */
      eglMakeCurrent(display->egl.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

      eglDestroySurface(display->egl.dpy, display->egl_surface);
      wl_egl_window_destroy(display->native);

      wl_surface_destroy(display->surface);

      if (display->callback)
        wl_callback_destroy(display->callback);
    }
Esempio n. 22
0
static void releaseGlContext_wayland(MPGLContext *ctx)
{
    GL *gl = ctx->gl;
    struct vo_wayland_state *wl = ctx->vo->wayland;

    gl->Finish();
    eglReleaseThread();
    wl_egl_window_destroy(wl->egl_context.egl_window);
    eglDestroySurface(wl->egl_context.egl.dpy, wl->egl_context.egl_surface);
    eglMakeCurrent(wl->egl_context.egl.dpy, NULL, NULL, EGL_NO_CONTEXT);
    eglDestroyContext(wl->egl_context.egl.dpy, wl->egl_context.egl.ctx);
    eglTerminate(wl->egl_context.egl.dpy);
    wl->egl_context.egl.ctx = NULL;
}
Esempio n. 23
0
File: window.cpp Progetto: KDE/kwin
Window::~Window()
{
    unmap();
    if (m_eglSurface != EGL_NO_SURFACE) {
        eglDestroySurface(m_integration->eglDisplay(), m_eglSurface);
    }
#if HAVE_WAYLAND_EGL
    if (m_eglWaylandWindow) {
        wl_egl_window_destroy(m_eglWaylandWindow);
    }
#endif
    delete m_shellSurface;
    delete m_surface;
}
Esempio n. 24
0
static void waylandgl_uninit(MPGLContext *ctx)
{
    struct vo_wayland_state *wl = ctx->vo->wayland;

    if (wl->egl_context.egl.ctx) {
        eglReleaseThread();
        wl_egl_window_destroy(wl->egl_context.egl_window);
        eglDestroySurface(wl->egl_context.egl.dpy, wl->egl_context.egl_surface);
        eglMakeCurrent(wl->egl_context.egl.dpy, NULL, NULL, EGL_NO_CONTEXT);
        eglDestroyContext(wl->egl_context.egl.dpy, wl->egl_context.egl.ctx);
    }
    eglTerminate(wl->egl_context.egl.dpy);
    wl->egl_context.egl.ctx = NULL;

    vo_wayland_uninit(ctx->vo);
}
Esempio n. 25
0
void QWaylandEglWindow::newSurfaceCreated()
{
    if (mWaylandEglWindow) {
        wl_egl_window_destroy(mWaylandEglWindow);
    }
    wl_visual *visual = QWaylandScreen::waylandScreenFromWidget(widget())->visual();
    QSize size = geometry().size();
    if (!size.isValid())
        size = QSize(0,0);

    mWaylandEglWindow = wl_egl_window_create(mSurface,size.width(),size.height(),visual);
    if (mGLContext) {
        EGLNativeWindowType window(reinterpret_cast<EGLNativeWindowType>(mWaylandEglWindow));
        EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL);
        mGLContext->setEglSurface(surface);
    }
}
GHOST_WindowWayland::~GHOST_WindowWayland()
{
	EGLDisplay display = m_system->getEglDisplay();

	if (m_egl_context != EGL_NO_CONTEXT) {
		context_make_current(EGL_NO_SURFACE);
		EGL_CHK(eglDestroyContext(display, m_egl_context));
	}

	if (m_egl_surface != EGL_NO_SURFACE)
		EGL_CHK(eglDestroySurface(display, m_egl_surface));

	if (m_window)
		wl_egl_window_destroy(m_window);

	wl::destroy(m_shell_surface);
	wl::destroy(m_surface);
}
Esempio n. 27
0
static void
nested_client_destroy(struct nested_client *client)
{
  eglMakeCurrent(client->egl_display,
                 EGL_NO_SURFACE, EGL_NO_SURFACE,
                 EGL_NO_CONTEXT);

  wl_egl_window_destroy(client->native);

  wl_surface_destroy(client->surface);

  if (client->compositor)
    wl_compositor_destroy(client->compositor);

  wl_registry_destroy(client->registry);
  wl_display_flush(client->display);
  wl_display_disconnect(client->display);
}
Esempio n. 28
0
WaylandEGLContext::~WaylandEGLContext ()
{
    if (subsurface)
        wl_subsurface_destroy (subsurface);

    if (region)
        wl_region_destroy (region);

    if (child)
        wl_surface_destroy (child);

    if (egl_context)
        eglDestroyContext (egl_display, egl_context);

    if (egl_surface)
        eglDestroySurface (egl_display, egl_surface);

    if (egl_window)
        wl_egl_window_destroy (egl_window);
}
static void
destroy_surfaces (GstGLWindowWaylandEGL * window_egl)
{
  if (window_egl->window.subsurface) {
    wl_subsurface_destroy (window_egl->window.subsurface);
    window_egl->window.subsurface = NULL;
  }
  if (window_egl->window.shell_surface) {
    wl_shell_surface_destroy (window_egl->window.shell_surface);
    window_egl->window.shell_surface = NULL;
  }
  if (window_egl->window.surface) {
    wl_surface_destroy (window_egl->window.surface);
    window_egl->window.surface = NULL;
  }
  if (window_egl->window.native) {
    wl_egl_window_destroy (window_egl->window.native);
    window_egl->window.native = NULL;
  }
}
Esempio n. 30
0
static void
_cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen)
{
  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
  CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform;

  if (wayland_onscreen->wayland_egl_native_window)
    {
      wl_egl_window_destroy (wayland_onscreen->wayland_egl_native_window);
      wayland_onscreen->wayland_egl_native_window = NULL;
    }

  if (wayland_onscreen->wayland_surface)
    {
      wl_surface_destroy (wayland_onscreen->wayland_surface);
      wayland_onscreen->wayland_surface = NULL;
    }

  g_slice_free (CoglOnscreenWayland, wayland_onscreen);
}