intel: Describe modifier compression with booleans

Replace the aux_usage field with two booleans: one for render
compression and one for media compression.

This more accurately describes how CCS_E is used on gfx12. On those
platforms, the FCV feature may be enabled or disabled, but ISL's
modifier table has been using the FCV aux-usage for every gfx12 render
compression modifier. Instead, set the newly-added render compression
boolean to true.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24120>
This commit is contained in:
Nanley Chery 2023-06-21 11:12:16 -04:00 committed by Marge Bot
parent 37068e8aaf
commit d9bdffa708
4 changed files with 25 additions and 21 deletions

View file

@ -244,7 +244,7 @@ static inline bool is_modifier_external_only(enum pipe_format pfmt,
* of media-compressed surfaces, resolves are avoided.
*/
return util_format_is_yuv(pfmt) ||
isl_drm_modifier_get_info(modifier)->aux_usage == ISL_AUX_USAGE_MC;
isl_drm_modifier_get_info(modifier)->supports_media_compression;
}
static void
@ -874,8 +874,8 @@ iris_resource_configure_aux(struct iris_screen *screen,
if (isl_surf_usage_is_stencil(res->surf.usage)) {
assert(!res->mod_info);
res->aux.usage = ISL_AUX_USAGE_STC_CCS;
} else if (res->mod_info) {
res->aux.usage = res->mod_info->aux_usage;
} else if (res->mod_info && res->mod_info->supports_media_compression) {
res->aux.usage = ISL_AUX_USAGE_MC;
} else if (want_ccs_e_for_format(devinfo, res->surf.format)) {
res->aux.usage = devinfo->ver < 12 ?
ISL_AUX_USAGE_CCS_E : ISL_AUX_USAGE_FCV_CCS_E;

View file

@ -1442,8 +1442,9 @@ struct isl_drm_modifier_info {
/** ISL tiling implied by this modifier */
enum isl_tiling tiling;
/** ISL aux usage implied by this modifier */
enum isl_aux_usage aux_usage;
/** Compression types supported by this modifier */
bool supports_render_compression;
bool supports_media_compression;
/** Whether or not this modifier supports clear color */
bool supports_clear_color;
@ -2252,7 +2253,8 @@ isl_drm_modifier_has_aux(uint64_t modifier)
if (modifier == DRM_FORMAT_MOD_INVALID)
return false;
return isl_drm_modifier_get_info(modifier)->aux_usage != ISL_AUX_USAGE_NONE;
return isl_drm_modifier_get_info(modifier)->supports_render_compression ||
isl_drm_modifier_get_info(modifier)->supports_media_compression;
}
/** Returns the default isl_aux_state for the given modifier.
@ -2283,12 +2285,11 @@ isl_drm_modifier_get_default_aux_state(uint64_t modifier)
const struct isl_drm_modifier_info *mod_info =
isl_drm_modifier_get_info(modifier);
if (!mod_info || mod_info->aux_usage == ISL_AUX_USAGE_NONE)
if (!mod_info || !isl_drm_modifier_has_aux(modifier))
return ISL_AUX_STATE_AUX_INVALID;
assert(mod_info->aux_usage == ISL_AUX_USAGE_CCS_E ||
mod_info->aux_usage == ISL_AUX_USAGE_FCV_CCS_E ||
mod_info->aux_usage == ISL_AUX_USAGE_MC);
assert(mod_info->supports_render_compression !=
mod_info->supports_media_compression);
return mod_info->supports_clear_color ? ISL_AUX_STATE_COMPRESSED_CLEAR :
ISL_AUX_STATE_COMPRESSED_NO_CLEAR;
}

View file

@ -97,28 +97,28 @@ isl_drm_modifier_info_list[] = {
.modifier = I915_FORMAT_MOD_Y_TILED_CCS,
.name = "I915_FORMAT_MOD_Y_TILED_CCS",
.tiling = ISL_TILING_Y0,
.aux_usage = ISL_AUX_USAGE_CCS_E,
.supports_render_compression = true,
.supports_clear_color = false,
},
{
.modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
.name = "I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS",
.tiling = ISL_TILING_Y0,
.aux_usage = ISL_AUX_USAGE_FCV_CCS_E,
.supports_render_compression = true,
.supports_clear_color = false,
},
{
.modifier = I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS,
.name = "I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS",
.tiling = ISL_TILING_Y0,
.aux_usage = ISL_AUX_USAGE_MC,
.supports_media_compression = true,
.supports_clear_color = false,
},
{
.modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC,
.name = "I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC",
.tiling = ISL_TILING_Y0,
.aux_usage = ISL_AUX_USAGE_FCV_CCS_E,
.supports_render_compression = true,
.supports_clear_color = true,
},
{
@ -130,42 +130,42 @@ isl_drm_modifier_info_list[] = {
.modifier = I915_FORMAT_MOD_4_TILED_DG2_RC_CCS,
.name = "I915_FORMAT_MOD_4_TILED_DG2_RC_CCS",
.tiling = ISL_TILING_4,
.aux_usage = ISL_AUX_USAGE_FCV_CCS_E,
.supports_render_compression = true,
.supports_clear_color = false,
},
{
.modifier = I915_FORMAT_MOD_4_TILED_DG2_MC_CCS,
.name = "I915_FORMAT_MOD_4_TILED_DG2_MC_CCS",
.tiling = ISL_TILING_4,
.aux_usage = ISL_AUX_USAGE_MC,
.supports_media_compression = true,
.supports_clear_color = false,
},
{
.modifier = I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC,
.name = "I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC",
.tiling = ISL_TILING_4,
.aux_usage = ISL_AUX_USAGE_FCV_CCS_E,
.supports_render_compression = true,
.supports_clear_color = true,
},
{
.modifier = I915_FORMAT_MOD_4_TILED_MTL_RC_CCS,
.name = "I915_FORMAT_MOD_4_TILED_MTL_RC_CCS",
.tiling = ISL_TILING_4,
.aux_usage = ISL_AUX_USAGE_FCV_CCS_E,
.supports_render_compression = true,
.supports_clear_color = false,
},
{
.modifier = I915_FORMAT_MOD_4_TILED_MTL_RC_CCS_CC,
.name = "I915_FORMAT_MOD_4_TILED_MTL_RC_CCS_CC",
.tiling = ISL_TILING_4,
.aux_usage = ISL_AUX_USAGE_FCV_CCS_E,
.supports_render_compression = true,
.supports_clear_color = true,
},
{
.modifier = I915_FORMAT_MOD_4_TILED_MTL_MC_CCS,
.name = "I915_FORMAT_MOD_4_TILED_MTL_MC_CCS",
.tiling = ISL_TILING_4,
.aux_usage = ISL_AUX_USAGE_MC,
.supports_media_compression = true,
.supports_clear_color = false,
},
{

View file

@ -1107,7 +1107,10 @@ check_drm_format_mod(const struct anv_device *device,
* The inverse, however, does not hold; if the modifier has no aux
* usage, then we may enable a private aux surface.
*/
if (plane->aux_usage != isl_mod_info->aux_usage) {
if ((isl_mod_info->supports_media_compression &&
plane->aux_usage != ISL_AUX_USAGE_MC) ||
(isl_mod_info->supports_render_compression &&
!isl_aux_usage_has_ccs_e(plane->aux_usage))) {
return vk_errorf(device, VK_ERROR_UNKNOWN,
"image with modifier unexpectedly has wrong aux "
"usage");