<div dir="ltr"><div>Series is<br><br>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><br></div>Nanley is also reviewing so he may want you to wait for him.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 13, 2017 at 7:50 AM, 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">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>gen6_depth_state.c | 31 +++++++++++----------------<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 7 ++++++<br>
2 files changed, 19 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>gen6_depth_state.c b/src/mesa/drivers/dri/i965/<wbr>gen6_depth_state.c<br>
index dcee1f9b61..0d8785db65 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>gen6_depth_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>gen6_depth_state.c<br>
@@ -91,7 +91,8 @@ gen6_emit_depth_stencil_hiz(<wbr>struct brw_context *brw,<br>
break;<br>
case GL_TEXTURE_3D:<br>
assert(mt);<br>
- depth = MAX2(mt->logical_depth0, 1);<br>
+ depth = mt->surf.size > 0 ? mt->surf.logical_level0_px.<wbr>depth :<br>
+ MAX2(mt->logical_depth0, 1);<br>
/* fallthrough */<br>
default:<br>
surftype = translate_tex_target(gl_<wbr>target);<br>
@@ -102,7 +103,10 @@ gen6_emit_depth_stencil_hiz(<wbr>struct brw_context *brw,<br>
<br>
lod = irb ? irb->mt_level - irb->mt->first_level : 0;<br>
<br>
- if (mt) {<br>
+ if (mt && mt->surf.size > 0) {<br>
+ width = mt->surf.logical_level0_px.<wbr>width;<br>
+ height = mt->surf.logical_level0_px.<wbr>height;<br>
+ } else if (mt) {<br>
width = mt->logical_width0;<br>
height = mt->logical_height0;<br>
}<br>
@@ -187,27 +191,16 @@ gen6_emit_depth_stencil_hiz(<wbr>struct brw_context *brw,<br>
<br>
/* Emit stencil buffer. */<br>
if (separate_stencil) {<br>
- uint32_t offset = 0;<br>
+ assert(stencil_mt->format == MESA_FORMAT_S_UINT8);<br>
+ assert(stencil_mt->surf.size > 0);<br>
<br>
- if (stencil_mt->array_layout == GEN6_HIZ_STENCIL) {<br>
- assert(stencil_mt->format == MESA_FORMAT_S_UINT8);<br>
-<br>
- /* Note: we can't compute the stencil offset using<br>
- * intel_region_get_aligned_<wbr>offset(), because stencil_region<br>
- * claims that the region is untiled even though it's W tiled.<br>
- */<br>
- offset = stencil_mt->level[lod].level_y * stencil_mt->pitch +<br>
- stencil_mt->level[lod].level_x * 64;<br>
- }<br>
+ uint32_t offset;<br>
+ isl_surf_get_image_offset_B_<wbr>tile_sa(&stencil_mt->surf,<br>
+ lod, 0, 0, &offset, NULL, NULL);<br>
<br>
BEGIN_BATCH(3);<br>
OUT_BATCH((_3DSTATE_STENCIL_<wbr>BUFFER << 16) | (3 - 2));<br>
- /* The stencil buffer has quirky pitch requirements. From Vol 2a,<br>
- * 11.5.6.2.1 3DSTATE_STENCIL_BUFFER, field "Surface Pitch":<br>
- * The pitch must be set to 2x the value computed based on width, as<br>
- * the stencil buffer is stored with two rows interleaved.<br>
- */<br>
- OUT_BATCH(2 * stencil_mt->pitch - 1);<br>
+ OUT_BATCH(stencil_mt->surf.<wbr>row_pitch - 1);<br>
OUT_RELOC(stencil_mt->bo,<br>
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,<br>
offset);<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 e2de4df498..26025311a0 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>
@@ -730,6 +730,13 @@ miptree_create(struct brw_context *brw,<br>
GLuint num_samples,<br>
uint32_t layout_flags)<br>
{<br>
+ if (brw->gen == 6 && format == MESA_FORMAT_S_UINT8)<br>
+ return make_surface(brw, target, format, first_level, last_level,<br>
+ width0, height0, depth0, num_samples, ISL_TILING_W,<br>
+ ISL_SURF_USAGE_STENCIL_BIT |<br>
+ ISL_SURF_USAGE_TEXTURE_BIT,<br>
+ BO_ALLOC_FOR_RENDER, NULL);<br>
+<br>
struct intel_mipmap_tree *mt;<br>
mesa_format tex_format = format;<br>
mesa_format etc_format = MESA_FORMAT_NONE;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>