Re: [FFmpeg-devel] [PATCH] libavutil/ppc: Include the hardware feature flags like the other archs

2024-11-01 Thread Sean McGovern
Hi Brad,

On Fri, Nov 1, 2024 at 1:46 AM Brad Smith
 wrote:
>
> ping.

Sorry for not ringing in on this sooner, the PowerMac G5 FATE node
does not like this:

src/libavutil/ppc/cpu.c:85:18: runtime error: left shift of 1 by 31
places cannot be represented in type 'int'

Probably something needs to be 'unsigned'.

-- Sean McGovern
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] libavutil/ppc: Include the hardware feature flags like the other archs

2024-11-01 Thread Brad Smith

On 2024-11-01 8:50 p.m., Michael Niedermayer wrote:

On Fri, Nov 01, 2024 at 01:45:46AM -0400, Brad Smith wrote:

ping.

it builds on my old cross compile environment on ubuntu
but i have no real ppc here to test beyond that

thx


Tested with a Linux Power8 VM.

[almalinux@ffmpeg1 tests]$ ./cpu
cpu_flags(raw) = 0x0007
cpu_flags_str(raw) = altivec vsx power8
cpu_flags(effective) = 0x0007
cpu_flags_str(effective) = altivec vsx power8
threads = auto (cpu_count = 2)



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] libavutil/ppc: Include the hardware feature flags like the other archs

2024-11-01 Thread Michael Niedermayer
On Fri, Nov 01, 2024 at 01:45:46AM -0400, Brad Smith wrote:
> ping.

it builds on my old cross compile environment on ubuntu
but i have no real ppc here to test beyond that

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] libavutil/ppc: Include the hardware feature flags like the other archs

2024-11-01 Thread Brad Smith

ping.

On 2024-10-20 3:44 a.m., Brad Smith wrote:

libavutil/ppc: Include the hardware feature flags like the other archs

Also include the hardware feature flags like the other archs do and
clean up the code a bit.

Tested on Linux POWER8.

Signed-off-by: Brad Smith 
---
  libavutil/ppc/cpu.c | 35 +--
  1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 9381272175..62d495ec1d 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -46,6 +46,17 @@
  #include "libavutil/cpu.h"
  #include "libavutil/cpu_internal.h"
  
+#ifndef AT_HWCAP

+#define AT_HWCAP 16
+#endif
+#ifndef AT_HWCAP2
+#define AT_HWCAP226
+#endif
+
+#define HWCAP_PPC_VSX(1 << 7)
+#define HWCAP_PPC_ALTIVEC(1 << 28)
+#define HWCAP2_PPC_ARCH_2_07 (1 << 31)
+
  /**
   * This function MAY rely on signal() or fork() in order to make sure AltiVec
   * is present.
@@ -65,20 +76,14 @@ int ff_get_cpu_flags_ppc(void)
  int flags = 0;
  
  unsigned long hwcap = ff_getauxval(AT_HWCAP);

-#ifdef PPC_FEATURE2_ARCH_2_07
  unsigned long hwcap2 = ff_getauxval(AT_HWCAP2);
-#endif
  
-if (hwcap & PPC_FEATURE_HAS_ALTIVEC)

+if (hwcap & HWCAP_PPC_ALTIVEC)
 flags |= AV_CPU_FLAG_ALTIVEC;
-#ifdef PPC_FEATURE_HAS_VSX
-if (hwcap & PPC_FEATURE_HAS_VSX)
+if (hwcap & HWCAP_PPC_VSX)
 flags |= AV_CPU_FLAG_VSX;
-#endif
-#ifdef PPC_FEATURE2_ARCH_2_07
-if (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+if (hwcap2 & HWCAP2_PPC_ARCH_2_07)
 flags |= AV_CPU_FLAG_POWER8;
-#endif
  
  return flags;

  #elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__)
@@ -112,23 +117,17 @@ int ff_get_cpu_flags_ppc(void)
  if (buf[i] == AT_NULL)
  goto out;
  if (buf[i] == AT_HWCAP) {
-if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC)
+if (buf[i + 1] & HWCAP_PPC_ALTIVEC)
  ret = AV_CPU_FLAG_ALTIVEC;
-#ifdef PPC_FEATURE_HAS_VSX
-if (buf[i + 1] & PPC_FEATURE_HAS_VSX)
+if (buf[i + 1] & HWCAP_PPC_VSX)
  ret |= AV_CPU_FLAG_VSX;
-#endif
  if (ret & AV_CPU_FLAG_VSX)
  av_assert0(ret & AV_CPU_FLAG_ALTIVEC);
  }
-#ifdef AT_HWCAP2 /* not introduced until glibc 2.18 */
  else if (buf[i] == AT_HWCAP2) {
-#ifdef PPC_FEATURE2_ARCH_2_07
-if (buf[i + 1] & PPC_FEATURE2_ARCH_2_07)
+if (buf[i + 1] & HWCAP2_PPC_ARCH_2_07)
  ret |= AV_CPU_FLAG_POWER8;
-#endif
  }
-#endif /* AT_HWCAP2 */
  }
  }
  

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".