From: Kenneth Graunke Date: Thu, 29 Aug 2019 07:38:15 +0000 (-0700) Subject: iris: Disable CCS_E for 32-bit floating point textures. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0a93763fba18ce3c9c90a0f939005f0b594e27c;p=mesa.git iris: Disable CCS_E for 32-bit floating point textures. A while back, Michael Larabel noticed that Paraview's Wavelet Volume case runs significantly slower on iris than i965. It turns out this is because we enable CCS_E for 32-bit floating point formats, while i965 disables it, with an oblique comment saying that we benchmarked it (on what exactly?) and determined that it was a loss. Paraview uses both R32_FLOAT and R32G32B32A32_FLOAT, and I observed large framerate drops when enabling CCS_E for either format. However, several other benchmarks (Aztec Ruins, many Synmark cases) use 16-bit floating point formats, with no apparent ill effects. So, disable compression for 32-bit float formats for now, but leave it enabled for 16-bit float formats as they seem to be working fine. Improves performance in Paraview's Wavelet Volume test by 62% on a Skylake GT4e. Fixes: 3cfc6a207bd ("iris: Fill out res->aux.possible_usages") --- diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 72b68a28815..b2f91eb32ed 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -628,6 +628,28 @@ supports_ccs(const struct gen_device_info *devinfo, return true; } +static bool +want_ccs_e_for_format(const struct gen_device_info *devinfo, + enum isl_format format) +{ + if (!isl_format_supports_ccs_e(devinfo, format)) + return false; + + const struct isl_format_layout *fmtl = isl_format_get_layout(format); + + /* CCS_E seems to significantly hurt performance with 32-bit floating + * point formats. For example, Paraview's "Wavelet Volume" case uses + * both R32_FLOAT and R32G32B32A32_FLOAT, and enabling CCS_E for those + * formats causes a 62% FPS drop. + * + * However, many benchmarks seem to use 16-bit float with no issues. + */ + if (fmtl->channels.r.bits == 32 && fmtl->channels.r.type == ISL_SFLOAT) + return false; + + return true; +} + static struct pipe_resource * iris_resource_create_for_buffer(struct pipe_screen *pscreen, const struct pipe_resource *templ) @@ -765,7 +787,7 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, 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)) + if (want_ccs_e_for_format(devinfo, res->surf.format)) res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_E; if (isl_format_supports_ccs_d(devinfo, res->surf.format))