<div dir="ltr">Adding people who may have some shot at understanding this stuff<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 12, 2017 at 4:23 PM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The setTexBuffer2 hook from GLX is used to implement glxBindTexImageEXT<br>
which has tighter restrictions than just "it's shared". In particular,<br>
it says that any rendering to the image while it is bound causes the<br>
contents to become undefined. This means that we can do whatever aux<br>
tracking we want between glxBindTexImageEXT and glxReleaseTexImageEXT so<br>
long as we always transition from external in Bind and to external in<br>
Release.<br>
<br>
The fact that we were using make_shareable before was a problem because<br>
it would resolve away 100% of the aux data and then throw away our<br>
reference to the aux buffer. If the aux data was shared with some other<br>
application (i.e. if we're using I915_FORMAT_MOD_Y_TILED_CCS) then we<br>
would forget that the aux data even existed for the rest of eternity.<br>
This is fine for the first frame but any subsequent calls to<br>
glxBindTexImageEXT would bind the texture as if it has no aux<br>
whatsoever and no resolves would happen and texturing would happen as if<br>
there is no aux. This was causing rendering corruption in mutter when<br>
running on top of X11 with modifiers.<br>
---<br>
src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c | 2 +-<br>
1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c b/src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c<br>
index 09ff287..0e8a947 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c<br>
@@ -251,7 +251,7 @@ intelSetTexBuffer2(__<wbr>DRIcontext *pDRICtx, GLint target,<br>
internal_format = GL_RGB;<br>
}<br>
<br>
- intel_miptree_make_shareable(<wbr>brw, rb->mt);<br>
+ intel_miptree_prepare_<wbr>external(brw, rb->mt);<br>
<br>
_mesa_lock_texture(&brw->ctx, texObj);<br>
texImage = _mesa_get_tex_image(ctx, texObj, target, 0);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.0.400.gff86faf<br>
<br>
</font></span></blockquote></div><br></div>