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>
This commit is contained in:
Alejandro Piñeiro 2019-11-29 13:55:38 +01:00 committed by Marge Bot
parent 0e0f18ae5e
commit 4e88e2d4a9
3 changed files with 37 additions and 1 deletions

View file

@ -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,
]

View file

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

View file

@ -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 */