summaryrefslogtreecommitdiff
path: root/pkg/libass
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2017-07-09 13:27:14 -0700
committerMichael Forney <mforney@mforney.org>2017-07-10 10:34:19 -0700
commitf3b7e96da81da3c9c15fac129bb2f551971afffc (patch)
tree03f5c020b13da33632dc96d7d833747c5d985659 /pkg/libass
parent5320c1eca6000c979e8f4440f93ac6540f7f6809 (diff)
libass: Build with x86 asm
Diffstat (limited to 'pkg/libass')
-rw-r--r--pkg/libass/config.h2
-rw-r--r--pkg/libass/gen.rc12
-rw-r--r--pkg/libass/patch/0001-Fix-ASM-build-with-nasm.patch82
-rw-r--r--pkg/libass/rev2
4 files changed, 96 insertions, 2 deletions
diff --git a/pkg/libass/config.h b/pkg/libass/config.h
index 862cd78e..517ab7ba 100644
--- a/pkg/libass/config.h
+++ b/pkg/libass/config.h
@@ -1,6 +1,6 @@
#include <config-posix.h>
-/* #undef CONFIG_ASM */
+#define CONFIG_ASM 1
/* #undef CONFIG_CORETEXT */
/* #undef CONFIG_DIRECTWRITE */
/* #undef CONFIG_FONTCONFIG */
diff --git a/pkg/libass/gen.rc b/pkg/libass/gen.rc
index bc116e15..0918289e 100644
--- a/pkg/libass/gen.rc
+++ b/pkg/libass/gen.rc
@@ -4,6 +4,13 @@ cflags\
-I include\
-I '$dir'
+set nasmflags\
+ -w -orphan-labels\
+ -D 'ARCH_X86_64=1' \
+ -D 'HAVE_ALIGNED_STACK=1' \
+ -i '$srcdir'/libass/x86/\
+ -f elf64
+
hdrs=(ass.h ass_types.h)
for(hdr in $hdrs)
build '$outdir'/include/ass/$hdr copy '$srcdir'/libass/$hdr
@@ -19,6 +26,11 @@ lib libass.a -d '$dir'/deps libass/^(\
ass_strtod.c ass_fontconfig.c\
ass_string.c\
ass_rasterizer.c ass_rasterizer_c.c\
+ x86/^(\
+ blend_bitmaps.asm blur.asm cpuid.asm utils.asm\
+ be_blur.asm\
+ rasterizer.asm\
+ )\
) '$builddir'/pkg/^(\
freetype/libfreetype.a.d\
fribidi/libfribidi.a\
diff --git a/pkg/libass/patch/0001-Fix-ASM-build-with-nasm.patch b/pkg/libass/patch/0001-Fix-ASM-build-with-nasm.patch
new file mode 100644
index 00000000..423b322e
--- /dev/null
+++ b/pkg/libass/patch/0001-Fix-ASM-build-with-nasm.patch
@@ -0,0 +1,82 @@
+From 311524f544cc648293ba20c99219f82bea3b3a35 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sun, 9 Jul 2017 12:55:56 -0700
+Subject: [PATCH] Fix ASM build with nasm
+
+---
+ libass/x86/be_blur.asm | 6 +++---
+ libass/x86/blend_bitmaps.asm | 4 ++--
+ libass/x86/x86inc.asm | 4 ----
+ 3 files changed, 5 insertions(+), 9 deletions(-)
+
+diff --git a/libass/x86/be_blur.asm b/libass/x86/be_blur.asm
+index 007d60d..3b09176 100644
+--- a/libass/x86/be_blur.asm
++++ b/libass/x86/be_blur.asm
+@@ -82,8 +82,8 @@ cglobal be_blur, 5,15,9
+ movzx r10, byte [r7] ; temp1 = src[0];
+ movzx r11, byte [r7 + 1] ; temp2 = src[1];
+ add r10, r11; temp1 += temp2
+- movd xmm0, r10; __m128i old_pix_128 = temp2;
+- movd xmm1, r11; __m128i old_sum_128 = temp1;
++ movq xmm0, r10; __m128i old_pix_128 = temp2;
++ movq xmm1, r11; __m128i old_sum_128 = temp1;
+ .width_loop
+ movq xmm2, [r7 + r6]; __m128i new_pix = (src+x);
+ punpcklbw xmm2, xmm6 ; new_pix = _mm_unpacklo_epi8(new_pix, temp3);
+@@ -152,7 +152,7 @@ cglobal be_blur, 5,15,9
+ lea r12, [r4 + r3 * 2] ; unsigned char *col_sum_buf = tmp + stride * 2;
+ lea r14, [r1 - 2] ; tmpreg = (w-2);
+ and r14, -16 ; tmpreg &= (~15);
+- vmovdqa ymm7, [low_word_zero wrt rip]
++ vmovdqa ymm7, [rel low_word_zero]
+ .first_loop
+ movzx r10, byte [r7 + r6] ; int temp1 = src[x];
+ lea r11, [r8 + r10] ; int temp2 = old_pix + temp1;
+diff --git a/libass/x86/blend_bitmaps.asm b/libass/x86/blend_bitmaps.asm
+index 3a9b2dd..5843133 100644
+--- a/libass/x86/blend_bitmaps.asm
++++ b/libass/x86/blend_bitmaps.asm
+@@ -215,7 +215,7 @@ cglobal mul_bitmaps, 8,12
+ imul r7, r3
+ add r7, r2 ; last address
+ pxor xmm2, xmm2
+- movdqa xmm3, [words_255 wrt rip]
++ movdqa xmm3, [rel words_255]
+ mov r9, r6
+ and r9, -8 ; &= (~8);
+ .height_loop:
+@@ -262,7 +262,7 @@ cglobal mul_bitmaps, 8,12
+ imul r7, r3
+ add r7, r2 ; last address
+ vpxor ymm2, ymm2
+- vmovdqa ymm3, [words_255 wrt rip]
++ vmovdqa ymm3, [rel words_255]
+ mov r9, r6
+ and r9, -16 ; &= (~16);
+ .height_loop:
+diff --git a/libass/x86/x86inc.asm b/libass/x86/x86inc.asm
+index 53e104d..a8c7408 100644
+--- a/libass/x86/x86inc.asm
++++ b/libass/x86/x86inc.asm
+@@ -82,9 +82,6 @@
+ default rel
+ %endif
+
+-; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
+-CPU amdnop
+-
+ ; Macros to eliminate most code duplication between x86_32 and x86_64:
+ ; Currently this works only for leaf functions which load all their arguments
+ ; into registers at the start, and make no other use of the stack. Luckily that
+@@ -745,7 +742,6 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
+ ; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.
+ ; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
+ %macro INIT_CPUFLAGS 0-2
+- CPU amdnop
+ %if %0 >= 1
+ %xdefine cpuname %1
+ %assign cpuflags cpuflags_%1
+--
+2.13.2
+
diff --git a/pkg/libass/rev b/pkg/libass/rev
index 1e8b3149..7f8f011e 100644
--- a/pkg/libass/rev
+++ b/pkg/libass/rev
@@ -1 +1 @@
-6
+7