summaryrefslogtreecommitdiff
path: root/cogl/winsys
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-04-30 14:09:11 +0100
committerRobert Bragg <robert@linux.intel.com>2013-05-29 19:15:14 +0100
commit79252d4e419e2462c5bc89ea4614b40bddc932c5 (patch)
tree08914f6d182f49862851b0b2b869c692baec26af /cogl/winsys
parentf67c7eaf23e1e2088e9956cb2b66dfdc9abc8b3b (diff)
downloadcogl-79252d4e419e2462c5bc89ea4614b40bddc932c5.tar.gz
check the wayland buffer format when creating texture
The implementation of cogl_wayland_texture_2d_new_from_buffer now uses eglQueryWaylandBuffer to query the format of the buffer before trying to create a texture from the buffer. This makes sure we don't try and create a texture from YUV buffers for instance that may actually require multiple textures. We now also report an error when we don't understand the buffer type or format. Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl/winsys')
-rw-r--r--cogl/winsys/cogl-winsys-egl-feature-functions.h4
-rw-r--r--cogl/winsys/cogl-winsys-egl-private.h8
-rw-r--r--cogl/winsys/cogl-winsys-egl.c18
3 files changed, 30 insertions, 0 deletions
diff --git a/cogl/winsys/cogl-winsys-egl-feature-functions.h b/cogl/winsys/cogl-winsys-egl-feature-functions.h
index a26a6c58..27588433 100644
--- a/cogl/winsys/cogl-winsys-egl-feature-functions.h
+++ b/cogl/winsys/cogl-winsys-egl-feature-functions.h
@@ -86,6 +86,10 @@ COGL_WINSYS_FEATURE_FUNCTION (EGLImageKHR, eglBindWaylandDisplay,
COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglUnbindWaylandDisplay,
(EGLDisplay dpy,
struct wl_display *wayland_display))
+COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglQueryWaylandBuffer,
+ (EGLDisplay dpy,
+ struct wl_buffer *buffer,
+ EGLint attribute, EGLint *value))
COGL_WINSYS_FEATURE_END ()
COGL_WINSYS_FEATURE_BEGIN (create_context,
diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h
index fe186da9..9a3b4ad5 100644
--- a/cogl/winsys/cogl-winsys-egl-private.h
+++ b/cogl/winsys/cogl-winsys-egl-private.h
@@ -159,6 +159,14 @@ _cogl_egl_destroy_image (CoglContext *ctx,
EGLImageKHR image);
#endif
+#ifdef EGL_WL_bind_wayland_display
+CoglBool
+_cogl_egl_query_wayland_buffer (CoglContext *ctx,
+ struct wl_buffer *buffer,
+ int attribute,
+ int *value);
+#endif
+
CoglBool
_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
CoglError **error);
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index 9aa0834b..73b9a887 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -1041,3 +1041,21 @@ _cogl_egl_destroy_image (CoglContext *ctx,
egl_renderer->pf_eglDestroyImage (egl_renderer->edpy, image);
}
#endif
+
+#ifdef EGL_WL_bind_wayland_display
+CoglBool
+_cogl_egl_query_wayland_buffer (CoglContext *ctx,
+ struct wl_buffer *buffer,
+ int attribute,
+ int *value)
+{
+ CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys;
+
+ _COGL_RETURN_IF_FAIL (egl_renderer->pf_eglQueryWaylandBuffer);
+
+ return egl_renderer->pf_eglQueryWaylandBuffer (egl_renderer->edpy,
+ buffer,
+ attribute,
+ value);
+}
+#endif