[vlc-commits] [Git][videolan/vlc][3.0.x] 8 commits: cpu: define VLC_ALTIVEC attribute macro

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Sat May 21 09:02:42 UTC 2022



Rémi Denis-Courmont pushed to branch 3.0.x at VideoLAN / VLC


Commits:
47fb9426 by Rémi Denis-Courmont at 2022-05-21T08:49:58+00:00
cpu: define VLC_ALTIVEC attribute macro

Like on x86 (e.g. VLC_SSE), this macro enables the use of AltiVec for
just a given function. Thus the other functions in the same C module
can be compiled without AltiVec and run on non-AltiVec processors.

(cherry picked from commit cb303e77f427c81e9644c12411a5908955181e55)

- - - - -
dfc27e4f by Rémi Denis-Courmont at 2022-05-21T08:49:58+00:00
cpu: use VLC_ALTIVEC

In a very broad sense, this is a substitute for
8cbec77763d30ba2f1d3eb42c5665b86a18cf438 from master, but the two
changes are completely different.

- - - - -
d9028ba4 by Rémi Denis-Courmont at 2022-05-21T08:49:58+00:00
configure: do not enable AltiVec in libvlccore

This was added ostensibly to fix compilation of the run-time AltiVec
test which was removed in bc146294cfeabde3a0c919883931c17e7c36630d.
Unfortunately, it causes the compiler to emit AltiVec instructions,
such that the executable crashes if AltiVec is not available.

Regression from e48d61955575634ef0324158cac88353e97d50b8.

(cherry picked from commit 4af9c85184549d7d21304ae2a76dd5891acda419)

- - - - -
cb863f07 by Rémi Denis-Courmont at 2022-05-21T08:49:58+00:00
i420_yuy2: use VLC_ALTIVEC

(cherry picked from commit 03d8a050e0b2dbb7bdfc65d1daadba6e6a79661c)

- - - - -
4dca3df3 by Rémi Denis-Courmont at 2022-05-21T08:49:58+00:00
configure: remove unused ALTIVEC_CFLAGS

(cherry picked from commit 5b7b2ff84285320c864d67c0ea27ba091993c789)

- - - - -
902c846b by Rémi Denis-Courmont at 2022-05-21T08:49:58+00:00
deinterlace: use VLC_ALTIVEC

(cherry picked from commit 04cfde414e5db145449b732912ec40006c5f44a4)

- - - - -
78e41c72 by Rémi Denis-Courmont at 2022-05-21T08:49:58+00:00
deinterlace: move CFLAGS to Makefile

(cherry picked from commit bcbbefbf9d5000a1e44ec22c902d3919b851ead3)

- - - - -
6c5ed18a by Rémi Denis-Courmont at 2022-05-21T08:49:58+00:00
configure: do not force AltiVec on everything

Fixes Debian #842513.

(cherry picked from commit 5a236388dea5f9e95f95204829050e89318e1d9c)

- - - - -


7 changed files:

- configure.ac
- include/vlc_cpu.h
- modules/video_chroma/Makefile.am
- modules/video_chroma/i420_yuy2.c
- modules/video_filter/Makefile.am
- modules/video_filter/deinterlace/merge.c
- src/misc/cpu.c


Changes:

=====================================
configure.ac
=====================================
@@ -1578,7 +1578,6 @@ AC_ARG_ENABLE(altivec,
         [enable_altivec=yes], [enable_altivec=no])
 ])
 have_altivec="no"
-ALTIVEC_CFLAGS=""
 AS_IF([test "${enable_altivec}" = "yes"], [
   ARCH="${ARCH} altivec";
   VLC_SAVE_FLAGS
@@ -1595,11 +1594,6 @@ AS_IF([test "${enable_altivec}" = "yes"], [
   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
               [Define to 1 if AltiVec inline assembly is available.])
-    AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
-      ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
-      VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
-    ])
-    have_altivec="yes"
   ])
 
   VLC_SAVE_FLAGS
@@ -1616,11 +1610,6 @@ AS_IF([test "${enable_altivec}" = "yes"], [
   ])
   VLC_RESTORE_FLAGS
   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
-    CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
-    AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
-    VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
-    ALTIVEC_CFLAGS="$ALTIVEC_CFLAGS ${ac_cv_c_altivec}"
-    VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec}])
     have_altivec="yes"
   ])
   AC_CHECK_HEADERS(altivec.h)
@@ -1635,7 +1624,6 @@ AS_IF([test "${enable_altivec}" = "yes"], [
     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
   ])
 ])
-AC_SUBST(ALTIVEC_CFLAGS)
 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
 
 dnl


=====================================
include/vlc_cpu.h
=====================================
@@ -135,8 +135,10 @@ VLC_API unsigned vlc_CPU(void);
 
 #  ifdef ALTIVEC
 #   define vlc_CPU_ALTIVEC() (1)
+#   define VLC_ALTIVEC
 #  else
 #   define vlc_CPU_ALTIVEC() ((vlc_CPU() & VLC_CPU_ALTIVEC) != 0)
+#   define VLC_ALTIVEC __attribute__ ((__target__ ("altivec")))
 #  endif
 
 # elif defined (__arm__)


=====================================
modules/video_chroma/Makefile.am
=====================================
@@ -70,7 +70,6 @@ EXTRA_LTLIBRARIES += libswscale_plugin.la libchroma_omx_plugin.la
 libi420_yuy2_altivec_plugin_la_SOURCES = video_chroma/i420_yuy2.c video_chroma/i420_yuy2.h
 libi420_yuy2_altivec_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
 	-DMODULE_NAME_IS_i420_yuy2_altivec
-libi420_yuy2_altivec_plugin_la_CFLAGS = $(AM_CFLAGS) $(ALTIVEC_CFLAGS)
 
 if HAVE_ALTIVEC
 chroma_LTLIBRARIES += \


=====================================
modules/video_chroma/i420_yuy2.c
=====================================
@@ -55,7 +55,7 @@
 #    define VLC_TARGET VLC_SSE
 #elif defined (MODULE_NAME_IS_i420_yuy2_altivec)
 #    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422"
-#    define VLC_TARGET
+#    define VLC_TARGET VLC_ALTIVEC
 #endif
 
 /*****************************************************************************


=====================================
modules/video_filter/Makefile.am
=====================================
@@ -144,6 +144,9 @@ if HAVE_ARM64
 libdeinterlace_plugin_la_SOURCES += video_filter/deinterlace/merge_arm64.S
 libdeinterlace_plugin_la_CFLAGS += -DCAN_COMPILE_ARM64
 endif
+if HAVE_ALTIVEC
+libdeinterlace_plugin_la_CFLAGS += -DCAN_COMPILE_C_ALTIVEC
+endif
 libdeinterlace_plugin_la_LIBADD = libdeinterlace_common.la
 video_filter_LTLIBRARIES += libdeinterlace_plugin.la
 


=====================================
modules/video_filter/deinterlace/merge.c
=====================================
@@ -179,6 +179,7 @@ void Merge16BitSSE2( void *_p_dest, const void *_p_s1, const void *_p_s2,
 #endif
 
 #ifdef CAN_COMPILE_C_ALTIVEC
+VLC_ALTIVEC
 void MergeAltivec( void *_p_dest, const void *_p_s1,
                    const void *_p_s2, size_t i_bytes )
 {


=====================================
src/misc/cpu.c
=====================================
@@ -106,7 +106,7 @@ VLC_MMX static void ThreeD_Now_test (void)
 #endif
 
 #if defined (CAN_COMPILE_ALTIVEC)
-static void Altivec_test (void)
+VLC_ALTIVEC static void Altivec_test (void)
 {
     asm volatile ("mtspr 256, %0\n" "vand %%v0, %%v0, %%v0\n" : : "r" (-1));
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3af4cf5cf4322b14d4c3e1995bb747242054b20f...6c5ed18a6bb06cc55afe0eaa7e2134fb090bf5d5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3af4cf5cf4322b14d4c3e1995bb747242054b20f...6c5ed18a6bb06cc55afe0eaa7e2134fb090bf5d5
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list