- Without sysinfo() fall back to sysconf() - 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 @@ -25,7 +25,9 @@ #include #include #include +#ifdef __GLIBC__ #include +#endif #include #include #include @@ -44,6 +46,17 @@ #include "genxml/gen7_pack.h" +#ifndef ETIME +#define ETIME ETIMEDOUT +#endif +#ifndef CLOCK_MONOTONIC_RAW +# ifdef CLOCK_MONOTONIC_FAST +# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST +# else +# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC +# endif +#endif + static void compiler_debug_log(void *data, const char *fmt, ...) { } @@ -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.