summaryrefslogtreecommitdiff
path: root/cogl/winsys
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2014-03-05 01:25:50 +0000
committerRobert Bragg <robert.bragg@intel.com>2014-03-20 17:34:04 +0000
commit804082abd3f76cb724d09804cbcd7d8fc4dff769 (patch)
tree99a9f9d7f55bdd03cd152b3fbd80b25a0b821346 /cogl/winsys
parent081acdc146b620e251a40052b6025bfb84f3a7b7 (diff)
Expose EGL context/display and GLX context
To help facilitate integration with third party frameworks this exposes the EGL context and display to applications as well as the GLX context. (Note that the GLX display is already available via cogl_xlib_renderer_get_display()) This adds a new top-level <cogl/cogl-glx.h> header that needs to be included explicitly to access the glx specific api. Anyone using these apis will be responsible for checking that Cogl is indeed using EGL or GLX by calling cogl_renderer_get_winsys_id() This will enable GStreamer, for example, to be able to create a GL context that shares resources with Cogl's context. https://bugzilla.gnome.org/show_bug.cgi?id=724992 Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl/winsys')
-rw-r--r--cogl/winsys/cogl-winsys-egl.c27
-rw-r--r--cogl/winsys/cogl-winsys-glx.c9
-rw-r--r--cogl/winsys/cogl-winsys-private.h5
3 files changed, 26 insertions, 15 deletions
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index fbdadfb1..2f15c5c6 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -47,6 +47,7 @@
#include "cogl-onscreen-template-private.h"
#include "cogl-gles2-context-private.h"
#include "cogl-error-private.h"
+#include "cogl-egl.h"
#include "cogl-private.h"
@@ -860,14 +861,6 @@ _cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen)
_cogl_winsys_onscreen_bind (onscreen);
}
-static EGLDisplay
-_cogl_winsys_context_egl_get_egl_display (CoglContext *context)
-{
- CoglRendererEGL *egl_renderer = context->display->renderer->winsys;
-
- return egl_renderer->edpy;
-}
-
static void
_cogl_winsys_save_context (CoglContext *ctx)
{
@@ -974,8 +967,6 @@ static CoglWinsysVtable _cogl_winsys_vtable =
.display_destroy = _cogl_winsys_display_destroy,
.context_init = _cogl_winsys_context_init,
.context_deinit = _cogl_winsys_context_deinit,
- .context_egl_get_egl_display =
- _cogl_winsys_context_egl_get_egl_display,
.context_create_gles2_context =
_cogl_winsys_context_create_gles2_context,
.destroy_gles2_context = _cogl_winsys_destroy_gles2_context,
@@ -1074,3 +1065,19 @@ _cogl_egl_query_wayland_buffer (CoglContext *ctx,
value);
}
#endif
+
+EGLDisplay
+cogl_egl_context_get_egl_display (CoglContext *context)
+{
+ CoglRendererEGL *egl_renderer = context->display->renderer->winsys;
+
+ return egl_renderer->edpy;
+}
+
+EGLContext
+cogl_egl_context_get_egl_context (CoglContext *context)
+{
+ CoglDisplayEGL *egl_display = context->display->winsys;
+
+ return egl_display->egl_context;
+}
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 2b135be8..3095acfd 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -59,6 +59,7 @@
#include "cogl-error-private.h"
#include "cogl-poll-private.h"
#include "cogl-version.h"
+#include "cogl-glx.h"
#include <stdlib.h>
#include <sys/types.h>
@@ -2707,3 +2708,11 @@ _cogl_winsys_glx_get_vtable (void)
{
return &_cogl_winsys_vtable;
}
+
+GLXContext
+cogl_glx_context_get_glx_context (CoglContext *context)
+{
+ CoglGLXDisplay *glx_display = context->display->winsys;
+
+ return glx_display->glx_context;
+}
diff --git a/cogl/winsys/cogl-winsys-private.h b/cogl/winsys/cogl-winsys-private.h
index a08e1b08..d6ff1658 100644
--- a/cogl/winsys/cogl-winsys-private.h
+++ b/cogl/winsys/cogl-winsys-private.h
@@ -145,11 +145,6 @@ typedef struct _CoglWinsysVtable
int
(*onscreen_get_buffer_age) (CoglOnscreen *onscreen);
-#ifdef COGL_HAS_EGL_SUPPORT
- EGLDisplay
- (*context_egl_get_egl_display) (CoglContext *context);
-#endif
-
#ifdef COGL_HAS_XLIB_SUPPORT
XVisualInfo *
(*xlib_get_visual_info) (void);