Xorg: added asm cpuid for x86

ulab-next-nosound
Jay Sorg 10 years ago
parent 6f5a70b242
commit a90d60c096

@ -8,7 +8,7 @@ rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \
rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o rdpClientCon.o rdpCapture.o \ rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o rdpClientCon.o rdpCapture.o \
rdpTrapezoids.o rdpXv.o rdpTrapezoids.o rdpXv.o
;OBJS += i420_to_rgb32_x86_sse2.o yv12_to_rgb32_x86_sse2.o yuy2_to_rgb32_x86_sse2.o uyvy_to_rgb32_x86_sse2.o ;OBJS += cpuid_x86.o i420_to_rgb32_x86_sse2.o yv12_to_rgb32_x86_sse2.o yuy2_to_rgb32_x86_sse2.o uyvy_to_rgb32_x86_sse2.o
;OBJS += i420_to_rgb32_amd64_sse2.o yv12_to_rgb32_amd64_sse2.o yuy2_to_rgb32_amd64_sse2.o uyvy_to_rgb32_amd64_sse2.o ;OBJS += i420_to_rgb32_amd64_sse2.o yv12_to_rgb32_amd64_sse2.o yuy2_to_rgb32_amd64_sse2.o uyvy_to_rgb32_amd64_sse2.o
CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 \ CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 \
@ -26,6 +26,9 @@ libxorgxrdp.so: $(OBJS) Makefile
clean: clean:
rm -f $(OBJS) libxorgxrdp.so rm -f $(OBJS) libxorgxrdp.so
cpuid_x86.o: x86/cpuid_x86.asm
yasm -f elf32 -g dwarf2 x86/cpuid_x86.asm
i420_to_rgb32_x86_sse2.o: x86/i420_to_rgb32_x86_sse2.asm i420_to_rgb32_x86_sse2.o: x86/i420_to_rgb32_x86_sse2.asm
yasm -f elf32 -g dwarf2 x86/i420_to_rgb32_x86_sse2.asm yasm -f elf32 -g dwarf2 x86/i420_to_rgb32_x86_sse2.asm

@ -50,7 +50,9 @@ XVideo
int g_xv_use_accel = 1; int g_xv_use_accel = 1;
/* use simd, compile time, if zero, g_xv_use_accel does not matter */ /* use simd, compile time, if zero, g_xv_use_accel does not matter */
#if !defined(XV_USE_ACCEL)
#define XV_USE_ACCEL 0 #define XV_USE_ACCEL 0
#endif
#define T_NUM_ENCODINGS 1 #define T_NUM_ENCODINGS 1
static XF86VideoEncodingRec g_xrdpVidEncodings[T_NUM_ENCODINGS] = static XF86VideoEncodingRec g_xrdpVidEncodings[T_NUM_ENCODINGS] =
@ -611,6 +613,7 @@ xrdpVidQueryImageAttributes(ScrnInfoPtr pScrn, int id,
return size; return size;
} }
#if XV_USE_ACCEL
#if defined(__x86_64__) || defined(__AMD64__) || defined (_M_AMD64) #if defined(__x86_64__) || defined(__AMD64__) || defined (_M_AMD64)
int int
yv12_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs); yv12_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
@ -622,6 +625,8 @@ int
uyvy_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs); uyvy_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
#elif defined(__x86__) || defined(_M_IX86) || defined(__i386__) #elif defined(__x86__) || defined(_M_IX86) || defined(__i386__)
int int
cpuid_x86(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx);
int
yv12_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs); yv12_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int int
i420_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs); i420_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
@ -630,6 +635,7 @@ yuy2_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int int
uyvy_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs); uyvy_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
#endif #endif
#endif
/*****************************************************************************/ /*****************************************************************************/
Bool Bool
@ -695,11 +701,26 @@ rdpXvInit(ScreenPtr pScreen, ScrnInfoPtr pScrn)
dev->uyvy_to_rgb32 = uyvy_to_rgb32_amd64_sse2; dev->uyvy_to_rgb32 = uyvy_to_rgb32_amd64_sse2;
LLOGLN(0, ("rdpXvInit: sse amd64 yuv functions assigned")); LLOGLN(0, ("rdpXvInit: sse amd64 yuv functions assigned"));
#elif defined(__x86__) || defined(_M_IX86) || defined(__i386__) #elif defined(__x86__) || defined(_M_IX86) || defined(__i386__)
int ax, bx, cx, dx;
cpuid_x86(1, 0, &ax, &bx, &cx, &dx);
LLOGLN(0, ("rdpXvInit: cpuid eax 1 ecx 0 return eax 0x%8.8x ebx "
"0x%8.8x ecx 0x%8.8x edx 0x%8.8x", ax, bx, cx, dx));
if (dx & (1 << 26)) /* SSE 2 */
{
dev->yv12_to_rgb32 = yv12_to_rgb32_x86_sse2; dev->yv12_to_rgb32 = yv12_to_rgb32_x86_sse2;
dev->i420_to_rgb32 = i420_to_rgb32_x86_sse2; dev->i420_to_rgb32 = i420_to_rgb32_x86_sse2;
dev->yuy2_to_rgb32 = yuy2_to_rgb32_x86_sse2; dev->yuy2_to_rgb32 = yuy2_to_rgb32_x86_sse2;
dev->uyvy_to_rgb32 = uyvy_to_rgb32_x86_sse2; dev->uyvy_to_rgb32 = uyvy_to_rgb32_x86_sse2;
LLOGLN(0, ("rdpXvInit: sse x86 yuv functions assigned")); LLOGLN(0, ("rdpXvInit: sse x86 yuv functions assigned"));
}
else
{
dev->yv12_to_rgb32 = YV12_to_RGB32;
dev->i420_to_rgb32 = I420_to_RGB32;
dev->yuy2_to_rgb32 = YUY2_to_RGB32;
dev->uyvy_to_rgb32 = UYVY_to_RGB32;
LLOGLN(0, ("rdpXvInit: warning, c yuv functions assigned"));
}
#else #else
dev->yv12_to_rgb32 = YV12_to_RGB32; dev->yv12_to_rgb32 = YV12_to_RGB32;
dev->i420_to_rgb32 = I420_to_RGB32; dev->i420_to_rgb32 = I420_to_RGB32;

@ -0,0 +1,33 @@
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
;int
;cpuid_x86(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx)
PROC cpuid_x86
; save registers
push ebx
push ecx
push edx
; cpuid
mov eax, [esp + 16]
mov ecx, [esp + 20]
cpuid
mov [esp + 24], eax
mov [esp + 28], ebx
mov [esp + 32], ecx
mov [esp + 36], edx
mov eax, 0
; restore registers
pop edx
pop ecx
pop ebx
ret;
align 16
Loading…
Cancel
Save