[SCM] x265/master: Use atomic on mips, mipsel and powerpc.

sramacher at users.alioth.debian.org sramacher at users.alioth.debian.org
Fri Dec 5 20:30:58 UTC 2014


The following commit has been merged in the master branch:
commit 21b02c5586dceb78f3b42487fe754b8c757a1d7a
Author: Sebastian Ramacher <sramacher at debian.org>
Date:   Fri Dec 5 19:13:27 2014 +0100

    Use atomic on mips, mipsel and powerpc.
    
    Thanks: Dejan Latinovic
    Closes: #771556

diff --git a/debian/patches/atomic.patch b/debian/patches/atomic.patch
new file mode 100644
index 0000000..c950b48
--- /dev/null
+++ b/debian/patches/atomic.patch
@@ -0,0 +1,46 @@
+Description: Use atomic on mips, mipsel and powerpc
+Author: Dejan Latinovi <Dejan.Latinovic at imgtec.com>,
+ Sebastian Ramacher <sramacher at debian.org>
+Bug: https://bitbucket.org/multicoreware/x265/issue/93/__sync_val_compare_exchange_8-not
+Bug-Debian: https://bugs.debian.org/771556
+Last-Update: 2014-12-05
+
+--- x265-1.4.orig/source/CMakeLists.txt
++++ x265-1.4/source/CMakeLists.txt
+@@ -50,6 +50,8 @@ elseif(${SYSPROC} STREQUAL "armv6l")
+     message(STATUS "Detected ARM target processor")
+     set(ARM 1)
+     add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
++elseif("${SYSPROC}" STREQUAL "ppc" or "${SYSPROC}" STREQUAL "mips")
++    set(NEEDS_ATOMIC 1)
+ else()
+     message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
+     message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
+@@ -61,6 +63,9 @@ if(UNIX)
+     if(LIBRT)
+         set(PLATFORM_LIBS ${PLATFORM_LIBS} rt)
+     endif()
++    if(NEEDS_ATOMIC)
++        set(PLATFORM_LIBS ${PLATFORM_LIBS} atomic)
++    endif()
+ endif(UNIX)
+ 
+ # Compiler detection
+--- x265-1.4.orig/source/common/threading.h
++++ x265-1.4/source/common/threading.h
+@@ -51,8 +51,15 @@
+ 
+ #define CLZ32(id, x)                        id = (unsigned long)__builtin_clz(x) ^ 31
+ #define CTZ64(id, x)                        id = (unsigned long)__builtin_ctzll(x)
++
++#if (defined(__mips__) && !defined(__mips64)) || (defined(__powerpc__) && !defined(__powerpc64__))
++#define ATOMIC_OR(ptr, mask)                __atomic_or_fetch(ptr, mask, __ATOMIC_SEQ_CST)
++#define ATOMIC_CAS(ptr, oldval, newval)     __atomic_compare_exchange(ptr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
++#else
+ #define ATOMIC_OR(ptr, mask)                __sync_or_and_fetch(ptr, mask)
+ #define ATOMIC_CAS(ptr, oldval, newval)     __sync_val_compare_and_swap(ptr, oldval, newval)
++#endif
++
+ #define ATOMIC_CAS32(ptr, oldval, newval)   __sync_val_compare_and_swap(ptr, oldval, newval)
+ #define ATOMIC_INC(ptr)                     __sync_add_and_fetch((volatile int32_t*)ptr, 1)
+ #define ATOMIC_DEC(ptr)                     __sync_add_and_fetch((volatile int32_t*)ptr, -1)
diff --git a/debian/patches/series b/debian/patches/series
index 63b1032..00941dc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 compile-flags.patch
+atomic.patch

-- 
x265 packaging



More information about the pkg-multimedia-commits mailing list