Commit 0c8ac2d2 authored by Natanael Copa's avatar Natanael Copa
Browse files

testing/mpv: fix x86_64, enable lua and vdpau

parent 43192905
From b7b7649fe791fc460ba973463f37a368191c5c87 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 26 Nov 2013 08:46:53 +0000
Subject: [PATCH] video/filter: fix PIC compile on x86
When using PIC on x86 (eg with hardened toolchains) the ebx register is
reserverd and cannot be used in assembly code.
For vf_eq we allow the compiler to use memory as input.
For vf_noise we temoporarily borrow the ebp register.
This fixes #361.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
video/filter/vf_eq.c | 3 ++-
video/filter/vf_noise.c | 9 +++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/video/filter/vf_eq.c b/video/filter/vf_eq.c
index 1bca39b..3cba73b 100644
--- a/video/filter/vf_eq.c
......@@ -19,21 +39,8 @@ index 1bca39b..3cba73b 100644
: "%eax"
);
diff --git a/video/filter/vf_gradfun.c b/video/filter/vf_gradfun.c
index f7b39fa..c4955ee 100644
--- a/video/filter/vf_gradfun.c
+++ b/video/filter/vf_gradfun.c
@@ -145,7 +145,7 @@ static void filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc,
"emms \n"
:"+r"(x)
:"r"(dst+width), "r"(src+width), "r"(dc+width/2),
- "rm"(thresh), "m"(*dithers), "m"(*pw_7f)
+ "g"(thresh), "m"(*dithers), "m"(*pw_7f)
:"memory"
);
}
diff --git a/video/filter/vf_noise.c b/video/filter/vf_noise.c
index c81a1d1..d8220be 100644
index c81a1d1..5e7bf75 100644
--- a/video/filter/vf_noise.c
+++ b/video/filter/vf_noise.c
@@ -216,13 +216,16 @@ static inline void lineNoise_C(uint8_t *dst, uint8_t *src, int8_t *noise, int le
......@@ -43,7 +50,7 @@ index c81a1d1..d8220be 100644
+ uint8_t *src_mmx_len = src+mmx_len;
__asm__ volatile(
+ "pushl %%"REG_BP" \n\t"
+ "push %%"REG_BP" \n\t"
+ "mov %0, %%"REG_BP" \n\t"
"mov %5, %%"REG_a" \n\t"
".align 4 \n\t"
......@@ -59,39 +66,12 @@ index c81a1d1..d8220be 100644
"add $8, %%"REG_a" \n\t"
" js 1b \n\t"
- :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len),
+ "popl %%"REG_BP" \n\t"
+ "pop %%"REG_BP" \n\t"
+ :: "g" (src_mmx_len), "r" (shift[0]+mmx_len),
+ "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len),
"r" (dst+mmx_len), "g" (-mmx_len)
: "%"REG_a
);
--- ./video/filter/vf_gradfun.c.orig 2013-11-25 10:55:18.192357135 +0000
+++ ./video/filter/vf_gradfun.c 2013-11-25 11:02:13.784535500 +0000
@@ -202,7 +202,10 @@
#if HAVE_SSE2 && HAVE_6REGS
#define BLURV(load)\
intptr_t x = -2*width;\
+ intptr_t dc_width = dc+width; \
__asm__ volatile(\
+ "pushl %%ebp \n"\
+ "mov %3, %%ebp \n"\
"movdqa %6, %%xmm7 \n"\
"1: \n"\
load" (%4,%0), %%xmm0 \n"\
@@ -220,13 +223,14 @@
"movdqa (%1,%0), %%xmm1 \n"\
"movdqa %%xmm0, (%1,%0) \n"\
"psubw %%xmm1, %%xmm0 \n"\
- "movdqa %%xmm0, (%3,%0) \n"\
+ "movdqa %%xmm0, (%%ebp,%0) \n"\
"add $16, %0 \n"\
"jl 1b \n"\
+ "popl %%ebp \n"\
:"+&r"(x)\
:"r"(buf+width),\
"r"(buf1+width),\
- "r"(dc+width),\
+ "g"(dc_width),\
"r"(src+width*2),\
"r"(src+width*2+sstride),\
"m"(*pw_ff)\
--
1.8.4.3
......@@ -2,20 +2,22 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mpv
pkgver=0.2.3
pkgrel=0
pkgrel=1
pkgdesc="Video player based on MPlayer/mplayer2"
url="http://mpv.io/"
arch="x86"
arch="all"
license="GPL"
depends=
makedepends="libxxf86dga-dev libxv-dev libmad-dev lame-dev libao-dev
libtheora-dev xvidcore-dev zlib-dev sdl-dev freetype-dev
x264-dev faac-dev ttf-dejavu libxvmc-dev alsa-lib-dev live-media-dev
mesa-dev ffmpeg-dev libass-dev perl clang"
mesa-dev ffmpeg-dev libass-dev perl lua5.2-dev libvdpau-dev"
install=""
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/mpv-player/mpv/archive/v$pkgver.tar.gz
pic.patch"
0001-video-filter-fix-PIC-compile-on-x86.patch
no-ebp.patch
"
_builddir="$srcdir"/mpv-$pkgver
prepare() {
......@@ -42,8 +44,11 @@ package() {
}
md5sums="11f25760d7666e6d41d85f06cece8f17 mpv-0.2.3.tar.gz
2b3a2c74be5b1f1a26b4ae7db1abe778 pic.patch"
dbb4ec33ed594468ab75c96cee37c56d 0001-video-filter-fix-PIC-compile-on-x86.patch
438d24181e0b58e94cbe380909432b3d no-ebp.patch"
sha256sums="6a0fe8b889dabdde68011dd0d3694dd36a747fc88d64f9ac9aa1e5c5d51d210c mpv-0.2.3.tar.gz
6fd70c520557dffdbb27fbc1115beea801d55a187268850441091e49fb8794ff pic.patch"
033abba4e17132497f325d89e704a439843380978f0001644cabc14229256323 0001-video-filter-fix-PIC-compile-on-x86.patch
d6ff4eabd3e9b598d4a236028690e0e30719d722a41371f1b42cbb35faa64e94 no-ebp.patch"
sha512sums="db111172f9c483c07ad79e020d9cf92ccc93b73dcbb05d28be7165a4591ae5c415b7cc4d806f859857263857af96249590076b4ba09eb01b29601bdc20c45846 mpv-0.2.3.tar.gz
06cb0e620609b8a2344f5f28cef90e502949b69d483ddf02d2916c9323df58e3372c974ab4bdba9966a258ca0fe3aee7e70d661b8bd2eda5482dcd8d72e856b2 pic.patch"
bd83dcada498d7ec210750f2675e844fe33858b99893b5a972883458395c386947b4427fa64f9c3d30b31a6e5c18411131fec0fc8f5d674baace4e53368a99e1 0001-video-filter-fix-PIC-compile-on-x86.patch
acbf0d8fb9f8d693022bc2a9130116b7aae2b0b24b0a16f6ab6602dd00965bd8a55385c25ea8fb9b15e22145a94e518d48fbf26238129635fc53348d806566ef no-ebp.patch"
gcc-4.8.2 does not allow use of ebp in asm
diff --git a/configure b/configure
index 2c41e05..3907655 100755
--- a/configure
+++ b/configure
@@ -3525,7 +3525,7 @@ $def_pthreads
#define HAVE_INLINE_ASM 1
/* Use these registers in x86 inline asm. No proper detection yet. */
-#define HAVE_EBP_AVAILABLE 1
+#define HAVE_EBP_AVAILABLE 0
#endif /* MPLAYER_CONFIG_H */
EOF
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment