<div dir="ltr">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 Wed, Jun 21, 2017 at 12:35 PM, Topi Pohjolainen <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Fixes dEQP-EGL.functional.image.<wbr>render_multiple_contexts.<br>
gles2_renderbuffer_stencil_<wbr>stencil_buffer<br>
<br>
CC: Mark Janes <<a href="mailto:mark.a.janes@intel.com">mark.a.janes@intel.com</a>><br>
CC: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
CC: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
 src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 19 ++++++++++++++++---<br>
 1 file changed, 16 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
index abc7f989db..69b02ead78 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
@@ -897,7 +897,22 @@ intel_miptree_create_for_bo(<wbr>struct brw_context *brw,<br>
 {<br>
    struct intel_mipmap_tree *mt;<br>
    uint32_t tiling, swizzle;<br>
-   GLenum target;<br>
+   const GLenum target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;<br>
+<br>
+   if (brw->gen == 6 && format == MESA_FORMAT_S_UINT8) {<br>
+      mt = make_surface(brw, target, MESA_FORMAT_S_UINT8,<br>
+                        0, 0, width, height, depth, 1, ISL_TILING_W,<br>
+                        ISL_SURF_USAGE_STENCIL_BIT |<br>
+                        ISL_SURF_USAGE_TEXTURE_BIT,<br>
+                        BO_ALLOC_FOR_RENDER, bo);<br>
+      if (!mt)<br>
+         return NULL;<br>
+<br>
+      assert(bo->size >= mt->surf.size);<br>
+<br>
+      brw_bo_reference(bo);<br>
+      return mt;<br>
+   }<br>
<br>
    brw_bo_get_tiling(bo, &tiling, &swizzle);<br>
<br>
@@ -912,8 +927,6 @@ intel_miptree_create_for_bo(<wbr>struct brw_context *brw,<br>
     */<br>
    assert(pitch >= 0);<br>
<br>
-   target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;<br>
-<br>
    /* The BO already has a tiling format and we shouldn't confuse the lower<br>
     * layers by making it try to find a tiling format again.<br>
     */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
</font></span></blockquote></div><br></div>