<div dir="ltr"><div>Ugh... Yeah, this is probably needed.  I've got another patch in my tree (I'll probably send that series tomorrow) which moves all of the resolve stuff back to brw_draw.c and not intel_update_state.<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 9, 2017 at 2:11 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The resolve code looks at the current color draw buffers.  These are not<br>
valid until intel_prepare_render() is called.  You can end up with one<br>
color buffer bound, but where the renderbuffer has zero width/height and<br>
no miptree allocated.<br>
<br>
You can get a call chain like: _mesa_Clear -> _mesa_update_state -><br>
intel_update_state, where no brw driver hooks were called, so there is<br>
no other point at which we could have called this.<br>
<br>
Fixes crashes in KWin where Clear was causing intel_disable_rb_aux_buffer<br>
to crash on irb != NULL but irb->mt == NULL.<br>
<br>
Tested-by: Tobias Klausmann <<a href="mailto:tobias.johannes.klausmann@mni.thm.de">tobias.johannes.klausmann@<wbr>mni.thm.de</a>><br>
Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>context.c | 2 ++<br>
 1 file changed, 2 insertions(+)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_context.c b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
index 6d27866fcea..5433f9080ee 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
@@ -201,6 +201,8 @@ intel_update_state(struct gl_context * ctx)<br>
<br>
    _mesa_unlock_context_textures(<wbr>ctx);<br>
<br>
+   intel_prepare_render(brw);<br>
+<br>
    /* Resolve the depth buffer's HiZ buffer. */<br>
    depth_irb = intel_get_renderbuffer(ctx-><wbr>DrawBuffer, BUFFER_DEPTH);<br>
    if (depth_irb && depth_irb->mt) {<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.0<br>
<br>
</font></span></blockquote></div><br></div>