On Thu, 2011-01-06 at 08:36 -0500, Kristian Høgsberg wrote: > On Thu, Jan 6, 2011 at 4:33 AM, Zhao, Juan J <juan.j.z...@intel.com> wrote: > > On Wed, 2011-01-05 at 08:28 -0500, Kristian Høgsberg wrote: > >> On Tue, Jan 4, 2011 at 11:10 PM, Zhao, Juan J <juan.j.z...@intel.com> > >> wrote: > >> > Hi all, > >> > > >> > In the structure “__DRItexBufferExtensionRec”, we don’t > >> > have > >> > one release interface now. But in our platform, we need to release some > >> > resources. > >> > > >> > Why we don’t need the release interface? Or should we add > >> > one? > >> > >> In the open source drivers, glXBindTexImageEXT is pretty much the same > >> as glBindTexture. The pixmaps stays bound until you bind another > >> texture or pixmap, at which point all the resources are released. > >> There is nothing for the open source drivers to do in release, so the > >> DRI extension never had a release function. If you need a release > >> function, just send a patch and we can add it. You'll need to bump > >> the extension version number and then add the call to release in the > >> dri loaders (libGL, AIGLX, egl_dri2) conditional on the extension > >> version. > >> > > Thanks a lot! :) > > I add this interface. Would you please help to check it? > >> Kristian > > Looks good, just a few commets: I don't think we need the format > argument in release do we? I'd like to drop that to make it a little > easier to call the release function. Thank your for your comments.:) Yes, we don't need this. I just removed this parameter.
> Also, in files in the mesa repo, > and in particular dri_interface.h, we don't need to check for > __DRI_TEX_BUFFER_VERSION >=3, since we know exactly what versions are > available. Only the AIGLX code in X (and potentially other > out-of-tree users of the DRI driver interface) need this. OK. And I updated this. > And please > keep the commit message under 80 characters wide: use a short > description in the header, then provide more detail in the following > lines, if necessary. Thanks a lot. I corrected the commit message. > Finally, why do you need the invalidate call in > dri2_release_tex_image()? I think the invalidate call is used to flush and bump the stamp sequence. When the stamp is changed, we will update render buffers and finally update frame-buffer size. Now we are releasing the texture image, so we need this call. > Kristian -- *^_^* Many thanks & Best Regards SSD-OTC Meego Middleware & TV Team Zhao Juan
From e2a707d6c602f686e9b738cb044ddc7f48bbfa8b Mon Sep 17 00:00:00 2001 From: JuanZhao <juan.j.z...@intel.com> Date: Fri, 7 Jan 2011 09:53:10 -0500 Subject: [PATCH] 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. --- include/GL/internal/dri_interface.h | 9 +++++++++ src/egl/drivers/dri2/egl_dri2.c | 29 +++++++++++++++++++++++++---- src/glx/dri2_glx.c | 26 ++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 9ee039b..641a2dc 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -251,6 +251,15 @@ struct __DRItexBufferExtensionRec { GLint target, GLint format, __DRIdrawable *pDraw); + /** + * Method to release texture buffer in case some special platform + * need this. + * + * For GLX_EXT_texture_from_pixmap with AIGLX. + */ + void (*releaseTexBuffer)(__DRIcontext *pDRICtx, + GLint target, + __DRIdrawable *pDraw); }; /** diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 6f40ab9..0ca01e4 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; } diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index b0559b2..3b3d458 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -719,6 +719,32 @@ dri2_bind_tex_image(Display * dpy, static void dri2_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer) { +#if __DRI_TEX_BUFFER_VERSION >= 3 + struct glx_context *gc = __glXGetCurrentContext(); + struct dri2_context *pcp = (struct dri2_context *) gc; + __GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable); + struct glx_display *dpyPriv = __glXInitialize(dpy); + struct dri2_drawable *pdraw = (struct dri2_drawable *) base; + struct dri2_display *pdp = + (struct dri2_display *) dpyPriv->dri2Display; + struct dri2_screen *psc; + + if (pdraw != NULL) { + psc = (struct dri2_screen *) base->psc; + +#if __DRI2_FLUSH_VERSION >= 3 + if (!pdp->invalidateAvailable && psc->f) + psc->f->invalidate(pdraw->driDrawable); +#endif + + if (psc->texBuffer->base.version >= 3 && + psc->texBuffer->releaseTexBuffer != NULL) { + (*psc->texBuffer->releaseTexBuffer) (pcp->driContext, + pdraw->base.textureTarget, + pdraw->driDrawable); + } + } +#endif } static const struct glx_context_vtable dri2_context_vtable = { -- 1.6.1.3
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev