diff options
author | Alejandro PiƱeiro <apinheiro@igalia.com> | 2019-11-29 13:55:38 +0100 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-10-13 21:21:25 +0000 |
commit | 4e88e2d4a9cf15a94af0891e3194974fda8c49c9 (patch) | |
tree | c52d10091993a2a760e0921daf829b16368b78ec | |
parent | 0e0f18ae5e62ba67e6bcd0dc96e98c80b3bc8abc (diff) |
v3dv: add support to use v3d simulator
v2: use spaces on both sides of ':'
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
-rw-r--r-- | src/broadcom/vulkan/meson.build | 6 | ||||
-rw-r--r-- | src/broadcom/vulkan/v3dv_device.c | 9 | ||||
-rw-r--r-- | src/broadcom/vulkan/v3dv_private.h | 23 |
3 files changed, 37 insertions, 1 deletions
diff --git a/src/broadcom/vulkan/meson.build b/src/broadcom/vulkan/meson.build index ed3d11b9939..abf2762a083 100644 --- a/src/broadcom/vulkan/meson.build +++ b/src/broadcom/vulkan/meson.build @@ -63,9 +63,15 @@ libv3dv_files = files( # driver. v3dv_flags = ['-DV3D_VERSION=42'] +dep_v3dv3 = dependency('v3dv3', required : false) +if dep_v3dv3.found() + v3dv_flags += '-DUSE_V3D_SIMULATOR' +endif + v3dv_deps = [ dep_libdrm, dep_valgrind, + dep_v3dv3, idep_vulkan_util, ] diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index c1de7930297..1cde4bc8fee 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -209,6 +209,10 @@ physical_device_finish(struct v3dv_physical_device *device) close(device->local_fd); if (device->master_fd >= 0) close(device->master_fd); + +#if using_v3d_simulator + v3d_simulator_destroy(device->sim_file); +#endif } void @@ -255,13 +259,16 @@ physical_device_init(struct v3dv_physical_device *device, snprintf(device->path, ARRAY_SIZE(device->path), "%s", path); /* FIXME: we will have to do plenty more here */ - device->name = "Broadcom Video Core VI"; device->local_fd = fd; device->master_fd = -1; uint8_t zeroes[VK_UUID_SIZE] = { 0 }; memcpy(device->pipeline_cache_uuid, zeroes, VK_UUID_SIZE); +#if using_v3d_simulator + device->sim_file = v3d_simulator_init(device->local_fd); +#endif + return VK_SUCCESS; } diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index 0d704142290..8df82183660 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -35,6 +35,8 @@ #include <vulkan/vulkan.h> #include <vulkan/vk_icd.h> +#include <xf86drm.h> + #ifdef HAVE_VALGRIND #include <valgrind/valgrind.h> #include <valgrind/memcheck.h> @@ -52,6 +54,7 @@ #include "v3dv_extensions.h" #include "vk_alloc.h" +#include "simulator/v3d_simulator.h" /* * FIXME: confirm value @@ -63,6 +66,14 @@ struct v3dv_instance; +#ifdef USE_V3D_SIMULATOR +#define using_v3d_simulator true +#else +#define using_v3d_simulator false +#endif + +struct v3d_simulator_file; + struct v3dv_device { VK_LOADER_DATA _loader_data; @@ -92,6 +103,9 @@ struct v3dv_physical_device { uint8_t pipeline_cache_uuid[VK_UUID_SIZE]; /* FIXME: stub */ + struct v3d_device_info devinfo; + + struct v3d_simulator_file *sim_file; }; struct v3dv_app_info { @@ -220,4 +234,13 @@ V3DV_DEFINE_HANDLE_CASTS(v3dv_queue, VkQueue) V3DV_DEFINE_NONDISP_HANDLE_CASTS(v3dv_device_memory, VkDeviceMemory) +static inline int +v3dv_ioctl(int fd, unsigned long request, void *arg) +{ + if (using_v3d_simulator) + return v3d_simulator_ioctl(fd, request, arg); + else + return drmIoctl(fd, request, arg); +} + #endif /* V3DV_PRIVATE_H */ |