venus: allow to build vtest-only on non-DRM/KMS systems

The vtest backend doesn't require drm.

Backport-to: 25.1
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13420
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36017>
This commit is contained in:
Yiwei Zhang 2025-07-09 06:27:18 +00:00 committed by Marge Bot
parent 610a19cf31
commit d93840dc22
2 changed files with 11 additions and 2 deletions

View file

@ -74,12 +74,10 @@ libvn_files = files(
'vn_ring.c',
'vn_renderer_internal.c',
'vn_renderer_util.c',
'vn_renderer_virtgpu.c',
'vn_renderer_vtest.c',
)
vn_deps = [
dep_libdrm,
dep_thread,
idep_mesautil,
idep_vulkan_util,
@ -96,6 +94,11 @@ vn_flags = [
vn_libs = []
if system_has_kms_drm
libvn_files += files('vn_renderer_virtgpu.c')
vn_deps += dep_libdrm
endif
if with_platform_wayland or with_platform_x11 or \
(system_has_kms_drm and not with_platform_android)
libvn_files += files('vn_wsi.c')

View file

@ -218,10 +218,12 @@ struct vn_renderer {
struct vn_renderer_sync_ops sync_ops;
};
#ifdef HAVE_LIBDRM
VkResult
vn_renderer_create_virtgpu(struct vn_instance *instance,
const VkAllocationCallbacks *alloc,
struct vn_renderer **renderer);
#endif
VkResult
vn_renderer_create_vtest(struct vn_instance *instance,
@ -233,6 +235,7 @@ vn_renderer_create(struct vn_instance *instance,
const VkAllocationCallbacks *alloc,
struct vn_renderer **renderer)
{
#ifdef HAVE_LIBDRM
if (VN_DEBUG(VTEST)) {
VkResult result = vn_renderer_create_vtest(instance, alloc, renderer);
if (result == VK_SUCCESS)
@ -240,6 +243,9 @@ vn_renderer_create(struct vn_instance *instance,
}
return vn_renderer_create_virtgpu(instance, alloc, renderer);
#else
return vn_renderer_create_vtest(instance, alloc, renderer);
#endif
}
static inline void