Deactiveate optimized primitives if no implementation compiled.

This commit is contained in:
Armin Novak 2018-01-30 14:51:56 +01:00
parent 8f7bc7990f
commit c82610c304
2 changed files with 16 additions and 6 deletions

View File

@ -17,8 +17,8 @@
#ifndef FREERDP_LIB_PRIM_INTERNAL_H
#define FREERDP_LIB_PRIM_INTERNAL_H
#ifndef CMAKE_BUILD_TYPE
#define CMAKE_BUILD_TYPE Release
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <freerdp/primitives.h>
@ -33,11 +33,17 @@
#endif
#endif
#if defined(WITH_SSE2) || defined(WITH_NEON)
#define HAVE_OPTIMIZED_PRIMITIVES 1
#endif
#if defined(WITH_SSE2)
/* Use lddqu for unaligned; load for 16-byte aligned. */
#define LOAD_SI128(_ptr_) \
(((ULONG_PTR) (_ptr_) & 0x0f) \
? _mm_lddqu_si128((__m128i *) (_ptr_)) \
: _mm_load_si128((__m128i *) (_ptr_)))
#endif
static INLINE BYTE* writePixelBGRX(BYTE* dst, DWORD formatSize, UINT32 format,
BYTE R, BYTE G, BYTE B, BYTE A)
@ -178,6 +184,7 @@ FREERDP_LOCAL void primitives_init_colors(primitives_t* prims);
FREERDP_LOCAL void primitives_init_YCoCg(primitives_t* prims);
FREERDP_LOCAL void primitives_init_YUV(primitives_t* prims);
#if defined(WITH_SSE2) || defined(WITH_NEON)
FREERDP_LOCAL void primitives_init_copy_opt(primitives_t* prims);
FREERDP_LOCAL void primitives_init_set_opt(primitives_t* prims);
FREERDP_LOCAL void primitives_init_add_opt(primitives_t* prims);
@ -188,5 +195,6 @@ FREERDP_LOCAL void primitives_init_alphaComp_opt(primitives_t* prims);
FREERDP_LOCAL void primitives_init_colors_opt(primitives_t* prims);
FREERDP_LOCAL void primitives_init_YCoCg_opt(primitives_t* prims);
FREERDP_LOCAL void primitives_init_YUV_opt(primitives_t* prims);
#endif
#endif /* FREERDP_LIB_PRIM_INTERNAL_H */

View File

@ -35,7 +35,7 @@ static INIT_ONCE primitives_InitOnce = INIT_ONCE_STATIC_INIT;
/* ------------------------------------------------------------------------- */
static BOOL CALLBACK primitives_init_generic(PINIT_ONCE once, PVOID param, PVOID *context)
static BOOL CALLBACK primitives_init_generic(PINIT_ONCE once, PVOID param, PVOID* context)
{
primitives_init_add(&pPrimitivesGeneric);
primitives_init_andor(&pPrimitivesGeneric);
@ -50,7 +50,8 @@ static BOOL CALLBACK primitives_init_generic(PINIT_ONCE once, PVOID param, PVOID
return TRUE;
}
static BOOL CALLBACK primitives_init(PINIT_ONCE once, PVOID param, PVOID *context)
#if defined(HAVE_OPTIMIZED_PRIMITIVES)
static BOOL CALLBACK primitives_init(PINIT_ONCE once, PVOID param, PVOID* context)
{
/* Now call each section's initialization routine. */
primitives_init_add_opt(&pPrimitives);
@ -65,20 +66,21 @@ static BOOL CALLBACK primitives_init(PINIT_ONCE once, PVOID param, PVOID *contex
primitives_init_YUV_opt(&pPrimitives);
return TRUE;
}
#endif
/* ------------------------------------------------------------------------- */
primitives_t* primitives_get(void)
{
InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic, NULL, NULL);
#if defined(HAVE_OPTIMIZED_PRIMITIVES)
InitOnceExecuteOnce(&primitives_InitOnce, primitives_init, NULL, NULL);
#endif
return &pPrimitives;
}
primitives_t* primitives_get_generic(void)
{
InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic, NULL, NULL);
return &pPrimitivesGeneric;
}