[cogl/wip/runtime-egl-platform: 3/11] Don't bother trying to accept NULL in _cogl_winsys_onscreen_bind
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/runtime-egl-platform: 3/11] Don't bother trying to accept NULL in _cogl_winsys_onscreen_bind
- Date: Tue, 13 Dec 2011 13:15:01 +0000 (UTC)
commit 2b8cb4c087c446b7883dd5de5c8b68757b1ab5d5
Author: Neil Roberts <neil linux intel com>
Date: Mon Dec 12 15:03:18 2011 +0000
Don't bother trying to accept NULL in _cogl_winsys_onscreen_bind
The GLX and EGL winsys backends had a check for when onscreen==NULL
in which case they would instead try to bind the dummy surface. This
wouldn't work however because it would have already crashed by that
point when it tried to get the Cogl context out of the onscreen. The
function needs a bit of refactoring before it could support this but
presumably nothing is relying on this anyway because it wouldn't work
so for now we can just remove it.
cogl/winsys/cogl-winsys-egl.c | 27 ++---------
cogl/winsys/cogl-winsys-glx.c | 100 +++++++++++++++++------------------------
2 files changed, 46 insertions(+), 81 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index 4ae4587..abd43cb 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -1507,28 +1507,11 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
if (egl_context->current_surface == egl_onscreen->egl_surface)
return;
- if (G_UNLIKELY (!onscreen))
- {
- if (renderer->winsys_vtable->id == COGL_WINSYS_ID_EGL_X11 ||
- renderer->winsys_vtable->id == COGL_WINSYS_ID_EGL_WAYLAND)
- {
- eglMakeCurrent (egl_renderer->edpy,
- egl_display->dummy_surface,
- egl_display->dummy_surface,
- egl_display->egl_context);
- egl_context->current_surface = egl_display->dummy_surface;
- }
- else
- return;
- }
- else
- {
- eglMakeCurrent (egl_renderer->edpy,
- egl_onscreen->egl_surface,
- egl_onscreen->egl_surface,
- egl_display->egl_context);
- egl_context->current_surface = egl_onscreen->egl_surface;
- }
+ eglMakeCurrent (egl_renderer->edpy,
+ egl_onscreen->egl_surface,
+ egl_onscreen->egl_surface,
+ egl_display->egl_context);
+ egl_context->current_surface = egl_onscreen->egl_surface;
if (onscreen->swap_throttled)
eglSwapInterval (egl_renderer->edpy, 1);
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 107829f..4e2d9ed 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -1034,70 +1034,52 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
CoglXlibTrapState old_state;
GLXDrawable drawable;
- if (G_UNLIKELY (!onscreen))
- {
- drawable =
- glx_display->dummy_glxwin ?
- glx_display->dummy_glxwin : glx_display->dummy_xwin;
-
- if (glx_context->current_drawable == drawable)
- return;
-
- _cogl_xlib_renderer_trap_errors (context->display->renderer, &old_state);
+ drawable =
+ glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin;
- glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy,
- drawable, drawable,
- glx_display->glx_context);
- }
- else
- {
- drawable =
- glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin;
+ if (glx_context->current_drawable == drawable)
+ return;
- if (glx_context->current_drawable == drawable)
- return;
+ _cogl_xlib_renderer_trap_errors (context->display->renderer, &old_state);
- _cogl_xlib_renderer_trap_errors (context->display->renderer, &old_state);
+ COGL_NOTE (WINSYS,
+ "MakeContextCurrent dpy: %p, window: 0x%x (%s), context: %p",
+ xlib_renderer->xdpy,
+ (unsigned int) drawable,
+ xlib_onscreen->is_foreign_xwin ? "foreign" : "native",
+ glx_display->glx_context);
- COGL_NOTE (WINSYS,
- "MakeContextCurrent dpy: %p, window: 0x%x (%s), context: %p",
- xlib_renderer->xdpy,
- (unsigned int) drawable,
- xlib_onscreen->is_foreign_xwin ? "foreign" : "native",
- glx_display->glx_context);
+ glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy,
+ drawable,
+ drawable,
+ glx_display->glx_context);
- glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy,
- drawable,
- drawable,
- glx_display->glx_context);
-
- /* In case we are using GLX_SGI_swap_control for vblank syncing
- * we need call glXSwapIntervalSGI here to make sure that it
- * affects the current drawable.
- *
- * Note: we explicitly set to 0 when we aren't using the swap
- * interval to synchronize since some drivers have a default
- * swap interval of 1. Sadly some drivers even ignore requests
- * to disable the swap interval.
- *
- * NB: glXSwapIntervalSGI applies to the context not the
- * drawable which is why we can't just do this once when the
- * framebuffer is allocated.
- *
- * FIXME: We should check for GLX_EXT_swap_control which allows
- * per framebuffer swap intervals. GLX_MESA_swap_control also
- * allows per-framebuffer swap intervals but the semantics tend
- * to be more muddled since Mesa drivers tend to expose both the
- * MESA and SGI extensions which should technically be mutually
- * exclusive.
- */
- if (glx_renderer->pf_glXSwapInterval)
- {
- if (onscreen->swap_throttled)
- glx_renderer->pf_glXSwapInterval (1);
- else
- glx_renderer->pf_glXSwapInterval (0);
- }
+ /* In case we are using GLX_SGI_swap_control for vblank syncing
+ * we need call glXSwapIntervalSGI here to make sure that it
+ * affects the current drawable.
+ *
+ * Note: we explicitly set to 0 when we aren't using the swap
+ * interval to synchronize since some drivers have a default
+ * swap interval of 1. Sadly some drivers even ignore requests
+ * to disable the swap interval.
+ *
+ * NB: glXSwapIntervalSGI applies to the context not the
+ * drawable which is why we can't just do this once when the
+ * framebuffer is allocated.
+ *
+ * FIXME: We should check for GLX_EXT_swap_control which allows
+ * per framebuffer swap intervals. GLX_MESA_swap_control also
+ * allows per-framebuffer swap intervals but the semantics tend
+ * to be more muddled since Mesa drivers tend to expose both the
+ * MESA and SGI extensions which should technically be mutually
+ * exclusive.
+ */
+ if (glx_renderer->pf_glXSwapInterval)
+ {
+ if (onscreen->swap_throttled)
+ glx_renderer->pf_glXSwapInterval (1);
+ else
+ glx_renderer->pf_glXSwapInterval (0);
}
XSync (xlib_renderer->xdpy, False);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]