From 144c2d4e4a9f0dc492bfed6fc24bb22fb057a806 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Wed, 23 Aug 2023 10:30:33 -0400 Subject: [PATCH] anv: Initialize the clear color more often for FCV Instead of only initializing the clear color when the first subresource is accessed, initialize it for every FCV-enabled subresource. This is needed because writes to any subresource may be converted to fast clears. Now that init_fast_clear_color is called for every subresource, we take care not to stomp on the fast-clear-tracking state of the first subresource by moving the code which updates it outside of init_fast_clear_color. Now init_fast_clear_color does just what it says: initializes the fast clear color. This fixes the regression introduced with commit 57445adc891, ("anv: Re-enable CCS_E on TGL+"). Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8461 Reviewed-by: Rohan Garg Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 81075556003..bb5c1387cf3 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -792,9 +792,6 @@ init_fast_clear_color(struct anv_cmd_buffer *cmd_buffer, assert(cmd_buffer && image); assert(image->vk.aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); - set_image_fast_clear_state(cmd_buffer, image, aspect, - ANV_FAST_CLEAR_NONE); - /* Initialize the struct fields that are accessed for fast clears so that * the HW restrictions on the field values are satisfied. * @@ -1122,8 +1119,11 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer, #endif if (must_init_fast_clear_state) { - if (base_level == 0 && base_layer == 0) - init_fast_clear_color(cmd_buffer, image, aspect); + if (base_level == 0 && base_layer == 0) { + set_image_fast_clear_state(cmd_buffer, image, aspect, + ANV_FAST_CLEAR_NONE); + } + init_fast_clear_color(cmd_buffer, image, aspect); } if (must_init_aux_surface) {