Changeset View
Changeset View
Standalone View
Standalone View
graphics/mesa/files/patch-src_intel_vulkan_anv__device.c
- Without sysinfo() fall back to sysconf() | - Without sysinfo() fall back to sysconf() | ||||
- Define ETIME if missing | - Define ETIME if missing | ||||
- Define CLOCK_MONOTONIC_RAW 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.orig 2019-12-18 19:04:21 UTC | ||||
+++ src/intel/vulkan/anv_device.c | +++ src/intel/vulkan/anv_device.c | ||||
@@ -25,7 +25,9 @@ | @@ -25,7 +25,9 @@ | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <sys/mman.h> | #include <sys/mman.h> | ||||
+#ifdef __GLIBC__ | +#ifdef __GLIBC__ | ||||
#include <sys/sysinfo.h> | #include <sys/sysinfo.h> | ||||
+#endif | +#endif | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <xf86drm.h> | #include <xf86drm.h> | ||||
@@ -44,6 +46,17 @@ | @@ -60,6 +62,17 @@ DRI_CONF_END; | ||||
*/ | |||||
#define MAX_DEBUG_MESSAGE_LENGTH 4096 | |||||
#include "genxml/gen7_pack.h" | |||||
+#ifndef ETIME | +#ifndef ETIME | ||||
+#define ETIME ETIMEDOUT | +#define ETIME ETIMEDOUT | ||||
+#endif | +#endif | ||||
+#ifndef CLOCK_MONOTONIC_RAW | +#ifndef CLOCK_MONOTONIC_RAW | ||||
+# ifdef CLOCK_MONOTONIC_FAST | +# ifdef CLOCK_MONOTONIC_FAST | ||||
+# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST | +# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST | ||||
+# else | +# else | ||||
+# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC | +# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC | ||||
+# endif | +# endif | ||||
+#endif | +#endif | ||||
+ | + | ||||
static void | static void | ||||
compiler_debug_log(void *data, const char *fmt, ...) | compiler_debug_log(void *data, const char *fmt, ...) | ||||
{ } | { | ||||
@@ -64,10 +73,15 @@ static VkResult | @@ -96,10 +109,15 @@ static uint64_t | ||||
anv_compute_heap_size(int fd, uint64_t gtt_size, uint64_t *heap_size) | anv_compute_heap_size(int fd, uint64_t gtt_size) | ||||
{ | { | ||||
/* Query the total ram from the system */ | /* Query the total ram from the system */ | ||||
+#ifdef __GLIBC__ | +#ifdef __GLIBC__ | ||||
struct sysinfo info; | struct sysinfo info; | ||||
sysinfo(&info); | sysinfo(&info); | ||||
uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit; | uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit; | ||||
+#else | +#else | ||||
+ uint64_t total_ram = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGE_SIZE); | + uint64_t total_ram = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGE_SIZE); | ||||
+#endif | +#endif | ||||
+ | + | ||||
/* We don't want to burn too much ram with the GPU. If the user has 4GiB | /* 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. | * or less, we use at most half. If they have more than 4GiB, we use 3/4. |