anv: fix clears on single aspect of YCbCr images

Fixes vkd3d-proton's test_planar_video_formats

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35679>
(cherry picked from commit 32b53a7c6a)
This commit is contained in:
Lionel Landwerlin 2025-06-17 16:16:12 +03:00 committed by Eric Engestrom
parent e4f52e75ef
commit 1dde4bccd4
5 changed files with 12 additions and 5 deletions

View file

@ -6174,7 +6174,7 @@
"description": "anv: fix clears on single aspect of YCbCr images",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1638,7 +1638,9 @@ void anv_CmdClearColorImage(
clear_rect.rect.extent.height,
false /* depth clear */, 0 /* depth value */,
true /* stencil_clear */, clear_color.u32[0] /* stencil_value */);
} else if (anv_can_fast_clear_color(cmd_buffer, image, level, &clear_rect,
} else if (anv_can_fast_clear_color(cmd_buffer, image,
pRanges[r].aspectMask,
level, &clear_rect,
imageLayout, src_format.isl_format,
clear_color)) {
assert(level == 0);
@ -1841,6 +1843,7 @@ can_fast_clear_color_att(struct anv_cmd_buffer *cmd_buffer,
return false;
return anv_can_fast_clear_color(cmd_buffer, att->iview->image,
att->iview->vk.aspects,
att->iview->vk.base_mip_level,
pRects, att->layout,
att->iview->planes[0].isl.format,
@ -2466,10 +2469,11 @@ anv_image_clear_color(struct anv_cmd_buffer *cmd_buffer,
uint32_t level, uint32_t base_layer, uint32_t layer_count,
VkRect2D area, union isl_color_value clear_color)
{
assert(image->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT);
assert((aspect & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0);
assert(util_bitcount(aspect) == 1);
/* We don't support planar images with multisampling yet */
assert(image->n_planes == 1);
assert(image->vk.samples == 1 || image->n_planes == 1);
struct blorp_batch batch;
anv_blorp_batch_init(cmd_buffer, &batch, 0);

View file

@ -3457,6 +3457,7 @@ anv_layout_to_fast_clear_type(const struct intel_device_info * const devinfo,
bool
anv_can_fast_clear_color(const struct anv_cmd_buffer *cmd_buffer,
const struct anv_image *image,
VkImageAspectFlags clear_aspect,
unsigned level,
const struct VkClearRect *clear_rect,
VkImageLayout layout,
@ -3476,7 +3477,7 @@ anv_can_fast_clear_color(const struct anv_cmd_buffer *cmd_buffer,
*/
enum anv_fast_clear_type fast_clear_type =
anv_layout_to_fast_clear_type(cmd_buffer->device->info, image,
VK_IMAGE_ASPECT_COLOR_BIT, layout,
clear_aspect, layout,
cmd_buffer->queue_family->queueFlags);
switch (fast_clear_type) {
case ANV_FAST_CLEAR_NONE:

View file

@ -6094,6 +6094,7 @@ anv_can_hiz_clear_ds_view(struct anv_device *device,
bool
anv_can_fast_clear_color(const struct anv_cmd_buffer *cmd_buffer,
const struct anv_image *image,
VkImageAspectFlags clear_aspect,
unsigned level,
const struct VkClearRect *clear_rect,
VkImageLayout layout,

View file

@ -5420,6 +5420,7 @@ void genX(CmdBeginRendering)(
const bool fast_clear =
(!is_multiview || (gfx->view_mask & 1)) &&
anv_can_fast_clear_color(cmd_buffer, iview->image,
iview->vk.aspects,
iview->vk.base_mip_level,
&clear_rect, att->imageLayout,
iview->planes[0].isl.format,