Changeset View
Changeset View
Standalone View
Standalone View
graphics/mesa-dri/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 | |||||
--- src/intel/vulkan/anv_device.c.orig 2018-01-23 18:08:50 UTC | --- 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 @@ | @@ -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> | ||||
@@ -40,6 +42,10 @@ | @@ -44,6 +46,13 @@ | ||||
#include "genxml/gen7_pack.h" | #include "genxml/gen7_pack.h" | ||||
+#ifndef ETIME | +#ifndef ETIME | ||||
+#define ETIME ETIMEDOUT | +#define ETIME ETIMEDOUT | ||||
+#endif | +#endif | ||||
+#ifndef CLOCK_MONOTONIC_RAW | |||||
+#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC | |||||
+#endif | |||||
+ | + | ||||
static void | static void | ||||
compiler_debug_log(void *data, const char *fmt, ...) | compiler_debug_log(void *data, const char *fmt, ...) | ||||
{ } | { } | ||||
@@ -75,10 +81,15 @@ anv_compute_heap_size(int fd, uint64_t *heap_size) | @@ -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 */ | /* 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. |