From 81d0c24e2f6e1416a097bddf95b5de85bedd3753 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 27 Nov 2024 14:43:27 +0100 Subject: [PATCH] panvk: Ignore the view aspects when dealing with depth/stencil attachments The spec says: " When an image view of a depth/stencil image is used as a depth/stencil framebuffer attachment, the aspectMask is ignored and both depth and stencil image subresources are used. " Make sure we do that when initializing depth/stencil attachments. Fixes the dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.*.subpass_count_*.d24_unorm_s8_uint dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.*.subpass_count_*.d32_sfloat_s8_uint failures. Signed-off-by: Boris Brezillon Reviewed-by: Lars-Ivar Hesselberg Simonsen Part-of: --- src/panfrost/ci/panfrost-g52-fails.txt | 37 ------------------------- src/panfrost/ci/panfrost-g610-fails.txt | 37 ------------------------- src/panfrost/vulkan/panvk_vX_cmd_draw.c | 25 ++++++++++++++--- 3 files changed, 21 insertions(+), 78 deletions(-) diff --git a/src/panfrost/ci/panfrost-g52-fails.txt b/src/panfrost/ci/panfrost-g52-fails.txt index 25ab96d8f11..6ec436c6b73 100644 --- a/src/panfrost/ci/panfrost-g52-fails.txt +++ b/src/panfrost/ci/panfrost-g52-fails.txt @@ -2714,43 +2714,6 @@ dEQP-VK.memory.pipeline_barrier.host_write_index_buffer.1048576,Fail dEQP-VK.memory.pipeline_barrier.host_write_index_buffer.65536,Fail dEQP-VK.memory.pipeline_barrier.host_write_index_buffer.8192,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_5.d24_unorm_s8_uint,Fail - dEQP-VK.spirv_assembly.instruction.graphics.cross_stage.basic_type.no_perspective,Fail dEQP-VK.spirv_assembly.instruction.graphics.cross_stage.interface_blocks.no_perspective,Fail diff --git a/src/panfrost/ci/panfrost-g610-fails.txt b/src/panfrost/ci/panfrost-g610-fails.txt index 327a3578c6b..c112d69003a 100644 --- a/src/panfrost/ci/panfrost-g610-fails.txt +++ b/src/panfrost/ci/panfrost-g610-fails.txt @@ -300,43 +300,6 @@ dEQP-VK.memory.pipeline_barrier.transfer_dst_storage_buffer.1048576,Crash dEQP-VK.memory.pipeline_barrier.transfer_dst_uniform_buffer.1048576,Crash dEQP-VK.memory.pipeline_barrier.transfer_dst_uniform_texel_buffer.1048576,Crash -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_128_128.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_32_32.subpass_count_5.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_2.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_2.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_3.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_3.d32_sfloat_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_5.d24_unorm_s8_uint,Fail -dEQP-VK.renderpass2.suballocation.subpass_dependencies.late_fragment_tests.render_size_64_64.subpass_count_5.d32_sfloat_s8_uint,Fail - dEQP-VK.renderpass.dedicated_allocation.attachment_allocation.input_output.63,Fail dEQP-VK.spirv_assembly.instruction.graphics.cross_stage.basic_type.no_perspective,Fail diff --git a/src/panfrost/vulkan/panvk_vX_cmd_draw.c b/src/panfrost/vulkan/panvk_vX_cmd_draw.c index 606142bb1d8..f184f8c468b 100644 --- a/src/panfrost/vulkan/panvk_vX_cmd_draw.c +++ b/src/panfrost/vulkan/panvk_vX_cmd_draw.c @@ -86,6 +86,9 @@ render_state_set_z_attachment(struct panvk_cmd_buffer *cmdbuf, */ if (iview->pview.format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) state->render.zs_pview.format = PIPE_FORMAT_Z32_FLOAT; + + state->render.zs_pview.planes[0] = &img->planes[0]; + state->render.zs_pview.planes[1] = NULL; fbinfo->nr_samples = MAX2(fbinfo->nr_samples, pan_image_view_get_nr_samples(&iview->pview)); state->render.z_attachment.iview = iview; @@ -98,6 +101,9 @@ render_state_set_z_attachment(struct panvk_cmd_buffer *cmdbuf, fbinfo->zs.preload.s = true; cmdbuf->state.gfx.render.zs_pview.format = PIPE_FORMAT_Z24_UNORM_S8_UINT; + } else { + state->render.zs_pview.format = + vk_format_to_pipe_format(vk_format_depth_only(img->vk.format)); } if (att->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) { @@ -140,8 +146,17 @@ render_state_set_s_attachment(struct panvk_cmd_buffer *cmdbuf, /* D32_S8 is a multiplanar format, so we need to adjust the format of the * stencil-only view to match the one of the stencil plane. */ - if (iview->pview.format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) - state->render.s_pview.format = PIPE_FORMAT_S8_UINT; + state->render.s_pview.format = img->vk.format == VK_FORMAT_D24_UNORM_S8_UINT + ? PIPE_FORMAT_Z24_UNORM_S8_UINT + : PIPE_FORMAT_S8_UINT; + if (img->vk.format == VK_FORMAT_D32_SFLOAT_S8_UINT) { + state->render.s_pview.planes[0] = NULL; + state->render.s_pview.planes[1] = &img->planes[1]; + } else { + state->render.s_pview.planes[0] = &img->planes[0]; + state->render.s_pview.planes[1] = NULL; + } + fbinfo->nr_samples = MAX2(fbinfo->nr_samples, pan_image_view_get_nr_samples(&iview->pview)); state->render.s_attachment.iview = iview; @@ -239,7 +254,8 @@ panvk_per_arch(cmd_init_render_state)(struct panvk_cmd_buffer *cmdbuf, const VkRenderingAttachmentInfo *att = pRenderingInfo->pDepthAttachment; VK_FROM_HANDLE(panvk_image_view, iview, att->imageView); - if (iview && (iview->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) { + if (iview) { + assert(iview->vk.image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT); render_state_set_z_attachment(cmdbuf, att); att_width = MAX2(iview->vk.extent.width, att_width); att_height = MAX2(iview->vk.extent.height, att_height); @@ -251,7 +267,8 @@ panvk_per_arch(cmd_init_render_state)(struct panvk_cmd_buffer *cmdbuf, const VkRenderingAttachmentInfo *att = pRenderingInfo->pStencilAttachment; VK_FROM_HANDLE(panvk_image_view, iview, att->imageView); - if (iview && (iview->vk.aspects & VK_IMAGE_ASPECT_STENCIL_BIT)) { + if (iview) { + assert(iview->vk.image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT); render_state_set_s_attachment(cmdbuf, att); att_width = MAX2(iview->vk.extent.width, att_width); att_height = MAX2(iview->vk.extent.height, att_height);