[Mesa-dev] [PATCH 4/4] i965: Use prepare_external instead of make_shareable in setTexBuffer2

Jason Ekstrand jason at jlekstrand.net
Tue Sep 12 23:29:57 UTC 2017


Adding people who may have some shot at understanding this stuff

On Tue, Sep 12, 2017 at 4:23 PM, Jason Ekstrand <jason at jlekstrand.net>
wrote:

> The setTexBuffer2 hook from GLX is used to implement glxBindTexImageEXT
> which has tighter restrictions than just "it's shared".  In particular,
> it says that any rendering to the image while it is bound causes the
> contents to become undefined.  This means that we can do whatever aux
> tracking we want between glxBindTexImageEXT and glxReleaseTexImageEXT so
> long as we always transition from external in Bind and to external in
> Release.
>
> The fact that we were using make_shareable before was a problem because
> it would resolve away 100% of the aux data and then throw away our
> reference to the aux buffer.  If the aux data was shared with some other
> application (i.e. if we're using I915_FORMAT_MOD_Y_TILED_CCS) then we
> would forget that the aux data even existed for the rest of eternity.
> This is fine for the first frame but any subsequent calls to
> glxBindTexImageEXT would bind the texture as if it has no aux
> whatsoever and no resolves would happen and texturing would happen as if
> there is no aux.  This was causing rendering corruption in mutter when
> running on top of X11 with modifiers.
> ---
>  src/mesa/drivers/dri/i965/intel_tex_image.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c
> b/src/mesa/drivers/dri/i965/intel_tex_image.c
> index 09ff287..0e8a947 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_image.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
> @@ -251,7 +251,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint
> target,
>        internal_format = GL_RGB;
>     }
>
> -   intel_miptree_make_shareable(brw, rb->mt);
> +   intel_miptree_prepare_external(brw, rb->mt);
>
>     _mesa_lock_texture(&brw->ctx, texObj);
>     texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
> --
> 2.5.0.400.gff86faf
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170912/181d79c9/attachment.html>


More information about the mesa-dev mailing list