Commit 715ecf93 authored by Balint Reczey's avatar Balint Reczey

First kodi package based on xbmc 2:13.2+dfsg1-4 packaging

parent b03e1d8f
XBMC from Debian
----------------
This package is different from the package you can build from the XBMC source
you can download from http://xbmc.org (vanilla XBMC, from now on).
This package uses external libraries such as libav distributed in Debian, while
the XBMC project suggests using the libraries embedded in vanilla XBMC's source.
This difference may cause problems not experienced with vanilla XBMC thus you
are kindly asked not to report bugs directly to http://xbmc.org, but to Debian's
BTS [1].
You can get an overview of the package at Debian PTS [2] or the list of open
bugs at [3].
XBMC for different Kernels and Architectures
--------------------------------------------
XBMC is known to build on i386, amd64, powerpc, arm and armhf in Debian [4].
If you are able to build and run XBMC on other architectures and/or kernels,
please provide patches to configure.in and any other files you may have modified
to the Debian BTS.
[1] http://www.debian.org/Bugs/
[2] http://packages.qa.debian.org/x/xbmc.html
[3] http://bugs.debian.org/cgi-bin/pkgreport.cgi?repeatmerged=no&src=xbmc
[4] https://buildd.debian.org/status/package.php?p=xbmc&suite=sid
kodi (14.0~beta1+dfsg1-1) UNRELEASED; urgency=medium
* First packaged Kodi version based on xbmc 2:13.2+dfsg1-4
-- Balint Reczey <balint@balintreczey.hu> Sat, 08 Nov 2014 11:14:40 +0100
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
The current PVR API version can be found in xbmc_pvr_types.h:
XBMC_PVR_API_VERSION
addons/library.xbmc.addon/libXBMC_addon.h usr/include/xbmc/
addons/library.xbmc.codec/libXBMC_codec.h usr/include/xbmc/
usr/include/xbmc/libXBMC_gui.h
usr/include/xbmc/libXBMC_pvr.h
xbmc/addons/include/*.h usr/include/xbmc/
xbmc/addons/include/*.hpp usr/include/xbmc/
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPacket.h usr/include/xbmc/
usr/lib/python*/*/xbmc
usr/share/pixmaps/xbmc
tools/EventClients/examples/*
usr/include/xbmc/xbmcclient.h
docs/manpages/xbmc-j2meremote.1
docs/manpages/xbmc-ps3remote.1
docs/manpages/xbmc-wiiremote.1
debian/xbmc.service
\ No newline at end of file
usr/bin/xbmc
usr/share/xbmc
usr/share/icons
usr/share/applications
usr/share/xbmc/addons/skin.confluence
usr/bin/xbmc-standalone
usr/share/xsessions
usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf usr/share/xbmc/addons/skin.confluence/fonts/DejaVuSans-Bold.ttf
usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf usr/share/xbmc/addons/skin.confluence/fonts/DejaVuSans.ttf
usr/share/fonts/truetype/roboto/Roboto-Bold.ttf usr/share/xbmc/addons/skin.confluence/fonts/Roboto-Bold.ttf
usr/share/fonts/truetype/roboto/Roboto-Regular.ttf usr/share/xbmc/addons/skin.confluence/fonts/Roboto-Regular.ttf
usr/share/javascript/jquery/jquery.min.js /usr/share/xbmc/addons/webinterface.default/js/jquery-1.8.2.min.js
usr/share/javascript/iscroll/iscroll-min.js /usr/share/xbmc/addons/webinterface.default/js/iscroll-min.js
\ No newline at end of file
# XBMC is a recursive acronym for "XBMC Media Center", hence why it appears
# at the start of the package description.
xbmc: description-starts-with-package-name
docs/manpages/xbmc.bin.1
docs/manpages/xbmc.1
docs/manpages/xbmc-standalone.1
?package(xbmc):needs="X11" section="Applications/Video" \
title="xbmc" command="/usr/bin/xbmc"
video/mpeg; xbmc %s; description="MPEG Video";
video/x-mpeg; xbmc %s; description="MPEG Video";
video/mpeg-system; xbmc %s; description="MPEG Video";
video/x-mpeg-system; xbmc %s; description="MPEG Video";
audio/x-wav; xbmc %s; description="WAV Audio"; nametemplate=%s.wav;
video/mpeg4; xbmc %s; description="MPEG-4 Video";
audio/mpeg; xbmc %s; description="MPEG Audio"; nametemplate=%s.mpg;
audio/mpegurl; xbmc %s; description="MPEG Audio URL"; nametemplate=%s.m3u;
audio/x-mp3; xbmc %s; nametemplate=%s.mp3; description="MPEG Audio";
audio/mpeg4; xbmc %s; description="MPEG-4 Audio";
application/mpeg4-iod; xbmc %s; description="MPEG-4 Video";
application/mpeg4-muxcodetable; xbmc %s; description="MPEG-4 Video";
video/x-msvideo; xbmc %s; description="MS Video (AVI)";
video/quicktime; xbmc %s; description="Apple Quicktime Video";
application/ogg; xbmc %s; nametemplate=%s.ogg; description="Ogg stream";
application/x-ogg; xbmc %s; nametemplate=%s.ogg; description="Ogg stream";
video/ogg; xbmc %s; description="Ogg Video";
application/x-ms-asf-plugin; xbmc %s; description="Windows Media Video";
application/x-mplayer2; xbmc %s; description="Windows Media";
[Unit]
Description = XBMC Media Center
After = remote-fs.target
After = syslog.target
[Service]
User = xbmc
Group = xbmc
Type = simple
Restart = always
RestartSec=5
KillMode=process
ExecStart = /usr/bin/xinit /usr/bin/xbmc-standalone -- :0
[Install]
WantedBy = multi-user.target
#!/usr/bin/fontforge
# merge $1 and $2 to $3 fonts
Open($1);
ScaleToEm(2048)
MergeFonts($2);
Generate($3);
From d1c2e454c9a5d7413ae5b6fe05c2c1168baf0f31 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Thu, 6 Mar 2014 13:19:34 +0100
Subject: [PATCH 1/2] Don't enter ffmpeg dir when using external ffmpeg/libav
---
lib/Makefile.in | 2 ++
1 file changed, 2 insertions(+)
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -87,12 +87,14 @@
endif
ffmpeg:
+ifneq (@USE_EXTERNAL_FFMPEG@,1)
$(MAKE) -C $@
ifeq ($(findstring osx,$(ARCH)), osx)
-$(AR) d ffmpeg/libavcodec/libavcodec.a log2_tab.o
-$(AR) d ffmpeg/libavformat/libavformat.a log2_tab.o
-$(AR) d ffmpeg/libswresample/libswresample.a log2_tab.o
endif
+endif
clean:
rm -f $(addprefix $(SYSDIR)/, $(LIBS))
From bf558f775574b2243f1da21b345e8ae252b500d7 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Thu, 6 Mar 2014 16:37:39 +0100
Subject: [PATCH 2/2] Fix compilation with libav 10 beta1
---
lib/xbmc-libav-hacks/libav_hacks.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/xbmc-libav-hacks/libav_hacks.h b/lib/xbmc-libav-hacks/libav_hacks.h
index f81e29e..a315c05 100644
--- a/lib/xbmc-libav-hacks/libav_hacks.h
+++ b/lib/xbmc-libav-hacks/libav_hacks.h
@@ -35,6 +35,11 @@
#error "Your libav version is too old. Please update to libav-10 or git master."
#endif
+// libavcodec
+
+// AVCodecContext does not have pkt_timebase member
+#define pkt_timebase time_base
+
// libavutil
#define AVFRAME_IN_LAVU
--
1.7.10.4
From 5451bad08317e8f36d9541980f773ceeb7262e80 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Fri, 7 Mar 2014 00:17:40 +0100
Subject: [PATCH] Disble static ffmpeg when using external ffmpeg/libav
---
configure.in | 3 +++
1 file changed, 3 insertions(+)
--- a/configure.in
+++ b/configure.in
@@ -876,6 +876,9 @@
fi
fi
fi
+if test "$use_static_ffmpeg" = "yes" -a "$use_external_ffmpeg" = "yes"; then
+ use_static_ffmpeg=no
+fi
if test "$use_static_ffmpeg" = "yes"; then
USE_STATIC_FFMPEG=1
AC_DEFINE([USE_STATIC_FFMPEG], [1], [link ffmpeg statically])
From e7fc1bf22a8ee7e744883eaa0c8f2910d51b4208 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Sun, 30 Mar 2014 14:54:07 +0200
Subject: [PATCH] Fix av_stream_get_r_frame_rate Libav hack accessor
---
lib/xbmc-libav-hacks/accessors.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/xbmc-libav-hacks/accessors.c b/lib/xbmc-libav-hacks/accessors.c
index 417bf32..969d576 100644
--- a/lib/xbmc-libav-hacks/accessors.c
+++ b/lib/xbmc-libav-hacks/accessors.c
@@ -28,8 +28,5 @@ AVDictionary *av_frame_get_metadata (const AVFrame *frame)
AVRational av_stream_get_r_frame_rate(const AVStream *s)
{
- AVRational zero;
- zero.num = 0;
- zero.den = 1;
- return zero;
+ return s->avg_frame_rate;
}
--
1.7.10.4
From bffb887a8d1137b26ca2605734c4c03673a40b42 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Wed, 21 May 2014 23:48:37 +0200
Subject: [PATCH 2/3] Define AV_CODEC_ID_SUBRIP to AV_CODEC_ID_TEXT in libav
hacks and fix compilation
---
lib/xbmc-libav-hacks/libav_hacks.h | 2 +-
xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
--- a/lib/xbmc-libav-hacks/libav_hacks.h
+++ b/lib/xbmc-libav-hacks/libav_hacks.h
@@ -45,7 +45,7 @@
#define AVFRAME_IN_LAVU
#define AV_CODEC_ID_OTF AV_CODEC_ID_TTF
-#define AV_CODEC_ID_SUBRIP AV_CODEC_ID_FIRST_SUBTITLE
+#define AV_CODEC_ID_SUBRIP AV_CODEC_ID_TEXT
AVDictionary *av_frame_get_metadata (const AVFrame *frame);
--- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
@@ -386,10 +386,17 @@
CDVDOverlayCodec* pCodec = NULL;
CDVDCodecOptions options;
+ // not all FFmpeg versions have AV_CODEC_ID_SUBRIP
+ // But when they have it, it works like AV_CODEC_ID_TEXT here
+ if (AV_CODEC_ID_SUBRIP == hint.codec) {
+ pCodec = OpenCodec(new CDVDOverlayCodecText(), hint, options);
+ if( pCodec ) return pCodec;
+ return NULL;
+ }
+
switch (hint.codec)
{
case AV_CODEC_ID_TEXT:
- case AV_CODEC_ID_SUBRIP:
pCodec = OpenCodec(new CDVDOverlayCodecText(), hint, options);
if( pCodec ) return pCodec;
break;
From dc85016024fef825a8fffcd9881a7a0bd86912af Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Fri, 16 May 2014 12:07:51 +0200
Subject: [PATCH] Enable using external ffmpeg in ./configure
---
configure.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/configure.in
+++ b/configure.in
@@ -602,7 +602,7 @@
READELF="${READELF:-readelf}"
NM="${NM:-nm}"
-use_external_ffmpeg=no
+use_external_ffmpeg=yes
use_static_ffmpeg=no
# ffmpeg needs the output of uname -s (e.x. linux, darwin) for the target_os
From 5c0cf96c60f8545b3bc7118f2e0060a908b63b7a Mon Sep 17 00:00:00 2001
From: Anton Khirnov <anton@khirnov.net>
Date: Sat, 4 Oct 2014 21:32:35 +0200
Subject: [PATCH] Setup AVVDPAUContext with API calls instead of using memset()
Origin: https://bugzilla.libav.org/show_bug.cgi?id=674
---
lib/xbmc-libav-hacks/libav_hacks.h | 7 +++++++
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 22 +++++++++-------------
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h | 2 +-
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/lib/xbmc-libav-hacks/libav_hacks.h b/lib/xbmc-libav-hacks/libav_hacks.h
index af64980..a840b31 100644
--- a/lib/xbmc-libav-hacks/libav_hacks.h
+++ b/lib/xbmc-libav-hacks/libav_hacks.h
@@ -21,11 +21,18 @@
#ifndef __LIBAV_HACKS_H
#define __LIBAV_HACKS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <libavutil/avutil.h>
#include <libavutil/opt.h>
#include <libavresample/avresample.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfilter.h>
+#include <libavcodec/vdpau.h>
+#ifdef __cplusplus
+}
+#endif
#if LIBAVUTIL_VERSION_MICRO >= 100
#error "You should not enable libav hacks when building against FFmpeg."
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
index 73c4fa4..932985a 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
@@ -488,7 +488,7 @@ CDecoder::CDecoder() : m_vdpauOutput(&m_inMsgEvent)
m_vdpauConfig.videoSurfaces = &m_videoSurfaces;
m_vdpauConfigured = false;
- m_hwContext.bitstream_buffers_allocated = 0;
+ m_hwContext = av_vdpau_alloc_context();
m_DisplayState = VDPAU_OPEN;
m_vdpauConfig.context = 0;
}
@@ -578,17 +578,16 @@ bool CDecoder::Open(AVCodecContext* avctx, const enum PixelFormat fmt, unsigned
m_vdpauConfig.context->GetProcs().vdp_decoder_destroy(m_vdpauConfig.vdpDecoder);
CheckStatus(vdp_st, __LINE__);
+ if (!ConfigVDPAU(avctx, 16))
+ return false;
// finally setup ffmpeg
- memset(&m_hwContext, 0, sizeof(AVVDPAUContext));
- m_hwContext.render = CDecoder::Render;
- m_hwContext.bitstream_buffers_allocated = 0;
+ m_hwContext->render = m_vdpauConfig.context->GetProcs().vdp_decoder_render;
+ m_hwContext->decoder = m_vdpauConfig.vdpDecoder;
avctx->get_buffer = CDecoder::FFGetBuffer;
avctx->reget_buffer = CDecoder::FFGetBuffer;
avctx->release_buffer = CDecoder::FFReleaseBuffer;
- avctx->draw_horiz_band = CDecoder::FFDrawSlice;
- avctx->slice_flags=SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
- avctx->hwaccel_context = &m_hwContext;
+ avctx->hwaccel_context = m_hwContext;
g_Windowing.Register(this);
return true;
@@ -613,11 +612,7 @@ void CDecoder::Close()
FiniVDPAUOutput();
m_vdpauOutput.Dispose();
- if (m_hwContext.bitstream_buffers_allocated)
- {
- m_dllAvUtil.av_freep(&m_hwContext.bitstream_buffers);
- }
-
+ av_freep(&m_hwContext);
m_dllAvUtil.Unload();
if (m_vdpauConfig.context)
@@ -1030,6 +1025,7 @@ VdpStatus CDecoder::Render( VdpDecoder decoder, VdpVideoSurface target,
return VDP_STATUS_OK;
}
+#if 0
void CDecoder::FFDrawSlice(struct AVCodecContext *s,
const AVFrame *src, int offset[4],
int y, int type, int height)
@@ -1089,7 +1085,7 @@ void CDecoder::FFDrawSlice(struct AVCodecContext *s,
if (diff*1000/CurrentHostFrequency() > 30)
CLog::Log(LOGDEBUG, "CVDPAU::DrawSlice - VdpDecoderRender long decoding: %d ms, dec: %d, proc: %d, rend: %d", (int)((diff*1000)/CurrentHostFrequency()), decoded, processed, rend);
}
-
+#endif
int CDecoder::Decode(AVCodecContext *avctx, AVFrame *pFrame)
{
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h
index ccad9a6..dc3956a 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h
@@ -619,7 +619,7 @@ protected:
bool m_vdpauConfigured;
CVdpauConfig m_vdpauConfig;
CVideoSurfaces m_videoSurfaces;
- AVVDPAUContext m_hwContext;
+ AVVDPAUContext *m_hwContext;
COutput m_vdpauOutput;
CVdpauBufferStats m_bufferStats;
--
2.1.1
From dccd6d3bec1ce8f13f771f5d21b7413f8b465836 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint@balintreczey.hu>
Date: Wed, 8 Oct 2014 15:17:17 +0200
Subject: [PATCH] Use VDPAU in Libav hacks only when VDPAU support is enabled
---
lib/xbmc-libav-hacks/libav_hacks.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/xbmc-libav-hacks/libav_hacks.h b/lib/xbmc-libav-hacks/libav_hacks.h
index a840b31..a193ecf 100644
--- a/lib/xbmc-libav-hacks/libav_hacks.h
+++ b/lib/xbmc-libav-hacks/libav_hacks.h
@@ -29,7 +29,9 @@ extern "C" {
#include <libavresample/avresample.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfilter.h>
+#ifdef HAVE_LIBVDPAU
#include <libavcodec/vdpau.h>
+#endif
#ifdef __cplusplus
}
#endif
--
2.1.1
From b82da322de1ebbadcc2b3bbb77a9599c28d7b745 Mon Sep 17 00:00:00 2001
From: theuni <theuni-nospam-@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,@ARCH@),$(findstring x86_64-linux,@ARCH@),$(findstring arm, @ARCH@),$(findstring freebsd,@ARCH@)),)
+ifeq ($(or $(findstring powerpc,@ARCH@),$(findstring x86_64-linux,@ARCH@),$(findstring arm, @ARCH@),$(findstring freebsd,@ARCH@),$(findstring mips,@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
From 3bb261a18c9d9f7220351007db51e97c0cfdd6d9 Mon Sep 17 00:00:00 2001
From: theuni <theuni-nospam-@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@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)