summaryrefslogtreecommitdiff
path: root/src/egl/drivers/dri2
diff options
context:
space:
mode:
authorJuan Zhao <juan.j.zhao@intel.com>2011-01-09 12:03:02 -0500
committerKristian Høgsberg <krh@bitplanet.net>2011-01-09 14:55:16 -0500
commite59fa4c46c8857f2e04447777dd197464c95b2cb (patch)
treedc08db1f93c23b4600f2071b7ddc985910a12052 /src/egl/drivers/dri2
parentfb9c6e681f91c986b7cbe2d6e9f6baceda00c415 (diff)
dri2: release texture image.
Add release function for texture_from_pixmap extension. Some platform need to release texture image for texture_from_pixmap extension, add this interface for those platforms.
Diffstat (limited to 'src/egl/drivers/dri2')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 6f40ab951f9..7592984c99e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1983,10 +1983,31 @@ static EGLBoolean
dri2_release_tex_image(_EGLDriver *drv,
_EGLDisplay *disp, _EGLSurface *surf, EGLint buffer)
{
- (void) drv;
- (void) disp;
- (void) surf;
- (void) buffer;
+#if __DRI_TEX_BUFFER_VERSION >= 3
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+ struct dri2_egl_context *dri2_ctx;
+ _EGLContext *ctx;
+ GLint target;
+
+ ctx = _eglGetCurrentContext();
+ dri2_ctx = dri2_egl_context(ctx);
+
+ if (!_eglReleaseTexImage(drv, disp, surf, buffer))
+ return EGL_FALSE;
+
+ switch (dri2_surf->base.TextureTarget) {
+ case EGL_TEXTURE_2D:
+ target = GL_TEXTURE_2D;
+ break;
+ default:
+ assert(0);
+ }
+ if (dri2_dpy->tex_buffer->releaseTexBuffer!=NULL)
+ (*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context,
+ target,
+ dri2_surf->dri_drawable);
+#endif
return EGL_TRUE;
}