Changeset View
Changeset View
Standalone View
Standalone View
head/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__device.c
- Without sysinfo() fall back to sysconf() | --- src/intel/vulkan/anv_device.c.orig 2020-09-28 22:52:12 UTC | ||||
- Define ETIME if missing | |||||
- Define CLOCK_MONOTONIC_RAW if missing | |||||
--- src/intel/vulkan/anv_device.c.orig 2018-11-06 16:16:02 UTC | |||||
+++ src/intel/vulkan/anv_device.c | +++ src/intel/vulkan/anv_device.c | ||||
@@ -25,7 +25,9 @@ | @@ -48,6 +48,10 @@ | ||||
#include <stdbool.h> | |||||
#include <string.h> | |||||
#include <sys/mman.h> | |||||
+#ifdef __GLIBC__ | |||||
#include <sys/sysinfo.h> | |||||
+#endif | |||||
#include <unistd.h> | |||||
#include <fcntl.h> | |||||
#include <xf86drm.h> | |||||
@@ -44,6 +46,17 @@ | |||||
#include "genxml/gen7_pack.h" | #include "genxml/gen7_pack.h" | ||||
+#ifndef ETIME | +#if DETECT_OS_FREEBSD | ||||
+#define ETIME ETIMEDOUT | |||||
+#endif | |||||
+#ifndef CLOCK_MONOTONIC_RAW | |||||
+# ifdef CLOCK_MONOTONIC_FAST | |||||
+# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST | +#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST | ||||
+# else | |||||
+# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC | |||||
+# endif | +#endif | ||||
+#endif | |||||
+ | + | ||||
static void | static const char anv_dri_options_xml[] = | ||||
compiler_debug_log(void *data, const char *fmt, ...) | DRI_CONF_BEGIN | ||||
{ } | DRI_CONF_SECTION_PERFORMANCE | ||||
@@ -64,10 +73,15 @@ static VkResult | |||||
anv_compute_heap_size(int fd, uint64_t gtt_size, uint64_t *heap_size) | |||||
{ | |||||
/* Query the total ram from the system */ | |||||
+#ifdef __GLIBC__ | |||||
struct sysinfo info; | |||||
sysinfo(&info); | |||||
uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit; | |||||
+#else | |||||
+ uint64_t total_ram = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGE_SIZE); | |||||
+#endif | |||||
+ | |||||
/* We don't want to burn too much ram with the GPU. If the user has 4GiB | |||||
* or less, we use at most half. If they have more than 4GiB, we use 3/4. |