surf->aux_usage = intel_miptree_get_aux_isl_usage(brw, mt);
- struct isl_surf *aux_surf = &tmp_surfs[1];
- intel_miptree_get_aux_isl_surf(brw, mt, surf->aux_usage, aux_surf);
+ struct isl_surf *aux_surf;
+ if (brw->gen == 6 && mt->hiz_buf) {
+ aux_surf = &mt->hiz_buf->aux_base.surf;
+ } else {
+ aux_surf = &tmp_surfs[1];
+ intel_miptree_get_aux_isl_surf(brw, mt, surf->aux_usage, aux_surf);
+ }
if (wants_resolve) {
bool supports_aux = surf->aux_usage != ISL_AUX_USAGE_NONE &&
/* Emit hiz buffer. */
if (hiz) {
assert(depth_mt);
- struct intel_mipmap_tree *hiz_mt = depth_mt->hiz_buf->mt;
- assert(hiz_mt->array_layout == GEN6_HIZ_STENCIL);
-
- const uint32_t offset = intel_miptree_get_aligned_offset(
- hiz_mt,
- hiz_mt->level[lod].level_x,
- hiz_mt->level[lod].level_y);
+ uint32_t offset;
+ isl_surf_get_image_offset_B_tile_sa(&depth_mt->hiz_buf->aux_base.surf,
+ lod, 0, 0, &offset, NULL, NULL);
BEGIN_BATCH(3);
OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
- OUT_BATCH(depth_mt->hiz_buf->aux_base.pitch - 1);
+ OUT_BATCH(depth_mt->hiz_buf->aux_base.surf.row_pitch - 1);
OUT_RELOC(depth_mt->hiz_buf->aux_base.bo,
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
offset);
if (hiz_buf == NULL)
return;
- if (hiz_buf->mt)
- intel_miptree_release(&hiz_buf->mt);
- else
- brw_bo_unreference(hiz_buf->aux_base.bo);
+ brw_bo_unreference(hiz_buf->aux_base.bo);
free(hiz_buf);
}
struct intel_mipmap_tree *mt)
{
struct intel_miptree_hiz_buffer *buf = calloc(sizeof(*buf), 1);
- uint32_t layout_flags = MIPTREE_LAYOUT_ACCELERATED_UPLOAD;
-
- if (brw->gen == 6)
- layout_flags |= MIPTREE_LAYOUT_GEN6_HIZ_STENCIL;
-
if (!buf)
return NULL;
- layout_flags |= MIPTREE_LAYOUT_TILING_ANY;
- buf->mt = intel_miptree_create(brw,
- mt->target,
- mt->format,
- mt->first_level,
- mt->last_level,
- mt->logical_width0,
- mt->logical_height0,
- mt->logical_depth0,
- mt->num_samples,
- layout_flags);
- if (!buf->mt) {
+ struct isl_surf temp_main_surf;
+ intel_miptree_get_isl_surf(brw, mt, &temp_main_surf);
+
+ if (!isl_surf_get_hiz_surf(&brw->isl_dev, &temp_main_surf,
+ &buf->aux_base.surf)) {
free(buf);
return NULL;
}
- buf->aux_base.bo = buf->mt->bo;
- buf->aux_base.size = buf->mt->total_height * buf->mt->pitch;
- buf->aux_base.pitch = buf->mt->pitch;
- buf->aux_base.qpitch = buf->mt->qpitch * 2;
+ struct isl_surf *surf = &buf->aux_base.surf;
+ buf->aux_base.bo = brw_bo_alloc_tiled(brw->bufmgr, "hiz", surf->size,
+ I915_TILING_Y, surf->row_pitch,
+ BO_ALLOC_FOR_RENDER);
+ if (!buf->aux_base.bo) {
+ free(buf);
+ return NULL;
+ }
return buf;
}
*/
struct intel_miptree_aux_buffer
{
+ struct isl_surf surf;
+
/**
* Buffer object containing the pixel data.
*
struct intel_miptree_hiz_buffer
{
struct intel_miptree_aux_buffer aux_base;
-
- /**
- * Hiz miptree. Used only by Gen6.
- */
- struct intel_mipmap_tree *mt;
};
struct intel_mipmap_tree