anv: add furmark workaround layer

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14274
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38410>
This commit is contained in:
Tapani Pälli
2025-11-12 09:05:01 +02:00
committed by Marge Bot
parent d10036362f
commit ba89826b75
3 changed files with 72 additions and 0 deletions

View File

@@ -355,6 +355,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,

View File

@@ -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");
}
}

View File

@@ -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',
@@ -140,6 +141,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',