git: 28ca735cd593 - main - multimedia/svt-av1: switch to upstream cpuinfo fix

Jan Beich jbeich at FreeBSD.org
Wed May 12 14:49:28 UTC 2021


The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=28ca735cd59348c8550457e25bd659d9cbed1771

commit 28ca735cd59348c8550457e25bd659d9cbed1771
Author:     Jan Beich <jbeich at FreeBSD.org>
AuthorDate: 2021-05-11 21:06:02 +0000
Commit:     Jan Beich <jbeich at FreeBSD.org>
CommitDate: 2021-05-12 14:43:25 +0000

    multimedia/svt-av1: switch to upstream cpuinfo fix
---
 multimedia/svt-av1/Makefile           |   4 +
 multimedia/svt-av1/distinfo           |   2 +
 multimedia/svt-av1/files/patch-revert | 231 ----------------------------------
 3 files changed, 6 insertions(+), 231 deletions(-)

diff --git a/multimedia/svt-av1/Makefile b/multimedia/svt-av1/Makefile
index 58d942dbf437..d5d7badc1cd7 100644
--- a/multimedia/svt-av1/Makefile
+++ b/multimedia/svt-av1/Makefile
@@ -1,8 +1,12 @@
 PORTNAME=	svt-av1
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.8.7
+PORTREVISION=	1
 CATEGORIES=	multimedia
 
+PATCH_SITES=	${GL_SITE}/${GL_ACCOUNT}/${GL_PROJECT}/commit/
+PATCHFILES+=	284ef885f85f.patch:-p1 # https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/1704
+
 MAINTAINER=	jbeich at FreeBSD.org
 COMMENT=	Scalable AV1 encoder
 
diff --git a/multimedia/svt-av1/distinfo b/multimedia/svt-av1/distinfo
index 5b0ba5eac19d..2887f5b2edd1 100644
--- a/multimedia/svt-av1/distinfo
+++ b/multimedia/svt-av1/distinfo
@@ -1,3 +1,5 @@
 TIMESTAMP = 1620464700
 SHA256 (AOMediaCodec-SVT-AV1-3971c982311d49f9355dc8dccdcf8d21b70fa624_GL0.tar.gz) = 5bb4e655e40beda6556897caa8f22e3be478a361e5000ffa0f015e1c32778893
 SIZE (AOMediaCodec-SVT-AV1-3971c982311d49f9355dc8dccdcf8d21b70fa624_GL0.tar.gz) = 6401397
+SHA256 (284ef885f85f.patch) = 00887b7716210570c65efd168198c0371b962ed25725414f8fefa7f336577794
+SIZE (284ef885f85f.patch) = 5534
diff --git a/multimedia/svt-av1/files/patch-revert b/multimedia/svt-av1/files/patch-revert
deleted file mode 100644
index a12b5df35443..000000000000
--- a/multimedia/svt-av1/files/patch-revert
+++ /dev/null
@@ -1,231 +0,0 @@
-Revert https://gitlab.com/AOMediaCodec/SVT-AV1/-/commit/fedc119668a4
-due to https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/1613
-
---- CMakeLists.txt.orig	2021-05-08 09:05:00 UTC
-+++ CMakeLists.txt
-@@ -389,8 +389,4 @@ endif()
- 
- add_subdirectory(third_party/fastfeat)
- 
--if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
--    add_subdirectory(third_party/cpuinfo)
--endif()
--
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/Source/API/ DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/svt-av1" FILES_MATCHING PATTERN "*.h")
---- Source/Lib/Common/Codec/CMakeLists.txt.orig	2020-11-29 07:10:56 UTC
-+++ Source/Lib/Common/Codec/CMakeLists.txt
-@@ -32,16 +32,14 @@ include_directories(${PROJECT_SOURCE_DIR}/Source/API/
-     ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX2/
-     ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX512/
-     ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/
--    ${PROJECT_SOURCE_DIR}/third_party/fastfeat/
--    ${PROJECT_SOURCE_DIR}/third_party/cpuinfo/include/)
-+    ${PROJECT_SOURCE_DIR}/third_party/fastfeat/)
- else ()
- # Include Encoder Subdirectories
- include_directories(${PROJECT_SOURCE_DIR}/Source/API/
-     ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/
-     ${PROJECT_SOURCE_DIR}/Source/Lib/Common/C_DEFAULT/
-     ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/
--    ${PROJECT_SOURCE_DIR}/third_party/fastfeat/
--    ${PROJECT_SOURCE_DIR}/third_party/cpuinfo/include/)
-+    ${PROJECT_SOURCE_DIR}/third_party/fastfeat/)
- endif ()
- file(GLOB all_files
-     "*.h"
---- Source/Lib/Common/Codec/common_dsp_rtcd.c.orig	2021-05-08 09:05:00 UTC
-+++ Source/Lib/Common/Codec/common_dsp_rtcd.c
-@@ -17,11 +17,6 @@
- #include "EbPackUnPack_C.h"
- #include "EbAvcStyleMcp.h"
- 
--#ifdef ARCH_X86_64
--// for get_cpu_flags
--#include "cpuinfo.h"
--#endif
--
- /*
-  * DSP deprecated flags
-  */
-@@ -72,30 +67,120 @@ int64_t svt_av1_block_error_c(const TranLow *coeff, co
-  * Instruction Set Support
-  **************************************/
- #ifdef ARCH_X86_64
-+// Helper Functions
-+static INLINE void run_cpuid(int eax, int ecx, int* abcd) {
-+#ifdef _WIN32
-+    __cpuidex(abcd, eax, ecx);
-+#else
-+    int ebx = 0, edx = 0;
-+#if defined(__i386__) && defined(__PIC__)
-+    /* in case of PIC under 32-bit EBX cannot be clobbered */
-+    __asm__("movl %%ebx, %%edi \n\t cpuid \n\t xchgl %%ebx, %%edi"
-+            : "=D"(ebx),
-+#else
-+    __asm__("cpuid"
-+    : "+b"(ebx),
-+#endif
-+    "+a"(eax),
-+    "+c"(ecx),
-+    "=d"(edx));
-+    abcd[0] = eax;
-+    abcd[1] = ebx;
-+    abcd[2] = ecx;
-+    abcd[3] = edx;
-+#endif
-+}
-+
-+static INLINE int32_t check_xcr0_ymm() {
-+    uint32_t xcr0;
-+#ifdef _WIN32
-+    xcr0 = (uint32_t)_xgetbv(0); /* min VS2010 SP1 compiler is required */
-+#else
-+    __asm__("xgetbv" : "=a"(xcr0) : "c"(0) : "%edx");
-+#endif
-+    return ((xcr0 & 6) == 6); /* checking if xmm and ymm state are enabled in XCR0 */
-+}
-+
-+static int32_t check_4thgen_intel_core_features() {
-+    int       abcd[4];
-+    const int fma_movbe_osxsave_mask = ((1 << 12) | (1 << 22) | (1 << 27));
-+    const int avx2_bmi12_mask        = (1 << 5) | (1 << 3) | (1 << 8);
-+
-+    /* CPUID.(EAX=01H, ECX=0H):ECX.FMA[bit 12]==1   &&
-+    CPUID.(EAX=01H, ECX=0H):ECX.MOVBE[bit 22]==1 &&
-+    CPUID.(EAX=01H, ECX=0H):ECX.OSXSAVE[bit 27]==1 */
-+    run_cpuid(1, 0, abcd);
-+    if ((abcd[2] & fma_movbe_osxsave_mask) != fma_movbe_osxsave_mask) return 0;
-+
-+    if (!check_xcr0_ymm()) return 0;
-+
-+    /*  CPUID.(EAX=07H, ECX=0H):EBX.AVX2[bit 5]==1  &&
-+    CPUID.(EAX=07H, ECX=0H):EBX.BMI1[bit 3]==1  &&
-+    CPUID.(EAX=07H, ECX=0H):EBX.BMI2[bit 8]==1  */
-+    run_cpuid(7, 0, abcd);
-+    if ((abcd[1] & avx2_bmi12_mask) != avx2_bmi12_mask) return 0;
-+    /* CPUID.(EAX=80000001H):ECX.LZCNT[bit 5]==1 */
-+    run_cpuid(0x80000001, 0, abcd);
-+    if ((abcd[2] & (1 << 5)) == 0) return 0;
-+    return 1;
-+}
-+
-+static INLINE int check_xcr0_zmm() {
-+    uint32_t xcr0;
-+    uint32_t zmm_ymm_xmm = (7 << 5) | (1 << 2) | (1 << 1);
-+#ifdef _WIN32
-+    xcr0 = (uint32_t)_xgetbv(0); /* min VS2010 SP1 compiler is required */
-+#else
-+    __asm__("xgetbv" : "=a"(xcr0) : "c"(0) : "%edx");
-+#endif
-+    return ((xcr0 & zmm_ymm_xmm) ==
-+            zmm_ymm_xmm); /* check if xmm, ymm and zmm state are enabled in XCR0 */
-+}
-+
-+static int32_t can_use_intel_avx512() {
-+    int abcd[4];
-+
-+    /*  CPUID.(EAX=07H, ECX=0):EBX[bit 16]==1 AVX512F
-+    CPUID.(EAX=07H, ECX=0):EBX[bit 17] AVX512DQ
-+    CPUID.(EAX=07H, ECX=0):EBX[bit 28] AVX512CD
-+    CPUID.(EAX=07H, ECX=0):EBX[bit 30] AVX512BW
-+    CPUID.(EAX=07H, ECX=0):EBX[bit 31] AVX512VL */
-+
-+    const int avx512_ebx_mask = (1u << 16) // AVX-512F
-+        | (1u << 17) // AVX-512DQ
-+        | (1u << 28) // AVX-512CD
-+        | (1u << 30) // AVX-512BW
-+        | (1u << 31); // AVX-512VL
-+
-+    if (!check_4thgen_intel_core_features()) return 0;
-+
-+    // ensure OS supports ZMM registers (and YMM, and XMM)
-+    if (!check_xcr0_zmm()) return 0;
-+
-+    run_cpuid(7, 0, abcd);
-+    if ((abcd[1] & avx512_ebx_mask) != avx512_ebx_mask) return 0;
-+
-+    return 1;
-+}
-+
- CPU_FLAGS get_cpu_flags() {
-     CPU_FLAGS flags = 0;
- 
--    // safe to call multiple times, and threadsafe
--    // also correctly checks whether the OS saves AVX(2|512) registers
--    cpuinfo_initialize();
-+    /* To detail tests CPU features, requires more accurate implementation.
-+        Documentation help:
-+        https://docs.microsoft.com/en-us/cpp/intrinsics/cpuid-cpuidex?redirectedfrom=MSDN&view=vs-2019
-+    */
- 
--    flags |= cpuinfo_has_x86_mmx() ? CPU_FLAGS_MMX : 0;
--    flags |= cpuinfo_has_x86_sse() ? CPU_FLAGS_SSE : 0;
--    flags |= cpuinfo_has_x86_sse2() ? CPU_FLAGS_SSE2 : 0;
--    flags |= cpuinfo_has_x86_sse3() ? CPU_FLAGS_SSE3 : 0;
--    flags |= cpuinfo_has_x86_ssse3() ? CPU_FLAGS_SSSE3 : 0;
--    flags |= cpuinfo_has_x86_sse4_1() ? CPU_FLAGS_SSE4_1 : 0;
--    flags |= cpuinfo_has_x86_sse4_2() ? CPU_FLAGS_SSE4_2 : 0;
-+    if (check_4thgen_intel_core_features()) {
-+        flags |= CPU_FLAGS_MMX | CPU_FLAGS_SSE | CPU_FLAGS_SSE2 | CPU_FLAGS_SSE3 | CPU_FLAGS_SSSE3 |
-+                 CPU_FLAGS_SSE4_1 | CPU_FLAGS_SSE4_2 | CPU_FLAGS_AVX | CPU_FLAGS_AVX2;
-+    }
- 
--    flags |= cpuinfo_has_x86_avx() ? CPU_FLAGS_AVX : 0;
--    flags |= cpuinfo_has_x86_avx2() ? CPU_FLAGS_AVX2 : 0;
-+    if (can_use_intel_avx512()) {
-+        flags |= CPU_FLAGS_AVX512F | CPU_FLAGS_AVX512DQ | CPU_FLAGS_AVX512CD | CPU_FLAGS_AVX512BW |
-+                 CPU_FLAGS_AVX512VL;
-+    }
- 
--    flags |= cpuinfo_has_x86_avx512f() ? CPU_FLAGS_AVX512F : 0;
--    flags |= cpuinfo_has_x86_avx512dq() ? CPU_FLAGS_AVX512DQ : 0;
--    flags |= cpuinfo_has_x86_avx512cd() ? CPU_FLAGS_AVX512CD : 0;
--    flags |= cpuinfo_has_x86_avx512bw() ? CPU_FLAGS_AVX512BW : 0;
--    flags |= cpuinfo_has_x86_avx512vl() ? CPU_FLAGS_AVX512VL : 0;
--
-     return flags;
- }
- 
-@@ -107,7 +192,7 @@ CPU_FLAGS get_cpu_flags_to_use() {
- #endif
-     return flags;
- }
--#endif /*ARCH_X86_64*/
-+#endif
- 
- #ifdef ARCH_X86_64
- #if EN_AVX512_SUPPORT
---- Source/Lib/Decoder/CMakeLists.txt.orig	2021-05-08 09:05:00 UTC
-+++ Source/Lib/Decoder/CMakeLists.txt
-@@ -100,9 +100,6 @@ set_target_properties(SvtAv1Dec PROPERTIES SOVERSION $
- set_target_properties(SvtAv1Dec PROPERTIES C_VISIBILITY_PRESET hidden)
- add_dependencies(SvtAv1Dec EbVersionHeaderGen)
- target_link_libraries(SvtAv1Dec PUBLIC ${PLATFORM_LIBS})
--if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
--    target_link_libraries(SvtAv1Dec PRIVATE cpuinfo_public)
--endif()
- 
- set(DEC_PKG_CONFIG_EXTRA_CFLAGS "")
- if (BUILD_SHARED_LIBS)
---- Source/Lib/Encoder/CMakeLists.txt.orig	2021-05-08 09:05:00 UTC
-+++ Source/Lib/Encoder/CMakeLists.txt
-@@ -131,9 +131,6 @@ set_target_properties(SvtAv1Enc PROPERTIES VERSION ${E
- set_target_properties(SvtAv1Enc PROPERTIES SOVERSION ${ENC_VERSION_MAJOR})
- set_target_properties(SvtAv1Enc PROPERTIES C_VISIBILITY_PRESET hidden)
- target_link_libraries(SvtAv1Enc PUBLIC ${PLATFORM_LIBS})
--if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
--    target_link_libraries(SvtAv1Enc PRIVATE cpuinfo_public)
--endif()
- 
- set(ENC_PKG_CONFIG_EXTRA_CFLAGS "")
- if (BUILD_SHARED_LIBS)
---- test/CMakeLists.txt.orig	2020-11-29 07:10:56 UTC
-+++ test/CMakeLists.txt
-@@ -86,7 +86,6 @@ set(lib_list
-     $<TARGET_OBJECTS:ENCODER_ASM_AVX2>
-     $<TARGET_OBJECTS:ENCODER_ASM_AVX512>
-     $<TARGET_OBJECTS:ENCODER_GLOBALS>
--    cpuinfo_public
-     gtest_all)
- if(UNIX)
-   # App Source Files


More information about the dev-commits-ports-all mailing list