summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2009-03-06 21:13:44 -0500
committerKristian Høgsberg <krh@redhat.com>2009-03-06 21:13:44 -0500
commit5176cff74f132f7b0583a16124bd56ab72450ca7 (patch)
tree91b61a1122ea27dfd53b3b4c47b3a5192e4d84c2
parentc21f18146dad6962527cf2f0a45b1f824c0a1596 (diff)
Add eglGetNativeBuffer to get the GEM buffer for a GL buffer.
-rw-r--r--eagle.h3
-rw-r--r--intel.c20
2 files changed, 23 insertions, 0 deletions
diff --git a/eagle.h b/eagle.h
index 6c788c5..b1eaf6f 100644
--- a/eagle.h
+++ b/eagle.h
@@ -256,6 +256,9 @@ extern EGLSurface eglCreateSurfaceForName(EGLDisplay dpy,
GLuint stride,
const EGLint *attribList);
+extern EGLBoolean eglGetNativeBuffer(EGLSurface surface, GLenum buffer,
+ uint32_t *name, uint32_t *stride);
+
extern EGLBoolean eglCopyNativeBuffers(EGLDisplay display,
EGLSurface dst, GLenum dstBuffer,
GLint dst_x, GLint dst_y,
diff --git a/intel.c b/intel.c
index dae7a5a..dfcfdd7 100644
--- a/intel.c
+++ b/intel.c
@@ -233,6 +233,26 @@ intelCreateDisplay(struct udev_device *device, const char *driver)
return display;
}
+EGLBoolean
+eglGetNativeBuffer(EGLSurface surface, GLenum buffer,
+ uint32_t *name, uint32_t *stride)
+{
+ EGLSurfaceNative nativeSurface = (EGLSurfaceNative) surface;
+
+ switch (buffer) {
+ case GL_FRONT_LEFT:
+ *name = nativeSurface->front.name;
+ *stride = nativeSurface->front.pitch;
+ return EGL_TRUE;
+ case GL_BACK_LEFT:
+ *name = surface->buffers[0].name;
+ *stride = surface->buffers[0].pitch;
+ return EGL_TRUE;
+ default:
+ return EGL_FALSE;
+ }
+}
+
EGLDisplay
i915CreateDisplay(struct udev_device *device)
{