Merge branch 'egfx' of github.com:awakecoding/FreeRDP into egfx

This commit is contained in:
Marc-André Moreau 2014-09-09 13:45:08 -04:00
commit 1931dc546f
6 changed files with 46 additions and 20 deletions

View File

@ -1,5 +1,5 @@
if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86") AND (CMAKE_SIZEOF_VOID_P EQUAL 4)) if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 4))
set(TARGET_ARCH "x86") set(TARGET_ARCH "x86")
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8)) elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
set(TARGET_ARCH "x64") set(TARGET_ARCH "x64")

View File

@ -100,7 +100,7 @@ endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")
if(BUILD_TESTING AND ((NOT WIN32) AND (NOT APPLE))) if(BUILD_TESTING AND NOT WIN32 AND NOT APPLE)
add_subdirectory(test) add_subdirectory(test)
endif() endif()

View File

@ -243,7 +243,7 @@ int test_set32u_func(void)
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
static inline void memset32u_naive( static INLINE void memset32u_naive(
UINT32 val, UINT32 val,
UINT32 *dst, UINT32 *dst,
size_t count) size_t count)
@ -275,7 +275,7 @@ int test_set32u_speed(void)
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
static inline void memset32s_naive( static INLINE void memset32s_naive(
INT32 val, INT32 val,
INT32 *dst, INT32 *dst,
size_t count) size_t count)

View File

@ -22,10 +22,6 @@
* Define GOOGLE_PROFILER if you want gperftools included. * Define GOOGLE_PROFILER if you want gperftools included.
*/ */
#ifdef _GNUC_
# pragma once
#endif
#ifndef __MEASURE_H_INCLUDED__ #ifndef __MEASURE_H_INCLUDED__
#define __MEASURE_H_INCLUDED__ #define __MEASURE_H_INCLUDED__
@ -35,9 +31,21 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#include <string.h> #include <winpr/crt.h>
#include <stdio.h>
#include <stdlib.h> #ifdef _WIN32
#define PROFILER_START(_prefix_)
#define PROFILER_STOP
#define MEASURE_LOOP_START(_prefix_, _count_)
#define MEASURE_LOOP_STOP
#define MEASURE_GET_RESULTS(_result_)
#define MEASURE_SHOW_RESULTS(_result_)
#define MEASURE_SHOW_RESULTS_SCALED(_scale_, _label_)
#define MEASURE_TIMED(_label_, _init_iter_, _test_time_, _result_, _call_)
#else
#ifdef GOOGLE_PROFILER #ifdef GOOGLE_PROFILER
#include <gperftools/profiler.h> #include <gperftools/profiler.h>
@ -122,4 +130,6 @@ extern void _floatprint(float t, char *output);
MEASURE_SHOW_RESULTS(_result_); \ MEASURE_SHOW_RESULTS(_result_); \
} }
#endif
#endif // __MEASURE_H_INCLUDED__ #endif // __MEASURE_H_INCLUDED__

View File

@ -18,9 +18,11 @@
#include "prim_test.h" #include "prim_test.h"
#ifndef _WIN32
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#endif
#include <winpr/sysinfo.h> #include <winpr/sysinfo.h>
#include <winpr/platform.h> #include <winpr/platform.h>
@ -83,6 +85,10 @@ void get_random_data(void *buffer, size_t size)
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#ifdef _WIN32
float _delta_time(const struct timespec *t0, const struct timespec *t1) { return 0.0f; }
#else
float _delta_time(const struct timespec *t0, const struct timespec *t1) float _delta_time(const struct timespec *t0, const struct timespec *t1)
{ {
INT64 secs = (INT64) (t1->tv_sec) - (INT64) (t0->tv_sec); INT64 secs = (INT64) (t1->tv_sec) - (INT64) (t0->tv_sec);
@ -98,6 +104,7 @@ float _delta_time(const struct timespec *t0, const struct timespec *t1)
retval = (double) secs + (double) nsecs / (double) 1000000000.0; retval = (double) secs + (double) nsecs / (double) 1000000000.0;
return (retval < 0.0) ? 0.0 : (float) retval; return (retval < 0.0) ? 0.0 : (float) retval;
} }
#endif
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
void _floatprint(float t, char *output) void _floatprint(float t, char *output)

View File

@ -13,10 +13,6 @@
* this code may be covered by patents by HP, Microsoft, or other parties. * this code may be covered by patents by HP, Microsoft, or other parties.
*/ */
#ifdef __GNUC__
# pragma once
#endif
#ifndef __PRIMTEST_H_INCLUDED__ #ifndef __PRIMTEST_H_INCLUDED__
#define __PRIMTEST_H_INCLUDED__ #define __PRIMTEST_H_INCLUDED__
@ -34,7 +30,11 @@
#include <ippi.h> #include <ippi.h>
#endif #endif
#ifdef _WIN32
#define ALIGN(x) x
#else
#define ALIGN(x) x DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) #define ALIGN(x) x DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)
#endif
#define ABS(_x_) ((_x_) < 0 ? (-(_x_)) : (_x_)) #define ABS(_x_) ((_x_) < 0 ? (-(_x_)) : (_x_))
#define MAX_TEST_SIZE 4096 #define MAX_TEST_SIZE 4096
@ -112,7 +112,7 @@ extern int test_or_32u_speed(void);
int size = size_array[s]; \ int size = size_array[s]; \
_prework_; \ _prework_; \
iter = iterations/size; \ iter = iterations/size; \
sprintf(label, "%s-%-4d", oplabel, size); \ sprintf_s(label, "%s-%-4d", oplabel, size); \
MEASURE_TIMED(label, iter, test_time, resultNormal[s], \ MEASURE_TIMED(label, iter, test_time, resultNormal[s], \
_funcNormal_); \ _funcNormal_); \
} \ } \
@ -128,7 +128,7 @@ extern int test_or_32u_speed(void);
int size = size_array[s]; \ int size = size_array[s]; \
_prework_; \ _prework_; \
iter = iterations/size; \ iter = iterations/size; \
sprintf(label, "%s-%s-%-4d", SIMD_TYPE, oplabel, size); \ sprintf_s(label, "%s-%s-%-4d", SIMD_TYPE, oplabel, size); \
MEASURE_TIMED(label, iter, test_time, resultOpt[s], \ MEASURE_TIMED(label, iter, test_time, resultOpt[s], \
_funcOpt_); \ _funcOpt_); \
} \ } \
@ -147,7 +147,7 @@ extern int test_or_32u_speed(void);
int size = size_array[s]; \ int size = size_array[s]; \
_prework_; \ _prework_; \
iter = iterations/size; \ iter = iterations/size; \
sprintf(label, "IPP-%s-%-4d", oplabel, size); \ sprintf_s(label, "IPP-%s-%-4d", oplabel, size); \
MEASURE_TIMED(label, iter, test_time, resultIPP[s], \ MEASURE_TIMED(label, iter, test_time, resultIPP[s], \
_funcIPP_); \ _funcIPP_); \
} \ } \
@ -158,6 +158,14 @@ extern int test_or_32u_speed(void);
#define PRIM_NOP do {} while (0) #define PRIM_NOP do {} while (0)
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#ifdef _WIN32
#define STD_SPEED_TEST( \
_name_, _srctype_, _dsttype_, _prework_, \
_doNormal_, _funcNormal_, \
_doOpt_, _funcOpt_, _flagOpt_, _flagExt_, \
_doIPP_, _funcIPP_)
#else
#define STD_SPEED_TEST( \ #define STD_SPEED_TEST( \
_name_, _srctype_, _dsttype_, _prework_, \ _name_, _srctype_, _dsttype_, _prework_, \
_doNormal_, _funcNormal_, \ _doNormal_, _funcNormal_, \
@ -210,7 +218,7 @@ static void _name_( \
_floatprint(resultOpt[s], sSN); \ _floatprint(resultOpt[s], sSN); \
if (resultNormal[s] > 0.0) \ if (resultNormal[s] > 0.0) \
{ \ { \
sprintf(sSNp, "%d%%", \ sprintf_s(sSNp, "%d%%", \
(int) (resultOpt[s] / resultNormal[s] * 100.0 + 0.5)); \ (int) (resultOpt[s] / resultNormal[s] * 100.0 + 0.5)); \
} \ } \
} \ } \
@ -219,7 +227,7 @@ static void _name_( \
_floatprint(resultIPP[s], sIPP); \ _floatprint(resultIPP[s], sIPP); \
if (resultNormal[s] > 0.0) \ if (resultNormal[s] > 0.0) \
{ \ { \
sprintf(sIPPp, "%d%%", \ sprintf_s(sIPPp, "%d%%", \
(int) (resultIPP[s] / resultNormal[s] * 100.0 + 0.5)); \ (int) (resultIPP[s] / resultNormal[s] * 100.0 + 0.5)); \
} \ } \
} \ } \
@ -228,5 +236,6 @@ static void _name_( \
} \ } \
free(resultNormal); free(resultOpt); free(resultIPP); \ free(resultNormal); free(resultOpt); free(resultIPP); \
} }
#endif
#endif // !__PRIMTEST_H_INCLUDED__ #endif // !__PRIMTEST_H_INCLUDED__