From 9c63ec26eaff563ae3583638ceb4bd43fa9c32ba Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Wed, 13 Mar 2019 16:56:55 -0700 Subject: [PATCH] iris: Enable HiZ for multisampled depth surfaces. Fix this check so that we can get a HiZ aux buffer for multisampled surfaces as well. Also make sure we don't try to emit a sampler view surface state for multisampled depth sufaces with HiZ enabled, as the sampler can't HiZ for multisampled buffers and isl would assert. Reviewed-by: Kenneth Graunke --- src/gallium/drivers/iris/iris_resource.c | 27 +++++++++++------------- src/gallium/drivers/iris/iris_state.c | 9 ++++++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index e0824723676..8bb0b3faa71 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -567,21 +567,18 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, if (res->mod_info) { res->aux.possible_usages |= 1 << res->mod_info->aux_usage; - } else if (res->surf.samples > 1) { - if (supports_mcs(&res->surf)) - res->aux.possible_usages |= 1 << ISL_AUX_USAGE_MCS; - } else { - if (has_depth) { - if (likely(!(INTEL_DEBUG & DEBUG_NO_HIZ))) - res->aux.possible_usages |= 1 << ISL_AUX_USAGE_HIZ; - } else if (likely(!(INTEL_DEBUG & DEBUG_NO_RBC)) && - supports_ccs(devinfo, &res->surf)) { - if (isl_format_supports_ccs_e(devinfo, res->surf.format)) - res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_E; - - if (isl_format_supports_ccs_d(devinfo, res->surf.format)) - res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_D; - } + } else if (supports_mcs(&res->surf)) { + res->aux.possible_usages |= 1 << ISL_AUX_USAGE_MCS; + } else if (has_depth) { + if (likely(!(INTEL_DEBUG & DEBUG_NO_HIZ))) + res->aux.possible_usages |= 1 << ISL_AUX_USAGE_HIZ; + } else if (likely(!(INTEL_DEBUG & DEBUG_NO_RBC)) && + supports_ccs(devinfo, &res->surf)) { + if (isl_format_supports_ccs_e(devinfo, res->surf.format)) + res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_E; + + if (isl_format_supports_ccs_d(devinfo, res->surf.format)) + res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_D; } res->aux.usage = util_last_bit(res->aux.possible_usages) - 1; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index eaa40d33fdf..bd5ee14a5f0 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -1731,8 +1731,13 @@ iris_create_sampler_view(struct pipe_context *ctx, while (aux_modes) { enum isl_aux_usage aux_usage = u_bit_scan(&aux_modes); - fill_surface_state(&screen->isl_dev, map, isv->res, &isv->view, - aux_usage); + /* If we have a multisampled depth buffer, do not create a sampler + * surface state with HiZ. + */ + if (!(aux_usage == ISL_AUX_USAGE_HIZ && isv->res->surf.samples > 1)) { + fill_surface_state(&screen->isl_dev, map, isv->res, &isv->view, + aux_usage); + } map += SURFACE_STATE_ALIGNMENT; } -- 2.30.2