wfreerdp: enable SSE2 acceleration for RemoteFX under Visual C++

This commit is contained in:
louyihua 2011-12-21 08:32:04 +08:00
parent 77bbd18d5c
commit 32ff6a0b69
2 changed files with 21 additions and 1 deletions

View File

@ -25,6 +25,10 @@
#include <string.h>
#include <sys/types.h>
#ifdef _MSC_VER
#include <intrin.h>
#endif
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
#include <freerdp/utils/args.h>
@ -208,7 +212,7 @@ boolean wf_pre_connect(freerdp* instance)
void cpuid(unsigned info, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx)
{
#ifdef __GNUC__
#if defined(__GNUC__)
#if defined(__i386__) || defined(__x86_64__)
*eax = info;
__asm volatile
@ -219,6 +223,13 @@ void cpuid(unsigned info, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned
:"+a" (*eax), "=S" (*ebx), "=c" (*ecx), "=d" (*edx)
: :"edi");
#endif
#elif defined(_MSC_VER)
int a[4];
__cpuid(a, info);
*eax = a[0];
*ebx = a[1];
*ecx = a[2];
*edx = a[3];
#endif
}
@ -262,6 +273,8 @@ boolean wf_post_connect(freerdp* instance)
gdi = instance->context->gdi;
wfi->hdc = gdi->primary->hdc;
wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, gdi->primary_buffer);
rfx_context_set_cpu_opt(gdi->rfx_context, wfi_detect_cpu());
}
else
{
@ -284,6 +297,9 @@ boolean wf_post_connect(freerdp* instance)
wfi->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count);
wfi->hdc->hwnd->ninvalid = 0;
wfi->image = wf_bitmap_new(wfi, 64, 64, 32, NULL);
wfi->image->_bitmap.data = NULL;
if (settings->rfx_codec)
{
wfi->tile = wf_bitmap_new(wfi, 64, 64, 24, NULL);

View File

@ -26,6 +26,10 @@
#include "rfx_types.h"
#include "rfx_sse2.h"
#ifdef _MSC_VER
#define __attribute__(...)
#endif
#define CACHE_LINE_BYTES 64
#define _mm_between_epi16(_val, _min, _max) \