anv: Require Linux 6.0 for dma-buf sync file import/export

This also implies all the other syncobj features we care about so those
become dead code.  We'll delete them in following commits.

We don't need a check for Xe because the Xe driver was merged into Linux
6.8 while dma-buf sync file import/export landed in 6.0.

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36783>
This commit is contained in:
Faith Ekstrand 2025-08-14 16:45:09 -04:00
parent d7416ebc19
commit affee04bd9
3 changed files with 14 additions and 28 deletions

View file

@ -142,9 +142,6 @@ static void
get_device_extensions(const struct anv_physical_device *device,
struct vk_device_extension_table *ext)
{
const bool has_syncobj_wait =
(device->sync_syncobj_type.features & VK_SYNC_FEATURE_CPU_WAIT) != 0;
const bool rt_enabled = ANV_SUPPORT_RT && device->info.has_ray_tracing;
const bool video_decode_enabled = device->instance->debug & ANV_DEBUG_VIDEO_DECODE;
const bool video_encode_enabled = device->instance->debug & ANV_DEBUG_VIDEO_ENCODE;
@ -170,8 +167,8 @@ get_device_extensions(const struct anv_physical_device *device,
.KHR_driver_properties = true,
.KHR_dynamic_rendering = true,
.KHR_dynamic_rendering_local_read = true,
.KHR_external_fence = has_syncobj_wait,
.KHR_external_fence_fd = has_syncobj_wait,
.KHR_external_fence = true,
.KHR_external_fence_fd = true,
.KHR_external_memory = true,
.KHR_external_memory_fd = true,
.KHR_external_semaphore = true,
@ -2667,28 +2664,13 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
device->has_cooperative_matrix =
device->info.cooperative_matrix_configurations[0].scope != INTEL_CMAT_SCOPE_NONE;
unsigned st_idx = 0;
device->sync_syncobj_type = vk_drm_syncobj_get_type(fd);
device->sync_types[st_idx++] = &device->sync_syncobj_type;
assert(vk_sync_type_is_drm_syncobj(&device->sync_syncobj_type));
assert(device->sync_syncobj_type.features & VK_SYNC_FEATURE_TIMELINE);
assert(device->sync_syncobj_type.features & VK_SYNC_FEATURE_CPU_WAIT);
/* anv_bo_sync_type is only supported with i915 for now */
if (device->info.kmd_type == INTEL_KMD_TYPE_I915) {
if (!(device->sync_syncobj_type.features & VK_SYNC_FEATURE_CPU_WAIT))
device->sync_types[st_idx++] = &anv_bo_sync_type;
if (!(device->sync_syncobj_type.features & VK_SYNC_FEATURE_TIMELINE)) {
device->sync_timeline_type = vk_sync_timeline_get_type(&anv_bo_sync_type);
device->sync_types[st_idx++] = &device->sync_timeline_type.sync;
}
} else {
assert(vk_sync_type_is_drm_syncobj(&device->sync_syncobj_type));
assert(device->sync_syncobj_type.features & VK_SYNC_FEATURE_TIMELINE);
assert(device->sync_syncobj_type.features & VK_SYNC_FEATURE_CPU_WAIT);
}
device->sync_types[st_idx++] = NULL;
assert(st_idx <= ARRAY_SIZE(device->sync_types));
device->sync_types[0] = &device->sync_syncobj_type;
device->sync_types[1] = NULL;
device->vk.supported_sync_types = device->sync_types;
device->vk.pipeline_cache_import_ops = anv_cache_import_ops;

View file

@ -99,7 +99,6 @@
#include "vk_sampler.h"
#include "vk_shader_module.h"
#include "vk_sync.h"
#include "vk_sync_timeline.h"
#include "vk_texcompress_astc.h"
#include "vk_util.h"
#include "vk_query_pool.h"
@ -1280,8 +1279,7 @@ struct anv_physical_device {
uint8_t rt_uuid[VK_UUID_SIZE];
struct vk_sync_type sync_syncobj_type;
struct vk_sync_timeline_type sync_timeline_type;
const struct vk_sync_type * sync_types[4];
const struct vk_sync_type * sync_types[2];
struct wsi_device wsi_device;
int local_fd;

View file

@ -121,6 +121,12 @@ anv_i915_physical_device_get_parameters(struct anv_physical_device *device)
return result;
}
if (!i915_gem_supports_dma_buf_sync_file(fd)) {
result = vk_errorf(device, VK_ERROR_INCOMPATIBLE_DRIVER,
"kernel missing dma-buf sync file import/export");
return result;
}
/* Start with medium; sorted low to high */
const VkQueueGlobalPriorityKHR priorities[] = {
VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR,