[libcrystalhd] Fix build on non-SSE2 arches
Hans de Goede
jwrdegoede at fedoraproject.org
Tue Aug 7 21:13:26 UTC 2012
commit 1a47c5d2c658929ac35ed214b067c6b4f1fa4ab9
Author: Hans de Goede <hdegoede at redhat.com>
Date: Tue Aug 7 23:18:47 2012 +0200
Fix build on non-SSE2 arches
- Install CrystalHD udev rule
- Clean spec file
.gitignore | 1 +
libcrystalhd-nosse2.patch | 105 +
libcrystalhd-snapshot.sh | 23 +
libcrystalhd-updates.patch |44108 --------------------------------------------
libcrystalhd.spec | 56 +-
sources | 2 +-
6 files changed, 167 insertions(+), 44128 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 278960b..198b99b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ libcrystalhd-0.9.25.tar.bz2
bcm70012fw.bin
bcm70015fw.bin
crystalhd_07032010.tbz2
+/libcrystalhd-20120405.tar.bz2
diff --git a/libcrystalhd-nosse2.patch b/libcrystalhd-nosse2.patch
new file mode 100644
index 0000000..e8a81cd
--- /dev/null
+++ b/libcrystalhd-nosse2.patch
@@ -0,0 +1,105 @@
+diff -up libcrystalhd-20120405/linux_lib/libcrystalhd/libcrystalhd_int_if.cpp.nosse2 libcrystalhd-20120405/linux_lib/libcrystalhd/libcrystalhd_int_if.cpp
+--- libcrystalhd-20120405/linux_lib/libcrystalhd/libcrystalhd_int_if.cpp.nosse2 2011-03-14 21:02:54.000000000 +0100
++++ libcrystalhd-20120405/linux_lib/libcrystalhd/libcrystalhd_int_if.cpp 2012-08-03 20:04:23.700362339 +0200
+@@ -33,7 +33,9 @@
+ #include "libcrystalhd_int_if.h"
+ #include "libcrystalhd_fwcmds.h"
+
++#if __SSE2__ || !defined __GNUC__
+ #include <emmintrin.h>
++#endif
+
+ #define SV_MAX_LINE_SZ 128
+ #define PCI_GLOBAL_CONTROL MISC2_GLOBAL_CTRL
+@@ -1425,11 +1427,14 @@ BC_STATUS DtsCopyNV12(DTS_LIB_CONTEXT *C
+ }
+
+ // TODO: add sse2 detection
++#if __SSE2__
+ static bool gSSE2 = true; // most of the platforms will have it anyway:
++#endif
+ // 64 bits: no test necessary
+ // mac: no test necessary
+ // linux/windows: we might have to do the test.
+
++#if __SSE2__
+ static void fast_memcpy(uint8_t *dst, const uint8_t *src, uint32_t count)
+ {
+ // tested
+@@ -1466,6 +1471,9 @@ static void fast_memcpy(uint8_t *dst, co
+ while (count --)
+ *dst++ = *src++;
+ }
++#else
++#define fast_memcpy(a,b,c) memcpy(a,b,c)
++#endif
+
+ // this is not good.
+ // if we have 3 buffers, we cannot assume V is after U
+@@ -1504,6 +1512,7 @@ static BC_STATUS DtsCopy422ToUYVY(uint8_
+
+ for (__y = 0; __y < height; __y++)
+ {
++#if __SSE2__
+ if (gSSE2)
+ {
+ if (((((uintptr_t) dstY) & 0xf) == 0) && ((((uintptr_t) srcY) & 0xf) == 0))
+@@ -1529,6 +1538,7 @@ static BC_STATUS DtsCopy422ToUYVY(uint8_
+ }
+ }
+ }
++#endif
+
+ while (x < srcWidth-1)
+ {
+@@ -1548,6 +1558,7 @@ static BC_STATUS DtsCopy422ToUYVY(uint8_
+ // convert to NV12
+ static BC_STATUS DtsCopy422ToNV12(uint8_t *dstY, uint8_t *dstUV, const uint8_t *srcY, uint32_t srcWidth, uint32_t dstWidth, uint32_t height, uint32_t strideY, uint32_t strideUV)
+ {
++#if __SSE2__
+ // tested
+ uint32_t x, __y;
+
+@@ -1667,6 +1678,9 @@ static BC_STATUS DtsCopy422ToNV12(uint8_
+ dstY += strideY;
+ }
+ return BC_STS_SUCCESS;
++#else
++ return BC_STS_INV_ARG;
++#endif
+ }
+
+
+@@ -1681,6 +1695,7 @@ static BC_STATUS DtsCopy420ToYV12(uint8_
+
+ static BC_STATUS DtsCopy420ToYUY2(uint8_t *dstY, uint8_t *dstUV, const uint8_t *srcY, const uint8_t *srcUV, uint32_t srcWidth, uint32_t dstWidth, uint32_t height, uint32_t strideY, uint32_t strideUV)
+ {
++#if __SSE2__
+ // TODO, test this
+ uint32_t x, __y;
+
+@@ -1836,10 +1851,14 @@ static BC_STATUS DtsCopy420ToYUY2(uint8_
+ }
+
+ return BC_STS_SUCCESS;
++#else
++ return BC_STS_INV_ARG;
++#endif
+ }
+
+ static BC_STATUS DtsCopy420ToUYVY(uint8_t *dstY, uint8_t *dstUV, const uint8_t *srcY, const uint8_t *srcUV, uint32_t srcWidth, uint32_t dstWidth, uint32_t height, uint32_t strideY, uint32_t strideUV)
+ {
++#if __SSE2__
+ // TODO, test this
+ uint32_t x, __y;
+
+@@ -1993,6 +2012,9 @@ static BC_STATUS DtsCopy420ToUYVY(uint8_
+ }
+
+ return BC_STS_SUCCESS;
++#else
++ return BC_STS_INV_ARG;
++#endif
+ }
+
+ static BC_STATUS DtsCopy420ToNV12(uint8_t *dstY, uint8_t *dstUV, const uint8_t *srcY, const uint8_t *srcUV, uint32_t srcWidth, uint32_t dstWidth, uint32_t height, uint32_t strideY, uint32_t strideUV)
diff --git a/libcrystalhd-snapshot.sh b/libcrystalhd-snapshot.sh
new file mode 100755
index 0000000..560ace2
--- /dev/null
+++ b/libcrystalhd-snapshot.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+tmp=$(mktemp -d)
+
+trap cleanup EXIT
+cleanup() {
+ set +e
+ [ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
+}
+
+unset CDPATH
+pwd=$(pwd)
+date=$(date +%Y%m%d)
+package=libcrystalhd
+svn={$date}
+svn=HEAD
+
+cd "$tmp"
+svn export --force https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/lib/libcrystalhd/ ${package}-${date}
+tar cJf "$pwd"/${package}-${date}.tar.xz ${package}-${date}
+cd - >/dev/null
diff --git a/libcrystalhd.spec b/libcrystalhd.spec
index ab9d773..426a0d5 100644
--- a/libcrystalhd.spec
+++ b/libcrystalhd.spec
@@ -1,24 +1,27 @@
+%global date 20120405
+
Summary: Broadcom Crystal HD device interface library
Name: libcrystalhd
-Version: 3.5.1
-Release: 4%{?dist}
+Version: 3.10.0
+Release: 2%{?dist}
License: LGPLv2
Group: System Environment/Libraries
#Source: http://www.broadcom.com/docs/support/crystalhd/crystalhd_linux_20100703.zip
# This tarball and README are inside the above zip file...
-Source0: crystalhd_07032010.tbz2
+# Patch generated from http://git.linuxtv.org/jarod/crystalhd.git
+Source0: libcrystalhd-%{date}.tar.bz2
Source1: README_07032010
# We're going to use even newer firmware for now
Source2: bcm70012fw.bin
Source3: bcm70015fw.bin
# LICENSE file is copy-n-pasted from http://www.broadcom.com/support/crystal_hd/
Source4: LICENSE
-Requires: crystalhd-firmware
+Source9: libcrystalhd-snapshot.sh
+Patch0: libcrystalhd-nosse2.patch
URL: http://www.broadcom.com/support/crystal_hd/
-# Patch generated from http://git.wilsonet.com/crystalhd.git/
-Patch0: libcrystalhd-updates.patch
ExcludeArch: s390 s390x
-BuildRequires: autoconf automake
+BuildRequires: autoconf automake libtool
+Requires: crystalhd-firmware
%description
The libcrystalhd library provides userspace access to Broadcom Crystal HD
@@ -62,9 +65,12 @@ BuildRequires: gstreamer-plugins-base-devel >= %{_gstpb}
Gstreamer crystalhd decoder plugin
%prep
-%setup -q -n 07032010
-%patch0 -p1
+%setup -q -n libcrystalhd-%{date}
cp %{SOURCE1} %{SOURCE4} .
+%ifnarch %{ix86} ia64 x86_64
+%patch0 -p1 -b .nosse2
+sed -i -e 's|-msse2||' linux_lib/libcrystalhd/Makefile
+%endif
%build
pushd linux_lib/libcrystalhd/ > /dev/null 2>&1
@@ -73,12 +79,14 @@ pushd linux_lib/libcrystalhd/ > /dev/null 2>&1
make %{?_smp_mflags}
popd > /dev/null 2>&1
pushd filters/gst/gst-plugin/ > /dev/null 2>&1
+sh autogen.sh || :
%configure
-make %{?_smp_mflags}
+make %{?_smp_mflags} \
+ CFLAGS="-I%{_builddir}/%{buildsubdir}/include -I%{_builddir}/%{buildsubdir}/linux_lib/libcrystalhd" \
+ BCMDEC_LDFLAGS="-L%{_builddir}/%{buildsubdir}/linux_lib/libcrystalhd -lcrystalhd"
popd > /dev/null 2>&1
%install
-rm -rf $RPM_BUILD_ROOT
pushd linux_lib/libcrystalhd/ > /dev/null 2>&1
make install LIBDIR=%{_libdir} DESTDIR=$RPM_BUILD_ROOT
popd > /dev/null 2>&1
@@ -86,11 +94,15 @@ pushd filters/gst/gst-plugin/ > /dev/null 2>&1
make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{_libdir}/gstreamer-0.10/libgstbcmdec.{a,la}
popd > /dev/null 2>&1
-cp -p %{SOURCE2} $RPM_BUILD_ROOT/lib/firmware/
-cp -p %{SOURCE3} $RPM_BUILD_ROOT/lib/firmware/
+rm -rf $RPM_BUILD_ROOT/lib/firmware/
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/firmware/
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_prefix}/lib/firmware/
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_prefix}/lib/firmware/
+#Install udev rule
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d
+install -pm 0644 driver/linux/20-crystalhd.rules \
+ $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d
-%clean
-rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
@@ -110,8 +122,9 @@ rm -rf $RPM_BUILD_ROOT
%files -n crystalhd-firmware
%defattr(-,root,root,0755)
%doc LICENSE
-/lib/firmware/bcm70012fw.bin
-/lib/firmware/bcm70015fw.bin
+%config %{_sysconfdir}/udev/rules.d/20-crystalhd.rules
+%{_prefix}/lib/firmware/bcm70012fw.bin
+%{_prefix}/lib/firmware/bcm70015fw.bin
%files -n gstreamer-plugin-crystalhd
%defattr(-,root,root,0755)
@@ -119,8 +132,13 @@ rm -rf $RPM_BUILD_ROOT
%changelog
-* Thu Jul 19 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.5.1-4
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+* Fri Aug 03 2012 Nicolas Chauvet <kwizart at gmail.com> - 3.10.0-2
+- Fix build on non-SSE2 arches
+- Install CrystalHD udev rule
+- Clean spec file
+
+* Thu Apr 05 2012 Nicolas Chauvet <kwizart at gmail.com> - 3.10.0-1
+- Update to 3.10.0
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
diff --git a/sources b/sources
index 2d8effe..4fb8ab9 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
47a30682b1b7355c2238f5d5f1920bcb bcm70012fw.bin
71d49df01f360f1581a1cfcf84bd1cfc bcm70015fw.bin
-94aafc12a96522841ea0c9a1151387af crystalhd_07032010.tbz2
+d1db00097b3e72f548da035a11b7a8f8 libcrystalhd-20120405.tar.bz2
More information about the scm-commits
mailing list