On 31 December 2017 at 16:55, Greg V <greg@unrelenting.technology> wrote: > --- > src/intel/vulkan/anv_device.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c > index 6f77d33f93..2d3062d103 100644 > --- a/src/intel/vulkan/anv_device.c > +++ b/src/intel/vulkan/anv_device.c > @@ -25,7 +25,9 @@ > #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> > @@ -79,10 +81,15 @@ anv_compute_heap_size(int fd, 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 > + Hmm we seems to be having this type of code in a new places already. Can I interest you in making a (static inline) helper in src/util and folding all the duplicated get_total_phys_memory implementations?
The instance in os_misc.c seems to be the most complete one. -Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev