<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 13, 2017 at 7:53 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/brw_<wbr>blorp.c | 9 +++--<br>
src/mesa/drivers/dri/i965/<wbr>gen6_depth_state.c | 12 +++----<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 50 ++++++++++++++-------------<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h | 7 ++--<br>
4 files changed, 39 insertions(+), 39 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
index 4bc53b76b5..b722454703 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
@@ -165,8 +165,13 @@ blorp_surf_for_miptree(struct brw_context *brw,<br>
<br>
surf->aux_usage = intel_miptree_get_aux_isl_<wbr>usage(brw, mt);<br>
<br>
- struct isl_surf *aux_surf = &tmp_surfs[1];<br>
- intel_miptree_get_aux_isl_<wbr>surf(brw, mt, surf->aux_usage, aux_surf);<br>
+ struct isl_surf *aux_surf;<br>
+ if (brw->gen == 6 && mt->hiz_buf) {<br>
+ aux_surf = &mt->hiz_buf->aux_base.surf;<br>
+ } else {<br>
+ aux_surf = &tmp_surfs[1];<br>
+ intel_miptree_get_aux_isl_<wbr>surf(brw, mt, surf->aux_usage, aux_surf);<br></blockquote><div><br></div><div>This is a bit awkward. Maybe just make intel_miptree_get_aux_isl_surf return the surf from hiz_buf on gen6? Not that it matters much since I have a feeling this is all going away in the future.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ }<br>
<br>
if (wants_resolve) {<br>
bool supports_aux = surf->aux_usage != ISL_AUX_USAGE_NONE &&<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 0d8785db65..0f5e4d3201 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>
@@ -165,18 +165,14 @@ gen6_emit_depth_stencil_hiz(<wbr>struct brw_context *brw,<br>
/* Emit hiz buffer. */<br>
if (hiz) {<br>
assert(depth_mt);<br>
- struct intel_mipmap_tree *hiz_mt = depth_mt->hiz_buf->mt;<br>
<br>
- assert(hiz_mt->array_layout == GEN6_HIZ_STENCIL);<br>
-<br>
- const uint32_t offset = intel_miptree_get_aligned_<wbr>offset(<br>
- hiz_mt,<br>
- hiz_mt->level[lod].level_x,<br>
- hiz_mt->level[lod].level_y);<br>
+ uint32_t offset;<br>
+ isl_surf_get_image_offset_B_<wbr>tile_sa(&depth_mt->hiz_buf-><wbr>aux_base.surf,<br>
+ lod, 0, 0, &offset, NULL, NULL);<br>
<br>
BEGIN_BATCH(3);<br>
OUT_BATCH((_3DSTATE_HIER_<wbr>DEPTH_BUFFER << 16) | (3 - 2));<br>
- OUT_BATCH(depth_mt->hiz_buf-><wbr>aux_base.pitch - 1);<br>
+ OUT_BATCH(depth_mt->hiz_buf-><wbr>aux_base.surf.row_pitch - 1);<br>
OUT_RELOC(depth_mt->hiz_buf-><a href="http://aux_base.bo" rel="noreferrer" target="_blank">a<wbr>ux_base.bo</a>,<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 d87dbfaacd..4dbf853eee 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>
@@ -1058,10 +1058,7 @@ intel_miptree_hiz_buffer_free(<wbr>struct intel_miptree_hiz_buffer *hiz_buf)<br>
if (hiz_buf == NULL)<br>
return;<br>
<br>
- if (hiz_buf->mt)<br>
- intel_miptree_release(&hiz_<wbr>buf->mt);<br>
- else<br>
- brw_bo_unreference(hiz_buf-><a href="http://aux_base.bo" rel="noreferrer" target="_blank">au<wbr>x_base.bo</a>);<br>
+ brw_bo_unreference(hiz_buf-><a href="http://aux_base.bo" rel="noreferrer" target="_blank">au<wbr>x_base.bo</a>);<br>
<br>
free(hiz_buf);<br>
}<br>
@@ -2007,34 +2004,39 @@ intel_hiz_miptree_buf_create(<wbr>struct brw_context *brw,<br>
struct intel_mipmap_tree *mt)<br>
{<br>
struct intel_miptree_hiz_buffer *buf = calloc(sizeof(*buf), 1);<br>
- uint32_t layout_flags = MIPTREE_LAYOUT_ACCELERATED_<wbr>UPLOAD;<br>
+ if (!buf)<br>
+ return NULL;<br>
<br>
- if (brw->gen == 6)<br>
- layout_flags |= MIPTREE_LAYOUT_GEN6_HIZ_<wbr>STENCIL;<br>
+ struct isl_surf_init_info init_info = {<br>
+ .dim = get_isl_surf_dim(mt->target),<br>
+ .format = ISL_FORMAT_HIZ,<br>
+ .width = mt->logical_width0,<br>
+ .height = mt->logical_height0,<br>
+ .depth = mt->target == GL_TEXTURE_3D ? mt->logical_depth0 : 1,<br>
+ .levels = mt->last_level - mt->first_level + 1,<br>
+ .array_len = mt->target == GL_TEXTURE_3D ? 1 : mt->logical_depth0,<br>
+ .samples = MAX2(mt->num_samples, 1),<br>
+ .usage = ISL_SURF_USAGE_HIZ_BIT,<br>
+ .tiling_flags = ISL_TILING_HIZ_BIT<br>
+ };<br>
<br>
- if (!buf)<br>
+ if (!isl_surf_init_s(&brw->isl_<wbr>dev, &buf->aux_base.surf, &init_info)) {<br>
+ free(buf);<br>
return NULL;<br>
+ }<br>
<br>
- layout_flags |= MIPTREE_LAYOUT_TILING_ANY;<br>
- buf->mt = intel_miptree_create(brw,<br>
- mt->target,<br>
- mt->format,<br>
- mt->first_level,<br>
- mt->last_level,<br>
- mt->logical_width0,<br>
- mt->logical_height0,<br>
- mt->logical_depth0,<br>
- mt->num_samples,<br>
- layout_flags);<br>
- if (!buf->mt) {<br>
+ struct isl_surf *surf = &buf->aux_base.surf;<br>
+ unsigned pitch = surf->row_pitch;<br>
+ buf-><a href="http://aux_base.bo" rel="noreferrer" target="_blank">aux_base.bo</a> = brw_bo_alloc_tiled(brw-><wbr>bufmgr, "hiz", surf->row_pitch,<br>
+ surf->size / surf->row_pitch, 1,<br>
+ I915_TILING_Y, &pitch,<br>
+ BO_ALLOC_FOR_RENDER);<br>
+ if (!buf-><a href="http://aux_base.bo" rel="noreferrer" target="_blank">aux_base.bo</a>) {<br>
free(buf);<br>
return NULL;<br>
}<br>
<br>
- buf-><a href="http://aux_base.bo" rel="noreferrer" target="_blank">aux_base.bo</a> = buf->mt->bo;<br>
- buf->aux_base.size = buf->mt->total_height * buf->mt->pitch;<br>
- buf->aux_base.pitch = buf->mt->pitch;<br>
- buf->aux_base.qpitch = buf->mt->qpitch * 2;<br>
+ assert(pitch == surf->row_pitch);<br>
<br>
return buf;<br>
}<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
index 37d6bb3813..9f23088d7b 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
@@ -307,6 +307,8 @@ enum intel_aux_disable {<br>
*/<br>
struct intel_miptree_aux_buffer<br>
{<br>
+ struct isl_surf surf;<br>
+<br>
/**<br>
* Buffer object containing the pixel data.<br>
*<br>
@@ -360,11 +362,6 @@ struct intel_miptree_aux_buffer<br>
struct intel_miptree_hiz_buffer<br>
{<br>
struct intel_miptree_aux_buffer aux_base;<br>
-<br>
- /**<br>
- * Hiz miptree. Used only by Gen6.<br>
- */<br>
- struct intel_mipmap_tree *mt;<br>
};<br>
<br>
struct intel_mipmap_tree<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></div>