swrast.c:141:48: error: use of undeclared identifier '_SC_PHYS_PAGES'
const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Thread model: posix
Created attachment 115281 [details] [review]
swrast: can retrieve system memory on osx
Based on https://chromium.googlesource.com/chromium/src/base/+/0fe07e993bde909d49fe4e2aac846218daa65809/sys_info_posix.cc
Created attachment 115565 [details] [review]
swrast: Build fix for darwin
Other solution from macports.
So which patch do you want to use? Either looks OK to me.
I would go for Jeremy's patch. Jeremy what do you think ?
Yeah, I think the sysctl() approach is probably more portable if you want to go that route.
I was also thinking that this should be refactored into a more abstract layer since other places in mesa would benefit from it.
(In reply to Jeremy Huddleston from comment #5)
> Yeah, I think the sysctl() approach is probably more portable if you want to
> go that route.
OK, I can commit that patch, but the cherry-pick info:
(cherry picked from commit 8da9f46f18fd4c73f2a9d708c86e7e3d5535b3d8)
refers to a commit that's not in Mesa, AFAICT. Should I remove/fix that?
> I was also thinking that this should be refactored into a more abstract
> layer since other places in mesa would benefit from it.
src/gallium/auxiliary/os/os_misc.c has similar code but that's kind of unreachable from src/mesa/drivers/ so I'm content with this patch.
Yes, please remove the 8da9f46f18fd4c73f2a9d708c86e7e3d5535b3d8 before commit to master. I suspect it refers to the commit on my (unmerged) master branch from which I cherry-picked to an (also unmerged) release branch from which I generated the patches for MacPorts.
Pushed as commit 5b2d3480f57168d50ad24cf0b8c9244414bd3701
Created attachment 115698 [details] [review]
Fix compilation when sys/sysctl.h is not present
Unfortunately, this patch unconditionally includes sys/sysctl.h, which breaks compilation for me (see http://tinderbox.x.org/builds/2015-05-07-0008/logs/mesa-mesa/#build)
I can't find any evidence that sys/sysctl.h is required by POSIX.
Attached is an attempt to fix this.
Additionally, I'm not sure if any platform exists which has both interfaces, but preferring sysctl() to sysconf() as this patch does, would mean on any such platforms a different path would be used to that previously.
Julien, can you test the new patch?
(In reply to Brian Paul from comment #10)
> Julien, can you test the new patch?
It is missing a #else just before #error "Unsupported platform", otherwise it is working fine.
My patch is superseded by http://lists.freedesktop.org/archives/mesa-dev/2015-May/084445.html
Looks like the patch was commited as 31cd2d75dc3844e40143f649fe383de17c152a13
Bug is resolved as closed so I presume that's it. Re-open if not.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.