summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Park <jpark37@lagfreegames.com>2020-12-03 02:15:50 -0800
committerMarge Bot <eric+marge@anholt.net>2021-01-26 09:16:15 +0000
commitc0b4b8fc748775156ecc50008087e47fef74fc2b (patch)
tree34a369fb64cee86052d0edaa9b9196545dd8d612
parent146e3262757300ecd217daf85d613db67db15b78 (diff)
radv: Stub sections that don't have _WIN32 support
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7793>
-rw-r--r--src/amd/vulkan/layers/radv_sqtt_layer.c2
-rw-r--r--src/amd/vulkan/radv_debug.c14
-rw-r--r--src/amd/vulkan/radv_device.c43
-rw-r--r--src/amd/vulkan/radv_meta.c10
-rw-r--r--src/amd/vulkan/radv_private.h6
5 files changed, 54 insertions, 21 deletions
diff --git a/src/amd/vulkan/layers/radv_sqtt_layer.c b/src/amd/vulkan/layers/radv_sqtt_layer.c
index 520f184d355..e921e5b23dc 100644
--- a/src/amd/vulkan/layers/radv_sqtt_layer.c
+++ b/src/amd/vulkan/layers/radv_sqtt_layer.c
@@ -312,6 +312,7 @@ radv_handle_thread_trace(VkQueue _queue)
} else {
bool frame_trigger = num_frames == queue->device->thread_trace.start_frame;
bool file_trigger = false;
+#ifndef _WIN32
if (queue->device->thread_trace.trigger_file &&
access(queue->device->thread_trace.trigger_file, W_OK) == 0) {
if (unlink(queue->device->thread_trace.trigger_file) == 0) {
@@ -322,6 +323,7 @@ radv_handle_thread_trace(VkQueue _queue)
fprintf(stderr, "RADV: could not remove thread trace trigger file, ignoring\n");
}
}
+#endif
if (frame_trigger || file_trigger) {
radv_begin_thread_trace(queue);
diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
index 106ff4a5495..41e46093db0 100644
--- a/src/amd/vulkan/radv_debug.c
+++ b/src/amd/vulkan/radv_debug.c
@@ -27,7 +27,9 @@
#include <stdlib.h>
#include <stdio.h>
+#ifndef _WIN32
#include <sys/utsname.h>
+#endif
#include <sys/stat.h>
#include "util/mesa-sha1.h"
@@ -511,6 +513,7 @@ radv_dump_queue_state(struct radv_queue *queue, FILE *f)
static void
radv_dump_cmd(const char *cmd, FILE *f)
{
+#ifndef _WIN32
char line[2048];
FILE *p;
@@ -521,6 +524,7 @@ radv_dump_cmd(const char *cmd, FILE *f)
fprintf(f, "\n");
pclose(p);
}
+#endif
}
static void
@@ -579,12 +583,19 @@ static void
radv_dump_device_name(struct radv_device *device, FILE *f)
{
struct radeon_info *info = &device->physical_device->rad_info;
+#ifndef _WIN32
char kernel_version[128] = {0};
struct utsname uname_data;
+#endif
const char *chip_name;
chip_name = device->ws->get_chip_name(device->ws);
+#ifdef _WIN32
+ fprintf(f, "Device name: %s (%s / DRM %i.%i.%i)\n\n",
+ chip_name, device->physical_device->name,
+ info->drm_major, info->drm_minor, info->drm_patchlevel);
+#else
if (uname(&uname_data) == 0)
snprintf(kernel_version, sizeof(kernel_version),
" / %s", uname_data.release);
@@ -593,6 +604,7 @@ radv_dump_device_name(struct radv_device *device, FILE *f)
chip_name, device->physical_device->name,
info->drm_major, info->drm_minor, info->drm_patchlevel,
kernel_version);
+#endif
}
static void
@@ -785,6 +797,7 @@ radv_check_gpu_hangs(struct radv_queue *queue, struct radeon_cmdbuf *cs)
void
radv_print_spirv(const char *data, uint32_t size, FILE *fp)
{
+#ifndef _WIN32
char path[] = "/tmp/fileXXXXXX";
char command[128];
int fd;
@@ -804,6 +817,7 @@ radv_print_spirv(const char *data, uint32_t size, FILE *fp)
fail:
close(fd);
unlink(path);
+#endif
}
bool
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 0a2ef7f8e9d..33ff3b6f214 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -36,10 +36,14 @@
#include "util/disk_cache.h"
#include "vk_deferred_operation.h"
#include "vk_util.h"
+#ifdef _WIN32
+typedef void* drmDevicePtr;
+#else
#include <xf86drm.h>
#include <amdgpu.h>
#include "drm-uapi/amdgpu_drm.h"
#include "winsys/amdgpu/radv_amdgpu_winsys_public.h"
+#endif
#include "winsys/null/radv_null_winsys_public.h"
#include "ac_llvm_util.h"
#include "vk_format.h"
@@ -293,6 +297,9 @@ radv_physical_device_try_create(struct radv_instance *instance,
int fd = -1;
int master_fd = -1;
+#ifdef _WIN32
+ assert(drm_device == NULL);
+#else
if (drm_device) {
const char *path = drm_device->nodes[DRM_NODE_RENDER];
drmVersionPtr version;
@@ -330,6 +337,7 @@ radv_physical_device_try_create(struct radv_instance *instance,
if (instance->debug_flags & RADV_DEBUG_STARTUP)
radv_logi("Found compatible device '%s'.", path);
}
+#endif
struct radv_physical_device *device =
vk_zalloc2(&instance->alloc, NULL, sizeof(*device), 8,
@@ -342,12 +350,16 @@ radv_physical_device_try_create(struct radv_instance *instance,
device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
device->instance = instance;
+#ifdef _WIN32
+ device->ws = radv_null_winsys_create();
+#else
if (drm_device) {
device->ws = radv_amdgpu_winsys_create(fd, instance->debug_flags,
instance->perftest_flags);
} else {
device->ws = radv_null_winsys_create();
}
+#endif
if (!device->ws) {
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
@@ -355,6 +367,7 @@ radv_physical_device_try_create(struct radv_instance *instance,
goto fail_alloc;
}
+#ifndef _WIN32
if (drm_device && instance->enabled_extensions.KHR_display) {
master_fd = open(drm_device->nodes[DRM_NODE_PRIMARY], O_RDWR | O_CLOEXEC);
if (master_fd >= 0) {
@@ -371,6 +384,7 @@ radv_physical_device_try_create(struct radv_instance *instance,
}
}
}
+#endif
device->master_fd = master_fd;
device->local_fd = fd;
@@ -441,8 +455,10 @@ radv_physical_device_try_create(struct radv_instance *instance,
radv_physical_device_get_supported_extensions(device,
&device->supported_extensions);
+#ifndef _WIN32
if (drm_device)
device->bus_info = *drm_device->businfo.pci;
+#endif
if ((device->instance->debug_flags & RADV_DEBUG_INFO))
ac_print_gpu_info(&device->rad_info, stdout);
@@ -857,10 +873,7 @@ radv_enumerate_physical_devices(struct radv_instance *instance)
instance->physical_devices_enumerated = true;
- /* TODO: Check for more devices ? */
- drmDevicePtr devices[8];
VkResult result = VK_SUCCESS;
- int max_devices;
if (getenv("RADV_FORCE_FAMILY")) {
/* When RADV_FORCE_FAMILY is set, the driver creates a nul
@@ -877,7 +890,10 @@ radv_enumerate_physical_devices(struct radv_instance *instance)
return VK_SUCCESS;
}
- max_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
+#ifndef _WIN32
+ /* TODO: Check for more devices ? */
+ drmDevicePtr devices[8];
+ int max_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
if (instance->debug_flags & RADV_DEBUG_STARTUP)
radv_logi("Found %d drm nodes", max_devices);
@@ -907,6 +923,7 @@ radv_enumerate_physical_devices(struct radv_instance *instance)
}
}
drmFreeDevices(devices, max_devices);
+#endif
/* If we successfully enumerated any devices, call it success */
return result;
@@ -2005,6 +2022,7 @@ void radv_GetPhysicalDeviceProperties2(
properties->conservativeRasterizationPostDepthCoverage = false;
break;
}
+#ifndef _WIN32
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT: {
VkPhysicalDevicePCIBusInfoPropertiesEXT *properties =
(VkPhysicalDevicePCIBusInfoPropertiesEXT *)ext;
@@ -2014,6 +2032,7 @@ void radv_GetPhysicalDeviceProperties2(
properties->pciFunction = pdevice->bus_info.func;
break;
}
+#endif
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES: {
VkPhysicalDeviceDriverProperties *properties =
(VkPhysicalDeviceDriverProperties *) ext;
@@ -5264,11 +5283,6 @@ PFN_vkVoidFunction radv_GetInstanceProcAddr(
PUBLIC
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
VkInstance instance,
- const char* pName);
-
-PUBLIC
-VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
- VkInstance instance,
const char* pName)
{
return radv_GetInstanceProcAddr(instance, pName);
@@ -5277,11 +5291,6 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
PUBLIC
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(
VkInstance _instance,
- const char* pName);
-
-PUBLIC
-VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(
- VkInstance _instance,
const char* pName)
{
RADV_FROM_HANDLE(radv_instance, instance, _instance);
@@ -7683,12 +7692,6 @@ void radv_DestroySampler(
vk_free2(&device->vk.alloc, pAllocator, sampler);
}
-/* vk_icd.h does not declare this function, so we declare it here to
- * suppress Wmissing-prototypes.
- */
-PUBLIC VKAPI_ATTR VkResult VKAPI_CALL
-vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion);
-
PUBLIC VKAPI_ATTR VkResult VKAPI_CALL
vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion)
{
diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index e340bcf6701..939c3628ff5 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -29,7 +29,9 @@
#include <fcntl.h>
#include <limits.h>
+#ifndef _WIN32
#include <pwd.h>
+#endif
#include <sys/stat.h>
void
@@ -293,6 +295,7 @@ meta_free(void* _device, void *data)
device->vk.alloc.pfnFree(device->vk.alloc.pUserData, data);
}
+#ifndef _WIN32
static bool
radv_builtin_cache_path(char *path)
{
@@ -322,10 +325,14 @@ radv_builtin_cache_path(char *path)
pwd.pw_dir, suffix2, sizeof(void *) * 8);
return ret > 0 && ret < PATH_MAX + 1;
}
+#endif
static bool
radv_load_meta_pipeline(struct radv_device *device)
{
+#ifdef _WIN32
+ return false;
+#else
char path[PATH_MAX + 1];
struct stat st;
void *data = NULL;
@@ -350,11 +357,13 @@ fail:
free(data);
close(fd);
return ret;
+#endif
}
static void
radv_store_meta_pipeline(struct radv_device *device)
{
+#ifndef _WIN32
char path[PATH_MAX + 1], path2[PATH_MAX + 7];
size_t size;
void *data = NULL;
@@ -391,6 +400,7 @@ fail:
free(data);
close(fd);
unlink(path2);
+#endif
}
VkResult
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index b0a52541e6c..3a7c1b1c0f7 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -43,7 +43,10 @@
#endif
#include "c11/threads.h"
+#ifndef _WIN32
#include <amdgpu.h>
+#include <xf86drm.h>
+#endif
#include "compiler/shader_enums.h"
#include "util/cnd_monotonic.h"
#include "util/macros.h"
@@ -84,7 +87,6 @@ typedef uint32_t xcb_window_t;
#include "radv_entrypoints.h"
#include "wsi_common.h"
-#include "wsi_common_display.h"
/* Helper to determine if we should compile
* any of the Android AHB support.
@@ -322,7 +324,9 @@ struct radv_physical_device {
enum radeon_bo_flag memory_flags[VK_MAX_MEMORY_TYPES];
unsigned heaps;
+#ifndef _WIN32
drmPciBusInfo bus_info;
+#endif
struct radv_device_extension_table supported_extensions;
};