if (mt->mcs_buf && !(flags & INTEL_AUX_BUFFER_DISABLED)) {
intel_miptree_get_aux_isl_surf(brw, mt, &aux_surf_s, &aux_usage);
aux_surf = &aux_surf_s;
- assert(mt->mcs_buf->mt->offset == 0);
- aux_offset = mt->mcs_buf->mt->bo->offset64;
+ assert(mt->mcs_buf->offset == 0);
+ aux_offset = mt->mcs_buf->bo->offset64;
/* We only really need a clear color if we also have an auxiliary
* surfacae. Without one, it does nothing.
assert((aux_offset & 0xfff) == 0);
drm_intel_bo_emit_reloc(brw->batch.bo,
*surf_offset + 4 * ss_info.aux_reloc_dw,
- mt->mcs_buf->mt->bo,
+ mt->mcs_buf->bo,
dw[ss_info.aux_reloc_dw] & 0xfff,
read_domains, write_domains);
}
free((*mt)->hiz_buf);
}
if ((*mt)->mcs_buf) {
- intel_miptree_release(&(*mt)->mcs_buf->mt);
+ drm_intel_bo_unreference((*mt)->mcs_buf->bo);
free((*mt)->mcs_buf);
}
intel_resolve_map_clear(&(*mt)->hiz_map);
const int ret = brw_bo_map_gtt(brw, mt->mcs_buf->bo, "miptree");
if (unlikely(ret)) {
fprintf(stderr, "Failed to map mcs buffer into GTT\n");
- intel_miptree_release(&mt->mcs_buf->mt);
+ drm_intel_bo_unreference(mt->mcs_buf->bo);
free(mt->mcs_buf);
return;
}
void *data = mt->mcs_buf->bo->virtual;
- memset(data, init_value,
- mt->mcs_buf->mt->total_height * mt->mcs_buf->mt->pitch);
+ memset(data, init_value, mt->mcs_buf->size);
drm_intel_bo_unmap(mt->mcs_buf->bo);
mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR;
}
uint32_t layout_flags)
{
struct intel_miptree_aux_buffer *buf = calloc(sizeof(*buf), 1);
+ struct intel_mipmap_tree *temp_mt;
if (!buf)
return NULL;
* "The MCS surface must be stored as Tile Y."
*/
layout_flags |= MIPTREE_LAYOUT_TILING_Y;
- buf->mt = miptree_create(brw,
+ temp_mt = miptree_create(brw,
mt->target,
format,
mt->first_level,
mt->logical_depth0,
0 /* num_samples */,
layout_flags);
- if (!buf->mt) {
+ if (!temp_mt) {
free(buf);
return NULL;
}
- buf->bo = buf->mt->bo;
- buf->pitch = buf->mt->pitch;
- buf->qpitch = buf->mt->qpitch;
+ buf->bo = temp_mt->bo;
+ buf->offset = temp_mt->offset;
+ buf->size = temp_mt->total_height * temp_mt->pitch;
+ buf->pitch = temp_mt->pitch;
+ buf->qpitch = temp_mt->qpitch;
+
+ /* Just hang on to the BO which backs the AUX buffer; the rest of the miptree
+ * structure should go away. We use miptree create simply as a means to make
+ * sure all the constraints for the buffer are satisfied.
+ */
+ drm_intel_bo_reference(temp_mt->bo);
+ intel_miptree_release(&temp_mt);
return buf;
}
{
uint32_t aux_pitch, aux_qpitch;
if (mt->mcs_buf) {
- aux_pitch = mt->mcs_buf->mt->pitch;
- aux_qpitch = mt->mcs_buf->mt->qpitch;
+ aux_pitch = mt->mcs_buf->pitch;
+ aux_qpitch = mt->mcs_buf->qpitch;
if (mt->num_samples > 1) {
assert(mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS);
*/
drm_intel_bo *bo;
+ /**
+ * Offset into bo where the surface starts.
+ *
+ * @see intel_mipmap_aux_buffer::bo
+ *
+ * @see RENDER_SURFACE_STATE.AuxiliarySurfaceBaseAddress
+ * @see 3DSTATE_DEPTH_BUFFER.SurfaceBaseAddress
+ * @see 3DSTATE_HIER_DEPTH_BUFFER.SurfaceBaseAddress
+ * @see 3DSTATE_STENCIL_BUFFER.SurfaceBaseAddress
+ */
+ uint32_t offset;
+
+ /*
+ * Size of the MCS surface.
+ *
+ * This is needed when doing any gtt mapped operations on the buffer (which
+ * will be Y-tiled). It is possible that it will not be the same as bo->size
+ * when the drm allocator rounds up the requested size.
+ */
+ size_t size;
+
/**
* Pitch in bytes.
*