forked from enlightenment/efl
+ Add eina_cpu subsystem: just query cpu simd operations for now.
+ Add eina_tiler subsystem: initially abstraction and import of gustavo's splitter code. SVN revision: 38793
This commit is contained in:
parent
40d9cab09a
commit
75299a9fa3
|
@ -158,6 +158,8 @@ extern "C" {
|
||||||
#include "eina_iterator.h"
|
#include "eina_iterator.h"
|
||||||
#include "eina_benchmark.h"
|
#include "eina_benchmark.h"
|
||||||
#include "eina_convert.h"
|
#include "eina_convert.h"
|
||||||
|
#include "eina_cpu.h"
|
||||||
|
#include "eina_tiler.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,9 @@ eina_inline_rbtree.x \
|
||||||
eina_inline_mempool.x \
|
eina_inline_mempool.x \
|
||||||
eina_inline_rectangle.x \
|
eina_inline_rectangle.x \
|
||||||
eina_iterator.h \
|
eina_iterator.h \
|
||||||
eina_main.h
|
eina_main.h \
|
||||||
|
eina_cpu.h \
|
||||||
|
eina_tiler.h
|
||||||
|
|
||||||
installed_mainheaderdir = $(includedir)/eina-@VMAJ@
|
installed_mainheaderdir = $(includedir)/eina-@VMAJ@
|
||||||
installed_mainheader_DATA = Eina.h eina_config.h
|
installed_mainheader_DATA = Eina.h eina_config.h
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/* EINA - EFL data type library
|
||||||
|
* Copyright (C) 2007-2008 Jorge Luis Zapata Muga
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library;
|
||||||
|
* if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef EINA_CPU_H_
|
||||||
|
#define EINA_CPU_H_
|
||||||
|
|
||||||
|
#include "eina_types.h"
|
||||||
|
|
||||||
|
typedef enum _Eina_Cpu_Features
|
||||||
|
{
|
||||||
|
EINA_CPU_MMX = 0x00000001,
|
||||||
|
EINA_CPU_SSE = 0x00000002,
|
||||||
|
EINA_CPU_SSE2 = 0x00000004,
|
||||||
|
EINA_CPU_SSE3 = 0x00000008,
|
||||||
|
/* TODO 3DNow! */
|
||||||
|
EINA_CPU_ALTIVEC = 0x00000010,
|
||||||
|
EINA_CPU_VIS = 0x00000020,
|
||||||
|
EINA_CPU_NEON = 0x00000040,
|
||||||
|
} Eina_Cpu_Features;
|
||||||
|
|
||||||
|
EAPI Eina_Cpu_Features eina_cpu_features_get(void);
|
||||||
|
|
||||||
|
#endif /* EINA_CPU_H_ */
|
|
@ -68,6 +68,9 @@
|
||||||
#define EINA_MAGIC_HASH 0x9876123e
|
#define EINA_MAGIC_HASH 0x9876123e
|
||||||
#define EINA_MAGIC_HASH_ITERATOR 0x9876123f
|
#define EINA_MAGIC_HASH_ITERATOR 0x9876123f
|
||||||
|
|
||||||
|
#define EINA_MAGIC_TILER 0x98761240
|
||||||
|
#define EINA_MAGIC_TILER_ITERATOR 0x98761241
|
||||||
|
|
||||||
/* undef the following, we want out version */
|
/* undef the following, we want out version */
|
||||||
#undef FREE
|
#undef FREE
|
||||||
#define FREE(ptr) \
|
#define FREE(ptr) \
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* EINA - EFL data type library
|
||||||
|
* Copyright (C) 2007-2008 Jorge Luis Zapata Muga
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library;
|
||||||
|
* if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef EINA_TILER_H_
|
||||||
|
#define EINA_TILER_H_
|
||||||
|
|
||||||
|
#include "eina_types.h"
|
||||||
|
#include "eina_iterator.h"
|
||||||
|
#include "eina_rectangle.h"
|
||||||
|
|
||||||
|
typedef struct _Eina_Tiler Eina_Tiler;
|
||||||
|
|
||||||
|
EAPI Eina_Tiler *eina_tiler_new(int w, int h);
|
||||||
|
EAPI void eina_tiler_del(Eina_Tiler *t);
|
||||||
|
EAPI void eina_tiler_tile_size_set(Eina_Tiler *t, int w, int h);
|
||||||
|
EAPI Eina_Bool eina_tiler_rect_add(Eina_Tiler *t, Eina_Rectangle *r);
|
||||||
|
EAPI void eina_tiler_rect_del(Eina_Tiler *t, Eina_Rectangle *r);
|
||||||
|
EAPI void eina_tiler_clear(Eina_Tiler *t);
|
||||||
|
EAPI Eina_Iterator * eina_tiler_iterator_new(const Eina_Tiler *t);
|
||||||
|
|
||||||
|
#endif /* EINA_TILER_H_ */
|
|
@ -31,7 +31,9 @@ eina_convert.c \
|
||||||
eina_rbtree.c \
|
eina_rbtree.c \
|
||||||
eina_benchmark.c \
|
eina_benchmark.c \
|
||||||
eina_rectangle.c \
|
eina_rectangle.c \
|
||||||
eina_stringshare.c
|
eina_stringshare.c \
|
||||||
|
eina_cpu.c \
|
||||||
|
eina_tiler.c
|
||||||
|
|
||||||
if EINA_STATIC_BUILD_CHAINED_POOL
|
if EINA_STATIC_BUILD_CHAINED_POOL
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
/* EINA - EFL data type library
|
||||||
|
* Copyright (C) 2007-2008 Jorge Luis Zapata Muga
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library;
|
||||||
|
* if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include "eina_cpu.h"
|
||||||
|
/*============================================================================*
|
||||||
|
* Local *
|
||||||
|
*============================================================================*/
|
||||||
|
/* FIXME this ifdefs should be replaced */
|
||||||
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
|
/* We save ebx and restore it to be PIC compatible */
|
||||||
|
static inline void _x86_cpuid(int op, int *a, int *b, int *c, int *d)
|
||||||
|
{
|
||||||
|
asm volatile(
|
||||||
|
"pushl %%ebx \n\t" /* save %ebx */
|
||||||
|
"cpuid \n\t"
|
||||||
|
"movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */
|
||||||
|
"popl %%ebx \n\t" /* restore the old %ebx */
|
||||||
|
: "=a"(*a), "=r"(*b), "=c"(*c), "=d"(*d)
|
||||||
|
: "a"(op)
|
||||||
|
: "cc");
|
||||||
|
}
|
||||||
|
|
||||||
|
void _x86_simd(Eina_Cpu_Features *features)
|
||||||
|
{
|
||||||
|
int a, b, c, d;
|
||||||
|
|
||||||
|
_x86_cpuid(1, &a, &b, &c, &d);
|
||||||
|
/*
|
||||||
|
* edx
|
||||||
|
* 18 = PN (Processor Number)
|
||||||
|
* 19 = CLFlush (Cache Line Flush)
|
||||||
|
* 23 = MMX
|
||||||
|
* 25 = SSE
|
||||||
|
* 26 = SSE2
|
||||||
|
* 28 = HTT (Hyper Threading)
|
||||||
|
* ecx
|
||||||
|
* 0 = SSE3
|
||||||
|
*/
|
||||||
|
if ((d >> 23) & 1)
|
||||||
|
*features |= EINA_CPU_MMX;
|
||||||
|
if ((d >> 25) & 1)
|
||||||
|
*features |= EINA_CPU_SSE;
|
||||||
|
if ((d >> 26) & 1)
|
||||||
|
*features |= EINA_CPU_SSE2;
|
||||||
|
if (c & 1)
|
||||||
|
*features |= EINA_CPU_SSE3;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*============================================================================*
|
||||||
|
* Global *
|
||||||
|
*============================================================================*/
|
||||||
|
/*============================================================================*
|
||||||
|
* API *
|
||||||
|
*============================================================================*/
|
||||||
|
/* FIXME the features checks should be called when this function is called?
|
||||||
|
* or make it static by doing eina_cpu_init() and return a local var
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EAPI Eina_Cpu_Features eina_cpu_features_get(void)
|
||||||
|
{
|
||||||
|
Eina_Cpu_Features ecf = 0;
|
||||||
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
|
_x86_simd(&ecf);
|
||||||
|
#endif
|
||||||
|
return ecf;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue