[SCM] xbmc/master: Patch upstream to support MIPS

rbalint at users.alioth.debian.org rbalint at users.alioth.debian.org
Wed Oct 15 12:50:33 UTC 2014


The following commit has been merged in the master branch:
commit 4ceb01fb87c0a6198e144c982130b26f5dc70e1d
Author: Balint Reczey <balint at balintreczey.hu>
Date:   Mon Oct 13 21:59:40 2014 +0200

    Patch upstream to support MIPS

diff --git a/debian/patches/0011-mips-add-guards.patch b/debian/patches/0011-mips-add-guards.patch
new file mode 100644
index 0000000..8f499c6
--- /dev/null
+++ b/debian/patches/0011-mips-add-guards.patch
@@ -0,0 +1,96 @@
+From b82da322de1ebbadcc2b3bbb77a9599c28d7b745 Mon Sep 17 00:00:00 2001
+From: theuni <theuni-nospam- at xbmc.org>
+Date: Fri, 30 Sep 2011 06:16:18 -0400
+Subject: [PATCH 1/4] mips: add guards
+
+Updated for 13.2 by Balint Reczey
+---
+ Makefile.in                       | 2 +-
+ xbmc/cores/DllLoader/DllLoader.h  | 2 +-
+ xbmc/cores/DllLoader/ldt_keeper.c | 2 +-
+ xbmc/linux/PlatformDefs.h         | 2 +-
+ xbmc/utils/fastmemcpy.c           | 2 +-
+ xbmc/utils/fastmemcpy.h           | 2 +-
+ 6 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 6c55e67..1bb69ba 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -432,7 +432,7 @@ ifeq (@USE_ASAP_CODEC@,1)
+   endif
+ endif
+ 	$(MAKE) -C lib/stsound/StSoundLibrary
+-ifeq ($(or $(findstring powerpc, at ARCH@),$(findstring x86_64-linux, at ARCH@),$(findstring arm, @ARCH@),$(findstring freebsd, at ARCH@)),)
++ifeq ($(or $(findstring powerpc, at ARCH@),$(findstring x86_64-linux, at ARCH@),$(findstring arm, @ARCH@),$(findstring freebsd, at ARCH@),$(findstring mips, at ARCH@)),)
+ 	$(MAKE) -C lib/snesapu/SNES/SNESAPU
+ endif
+ imagelib: dllloader
+diff --git a/xbmc/cores/DllLoader/DllLoader.h b/xbmc/cores/DllLoader/DllLoader.h
+index 7109ea7..864c5b2 100644
+--- a/xbmc/cores/DllLoader/DllLoader.h
++++ b/xbmc/cores/DllLoader/DllLoader.h
+@@ -23,7 +23,7 @@
+ #include "coffldr.h"
+ #include "LibraryLoader.h"
+ 
+-#if defined(__linux__) && !defined(__powerpc__) && !defined(__arm__)
++#if defined(__linux__) && !defined(__powerpc__) && !defined(__arm__) && !defined(__mips__)
+ #define USE_LDT_KEEPER
+ #include "ldt_keeper.h"
+ #endif
+diff --git a/xbmc/cores/DllLoader/ldt_keeper.c b/xbmc/cores/DllLoader/ldt_keeper.c
+index 91c7a22..8af9a86 100644
+--- a/xbmc/cores/DllLoader/ldt_keeper.c
++++ b/xbmc/cores/DllLoader/ldt_keeper.c
+@@ -19,7 +19,7 @@
+  */
+ 
+ //#ifndef __powerpc__
+-#if !defined(__powerpc__) && !defined(__ppc__) && !defined(__arm__)
++#if !defined(__powerpc__) && !defined(__ppc__) && !defined(__arm__) && !defined(__mips__)
+ 
+ #include "ldt_keeper.h"
+ 
+diff --git a/xbmc/linux/PlatformDefs.h b/xbmc/linux/PlatformDefs.h
+index 1686961..4350075 100644
+--- a/xbmc/linux/PlatformDefs.h
++++ b/xbmc/linux/PlatformDefs.h
+@@ -161,7 +161,7 @@
+ #define __int64   long long
+ #define __uint64  unsigned long long
+ 
+-#if defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__) || defined (__arm__) // should this be powerpc64 only?
++#if defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__) || defined (__arm__) || defined(__mips__) // should this be powerpc64 only?
+ #define __stdcall
+ #else /* !__x86_64__ */
+ #define __stdcall   __attribute__((__stdcall__))
+diff --git a/xbmc/utils/fastmemcpy.c b/xbmc/utils/fastmemcpy.c
+index d2a1d49..ec9019a 100644
+--- a/xbmc/utils/fastmemcpy.c
++++ b/xbmc/utils/fastmemcpy.c
+@@ -25,7 +25,7 @@
+  *  <http://www.gnu.org/licenses/>.
+  *
+  */
+-#if !defined(TARGET_WINDOWS) && !defined(__ppc__) && !defined(__powerpc__) && !defined(__arm__) 
++#if !defined(TARGET_WINDOWS) && !defined(__ppc__) && !defined(__powerpc__) && !defined(__arm__) && !defined(__mips__)
+ #define HAVE_MMX2
+ #define HAVE_SSE
+ 
+diff --git a/xbmc/utils/fastmemcpy.h b/xbmc/utils/fastmemcpy.h
+index ce78d49..43f5904 100644
+--- a/xbmc/utils/fastmemcpy.h
++++ b/xbmc/utils/fastmemcpy.h
+@@ -23,7 +23,7 @@
+ extern "C" {
+ #endif
+ 
+-#if !defined(TARGET_WINDOWS) && !defined(__ppc__) && !defined(__powerpc__) && !defined(TARGET_ANDROID) && !defined(TARGET_DARWIN_IOS)
++#if !defined(TARGET_WINDOWS) && !defined(__ppc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(TARGET_ANDROID) && !defined(TARGET_DARWIN_IOS)
+ void * fast_memcpy(void * to, const void * from, size_t len);
+ //#define fast_memcpy memcpy
+ #else
+-- 
+2.1.1
+
diff --git a/debian/patches/0012-mips-add-atomics.patch b/debian/patches/0012-mips-add-atomics.patch
new file mode 100644
index 0000000..90836da
--- /dev/null
+++ b/debian/patches/0012-mips-add-atomics.patch
@@ -0,0 +1,230 @@
+From 3bb261a18c9d9f7220351007db51e97c0cfdd6d9 Mon Sep 17 00:00:00 2001
+From: theuni <theuni-nospam- at xbmc.org>
+Date: Fri, 30 Sep 2011 06:17:00 -0400
+Subject: [PATCH 2/4] mips: add atomics
+
+Most taken from the Linux kernel.
+
+Updated for 13.2 by Balint Reczey
+---
+ xbmc/threads/Atomics.cpp   |  35 ++++++--------
+ xbmc/threads/MipsAtomics.h | 115 +++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 130 insertions(+), 20 deletions(-)
+ create mode 100644 xbmc/threads/MipsAtomics.h
+
+diff --git a/xbmc/threads/Atomics.cpp b/xbmc/threads/Atomics.cpp
+index 12d3e56..ca5d981 100644
+--- a/xbmc/threads/Atomics.cpp
++++ b/xbmc/threads/Atomics.cpp
+@@ -20,6 +20,12 @@
+ 
+ #include "Atomics.h"
+ #include "system.h"
++
++#if defined(__mips__)
++#include "MipsAtomics.h"
++pthread_mutex_t cmpxchg_mutex = PTHREAD_MUTEX_INITIALIZER;
++#endif
++
+ ///////////////////////////////////////////////////////////////////////////
+ // 32-bit atomic compare-and-swap
+ // Returns previous value of *pAddr
+@@ -63,10 +69,7 @@ long cas(volatile long *pAddr, long expectedVal, long swapVal)
+   return prev;
+ 
+ #elif defined(__mips__)
+-// TODO:
+-  unsigned int prev;
+-  #error atomic cas undefined for mips
+-  return prev;
++  return cmpxchg32(pAddr, expectedVal, swapVal);
+ 
+ #elif defined(TARGET_WINDOWS)
+   long prev;
+@@ -103,11 +106,14 @@ long cas(volatile long *pAddr, long expectedVal, long swapVal)
+ ///////////////////////////////////////////////////////////////////////////
+ long long cas2(volatile long long* pAddr, long long expectedVal, long long swapVal)
+ {
+-#if defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || defined(__mips__) // PowerPC, ARM, and MIPS
++#if defined(__ppc__) || defined(__powerpc__) || defined(__arm__)// PowerPC and ARM
+ // Not available/required
+ // Hack to allow compilation
+   throw "cas2 is not implemented";
+ 
++#elif defined(__mips__)
++  return cmpxchg64(pAddr, expectedVal, swapVal);
++
+ #elif defined(TARGET_WINDOWS)
+   long long prev;
+   __asm
+@@ -183,10 +189,7 @@ long AtomicIncrement(volatile long* pAddr)
+   return val;
+ 
+ #elif defined(__mips__)
+-// TODO:
+-  long val;
+-  #error AtomicIncrement undefined for mips
+-  return val;
++  return atomic_add(1, pAddr);
+ 
+ #elif defined(TARGET_WINDOWS)
+   long val;
+@@ -261,10 +264,7 @@ long AtomicAdd(volatile long* pAddr, long amount)
+   return val;
+ 
+ #elif defined(__mips__)
+-// TODO:
+-  long val;
+-  #error AtomicAdd undefined for mips
+-  return val;
++  return atomic_add(amount, pAddr);
+ 
+ #elif defined(TARGET_WINDOWS)
+   __asm
+@@ -339,10 +339,7 @@ long AtomicDecrement(volatile long* pAddr)
+   return val;
+ 
+ #elif defined(__mips__)
+-// TODO:
+-  long val;
+-  #error AtomicDecrement undefined for mips
+-  return val;
++  return atomic_sub(1, pAddr);
+ 
+ #elif defined(TARGET_WINDOWS)
+   long val;
+@@ -418,9 +415,7 @@ long AtomicSubtract(volatile long* pAddr, long amount)
+   return val;
+ 
+ #elif defined(__mips__)
+-// TODO:
+-  #error AtomicSubtract undefined for mips
+-  return val;
++  return atomic_sub(amount, pAddr);
+ 
+ #elif defined(TARGET_WINDOWS)
+   amount *= -1;
+diff --git a/xbmc/threads/MipsAtomics.h b/xbmc/threads/MipsAtomics.h
+new file mode 100644
+index 0000000..8ff69b6
+--- /dev/null
++++ b/xbmc/threads/MipsAtomics.h
+@@ -0,0 +1,115 @@
++/*
++ *      Copyright (C) 2005-2011 Team XBMC
++ *      http://www.xbmc.org
++ *
++ *  This Program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2, or (at your option)
++ *  any later version.
++ *
++ *  This Program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with XBMC; see the file COPYING.  If not, write to
++ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ *  http://www.gnu.org/copyleft/gpl.html
++ *
++ * Copyright (C) 2003, 06, 07 by Ralf Baechle (ralf at linux-mips.org)
++ *
++ * Most of this file was borrowed from the linux kernel.
++ */
++
++#ifndef __ATOMIC_MIPS_H_
++#define __ATOMIC_MIPS_H_
++
++#include <inttypes.h>
++#include <pthread.h>
++
++extern pthread_mutex_t cmpxchg_mutex;
++
++static inline long cmpxchg32(volatile long *m, long oldval, long newval)
++{
++	long retval;
++	__asm__ __volatile__(						\
++		"	.set	push				\n"	\
++		"	.set	noat				\n"	\
++		"	.set	mips3				\n"	\
++		"1:	ll	%0, %2		# __cmpxchg_asm	\n"	\
++		"	bne	%0, %z3, 2f			\n"	\
++		"	.set	mips0				\n"	\
++		"	move	$1, %z4				\n"	\
++		"	.set	mips3				\n"	\
++		"	sc	$1, %1				\n"	\
++		"	beqz	$1, 3f				\n"	\
++		"2:						\n"	\
++		"	.subsection 2				\n"	\
++		"3:	b	1b				\n"	\
++		"	.previous				\n"	\
++		"	.set	pop				\n"	\
++		: "=&r" (retval), "=R" (*m)				\
++		: "R" (*m), "Jr" (oldval), "Jr" (newval)			\
++		: "memory");						\
++
++	return retval;
++}
++
++
++static inline long long cmpxchg64(volatile long long *ptr,
++				      long long oldval, long long newval)
++{
++	long long prev;
++
++	pthread_mutex_lock(&cmpxchg_mutex);
++	prev = *(long long *)ptr;
++	if (prev == oldval)
++		*(long long *)ptr = newval;
++	pthread_mutex_unlock(&cmpxchg_mutex);
++	return prev;
++}
++
++
++static __inline__ long atomic_add(int i, volatile long* v)
++{
++	long temp;
++
++	__asm__ __volatile__(
++		"	.set	mips3					\n"
++		"1:	ll	%0, %1		# atomic_add		\n"
++		"	addu	%0, %2					\n"
++		"	sc	%0, %1					\n"
++		"	beqz	%0, 2f					\n"
++		"	.subsection 2					\n"
++		"2:	b	1b					\n"
++		"	.previous					\n"
++		"	.set	mips0					\n"
++		: "=&r" (temp), "=m" (*v)
++		: "Ir" (i), "m" (*v));
++
++	return temp;
++}
++
++static __inline__ long atomic_sub(int i, volatile long* v)
++{
++	long temp;
++
++	__asm__ __volatile__(
++		"	.set	mips3					\n"
++		"1:	ll	%0, %1		# atomic_sub		\n"
++		"	subu	%0, %2					\n"
++		"	sc	%0, %1					\n"
++		"	beqz	%0, 2f					\n"
++		"	.subsection 2					\n"
++		"2:	b	1b					\n"
++		"	.previous					\n"
++		"	.set	mips0					\n"
++		: "=&r" (temp), "=m" (*v)
++		: "Ir" (i), "m" (*v));
++
++	return temp;
++}
++
++
++#endif
+-- 
+2.1.1
+
diff --git a/debian/patches/0013-mips-Add-configure-option-for-mips-and-mipsel.patch b/debian/patches/0013-mips-Add-configure-option-for-mips-and-mipsel.patch
new file mode 100644
index 0000000..09ea79f
--- /dev/null
+++ b/debian/patches/0013-mips-Add-configure-option-for-mips-and-mipsel.patch
@@ -0,0 +1,48 @@
+From fef995c74fc6719bce4b8c523ade6f589129a05a Mon Sep 17 00:00:00 2001
+From: Balint Reczey <balint at balintreczey.hu>
+Date: Fri, 30 Sep 2011 06:22:51 -0400
+Subject: [PATCH 3/4] mips: Add configure option for mips and mipsel
+
+---
+ configure.in    | 10 ++++++++++
+ m4/xbmc_arch.m4 |  3 +++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/configure.in b/configure.in
+index 2e49fa1..186edfe 100644
+--- a/configure.in
++++ b/configure.in
+@@ -715,6 +715,16 @@ case $host in
+      use_wayland=no
+      build_shared_lib=yes
+      ;;
++  mips*-*-linux-gnu*)
++     ARCH="mips"
++     use_arch="mips"
++     ffmpeg_target_os=linux
++     use_joystick=no
++     use_gles=yes
++     use_sdl=no
++     use_x11=no
++     use_wayland=no
++     ;;
+   *)
+      AC_MSG_ERROR(unsupported host ($host))
+ esac
+diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4
+index 5bcdd81..f9ab5cd 100644
+--- a/m4/xbmc_arch.m4
++++ b/m4/xbmc_arch.m4
+@@ -32,6 +32,9 @@ case $host in
+   arm*-*-linux-gnu*|arm*-*-linux-uclibc*)
+      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
+      ;;
++  mips*-*-linux-gnu*|mips*-*-linux-uclibc*)
++     AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
++     ;;
+   *-*linux-android*)
+      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID")
+      ;;
+-- 
+2.1.1
+
diff --git a/debian/patches/08-armel.patch b/debian/patches/0014-mips-Don-t-use-ASM-round-and-truncate-on-MIPS.patch
similarity index 59%
copy from debian/patches/08-armel.patch
copy to debian/patches/0014-mips-Don-t-use-ASM-round-and-truncate-on-MIPS.patch
index 5ea75fb..e8cb847 100644
--- a/debian/patches/08-armel.patch
+++ b/debian/patches/0014-mips-Don-t-use-ASM-round-and-truncate-on-MIPS.patch
@@ -1,12 +1,21 @@
+From 7f6a9770ea9a669294847b3b03eadf07ebe7a896 Mon Sep 17 00:00:00 2001
+From: Balint Reczey <balint at balitreczey.hu>
+Date: Mon, 13 Oct 2014 17:10:40 +0100
+Subject: [PATCH 4/4] mips: Don't use ASM round and truncate on MIPS
+
+---
+ xbmc/utils/MathUtils.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
 diff --git a/xbmc/utils/MathUtils.h b/xbmc/utils/MathUtils.h
-index 96af9f4..76dacc8 100644
+index 96af9f4..b8ba6cc 100644
 --- a/xbmc/utils/MathUtils.h
 +++ b/xbmc/utils/MathUtils.h
 @@ -34,6 +34,7 @@
  
  #if defined(__ppc__) || \
      defined(__powerpc__) || \
-+   (defined(__VFP_FP__) && defined(__SOFTFP__)) || \
++    defined(__mips__) || \
     (defined(TARGET_DARWIN_IOS) && defined(__llvm__)) || \
     (defined(TARGET_ANDROID) && defined(__arm__)) || \
      defined(TARGET_RASPBERRY_PI)
@@ -14,7 +23,10 @@ index 96af9f4..76dacc8 100644
  
  #if defined(__ppc__) || \
      defined(__powerpc__) || \
-+   (defined(__VFP_FP__) && defined(__SOFTFP__)) || \
++    defined(__mips__) || \
     (defined(TARGET_DARWIN) && defined(__llvm__)) || \
     (defined(TARGET_ANDROID) && defined(__arm__)) || \
      defined(TARGET_RASPBERRY_PI)
+-- 
+2.1.1
+
diff --git a/debian/patches/series b/debian/patches/series
index bc3c1d8..178c602 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,6 +6,10 @@
 0007-Enable-using-external-ffmpeg-in-.-configure.patch
 0008-Setup-AVVDPAUContext-with-API-calls-instead-of-using.patch
 0009-Use-VDPAU-in-Libav-hacks-only-when-VDPAU-support-is-.patch
+0011-mips-add-guards.patch
+0012-mips-add-atomics.patch
+0013-mips-Add-configure-option-for-mips-and-mipsel.patch
+0014-mips-Don-t-use-ASM-round-and-truncate-on-MIPS.patch
 03-privacy.patch
 04-differentiate-from-vanilla-XBMC.patch
 05-Fix-GLES-with-X11.patch

-- 
xbmc packaging



More information about the pkg-multimedia-commits mailing list