[pkg-remote-commits] [xrdp] 02/03: Port the two more difficult files as well
Thorsten Glaser
tg at moszumanska.debian.org
Thu Jan 26 19:10:08 UTC 2017
This is an automated email from the git hooks/post-receive script.
tg pushed a commit to branch experimental
in repository xrdp.
commit feb97099ecafb8940b801fac8e123e9e750309c8
Author: mirabilos <t.glaser at tarent.de>
Date: Thu Jan 26 19:53:45 2017 +0100
Port the two more difficult files as well
---
debian/changelog | 5 +-
debian/patches/i386-pic-asm-part1.diff | 231 +++++++++++++++++++++++++++++----
debian/patches/i386-pic-asm-part2.diff | 172 +++++++++++++++++++++++-
3 files changed, 378 insertions(+), 30 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index b02e551..4cec015 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,8 @@
xrdp (0.9.1-5~exp1) experimental; urgency=low
- * Port most i386 assembly files to ELF PIC and disable using the
- unported ones if PIC is active; re-enable SIMD on [any-i386].
+ * Port i386 assembly files to ELF PIC; re-enable SIMD on any-i386.
- -- Thorsten Glaser <tg at mirbsd.de> Thu, 26 Jan 2017 19:32:10 +0100
+ -- Thorsten Glaser <tg at mirbsd.de> Thu, 26 Jan 2017 19:53:21 +0100
xrdp (0.9.1-4) unstable; urgency=high
diff --git a/debian/patches/i386-pic-asm-part1.diff b/debian/patches/i386-pic-asm-part1.diff
index d8bc0c5..51d8205 100644
--- a/debian/patches/i386-pic-asm-part1.diff
+++ b/debian/patches/i386-pic-asm-part1.diff
@@ -1,6 +1,5 @@
From: Thorsten Glaser <tg at mirbsd.org>
-Subject: Free the ebx register from use of the assembly code (WIP)
- missing: xorgxrdp/module/x86/ i420_to_rgb32_x86_sse2.asm yv12_to_rgb32_x86_sse2.asm
+Subject: Free the ebx register from use by the assembly code
--- a/librfxcodec/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
+++ b/librfxcodec/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
@@ -218,20 +217,6 @@ Subject: Free the ebx register from use of the assembly code (WIP)
por xmm7, xmm6
paddw xmm5, xmm7
psraw xmm5, 1
---- a/xorgxrdp/module/rdpSimd.c
-+++ b/xorgxrdp/module/rdpSimd.c
-@@ -98,8 +98,11 @@ rdpSimdInit(ScreenPtr pScreen, ScrnInfoP
- "0x%8.8x cx 0x%8.8x dx 0x%8.8x", ax, bx, cx, dx));
- if (dx & (1 << 26)) /* SSE 2 */
- {
-+#ifndef PIC
-+ /*XXX TODO: make these two PIC compatible */
- dev->yv12_to_rgb32 = yv12_to_rgb32_x86_sse2;
- dev->i420_to_rgb32 = i420_to_rgb32_x86_sse2;
-+#endif
- dev->yuy2_to_rgb32 = yuy2_to_rgb32_x86_sse2;
- dev->uyvy_to_rgb32 = uyvy_to_rgb32_x86_sse2;
- dev->a8r8g8b8_to_a8b8g8r8_box = a8r8g8b8_to_a8b8g8r8_box_x86_sse2;
--- a/xorgxrdp/module/x86/a8r8g8b8_to_a8b8g8r8_box_x86_sse2.asm
+++ b/xorgxrdp/module/x86/a8r8g8b8_to_a8b8g8r8_box_x86_sse2.asm
@@ -66,10 +66,10 @@ loop_y:
@@ -317,15 +302,209 @@ Subject: Free the ebx register from use of the assembly code (WIP)
mov eax, 0 ; return value
--- a/xorgxrdp/module/x86/i420_to_rgb32_x86_sse2.asm
+++ b/xorgxrdp/module/x86/i420_to_rgb32_x86_sse2.asm
-@@ -1,3 +1,4 @@
-+;XXX TODO free ebx, then add PIC
- ;
- ;Copyright 2014 Jay Sorg
- ;
+@@ -56,8 +56,8 @@ SECTION .text
+ do8_uv:
+
+ ; v
+- movd xmm1, [ebx] ; 4 at a time
+- lea ebx, [ebx + 4]
++ movd xmm1, [ebp] ; 4 at a time
++ lea ebp, [ebp + 4]
+ punpcklbw xmm1, xmm1
+ pxor xmm6, xmm6
+ punpcklbw xmm1, xmm6
+@@ -144,9 +144,6 @@ PROC _i420_to_rgb32_x86_sse2
+
+ mov esi, [esp + 20] ; y
+
+- mov ebx, esi ; u = y + width * height
+- add ebx, eax
+-
+ ; local vars
+ ; char* yptr1
+ ; char* yptr2
+@@ -156,13 +153,18 @@ PROC _i420_to_rgb32_x86_sse2
+ ; int* rgbs2
+ ; int width
+ sub esp, 28 ; local vars, 28 bytes
++
++ push ebp ; must come after the above line
++ mov ebp, esi ; u = y + width * height
++ add ebp, eax
++
+ mov [esp + 0], esi ; save y1
+ add esi, edx
+ mov [esp + 4], esi ; save y2
+- mov [esp + 8], ebx ; save u
++ mov [esp + 8], ebp ; save u
+ shr eax, 2
+- add ebx, eax ; v = u + (width * height / 4)
+- mov [esp + 12], ebx ; save v
++ add ebp, eax ; v = u + (width * height / 4)
++ mov [esp + 12], ebp ; save v
+
+ mov [esp + 16], edi ; save rgbs1
+ mov eax, edx
+@@ -185,7 +187,7 @@ loop_y:
+ loop_x:
+
+ mov esi, [esp + 0] ; y1
+- mov ebx, [esp + 8] ; u
++ mov ebp, [esp + 8] ; u
+ mov edx, [esp + 12] ; v
+ mov edi, [esp + 16] ; rgbs1
+
+@@ -202,7 +204,7 @@ loop_x:
+ call do8
+
+ mov [esp + 4], esi ; y2
+- mov [esp + 8], ebx ; u
++ mov [esp + 8], ebp ; u
+ mov [esp + 12], edx ; v
+ mov [esp + 20], edi ; rgbs2
+
+@@ -214,30 +216,33 @@ loop_x:
+
+ ; update y1 and 2
+ mov eax, [esp + 0]
+- mov ebx, edx
+- add eax, ebx
++ mov ebp, edx
++ add eax, ebp
+ mov [esp + 0], eax
+
+ mov eax, [esp + 4]
+- add eax, ebx
++ add eax, ebp
+ mov [esp + 4], eax
+
+ ; update rgb1 and 2
+ mov eax, [esp + 16]
+- mov ebx, edx
+- shl ebx, 2
+- add eax, ebx
++ mov ebp, edx
++ shl ebp, 2
++ add eax, ebp
+ mov [esp + 16], eax
+
+ mov eax, [esp + 20]
+- add eax, ebx
++ add eax, ebp
+ mov [esp + 20], eax
+
++ pop ebp
+ mov ecx, ebp
+ dec ecx ; height
+ mov ebp, ecx
++ push ebp
+ jnz loop_y
+
++ pop ebp
+ add esp, 28
+
+ mov eax, 0
--- a/xorgxrdp/module/x86/yv12_to_rgb32_x86_sse2.asm
+++ b/xorgxrdp/module/x86/yv12_to_rgb32_x86_sse2.asm
-@@ -1,3 +1,4 @@
-+;XXX TODO free ebx, then add PIC
- ;
- ;Copyright 2014 Jay Sorg
- ;
+@@ -56,8 +56,8 @@ SECTION .text
+ do8_uv:
+
+ ; u
+- movd xmm1, [ebx] ; 4 at a time
+- lea ebx, [ebx + 4]
++ movd xmm1, [ebp] ; 4 at a time
++ lea ebp, [ebp + 4]
+ punpcklbw xmm1, xmm1
+ pxor xmm6, xmm6
+ punpcklbw xmm1, xmm6
+@@ -144,9 +144,6 @@ PROC _yv12_to_rgb32_x86_sse2
+
+ mov esi, [esp + 20] ; y
+
+- mov ebx, esi ; u = y + width * height
+- add ebx, eax
+-
+ ; local vars
+ ; char* yptr1
+ ; char* yptr2
+@@ -156,13 +153,18 @@ PROC _yv12_to_rgb32_x86_sse2
+ ; int* rgbs2
+ ; int width
+ sub esp, 28 ; local vars, 28 bytes
++
++ push ebp ; must come after the above line
++ mov ebp, esi ; u = y + width * height
++ add ebp, eax
++
+ mov [esp + 0], esi ; save y1
+ add esi, edx
+ mov [esp + 4], esi ; save y2
+- mov [esp + 8], ebx ; save u
++ mov [esp + 8], ebp ; save u
+ shr eax, 2
+- add ebx, eax ; v = u + (width * height / 4)
+- mov [esp + 12], ebx ; save v
++ add ebp, eax ; v = u + (width * height / 4)
++ mov [esp + 12], ebp ; save v
+
+ mov [esp + 16], edi ; save rgbs1
+ mov eax, edx
+@@ -185,7 +187,7 @@ loop_y:
+ loop_x:
+
+ mov esi, [esp + 0] ; y1
+- mov ebx, [esp + 8] ; u
++ mov ebp, [esp + 8] ; u
+ mov edx, [esp + 12] ; v
+ mov edi, [esp + 16] ; rgbs1
+
+@@ -202,7 +204,7 @@ loop_x:
+ call do8
+
+ mov [esp + 4], esi ; y2
+- mov [esp + 8], ebx ; u
++ mov [esp + 8], ebp ; u
+ mov [esp + 12], edx ; v
+ mov [esp + 20], edi ; rgbs2
+
+@@ -214,30 +216,33 @@ loop_x:
+
+ ; update y1 and 2
+ mov eax, [esp + 0]
+- mov ebx, edx
+- add eax, ebx
++ mov ebp, edx
++ add eax, ebp
+ mov [esp + 0], eax
+
+ mov eax, [esp + 4]
+- add eax, ebx
++ add eax, ebp
+ mov [esp + 4], eax
+
+ ; update rgb1 and 2
+ mov eax, [esp + 16]
+- mov ebx, edx
+- shl ebx, 2
+- add eax, ebx
++ mov ebp, edx
++ shl ebp, 2
++ add eax, ebp
+ mov [esp + 16], eax
+
+ mov eax, [esp + 20]
+- add eax, ebx
++ add eax, ebp
+ mov [esp + 20], eax
+
++ pop ebp
+ mov ecx, ebp
+ dec ecx ; height
+ mov ebp, ecx
++ push ebp
+ jnz loop_y
+
++ pop ebp
+ add esp, 28
+
+ mov eax, 0
diff --git a/debian/patches/i386-pic-asm-part2.diff b/debian/patches/i386-pic-asm-part2.diff
index 769979c..df1b0f9 100644
--- a/debian/patches/i386-pic-asm-part2.diff
+++ b/debian/patches/i386-pic-asm-part2.diff
@@ -1,5 +1,5 @@
From: Thorsten Glaser <tg at mirbsd.org>
-Subject: Convert i386 asm code to ELF PIC (WIP)
+Subject: Convert i386 asm code to ELF PIC
--- a/librfxcodec/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
+++ b/librfxcodec/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
@@ -1233,6 +1233,91 @@ Subject: Convert i386 asm code to ELF PIC (WIP)
psrlw mm2, 2 ; div 4
packuswb mm1, mm1
+--- a/xorgxrdp/module/x86/i420_to_rgb32_x86_sse2.asm
++++ b/xorgxrdp/module/x86/i420_to_rgb32_x86_sse2.asm
+@@ -1,5 +1,6 @@
+ ;
+ ;Copyright 2014 Jay Sorg
++;Copyright 2017 mirabilos
+ ;
+ ;Permission to use, copy, modify, distribute, and sell this software and its
+ ;documentation for any purpose is hereby granted without fee, provided that
+@@ -34,7 +35,30 @@
+ ; 4096 9324 0
+
+ %ifidn __OUTPUT_FORMAT__,elf
+-SECTION .note.GNU-stack noalloc noexec nowrite progbits
++section .note.GNU-stack noalloc noexec nowrite progbits
++%ifdef PIC
++section .text
++extern _GLOBAL_OFFSET_TABLE_
++.get_GOT:
++ mov ebx,dword ptr [esp]
++ ret
++%define lsym(name) ebx + name wrt ..gotoff
++%macro get_GOT 0
++ call .get_GOT
++ add ebx,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc
++%endmacro
++%else
++%endif
++%else
++; not ELF
++%ifdef PIC
++%error Position-Independent Code is currently only supported for ELF
++%endif
++%endif
++%ifndef lsym
++%define lsym(name) name
++%macro get_GOT 0
++%endmacro
+ %endif
+
+ SECTION .data
+@@ -61,7 +85,7 @@ do8_uv:
+ punpcklbw xmm1, xmm1
+ pxor xmm6, xmm6
+ punpcklbw xmm1, xmm6
+- movdqa xmm7, [c128]
++ movdqa xmm7, [lsym(c128)]
+ psubw xmm1, xmm7
+ psllw xmm1, 4
+
+@@ -82,22 +106,22 @@ do8:
+ punpcklbw xmm0, xmm6
+
+ ; r = y + hiword(4669 * (v << 4))
+- movdqa xmm4, [c4669]
++ movdqa xmm4, [lsym(c4669)]
+ pmulhw xmm4, xmm1
+ movdqa xmm3, xmm0
+ paddw xmm3, xmm4
+
+ ; g = y - hiword(1616 * (u << 4)) - hiword(2378 * (v << 4))
+- movdqa xmm5, [c1616]
++ movdqa xmm5, [lsym(c1616)]
+ pmulhw xmm5, xmm2
+- movdqa xmm6, [c2378]
++ movdqa xmm6, [lsym(c2378)]
+ pmulhw xmm6, xmm1
+ movdqa xmm4, xmm0
+ psubw xmm4, xmm5
+ psubw xmm4, xmm6
+
+ ; b = y + hiword(9324 * (u << 4))
+- movdqa xmm6, [c9324]
++ movdqa xmm6, [lsym(c9324)]
+ pmulhw xmm6, xmm2
+ movdqa xmm5, xmm0
+ paddw xmm5, xmm6
+@@ -129,6 +153,7 @@ PROC i420_to_rgb32_x86_sse2
+ PROC _i420_to_rgb32_x86_sse2
+ %endif
+ push ebx
++ get_GOT
+ push esi
+ push edi
+ push ebp
--- a/xorgxrdp/module/x86/uyvy_to_rgb32_x86_sse2.asm
+++ b/xorgxrdp/module/x86/uyvy_to_rgb32_x86_sse2.asm
@@ -1,5 +1,6 @@
@@ -1403,3 +1488,88 @@ Subject: Convert i386 asm code to ELF PIC (WIP)
pmulhw xmm6, xmm2
movdqa xmm5, xmm0
paddw xmm5, xmm6
+--- a/xorgxrdp/module/x86/yv12_to_rgb32_x86_sse2.asm
++++ b/xorgxrdp/module/x86/yv12_to_rgb32_x86_sse2.asm
+@@ -1,5 +1,6 @@
+ ;
+ ;Copyright 2014 Jay Sorg
++;Copyright 2017 mirabilos
+ ;
+ ;Permission to use, copy, modify, distribute, and sell this software and its
+ ;documentation for any purpose is hereby granted without fee, provided that
+@@ -34,7 +35,30 @@
+ ; 4096 9324 0
+
+ %ifidn __OUTPUT_FORMAT__,elf
+-SECTION .note.GNU-stack noalloc noexec nowrite progbits
++section .note.GNU-stack noalloc noexec nowrite progbits
++%ifdef PIC
++section .text
++extern _GLOBAL_OFFSET_TABLE_
++.get_GOT:
++ mov ebx,dword ptr [esp]
++ ret
++%define lsym(name) ebx + name wrt ..gotoff
++%macro get_GOT 0
++ call .get_GOT
++ add ebx,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc
++%endmacro
++%else
++%endif
++%else
++; not ELF
++%ifdef PIC
++%error Position-Independent Code is currently only supported for ELF
++%endif
++%endif
++%ifndef lsym
++%define lsym(name) name
++%macro get_GOT 0
++%endmacro
+ %endif
+
+ SECTION .data
+@@ -61,7 +85,7 @@ do8_uv:
+ punpcklbw xmm1, xmm1
+ pxor xmm6, xmm6
+ punpcklbw xmm1, xmm6
+- movdqa xmm7, [c128]
++ movdqa xmm7, [lsym(c128)]
+ psubw xmm1, xmm7
+ psllw xmm1, 4
+
+@@ -82,22 +106,22 @@ do8:
+ punpcklbw xmm0, xmm6
+
+ ; r = y + hiword(4669 * (v << 4))
+- movdqa xmm4, [c4669]
++ movdqa xmm4, [lsym(c4669)]
+ pmulhw xmm4, xmm2
+ movdqa xmm3, xmm0
+ paddw xmm3, xmm4
+
+ ; g = y - hiword(1616 * (u << 4)) - hiword(2378 * (v << 4))
+- movdqa xmm5, [c1616]
++ movdqa xmm5, [lsym(c1616)]
+ pmulhw xmm5, xmm1
+- movdqa xmm6, [c2378]
++ movdqa xmm6, [lsym(c2378)]
+ pmulhw xmm6, xmm2
+ movdqa xmm4, xmm0
+ psubw xmm4, xmm5
+ psubw xmm4, xmm6
+
+ ; b = y + hiword(9324 * (u << 4))
+- movdqa xmm6, [c9324]
++ movdqa xmm6, [lsym(c9324)]
+ pmulhw xmm6, xmm1
+ movdqa xmm5, xmm0
+ paddw xmm5, xmm6
+@@ -129,6 +153,7 @@ PROC yv12_to_rgb32_x86_sse2
+ PROC _yv12_to_rgb32_x86_sse2
+ %endif
+ push ebx
++ get_GOT
+ push esi
+ push edi
+ push ebp
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-remote/xrdp.git
More information about the pkg-remote-commits
mailing list