diff --git a/.pick_status.json b/.pick_status.json index de4cbf85096..9aa35dbf5a1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1404,7 +1404,7 @@ "description": "anv: add furmark workaround layer", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 4dc065b1a88..78c3581bcff 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -354,6 +354,15 @@ VkResult anv_CreateDevice( true); override_initial_entrypoints = false; } + + if (physical_device->info.ver < 12 && + physical_device->instance->vk.app_info.app_name && + !strcmp(physical_device->instance->vk.app_info.app_name, "GeeXLab")) { + vk_device_dispatch_table_from_entrypoints(&dispatch_table, + &anv_furmark_device_entrypoints, + true); + override_initial_entrypoints = false; + } #if DETECT_OS_ANDROID vk_device_dispatch_table_from_entrypoints(&dispatch_table, &anv_android_device_entrypoints, diff --git a/src/intel/vulkan/layers/anv_furmark.c b/src/intel/vulkan/layers/anv_furmark.c new file mode 100644 index 00000000000..eee591a12da --- /dev/null +++ b/src/intel/vulkan/layers/anv_furmark.c @@ -0,0 +1,61 @@ +/* + * Copyright © 2025 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "anv_private.h" +#include "vk_common_entrypoints.h" + +/** + * Furmark VK rendering corruption is happening because the benchmark does + * invalid layout transition. Here we override the initial layout to fix it. + */ + +void anv_furmark_CmdPipelineBarrier2( + VkCommandBuffer commandBuffer, + const VkDependencyInfo* pDependencyInfo) +{ + ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); + const VkDependencyInfo *dep_info = pDependencyInfo; + const struct intel_device_info *devinfo = cmd_buffer->device->info; + + for (uint32_t i = 0; i < dep_info->imageMemoryBarrierCount; i++) { + VkImageMemoryBarrier2 *img_barrier = (VkImageMemoryBarrier2*) + &dep_info->pImageMemoryBarriers[i]; + VkImageLayout old_layout = img_barrier->oldLayout; + VkImageLayout new_layout = img_barrier->newLayout; + if (old_layout == VK_IMAGE_LAYOUT_UNDEFINED && + new_layout == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) { + img_barrier->oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + } + } + + switch (devinfo->verx10) { + case 90: + gfx9_CmdPipelineBarrier2(commandBuffer, pDependencyInfo); + break; + case 110: + gfx11_CmdPipelineBarrier2(commandBuffer, pDependencyInfo); + break; + default: + unreachable("should not happen"); + } +} diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build index b1d27c41769..020b7003155 100644 --- a/src/intel/vulkan/meson.build +++ b/src/intel/vulkan/meson.build @@ -25,6 +25,7 @@ anv_entrypoints = custom_target( '--device-prefix', 'gfx20', '--device-prefix', 'gfx30', '--device-prefix', 'anv_doom64', + '--device-prefix', 'anv_furmark', '--device-prefix', 'anv_hitman3', '--device-prefix', 'anv_android', '--device-prefix', 'anv_rmv', @@ -137,6 +138,7 @@ libanv_files = files( 'i915/anv_queue.h', 'layers/anv_android_layer.c', 'layers/anv_doom64.c', + 'layers/anv_furmark.c', 'layers/anv_hitman3.c', 'layers/anv_rmv_layer.c', 'xe/anv_batch_chain.c',