Re: openal: enable NEON on OpenBSD

2021-04-24 Thread Patrick Wildt
Am Thu, Apr 22, 2021 at 12:08:45AM -0400 schrieb Brad Smith:
> On 4/20/2021 3:38 PM, Patrick Wildt wrote:
> > Hi,
> > 
> > both our arm64 and armv7 require at least NEON support.  audio/openal
> > checks for NEON support by opening /proc/cpuinfo and parsing it, which
> > we obviously don't have.  I'd propose just patching it and enabling it
> > for OpenBSD.  At the very least, it gets rid of this obnoxious message:
> > 
> > Failed to open /proc/cpuinfo, cannot check for NEON support
> > 
> > Tested by running games/openal.
> > 
> > Opinions?
> 
> I just sent out an update to OpenAL where this bit of code has been removed.
> 
> https://github.com/kcat/openal-soft/commit/9d354f721c39dc643399b36297c57ef809451f6f
> 
> Please double check how things are with ARM with the latest code I sent over
> to you.

So I had a look at your openal 1.21.1 diff, and it looks like we don't
have to patch anything.

First they added

https://github.com/kcat/openal-soft/commit/c75c96ce2d2f3801c8e28462d529fe999d12db8f

which skips the cpuinfo dance if __ARM_NEON is defined.

Then, as you pointed out, the cpuinfo stuff was removed.

https://github.com/kcat/openal-soft/commit/9d354f721c39dc643399b36297c57ef809451f6f

In 1.21.1, the code now looks like this:

 #ifdef HAVE_NEON
 #ifdef __ARM_NEON
 ret.mCaps |= CPU_CAP_NEON;
+#error fu
 #elif defined(_WIN32) && (defined(_M_ARM) || defined(_M_ARM64))
 if(IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE))
 ret.mCaps |= CPU_CAP_NEON;
 #else
 #warning "Assuming NEON run-time support!"
 ret.mCaps |= CPU_CAP_NEON;
 #endif
 #endif

I added the #error fu, to check if the build fails, which means that we
have __ARM_NEON defined.  The build fails with that error, meaning that
I believe we can just update to 1.21.1 without having to patch it.

So yeah, I'm happy with that then!

Patrick



Re: openal: enable NEON on OpenBSD

2021-04-22 Thread Brad Smith

On 4/20/2021 3:38 PM, Patrick Wildt wrote:

Hi,

both our arm64 and armv7 require at least NEON support.  audio/openal
checks for NEON support by opening /proc/cpuinfo and parsing it, which
we obviously don't have.  I'd propose just patching it and enabling it
for OpenBSD.  At the very least, it gets rid of this obnoxious message:

Failed to open /proc/cpuinfo, cannot check for NEON support

Tested by running games/openal.

Opinions?


I just sent out an update to OpenAL where this bit of code has been removed.

https://github.com/kcat/openal-soft/commit/9d354f721c39dc643399b36297c57ef809451f6f

Please double check how things are with ARM with the latest code I sent 
over to you.




openal: enable NEON on OpenBSD

2021-04-20 Thread Patrick Wildt
Hi,

both our arm64 and armv7 require at least NEON support.  audio/openal
checks for NEON support by opening /proc/cpuinfo and parsing it, which
we obviously don't have.  I'd propose just patching it and enabling it
for OpenBSD.  At the very least, it gets rid of this obnoxious message:

Failed to open /proc/cpuinfo, cannot check for NEON support

Tested by running games/openal.

Opinions?

Patrick

diff --git a/audio/openal/Makefile b/audio/openal/Makefile
index 871aa7bbf6c..a1de0e0467b 100644
--- a/audio/openal/Makefile
+++ b/audio/openal/Makefile
@@ -7,6 +7,7 @@ EPOCH = 0
 DISTNAME = openal-soft-$V
 PKGNAME =  openal-$V
 CATEGORIES =   audio
+REVISION = 0
 
 SHARED_LIBS =  openal  4.0
 
diff --git a/audio/openal/patches/patch-alc_helpers_cpp 
b/audio/openal/patches/patch-alc_helpers_cpp
new file mode 100644
index 000..f3f781d5afc
--- /dev/null
+++ b/audio/openal/patches/patch-alc_helpers_cpp
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Index: alc/helpers.cpp
+--- alc/helpers.cpp.orig
 alc/helpers.cpp
+@@ -161,6 +161,9 @@ void FillCPUCaps(int capfilter)
+ #endif
+ #endif
+ #ifdef HAVE_NEON
++#if defined(__OpenBSD__)
++caps |= CPU_CAP_NEON;
++#else
+ al::ifstream file{"/proc/cpuinfo"};
+ if(!file.is_open())
+ ERR("Failed to open /proc/cpuinfo, cannot check for NEON support\n");
+@@ -193,6 +196,7 @@ void FillCPUCaps(int capfilter)
+ }
+ }
+ }
++#endif
+ #endif
+ 
+ TRACE("Extensions:%s%s%s%s%s%s\n",