From 6466a977e493dcda47a4cf616a469d394765f957 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 14 May 2024 09:42:04 -0400 Subject: [PATCH] zink: add a driver workaround to disable 2D_VIEW_COMPATIBLE+sparse this fixes a lot of stuff on intel and hopefully never hits any corner case app use Part-of: --- src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt | 10 ---------- src/gallium/drivers/zink/zink_resource.c | 3 ++- src/gallium/drivers/zink/zink_screen.c | 11 +++++++++++ src/gallium/drivers/zink/zink_types.h | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt b/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt index 15dcc27f5fe..480bb9bd506 100644 --- a/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt @@ -580,22 +580,12 @@ spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-gs-getuniformdv,Crash spec@arb_fragment_layer_viewport@layer-no-gs,Fail -# Crashes with VUID-VkSparseMemoryBind-size-01102 due to 2D_3D compability -# issues. -KHR-GL46.sparse_texture_tests.SparseTextureCommitment,Crash - -# Issue 11073 constains a big explanation on why this fails. The test is using a -# 2D_3D compatible format that ends up being marked by Anv as "everything is -# miptail" and the test is not expecting that. -KHR-GL46.sparse_texture2_tests.UncommittedRegionsAccess,Fail - # glcts: ../../src/intel/vulkan/anv_sparse.c:970: vk_bind_to_anv_vm_bind: Assertion `vk_bind->memoryOffset + vk_bind->size <= anv_bind.bo->size' failed. # Also related to https://gitlab.freedesktop.org/mesa/mesa/-/issues/11073 KHR-GL46.sparse_texture_clamp_tests.SparseTextureClampLookupColor,Crash # Error detected at x,y,z: expected [a] got [b] KHR-GL46.sparse_texture2_tests.SparseTexture2Commitment,Fail -KHR-GL46.sparse_texture_clamp_tests.SparseTextureClampLookupResidency,Fail KHR-GL46.sparse_texture2_tests.SparseTexture2Lookup,Fail diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 55bc85cdc85..83094b4e793 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -732,7 +732,8 @@ init_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe_r ici->imageType = VK_IMAGE_TYPE_3D; if (!(templ->flags & PIPE_RESOURCE_FLAG_SPARSE)) ici->flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT; - if (screen->info.have_EXT_image_2d_view_of_3d) + if (screen->info.have_EXT_image_2d_view_of_3d && + (screen->driver_workarounds.can_2d_view_sparse || !(templ->flags & PIPE_RESOURCE_FLAG_SPARSE))) ici->flags |= VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT; break; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index f985ff06dce..e36b84691a0 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -3059,6 +3059,17 @@ init_driver_workarounds(struct zink_screen *screen) break; } + screen->driver_workarounds.can_2d_view_sparse = true; + switch (screen->info.driver_props.driverID) { + case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA: + case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS: + /* this does wild things to block shapes */ + screen->driver_workarounds.can_2d_view_sparse = false; + break; + default: + break; + } + if (!screen->resizable_bar) screen->info.have_EXT_host_image_copy = false; } diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 421e2cd863e..95632c885bf 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1544,6 +1544,7 @@ struct zink_screen { bool can_do_invalid_linear_modifier; bool io_opt; bool inconsistent_interpolation; + bool can_2d_view_sparse; unsigned z16_unscaled_bias; unsigned z24_unscaled_bias; } driver_workarounds;