assert(mt->last_level == 0);
/* We shouldn't already have a CCS */
- assert(!mt->mcs_buf);
+ assert(!mt->aux_buf);
if (!isl_surf_get_ccs_surf(&brw->isl_dev, &mt->surf, &temp_ccs_surf,
image->aux_pitch))
assert(image->aux_offset < image->bo->size);
assert(temp_ccs_surf.size <= image->bo->size - image->aux_offset);
- mt->mcs_buf = calloc(sizeof(*mt->mcs_buf), 1);
- if (mt->mcs_buf == NULL)
+ mt->aux_buf = calloc(sizeof(*mt->aux_buf), 1);
+ if (mt->aux_buf == NULL)
return false;
mt->aux_state = create_aux_state_map(mt, initial_state);
if (!mt->aux_state) {
- free(mt->mcs_buf);
- mt->mcs_buf = NULL;
+ free(mt->aux_buf);
+ mt->aux_buf = NULL;
return false;
}
*/
const struct gen_device_info *devinfo = &brw->screen->devinfo;
if (devinfo->gen >= 10) {
- mt->mcs_buf->clear_color_bo =
+ mt->aux_buf->clear_color_bo =
brw_bo_alloc(brw->bufmgr, "clear_color_bo",
brw->isl_dev.ss.clear_color_state_size);
- if (!mt->mcs_buf->clear_color_bo) {
- free(mt->mcs_buf);
- mt->mcs_buf = NULL;
+ if (!mt->aux_buf->clear_color_bo) {
+ free(mt->aux_buf);
+ mt->aux_buf = NULL;
return false;
}
}
- mt->mcs_buf->bo = image->bo;
+ mt->aux_buf->bo = image->bo;
brw_bo_reference(image->bo);
- mt->mcs_buf->offset = image->aux_offset;
- mt->mcs_buf->size = image->bo->size - image->aux_offset;
- mt->mcs_buf->pitch = image->aux_pitch;
- mt->mcs_buf->qpitch = 0;
- mt->mcs_buf->surf = temp_ccs_surf;
+ mt->aux_buf->offset = image->aux_offset;
+ mt->aux_buf->size = image->bo->size - image->aux_offset;
+ mt->aux_buf->pitch = image->aux_pitch;
+ mt->aux_buf->qpitch = 0;
+ mt->aux_buf->surf = temp_ccs_surf;
return true;
}
brw_bo_unreference((*mt)->bo);
intel_miptree_release(&(*mt)->stencil_mt);
intel_miptree_release(&(*mt)->r8stencil_mt);
- intel_miptree_aux_buffer_free(intel_miptree_get_aux_buffer(*mt));
+ intel_miptree_aux_buffer_free((*mt)->aux_buf);
free_aux_state_map((*mt)->aux_state);
intel_miptree_release(&(*mt)->plane[0]);
struct intel_mipmap_tree *mt,
int init_value)
{
- assert(mt->mcs_buf != NULL);
+ assert(mt->aux_buf != NULL);
/* From the Ivy Bridge PRM, Vol 2 Part 1 p326:
*
*
* Note: the clear value for MCS buffers is all 1's, so we memset to 0xff.
*/
- void *map = brw_bo_map(brw, mt->mcs_buf->bo, MAP_WRITE | MAP_RAW);
+ void *map = brw_bo_map(brw, mt->aux_buf->bo, MAP_WRITE | MAP_RAW);
if (unlikely(map == NULL)) {
fprintf(stderr, "Failed to map mcs buffer into GTT\n");
- brw_bo_unreference(mt->mcs_buf->bo);
- free(mt->mcs_buf);
+ brw_bo_unreference(mt->aux_buf->bo);
+ free(mt->aux_buf);
return;
}
void *data = map;
- memset(data, init_value, mt->mcs_buf->size);
- brw_bo_unmap(mt->mcs_buf->bo);
+ memset(data, init_value, mt->aux_buf->size);
+ brw_bo_unmap(mt->aux_buf->bo);
}
static struct intel_miptree_aux_buffer *
GLuint num_samples)
{
assert(brw->screen->devinfo.gen >= 7); /* MCS only used on Gen7+ */
- assert(mt->mcs_buf == NULL);
+ assert(mt->aux_buf == NULL);
assert(mt->aux_usage == ISL_AUX_USAGE_MCS);
/* Multisampled miptrees are only supported for single level. */
* to be just used by the GPU.
*/
const uint32_t alloc_flags = 0;
- mt->mcs_buf = intel_alloc_aux_buffer(brw, "mcs-miptree",
+ mt->aux_buf = intel_alloc_aux_buffer(brw, "mcs-miptree",
&temp_mcs_surf, alloc_flags, mt);
- if (!mt->mcs_buf) {
+ if (!mt->aux_buf) {
free(aux_state);
return false;
}
intel_miptree_alloc_ccs(struct brw_context *brw,
struct intel_mipmap_tree *mt)
{
- assert(mt->mcs_buf == NULL);
+ assert(mt->aux_buf == NULL);
assert(mt->aux_usage == ISL_AUX_USAGE_CCS_E ||
mt->aux_usage == ISL_AUX_USAGE_CCS_D);
*/
const uint32_t alloc_flags = mt->aux_usage == ISL_AUX_USAGE_CCS_E ?
BO_ALLOC_ZEROED : BO_ALLOC_BUSY;
- mt->mcs_buf = intel_alloc_aux_buffer(brw, "ccs-miptree",
+ mt->aux_buf = intel_alloc_aux_buffer(brw, "ccs-miptree",
&temp_ccs_surf, alloc_flags, mt);
- if (!mt->mcs_buf) {
+ if (!mt->aux_buf) {
free(aux_state);
return false;
}
{
const struct gen_device_info *devinfo = &brw->screen->devinfo;
- assert(mt->hiz_buf);
+ assert(mt->aux_buf);
assert(mt->surf.size > 0);
if (devinfo->gen >= 8 || devinfo->is_haswell) {
intel_miptree_alloc_hiz(struct brw_context *brw,
struct intel_mipmap_tree *mt)
{
- assert(mt->hiz_buf == NULL);
+ assert(mt->aux_buf == NULL);
assert(mt->aux_usage == ISL_AUX_USAGE_HIZ);
enum isl_aux_state **aux_state =
assert(ok);
const uint32_t alloc_flags = BO_ALLOC_BUSY;
- mt->hiz_buf = intel_alloc_aux_buffer(brw, "hiz-miptree",
+ mt->aux_buf = intel_alloc_aux_buffer(brw, "hiz-miptree",
&temp_hiz_surf, alloc_flags, mt);
- if (!mt->hiz_buf) {
+ if (!mt->aux_buf) {
free(aux_state);
return false;
}
return false;
}
- if (!mt->hiz_buf) {
+ if (!mt->aux_buf) {
return false;
}
{
assert(_mesa_is_format_color_format(mt->format));
- if (!mt->mcs_buf)
+ if (!mt->aux_buf)
return false;
/* Clamp the level range to fit the miptree */
const struct intel_mipmap_tree *mt,
unsigned level, unsigned layer)
{
- if (!mt->mcs_buf)
+ if (!mt->aux_buf)
return;
/* Fast color clear is supported for mipmapped surfaces only on Gen8+. */
break;
case ISL_AUX_USAGE_MCS:
- assert(mt->mcs_buf);
+ assert(mt->aux_buf);
assert(start_level == 0 && num_levels == 1);
const uint32_t level_layers =
miptree_layer_range_length(mt, 0, start_layer, num_layers);
case ISL_AUX_USAGE_CCS_D:
case ISL_AUX_USAGE_CCS_E:
- if (!mt->mcs_buf)
+ if (!mt->aux_buf)
return;
for (uint32_t l = 0; l < num_levels; l++) {
break;
case ISL_AUX_USAGE_HIZ:
- assert(mt->hiz_buf);
+ assert(mt->aux_buf);
for (uint32_t l = 0; l < num_levels; l++) {
const uint32_t level = start_level + l;
if (!intel_miptree_level_has_hiz(mt, level))
break;
case ISL_AUX_USAGE_MCS:
- assert(mt->mcs_buf);
+ assert(mt->aux_buf);
for (uint32_t a = 0; a < num_layers; a++) {
intel_miptree_finish_mcs_write(brw, mt, start_layer + a,
aux_usage);
case ISL_AUX_USAGE_CCS_D:
case ISL_AUX_USAGE_CCS_E:
- if (!mt->mcs_buf)
+ if (!mt->aux_buf)
return;
for (uint32_t a = 0; a < num_layers; a++) {
intel_miptree_check_level_layer(mt, level, layer);
if (_mesa_is_format_color_format(mt->format)) {
- assert(mt->mcs_buf != NULL);
+ assert(mt->aux_buf != NULL);
assert(mt->surf.samples == 1 ||
mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);
} else if (mt->format == MESA_FORMAT_S_UINT8) {
num_layers = miptree_layer_range_length(mt, level, start_layer, num_layers);
if (_mesa_is_format_color_format(mt->format)) {
- assert(mt->mcs_buf != NULL);
+ assert(mt->aux_buf != NULL);
assert(mt->surf.samples == 1 ||
mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);
} else if (mt->format == MESA_FORMAT_S_UINT8) {
case ISL_AUX_USAGE_CCS_D:
case ISL_AUX_USAGE_CCS_E:
- if (!mt->mcs_buf) {
+ if (!mt->aux_buf) {
assert(mt->aux_usage == ISL_AUX_USAGE_CCS_D);
return ISL_AUX_USAGE_NONE;
}
switch (mt->aux_usage) {
case ISL_AUX_USAGE_MCS:
- assert(mt->mcs_buf);
+ assert(mt->aux_buf);
return ISL_AUX_USAGE_MCS;
case ISL_AUX_USAGE_CCS_D:
case ISL_AUX_USAGE_CCS_E:
- if (!mt->mcs_buf) {
+ if (!mt->aux_buf) {
assert(mt->aux_usage == ISL_AUX_USAGE_CCS_D);
return ISL_AUX_USAGE_NONE;
}
uint32_t start_layer, uint32_t layer_count)
{
intel_miptree_prepare_access(brw, mt, level, 1, start_layer, layer_count,
- mt->aux_usage, mt->hiz_buf != NULL);
+ mt->aux_usage, mt->aux_buf != NULL);
}
void
{
if (depth_written) {
intel_miptree_finish_write(brw, mt, level, start_layer, layer_count,
- mt->hiz_buf != NULL);
+ mt->aux_buf != NULL);
}
}
assert(mt->surf.logical_level0_px.depth == 1);
assert(mt->surf.logical_level0_px.array_len == 1);
assert(mt->surf.samples == 1);
- assert(mt->mcs_buf != NULL);
+ assert(mt->aux_buf != NULL);
aux_usage = mod_info->aux_usage;
supports_fast_clear = mod_info->supports_clear_color;
intel_miptree_finish_external(struct brw_context *brw,
struct intel_mipmap_tree *mt)
{
- if (!mt->mcs_buf)
+ if (!mt->aux_buf)
return;
/* We don't know the actual aux state of the aux surface. The previous
0, INTEL_REMAINING_LAYERS,
ISL_AUX_USAGE_NONE, false);
- struct intel_miptree_aux_buffer *aux_buf = intel_miptree_get_aux_buffer(mt);
- if (aux_buf) {
- intel_miptree_aux_buffer_free(aux_buf);
- mt->mcs_buf = NULL;
- mt->hiz_buf = NULL;
+ if (mt->aux_buf) {
+ intel_miptree_aux_buffer_free(mt->aux_buf);
+ mt->aux_buf = NULL;
/* Make future calls of intel_miptree_level_has_hiz() return false. */
for (uint32_t l = mt->first_level; l <= mt->last_level; ++l) {
*/
uint32_t offset;
- /**
- * \brief HiZ aux buffer
- *
- * To allocate the hiz buffer, use intel_miptree_alloc_hiz().
- *
- * To determine if hiz is enabled, do not check this pointer. Instead, use
- * intel_miptree_level_has_hiz().
- */
- struct intel_miptree_aux_buffer *hiz_buf;
-
/**
* \brief The type of auxiliary compression used by this miptree.
*
bool r8stencil_needs_update;
/**
- * \brief MCS auxiliary buffer.
+ * \brief CCS, MCS, or HiZ auxiliary buffer.
+ *
+ * NULL if no auxiliary buffer is in use for this surface.
*
- * This buffer contains the "multisample control surface", which stores
- * the necessary information to implement compressed MSAA
- * (INTEL_MSAA_FORMAT_CMS) and "fast color clear" behaviour on Gen7+.
+ * For single-sampled color miptrees:
+ * This buffer contains the Color Control Surface, which stores the
+ * necessary information to implement lossless color compression (CCS_E)
+ * and "fast color clear" (CCS_D) behaviour.
*
- * NULL if no MCS buffer is in use for this surface.
+ * For multi-sampled color miptrees:
+ * This buffer contains the Multisample Control Surface, which stores the
+ * necessary information to implement compressed MSAA
+ * (INTEL_MSAA_FORMAT_CMS).
+ *
+ * For depth miptrees:
+ * This buffer contains the Hierarchical Depth Buffer, which stores the
+ * necessary information to implement lossless depth compression and fast
+ * depth clear behavior.
+ *
+ * To determine if HiZ is enabled, do not check this pointer. Instead,
+ * use intel_miptree_level_has_hiz().
*/
- struct intel_miptree_aux_buffer *mcs_buf;
+ struct intel_miptree_aux_buffer *aux_buf;
/**
* Planes 1 and 2 in case this is a planar surface.
get_isl_dim_layout(const struct gen_device_info *devinfo,
enum isl_tiling tiling, GLenum target);
-static inline struct intel_miptree_aux_buffer *
-intel_miptree_get_aux_buffer(const struct intel_mipmap_tree *mt)
-{
- switch (mt->aux_usage) {
- case ISL_AUX_USAGE_MCS:
- case ISL_AUX_USAGE_CCS_D:
- case ISL_AUX_USAGE_CCS_E:
- return mt->mcs_buf;
- case ISL_AUX_USAGE_HIZ:
- return mt->hiz_buf;
- case ISL_AUX_USAGE_NONE:
- return NULL;
- default:
- unreachable("Invalid aux_usage!\n");
- }
-}
-
void
intel_get_image_dims(struct gl_texture_image *image,
int *width, int *height, int *depth);