From 26802b32240a32962accf06a822d70cbf0adfb38 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Thu, 7 Mar 2024 19:01:48 -0500 Subject: [PATCH] iris,anv: Disable gfx12.0 fast-clears with unaligned pitch We'll reduce pitch alignment in a following patch. However, CCS fast-clears don't seem to work unless the pitch is 512B aligned. Disable fast clears for unaligned pitches. Prevents the next patch from failing the following piglit tests: * fbo-attachments-blit-scaled-linear * hiz-stencil-test-fbo-d24s8 * hiz * polygon-mode-facing * clearbuffer-mixed-format * glsl-lod-bias (transient failure) No failures have been observed in anv, but there are more restrictions for fast-clears in that driver compared to iris. Note: * The -fbo flag is necessary to make these fail. Otherwise, they end up with aligned render targets. * Each of these tests allocate an image that has a pitch greater than 512B and they collectively cover all the misalignment options - 128B, 256B and 384B. Reviewed-by: Jianxun Zhang Part-of: --- src/gallium/drivers/iris/iris_clear.c | 10 ++++++++++ src/intel/vulkan/anv_image.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c index 7810920813e..6be35db8eb5 100644 --- a/src/gallium/drivers/iris/iris_clear.c +++ b/src/gallium/drivers/iris/iris_clear.c @@ -147,6 +147,16 @@ can_fast_clear_color(struct iris_context *ice, return false; } + /* On gfx12.0, CCS fast clears don't seem to cover the correct portion of + * the aux buffer when the pitch is not 512B-aligned. + */ + if (devinfo->verx10 == 120 && + res->surf.samples == 1 && + res->surf.row_pitch_B % 512) { + perf_debug(&ice->dbg, "Pitch not 512B-aligned. Slow clearing surface."); + return false; + } + return true; } diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 42289b46c32..28721c4474a 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -3485,6 +3485,17 @@ anv_can_fast_clear_color_view(struct anv_device *device, return false; } + /* On gfx12.0, CCS fast clears don't seem to cover the correct portion of + * the aux buffer when the pitch is not 512B-aligned. + */ + if (device->info->verx10 == 120 && + iview->image->planes->primary_surface.isl.samples == 1 && + iview->image->planes->primary_surface.isl.row_pitch_B % 512) { + anv_perf_warn(VK_LOG_OBJS(&iview->image->vk.base), + "Pitch not 512B-aligned. Slow clearing surface."); + return false; + } + /* Disable sRGB fast-clears for non-0/1 color values on Gfx9. For texturing * and draw calls, HW expects the clear color to be in two different color * spaces after sRGB fast-clears - sRGB in the former and linear in the