const bool has_ccs =
((devinfo->ver >= 7 && !res->mod_info && !(INTEL_DEBUG & DEBUG_NO_RBC)) ||
(res->mod_info && res->mod_info->aux_usage != ISL_AUX_USAGE_NONE)) &&
- isl_surf_get_ccs_surf(&screen->isl_dev, &res->surf, &res->aux.surf,
- NULL, 0);
+ isl_surf_get_ccs_surf(&screen->isl_dev, &res->surf, NULL,
+ &res->aux.surf, 0);
/* Having more than one type of compression is impossible */
assert(has_ccs + has_mcs + has_hiz <= 1);
return true;
}
+static bool
+iris_get_ccs_surf(const struct isl_device *dev,
+ const struct isl_surf *surf,
+ struct isl_surf *aux_surf,
+ struct isl_surf *extra_aux_surf,
+ uint32_t row_pitch_B)
+{
+ assert(extra_aux_surf->size_B == 0);
+
+ struct isl_surf *ccs_surf;
+ const struct isl_surf *hiz_or_mcs_surf;
+ if (aux_surf->size_B > 0) {
+ assert(aux_surf->usage & (ISL_SURF_USAGE_HIZ_BIT |
+ ISL_SURF_USAGE_MCS_BIT));
+ hiz_or_mcs_surf = aux_surf;
+ ccs_surf = extra_aux_surf;
+ } else {
+ hiz_or_mcs_surf = NULL;
+ ccs_surf = aux_surf;
+ }
+
+ return isl_surf_get_ccs_surf(dev, surf, hiz_or_mcs_surf,
+ ccs_surf, row_pitch_B);
+}
+
/**
* Configure aux for the resource, but don't allocate it. For images which
* might be shared with modifiers, we must allocate the image and aux data in
const bool has_ccs =
((!res->mod_info && !(INTEL_DEBUG & DEBUG_NO_RBC)) ||
(res->mod_info && res->mod_info->aux_usage != ISL_AUX_USAGE_NONE)) &&
- isl_surf_get_ccs_surf(&screen->isl_dev, &res->surf, &res->aux.surf,
- &res->aux.extra_aux.surf, 0);
+ iris_get_ccs_surf(&screen->isl_dev, &res->surf, &res->aux.surf,
+ &res->aux.extra_aux.surf, 0);
/* Having both HIZ and MCS is impossible. */
assert(!has_mcs || !has_hiz);
- /* Ensure aux surface creation for MCS_CCS and HIZ_CCS is correct. */
- if (has_ccs && (has_mcs || has_hiz)) {
- assert(res->aux.extra_aux.surf.size_B > 0 &&
- res->aux.extra_aux.surf.usage & ISL_SURF_USAGE_CCS_BIT);
- assert(res->aux.surf.size_B > 0 &&
- res->aux.surf.usage &
- (ISL_SURF_USAGE_HIZ_BIT | ISL_SURF_USAGE_MCS_BIT));
- }
-
if (res->mod_info && has_ccs) {
/* Only allow a CCS modifier if the aux was created successfully. */
res->aux.possible_usages |= 1 << res->mod_info->aux_usage;
bool
isl_surf_get_ccs_surf(const struct isl_device *dev,
const struct isl_surf *surf,
- struct isl_surf *aux_surf,
- struct isl_surf *extra_aux_surf,
+ const struct isl_surf *hiz_or_mcs_surf,
+ struct isl_surf *ccs_surf,
uint32_t row_pitch_B)
{
- assert(aux_surf);
- if (aux_surf->size_B > 0)
- assert(extra_aux_surf);
- assert(!(aux_surf->usage & ISL_SURF_USAGE_CCS_BIT));
-
- const struct isl_surf *hiz_or_mcs_surf =
- aux_surf->size_B > 0 ? aux_surf : NULL;
- struct isl_surf *ccs_surf =
- aux_surf->size_B > 0 ? extra_aux_surf : aux_surf;
-
if (!isl_surf_supports_ccs(dev, surf, hiz_or_mcs_surf))
return false;
bool
isl_surf_get_ccs_surf(const struct isl_device *dev,
const struct isl_surf *surf,
- struct isl_surf *aux_surf,
- struct isl_surf *extra_aux_surf,
+ const struct isl_surf *hiz_or_mcs_surf,
+ struct isl_surf *ccs_surf,
uint32_t row_pitch_B /**< Ignored if 0 */);
#define isl_surf_fill_state(dev, state, ...) \
ok = isl_surf_get_ccs_surf(&device->isl_dev,
&image->planes[plane].primary_surface.isl,
+ NULL,
&image->planes[plane].aux_surface.isl,
- NULL, stride);
+ stride);
if (!ok)
return VK_SUCCESS;
/* We shouldn't already have a CCS */
assert(!mt->aux_buf);
- if (!isl_surf_get_ccs_surf(&brw->isl_dev, &mt->surf, &temp_ccs_surf, NULL,
- image->aux_pitch))
+ if (!isl_surf_get_ccs_surf(&brw->isl_dev, &mt->surf, NULL,
+ &temp_ccs_surf, image->aux_pitch))
return false;
assert(image->aux_offset < image->bo->size);
initial_state = ISL_AUX_STATE_PASS_THROUGH;
memset_value = 0;
aux_surf_ok =
- isl_surf_get_ccs_surf(&brw->isl_dev, &mt->surf, &aux_surf, NULL, 0);
+ isl_surf_get_ccs_surf(&brw->isl_dev, &mt->surf, NULL, &aux_surf, 0);
break;
default:
struct isl_surf aux_surf = {0,};
if (mod_info->aux_usage == ISL_AUX_USAGE_CCS_E) {
- ok = isl_surf_get_ccs_surf(&screen->isl_dev, &surf, &aux_surf, NULL, 0);
+ ok = isl_surf_get_ccs_surf(&screen->isl_dev, &surf, NULL, &aux_surf, 0);
if (!ok) {
free(image);
return NULL;
}
struct isl_surf aux_surf = {0,};
- ok = isl_surf_get_ccs_surf(&screen->isl_dev, &surf, &aux_surf, NULL,
+ ok = isl_surf_get_ccs_surf(&screen->isl_dev, &surf, NULL, &aux_surf,
image->aux_pitch);
if (!ok) {
brw_bo_unreference(image->bo);