1 |
vapier 13/12/31 19:18:32 |
2 |
|
3 |
Added: xbmc-12.3-no-sse2.patch |
4 |
Log: |
5 |
Add patch from upstream for building on cpus w/out sse2 #475266 by Jose Quinteiro. |
6 |
|
7 |
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key D2E96200) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 media-tv/xbmc/files/xbmc-12.3-no-sse2.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-tv/xbmc/files/xbmc-12.3-no-sse2.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-tv/xbmc/files/xbmc-12.3-no-sse2.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: xbmc-12.3-no-sse2.patch |
16 |
=================================================================== |
17 |
https://bugs.gentoo.org/475266 |
18 |
|
19 |
From 07ccc514dc688f0dd53f603d206894023e65ab20 Mon Sep 17 00:00:00 2001 |
20 |
From: Jose Quinteiro <gentoo@×××××××××.org> |
21 |
Date: Sat, 27 Apr 2013 11:29:51 -0700 |
22 |
Subject: [PATCH] Detect SSE2 support |
23 |
|
24 |
Compilation on an older 32-bit Athlon XP chip fails with the error |
25 |
"./Utils/AEUtil.h:50:12: error: '__m128i' does not name a type" |
26 |
This is because the __m128i type is only available on SSE2 platforms. |
27 |
Modify the preprocessor logic to detect SSE and SSE2 support separately. |
28 |
|
29 |
The "emmintrin.h" header should only be included on SSE2 platforms as |
30 |
well. |
31 |
--- |
32 |
xbmc/cores/AudioEngine/Utils/AEConvert.cpp | 25 ++++++++++--------------- |
33 |
xbmc/cores/AudioEngine/Utils/AEUtil.cpp | 4 ++-- |
34 |
xbmc/cores/AudioEngine/Utils/AEUtil.h | 9 ++++++++- |
35 |
3 files changed, 20 insertions(+), 18 deletions(-) |
36 |
|
37 |
diff --git a/xbmc/cores/AudioEngine/Utils/AEConvert.cpp b/xbmc/cores/AudioEngine/Utils/AEConvert.cpp |
38 |
index 0b0b646..7cfde5e 100644 |
39 |
--- a/xbmc/cores/AudioEngine/Utils/AEConvert.cpp |
40 |
+++ b/xbmc/cores/AudioEngine/Utils/AEConvert.cpp |
41 |
@@ -33,11 +33,6 @@ |
42 |
#include <math.h> |
43 |
#include <string.h> |
44 |
|
45 |
-#ifdef __SSE__ |
46 |
-#include <xmmintrin.h> |
47 |
-#include <emmintrin.h> |
48 |
-#endif |
49 |
- |
50 |
#ifdef __ARM_NEON__ |
51 |
#include <arm_neon.h> |
52 |
#endif |
53 |
@@ -517,7 +512,7 @@ unsigned int CAEConvert::Float_S8(float *data, const unsigned int samples, uint8 |
54 |
unsigned int CAEConvert::Float_S16LE(float *data, const unsigned int samples, uint8_t *dest) |
55 |
{ |
56 |
int16_t *dst = (int16_t*)dest; |
57 |
- #ifdef __SSE__ |
58 |
+ #ifdef __SSE2__ |
59 |
|
60 |
unsigned int count = samples; |
61 |
unsigned int unaligned = (0x10 - ((uintptr_t)data & 0xF)) >> 2; |
62 |
@@ -623,7 +618,7 @@ unsigned int CAEConvert::Float_S16LE(float *data, const unsigned int samples, ui |
63 |
/* cleanup */ |
64 |
_mm_empty(); |
65 |
|
66 |
- #else /* no SSE */ |
67 |
+ #else /* no SSE2 */ |
68 |
|
69 |
uint32_t i = 0; |
70 |
uint32_t even = samples & ~0x3; |
71 |
@@ -651,7 +646,7 @@ unsigned int CAEConvert::Float_S16LE(float *data, const unsigned int samples, ui |
72 |
unsigned int CAEConvert::Float_S16BE(float *data, const unsigned int samples, uint8_t *dest) |
73 |
{ |
74 |
int16_t *dst = (int16_t*)dest; |
75 |
- #ifdef __SSE__ |
76 |
+ #ifdef __SSE2__ |
77 |
|
78 |
unsigned int count = samples; |
79 |
unsigned int unaligned = (0x10 - ((uintptr_t)data & 0xF)) >> 2; |
80 |
@@ -757,7 +752,7 @@ unsigned int CAEConvert::Float_S16BE(float *data, const unsigned int samples, ui |
81 |
/* cleanup */ |
82 |
_mm_empty(); |
83 |
|
84 |
- #else /* no SSE */ |
85 |
+ #else /* no SSE2 */ |
86 |
|
87 |
uint32_t i = 0; |
88 |
uint32_t even = samples & ~0x3; |
89 |
@@ -785,7 +780,7 @@ unsigned int CAEConvert::Float_S16BE(float *data, const unsigned int samples, ui |
90 |
unsigned int CAEConvert::Float_S24NE4(float *data, const unsigned int samples, uint8_t *dest) |
91 |
{ |
92 |
int32_t *dst = (int32_t*)dest; |
93 |
- #ifdef __SSE__ |
94 |
+ #ifdef __SSE2__ |
95 |
|
96 |
const __m128 mul = _mm_set_ps1((float)INT24_MAX+.5f); |
97 |
unsigned int count = samples; |
98 |
@@ -835,7 +830,7 @@ unsigned int CAEConvert::Float_S24NE4(float *data, const unsigned int samples, u |
99 |
} |
100 |
} |
101 |
_mm_empty(); |
102 |
- #else /* no SSE */ |
103 |
+ #else /* no SSE2 */ |
104 |
for (uint32_t i = 0; i < samples; ++i) |
105 |
*dst++ = (safeRound(*data++ * ((float)INT24_MAX+.5f)) & 0xFFFFFF) << 8; |
106 |
#endif |
107 |
@@ -929,7 +924,7 @@ unsigned int CAEConvert::Float_S24NE3(float *data, const unsigned int samples, u |
108 |
unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, uint8_t *dest) |
109 |
{ |
110 |
int32_t *dst = (int32_t*)dest; |
111 |
- #ifdef __SSE__ |
112 |
+ #ifdef __SSE2__ |
113 |
const __m128 mul = _mm_set_ps1(MUL32); |
114 |
unsigned int count = samples; |
115 |
|
116 |
@@ -989,7 +984,7 @@ unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, ui |
117 |
_mm_empty(); |
118 |
#else |
119 |
|
120 |
- /* no SIMD */ |
121 |
+ /* no SSE2 */ |
122 |
for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) |
123 |
{ |
124 |
dst[0] = safeRound(data[0] * MUL32); |
125 |
@@ -1038,7 +1033,7 @@ unsigned int CAEConvert::Float_S32LE_Neon(float *data, const unsigned int sample |
126 |
unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, uint8_t *dest) |
127 |
{ |
128 |
int32_t *dst = (int32_t*)dest; |
129 |
- #ifdef __SSE__ |
130 |
+ #ifdef __SSE2__ |
131 |
const __m128 mul = _mm_set_ps1(MUL32); |
132 |
unsigned int count = samples; |
133 |
|
134 |
@@ -1097,7 +1092,7 @@ unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui |
135 |
} |
136 |
_mm_empty(); |
137 |
#else |
138 |
- /* no SIMD */ |
139 |
+ /* no SSE2 */ |
140 |
for (uint32_t i = 0; i < samples; ++i, ++data, ++dst) |
141 |
{ |
142 |
dst[0] = safeRound(data[0] * MUL32); |
143 |
diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp |
144 |
index 6de84dc..2b6e0cd 100644 |
145 |
--- a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp |
146 |
+++ b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp |
147 |
@@ -30,7 +30,7 @@ using namespace std; |
148 |
|
149 |
/* declare the rng seed and initialize it */ |
150 |
unsigned int CAEUtil::m_seed = (unsigned int)(CurrentHostCounter() / 1000.0f); |
151 |
-#ifdef __SSE__ |
152 |
+#ifdef __SSE2__ |
153 |
/* declare the SSE seed and initialize it */ |
154 |
MEMALIGN(16, __m128i CAEUtil::m_sseSeed) = _mm_set_epi32(CAEUtil::m_seed, CAEUtil::m_seed+1, CAEUtil::m_seed, CAEUtil::m_seed+1); |
155 |
#endif |
156 |
@@ -386,7 +386,7 @@ float CAEUtil::FloatRand1(const float min, const float max) |
157 |
|
158 |
void CAEUtil::FloatRand4(const float min, const float max, float result[4], __m128 *sseresult/* = NULL */) |
159 |
{ |
160 |
- #ifdef __SSE__ |
161 |
+ #ifdef __SSE2__ |
162 |
/* |
163 |
this method may be called from other SSE code, we need |
164 |
to calculate the delta & factor using SSE as the FPU |
165 |
diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.h b/xbmc/cores/AudioEngine/Utils/AEUtil.h |
166 |
index 48cbc3b..6fdb7f2 100644 |
167 |
--- a/xbmc/cores/AudioEngine/Utils/AEUtil.h |
168 |
+++ b/xbmc/cores/AudioEngine/Utils/AEUtil.h |
169 |
@@ -27,6 +27,9 @@ |
170 |
#ifdef TARGET_WINDOWS |
171 |
#if _M_IX86_FP>0 && !defined(__SSE__) |
172 |
#define __SSE__ |
173 |
+#if _M_IX86_FP>1 && !defined(__SSE2__) |
174 |
+#define __SSE2__ |
175 |
+#endif |
176 |
#endif |
177 |
#endif |
178 |
|
179 |
@@ -36,6 +39,10 @@ |
180 |
#define __m128 void |
181 |
#endif |
182 |
|
183 |
+#ifdef __SSE2__ |
184 |
+#include <emmintrin.h> |
185 |
+#endif |
186 |
+ |
187 |
#ifdef __GNUC__ |
188 |
#define MEMALIGN(b, x) x __attribute__((aligned(b))) |
189 |
#else |
190 |
@@ -63,7 +70,7 @@ class CAEUtil |
191 |
{ |
192 |
private: |
193 |
static unsigned int m_seed; |
194 |
- #ifdef __SSE__ |
195 |
+ #ifdef __SSE2__ |
196 |
static __m128i m_sseSeed; |
197 |
#endif |
198 |
|
199 |
-- |
200 |
1.8.4.3 |