efl: remove PS3 backend.

This backend has received no patch and maintenance from anyone who could
actually test it over the last few years. After talking with KaKaRoTo it
is best to remove it. If anyone want to take over its maintenance, you
are welcome to revert this patch.
This commit is contained in:
Cedric BAIL 2017-08-25 10:48:42 -07:00
parent e6b4878a9e
commit d179a5c2a9
33 changed files with 3 additions and 3270 deletions

View File

@ -221,10 +221,6 @@ if BUILD_ENGINE_SOFTWARE_DDRAW
pkgconfig_DATA += pc/evas-software-ddraw.pc
endif
if BUILD_ENGINE_PSL1GHT
pkgconfig_DATA += pc/evas-psl1ght.pc
endif
if BUILD_ENGINE_WAYLAND_SHM
pkgconfig_DATA += pc/evas-wayland-shm.pc
endif
@ -249,10 +245,6 @@ if HAVE_ECORE_DRM
pkgconfig_DATA += pc/ecore-drm.pc
endif
if HAVE_PS3
pkgconfig_DATA += pc/ecore-psl1ght.pc
endif
if HAVE_ECORE_SDL
pkgconfig_DATA += pc/ecore-sdl.pc
endif

8
README
View File

@ -168,14 +168,6 @@ supports all the transport layers Ecore Con supports.
**Ecore Psl1ght:**
//BSD 2-Clause license//
This library acts as a helper for porting to the Playstation 3 (PS3)
native runtime environment.
**Ecore SDL:**

View File

@ -2523,13 +2523,8 @@ define([EVAS_ENGINE_DEP_CHECK_FB], [
AC_CHECK_HEADER([linux/fb.h], [:], [AC_MSG_ERROR([Missing linux/fb.h])])
])
define([EVAS_ENGINE_DEP_CHECK_PSL1GHT], [
AC_CHECK_HEADER([rsx/rsx.h], [:], [AC_MSG_ERROR([Missing rsx/rsx.h])])
])
EVAS_ENGINE([buffer], [static])
EVAS_ENGINE([fb], [${want_fb}], [EVAS_ENGINE_DEP_CHECK_FB])
EVAS_ENGINE([psl1ght], [${have_ps3}], [EVAS_ENGINE_DEP_CHECK_PSL1GHT])
# XXX TODO:
EVAS_CHECK_ENGINE([gl-cocoa], [${want_evas_engine_gl_cocoa}], [no], [OpenGL Cocoa])
@ -3521,42 +3516,6 @@ EFL_LIB_END_OPTIONAL([Ecore_FB])
#### End of Ecore_FB
#### Ecore_Psl1ght
EFL_LIB_START_OPTIONAL([Ecore_Psl1ght], [test "${have_ps3}" = "yes"])
### Additional options to configure
### Default values
### Checks for programs
### Checks for libraries
EFL_PLATFORM_DEPEND([ECORE_PSL1GHT], [escape])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [ecore-input])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [ecore])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [eo])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [efl])
EFL_INTERNAL_DEPEND_PKG([ECORE_PSL1GHT], [eina])
EFL_ADD_LIBS([ECORE_PSL1GHT], [-lio -lsysutil -lgem -lcamera -lspurs])
### Checks for header files
### Checks for types
### Checks for structures
### Checks for compiler characteristics
### Checks for linker characteristics
### Checks for library functions
EFL_LIB_END_OPTIONAL([Ecore_Psl1ght])
#### End of Ecore_Psl1ght
#### Ecore_SDL
EFL_LIB_START_OPTIONAL([Ecore_SDL], [test "${want_sdl}" = "yes"])
@ -4492,7 +4451,6 @@ ECORE_EVAS_MODULE([drm], [${want_drm}],
[EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [${want_drm}], [ecore-drm2])])
ECORE_EVAS_MODULE([gl-drm], [${want_gl_drm}],
[EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [${want_gl_drm}], [ecore-drm2])])
ECORE_EVAS_MODULE([psl1ght], [${have_ps3}])
ECORE_EVAS_MODULE([opengl-cocoa], [${want_ecore_evas_gl_cocoa}])
@ -5389,7 +5347,6 @@ EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [elocation])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_x11_any}], [ecore_x])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_fb}], [ecore_fb])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${have_ps3}], [ecore_psl1ght])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_sdl}], [ecore_sdl])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_ecore_evas_gl_cocoa}], [ecore_cocoa])
EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${build_ecore_evas_win32}], [ecore_win32])
@ -5409,7 +5366,6 @@ EFL_ADD_LIBS([ELEMENTARY], [-lm])
ELM_CHECK_BACKEND([X], [${want_x11_any}])
ELM_CHECK_BACKEND([FB], [${want_fb}])
ELM_CHECK_BACKEND([PSL1GHT], [${have_ps3}])
ELM_CHECK_BACKEND([SDL], [${want_sdl}])
ELM_CHECK_BACKEND([Cocoa], [${want_ecore_evas_gl_cocoa}])
ELM_CHECK_BACKEND([Win32], [${build_ecore_evas_win32}])
@ -5689,7 +5645,6 @@ pc/evas-eglfs.pc
pc/evas-opengl-x11.pc
pc/evas-opengl-sdl.pc
pc/evas-opengl-cocoa.pc
pc/evas-psl1ght.pc
pc/evas-software-buffer.pc
pc/evas-software-x11.pc
pc/evas-software-gdi.pc
@ -5710,7 +5665,6 @@ pc/ecore-input-evas.pc
pc/ecore-cocoa.pc
pc/ecore-drm.pc
pc/ecore-fb.pc
pc/ecore-psl1ght.pc
pc/ecore-sdl.pc
pc/ecore-wayland.pc
pc/ecore-wl2.pc
@ -5897,8 +5851,6 @@ echo "IVI-Shell.......: $want_wayland_ivi_shell"
echo "Ecore_Buffer....: $want_ecore_buffer (${features_ecore_buffer})"
if test "${have_linux}" = "yes"; then
echo "Ecore_FB........: $want_fb (${features_ecore_fb})"
elif test "${have_ps3}" = "yes"; then
echo "Ecore_PSL1GHT...: $have_ps3"
elif test "${have_darwin}" = "yes"; then
echo "Ecore_Cocoa.....: $efl_lib_optional_ecore_cocoa"
elif test "${have_windows}" = "yes"; then

2
pc/.gitignore vendored
View File

@ -11,7 +11,6 @@
/ecore-input-evas.pc
/ecore-input.pc
/ecore-ipc.pc
/ecore-psl1ght.pc
/ecore-sdl.pc
/ecore-wayland.pc
/ecore-wl2.pc
@ -49,7 +48,6 @@
/evas-opengl-cocoa.pc
/evas-opengl-sdl.pc
/evas-opengl-x11.pc
/evas-psl1ght.pc
/evas-software-buffer.pc
/evas-software-ddraw.pc
/evas-software-gdi.pc

View File

@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: ecore-psl1ght
Description: E core library, PSL1GHT module
Requires.private: @requirements_pc_ecore_psl1ght@
Version: @VERSION@
Libs: -L${libdir} -lecore_psl1ght
Libs.private: @requirements_libs_ecore_psl1ght@
Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/ecore-psl1ght-@VMAJ@

View File

@ -1,3 +0,0 @@
Name: evas-psl1ght
Description: Evas PSL1GHT engine
Version: @VERSION@

View File

@ -48,7 +48,6 @@ include Makefile_Ecore_Input.am
include Makefile_Ecore_Input_Evas.am
include Makefile_Ecore_Cocoa.am
include Makefile_Ecore_FB.am
include Makefile_Ecore_Psl1ght.am
include Makefile_Ecore_SDL.am
include Makefile_Ecore_Wayland.am
include Makefile_Ecore_Wl2.am

View File

@ -144,31 +144,6 @@ modules_ecore_evas_engines_fb_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_ecore_evas_engines_fb_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if BUILD_ECORE_EVAS_PSL1GHT
PSL1GHTSOURCES = modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
ecoreevasenginepsl1ghtpkgdir = $(libdir)/ecore_evas/engines/psl1ght/$(MODULE_ARCH)
ecoreevasenginepsl1ghtpkg_LTLIBRARIES = modules/ecore_evas/engines/psl1ght/module.la
# Workaround for broken parallel install support in automake (relink issue)
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328
install_ecoreevasenginepsl1ghtpkgLTLIBRARIES = install-ecoreevasenginepsl1ghtpkgLTLIBRARIES
$(install_ecoreevasenginepsl1ghtpkgLTLIBRARIES): install-libLTLIBRARIES
modules_ecore_evas_engines_psl1ght_module_la_SOURCES = $(PSL1GHTSOURCES)
modules_ecore_evas_engines_psl1ght_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
@ECORE_EVAS_CFLAGS@ \
@ECORE_PSL1GHT_CFLAGS@ \
-I$(top_srcdir)/src/modules/evas/engines/psl1ght
modules_ecore_evas_engines_psl1ght_module_la_LIBADD = \
@USE_ECORE_EVAS_LIBS@ \
@USE_ECORE_PSL1GHT_LIBS@
modules_ecore_evas_engines_psl1ght_module_la_DEPENDENCIES = \
@USE_ECORE_EVAS_INTERNAL_LIBS@ \
@USE_ECORE_PSL1GHT_INTERNAL_LIBS@
modules_ecore_evas_engines_psl1ght_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_ecore_evas_engines_psl1ght_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if BUILD_ECORE_EVAS_WAYLAND
WAYLANDSOURCES = \
modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c \

View File

@ -1,29 +0,0 @@
if HAVE_PS3
### Library
lib_LTLIBRARIES += lib/ecore_psl1ght/libecore_psl1ght.la
installed_ecorepsl1ghtmainheadersdir = $(includedir)/ecore-psl1ght-@VMAJ@
dist_installed_ecorepsl1ghtmainheaders_DATA = \
lib/ecore_psl1ght/Ecore_Psl1ght.h
lib_ecore_psl1ght_libecore_psl1ght_la_SOURCES = \
lib/ecore_psl1ght/ecore_psl1ght.c \
lib/ecore_psl1ght/moveutil.c \
lib/ecore_psl1ght/moveutil.h \
lib/ecore_psl1ght/spursutil.c \
lib/ecore_psl1ght/spursutil.h \
lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h \
lib/ecore_psl1ght/ecore_psl1ght_private.h
lib_ecore_psl1ght_libecore_psl1ght_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_PSL1GHT_CFLAGS@
lib_ecore_psl1ght_libecore_psl1ght_la_LIBADD = @ECORE_PSL1GHT_LIBS@
lib_ecore_psl1ght_libecore_psl1ght_la_DEPENDENCIES = @ECORE_PSL1GHT_INTERNAL_LIBS@
lib_ecore_psl1ght_libecore_psl1ght_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
endif
# TODO: what are they used for?
EXTRA_DIST2 += \
lib/ecore_psl1ght/gemutil.c \
lib/ecore_psl1ght/gemutil.h

View File

@ -1043,41 +1043,6 @@ modules_evas_engines_gl_x11_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
endif
if BUILD_ENGINE_PSL1GHT
PSL1GHT_SOURCES = \
modules/evas/engines/psl1ght/evas_engine.c \
modules/evas/engines/psl1ght/rsxutil.c \
modules/evas/engines/psl1ght/evas_engine.h \
modules/evas/engines/psl1ght/rsxutil.h \
modules/evas/engines/psl1ght/Evas_Engine_PSL1GHT.h
if EVAS_STATIC_BUILD_PSL1GHT
lib_evas_libevas_la_SOURCES += $(PSL1GHT_SOURCES)
lib_evas_libevas_la_CPPFLAGS += @evas_engine_psl1ght_cflags@
lib_evas_libevas_la_LIBADD += @evas_engine_psl1ght_libs@
else
enginepsl1ghtpkgdir = $(libdir)/evas/modules/engines/psl1ght/$(MODULE_ARCH)
enginepsl1ghtpkg_LTLIBRARIES = modules/evas/engines/psl1ght/module.la
# Workaround for broken parallel install support in automake (relink issue)
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328
install_enginepsl1ghtpkgLTLIBRARIES = install-enginepsl1ghtpkgLTLIBRARIES
$(install_enginepsl1ghtpkgLTLIBRARIES): install-libLTLIBRARIES
modules_evas_engines_psl1ght_module_la_SOURCES = $(PSL1GHT_SOURCES)
modules_evas_engines_psl1ght_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/lib/evas/include \
-I$(top_srcdir)/src/lib/evas/cserve2 \
@EVAS_CFLAGS@ \
@evas_engine_psl1ght_cflags@
modules_evas_engines_psl1ght_module_la_LIBADD = \
@USE_EVAS_LIBS@ \
@evas_engine_psl1ght_libs@
modules_evas_engines_psl1ght_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
modules_evas_engines_psl1ght_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
modules_evas_engines_psl1ght_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
endif
if BUILD_ENGINE_SOFTWARE_DDRAW
SOFTWARE_DDRAW_SOURCES = \
modules/evas/engines/software_ddraw/evas_engine.c \

View File

@ -2020,7 +2020,7 @@ EAPI Ecore_Evas *ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent,
*
* The psl1ght backend is used for the PS3 GameOS.
*/
EAPI Ecore_Evas *ecore_evas_psl1ght_new(const char* name, int w, int h);
EAPI Ecore_Evas *ecore_evas_psl1ght_new(const char* name, int w, int h) EINA_DEPRECATED;
/* generic manipulation calls */

View File

@ -555,11 +555,7 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
return EINA_FALSE;
#endif
case ECORE_EVAS_ENGINE_PSL1GHT:
#ifdef BUILD_ECORE_EVAS_PSL1GHT
return EINA_TRUE;
#else
return EINA_FALSE;
#endif
case ECORE_EVAS_ENGINE_WAYLAND_SHM:
#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
return EINA_TRUE;
@ -897,17 +893,9 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, c
}
static Ecore_Evas *
_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED, const char *extra_options EINA_UNUSED)
{
Ecore_Evas *ee;
char *name = NULL;
_ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
ee = ecore_evas_psl1ght_new(name, w, h);
free(name);
if (ee) ecore_evas_move(ee, x, y);
return ee;
return NULL;
}
static Ecore_Evas *

View File

@ -288,12 +288,6 @@ _ecore_evas_available_engines_get(void)
{
#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
ADDENG("opengl_cocoa");
#endif
}
else if (!strcmp(name, "psl1ght"))
{
#ifdef BUILD_ECORE_EVAS_PSL1GHT
ADDENG("psl1ght");
#endif
}
else if (!strcmp(name, "sdl"))

View File

@ -1,124 +0,0 @@
#ifndef _ECORE_PSL1GHT_H
#define _ECORE_PSL1GHT_H
#ifdef EAPI
# undef EAPI
#endif
#ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
#else
# define EAPI
#endif
/**
* @file
* @brief Ecore PSL1GHT system functions.
*/
#ifdef __cplusplus
extern "C" {
#endif
EAPI extern int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS;
EAPI extern int ECORE_PSL1GHT_EVENT_GOT_FOCUS;
EAPI extern int ECORE_PSL1GHT_EVENT_LOST_FOCUS;
EAPI extern int ECORE_PSL1GHT_EVENT_EXPOSE;
EAPI extern int ECORE_PSL1GHT_EVENT_QUIT;
typedef struct _Ecore_Psl1ght_Event_Key_Modifiers Ecore_Psl1ght_Event_Key_Modifiers;
struct _Ecore_Psl1ght_Event_Key_Modifiers /** PSL1GHT Key Modifier event */
{
unsigned int timestamp;
unsigned int modifiers;
int shift_changed : 1;
int shift : 1;
int alt_changed : 1;
int alt : 1;
int ctrl_changed : 1;
int ctrl : 1;
int win_changed : 1;
int win : 1;
int num_lock_changed : 1;
int num_lock : 1;
int caps_lock_changed : 1;
int caps_lock : 1;
int scroll_lock_changed : 1;
int scroll_lock : 1;
};
typedef struct _Ecore_Psl1ght_Event_Key_Down Ecore_Psl1ght_Event_Key_Down;
struct _Ecore_Psl1ght_Event_Key_Down /** PSL1GHT Key Down event */
{
const char *keyname; /**< The name of the key that was pressed */
const char *keycompose; /**< The UTF-8 string conversion if any */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Key_Up Ecore_Psl1ght_Event_Key_Up;
struct _Ecore_Psl1ght_Event_Key_Up /** PSL1GHT Key Up event */
{
const char *keyname; /**< The name of the key that was released */
const char *keycompose; /**< The UTF-8 string conversion if any */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Mouse_Button_Down Ecore_Psl1ght_Event_Mouse_Button_Down;
struct _Ecore_Psl1ght_Event_Mouse_Button_Down /** PSL1GHT Mouse Down event */
{
int button; /**< Mouse button that was pressed (1 - 32) */
int x; /**< Mouse co-ordinates when mouse button was pressed */
int y; /**< Mouse co-ordinates when mouse button was pressed */
int double_click : 1; /**< Set if click was a double click */
int triple_click : 1; /**< Set if click was a triple click */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Mouse_Button_Up Ecore_Psl1ght_Event_Mouse_Button_Up;
struct _Ecore_Psl1ght_Event_Mouse_Button_Up /** PSL1GHT Mouse Up event */
{
int button; /**< Mouse button that was released (1 - 32) */
int x; /**< Mouse co-ordinates when mouse button was raised */
int y; /**< Mouse co-ordinates when mouse button was raised */
int double_click : 1; /**< Set if click was a double click */
int triple_click : 1; /**< Set if click was a triple click */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Mouse_Move Ecore_Psl1ght_Event_Mouse_Move;
struct _Ecore_Psl1ght_Event_Mouse_Move /** PSL1GHT Mouse Move event */
{
int x; /**< Mouse co-ordinates where the mouse cursor moved to */
int y; /**< Mouse co-ordinates where the mouse cursor moved to */
unsigned int time;
};
typedef struct _Ecore_Psl1ght_Event_Mouse_Wheel Ecore_Psl1ght_Event_Mouse_Wheel;
struct _Ecore_Psl1ght_Event_Mouse_Wheel /** PSL1GHT Mouse Wheel event */
{
int x, y;
int direction; /* 0 = vertical, 1 = horizontal */
int wheel; /* value 1 (left/up), -1 (right/down) */
unsigned int time;
};
EAPI int ecore_psl1ght_init(const char *name);
EAPI int ecore_psl1ght_shutdown(void);
EAPI void ecore_psl1ght_resolution_set(int width, int height);
EAPI void ecore_psl1ght_poll_events(void);
EAPI void ecore_psl1ght_screen_resolution_get(int *w, int *h);
EAPI void ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h);
#ifdef __cplusplus
}
#endif
#undef EAPI
#define EAPI
#endif

View File

@ -1,78 +0,0 @@
#ifndef ECORE_PSL1GHT_KEYS_H__
# define ECORE_PSL1GHT_KEYS_H__
struct _ecore_psl1ght_keys_s
{
int code;
const char *name;
const char *compose;
};
static const struct _ecore_psl1ght_keys_s keystable[] =
{
{ KB_RAWKEY_NO_EVENT, "0x00", "" },
{ KB_RAWKEY_BS, "BackSpace", "\010" },
{ KB_RAWKEY_TAB, "Tab", "\011" },
{ KB_RAWKEY_ENTER, "Return", "\015" },
{ KB_RAWKEY_PAUSE, "Pause", "Pause" },
{ KB_RAWKEY_ESCAPE, "Escape", "\033" },
{ KB_RAWKEY_SPACE, "space", " " },
/* Skip uppercase letters */
{ KB_RAWKEY_LEFT_BRACKET_101, "bracketleft", "[" },
{ KB_RAWKEY_BACKSLASH_101, "backslash", "\\" },
{ KB_RAWKEY_RIGHT_BRACKET_101, "bracketright", "]" },
{ KB_RAWKEY_ACCENT_CIRCONFLEX_106, "asciicircumm", "^" },
{ KB_RAWKEY_DELETE, "Delete", "\177" },
/* End of ASCII mapped keysyms */
/* Numeric keypad */
{ KB_RAWKEY_KPAD_0, "KP0", "0" },
{ KB_RAWKEY_KPAD_1, "KP1", "1" },
{ KB_RAWKEY_KPAD_2, "KP2", "2" },
{ KB_RAWKEY_KPAD_3, "KP3", "3" },
{ KB_RAWKEY_KPAD_4, "KP4", "4" },
{ KB_RAWKEY_KPAD_5, "KP5", "5" },
{ KB_RAWKEY_KPAD_6, "KP6", "6" },
{ KB_RAWKEY_KPAD_7, "KP7", "7" },
{ KB_RAWKEY_KPAD_8, "KP8", "8" },
{ KB_RAWKEY_KPAD_9, "KP9", "9" },
{ KB_RAWKEY_KPAD_PERIOD, "period", "." },
{ KB_RAWKEY_KPAD_SLASH, "KP_Divide", "/" },
{ KB_RAWKEY_KPAD_ASTERISK, "KP_Multiply", "*" },
{ KB_RAWKEY_KPAD_MINUS, "KP_Minus", "-" },
{ KB_RAWKEY_KPAD_PLUS, "KP_Plus", "+" },
{ KB_RAWKEY_KPAD_ENTER, "KP_Enter", "\015" },
/* Arrows + Home/End pad */
{ KB_RAWKEY_UP_ARROW, "Up", "Up" },
{ KB_RAWKEY_DOWN_ARROW, "Down", "Down" },
{ KB_RAWKEY_RIGHT_ARROW, "Right", "Right" },
{ KB_RAWKEY_LEFT_ARROW, "Left", "Left" },
{ KB_RAWKEY_INSERT, "Insert", "Insert" },
{ KB_RAWKEY_HOME, "Home", "Home" },
{ KB_RAWKEY_END, "End", "End" },
{ KB_RAWKEY_PAGE_UP, "Page_Up", "Page_Up" },
{ KB_RAWKEY_PAGE_DOWN, "Page_Down", "Page_Down" },
/* Function keys */
{ KB_RAWKEY_F1, "F1", "F1" },
{ KB_RAWKEY_F2, "F2", "F2" },
{ KB_RAWKEY_F3, "F3", "F3" },
{ KB_RAWKEY_F4, "F4", "F4" },
{ KB_RAWKEY_F5, "F5", "F5" },
{ KB_RAWKEY_F6, "F6", "F6" },
{ KB_RAWKEY_F7, "F7", "F7" },
{ KB_RAWKEY_F8, "F8", "F8" },
{ KB_RAWKEY_F9, "F9", "F9" },
{ KB_RAWKEY_F10, "F10", "F10" },
{ KB_RAWKEY_F11, "F11", "F11" },
{ KB_RAWKEY_F12, "F12", "F12" },
/* Key state modifier keys */
{ KB_RAWKEY_KPAD_NUMLOCK, "Num_Lock", "Num_Lock" },
{ KB_RAWKEY_CAPS_LOCK, "Caps_Lock", "Caps_Lock" },
{ KB_RAWKEY_SCROLL_LOCK, "Scroll_Lock", "Scroll_Lock" },
};
#endif /* ECORE_PSL1GHT_KEYS_H__ */

View File

@ -1,862 +0,0 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sysutil/video.h>
#include <sysutil/sysutil.h>
#include <sysmodule/sysmodule.h>
#include <io/pad.h>
#include <io/mouse.h>
#include <io/kb.h>
#include <io/camera.h>
#include <io/move.h>
#include <sys/process.h>
#include "moveutil.h"
#include "Eina.h"
#include "Ecore_Psl1ght.h"
#include "Ecore_Input.h"
#include "Ecore.h"
#include "ecore_psl1ght_private.h"
#include "ecore_private.h"
#include "Ecore_Psl1ght_Keys.h"
/* Allocate 1MB stack to avoid overflows */
SYS_PROCESS_PARAM(1001, 0x100000);
int _ecore_psl1ght_log_dom = -1;
EAPI int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0;
EAPI int ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0;
EAPI int ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0;
EAPI int ECORE_PSL1GHT_EVENT_EXPOSE = 0;
EAPI int ECORE_PSL1GHT_EVENT_QUIT = 0;
static int _ecore_psl1ght_init_count = 0;
static int window_width = 0;
static int window_height = 0;
/* Mouse support */
static int mouse_connected = FALSE;
static u8 mouse_buttons = 0;
static int mouse_x = 0;
static int mouse_y = 0;
/* Keyboard support */
static int keyboard_connected = FALSE;
static KbLed keyboard_leds = {{0}};
static KbMkey keyboard_mods = {{0}};
static u16 keyboard_old_key = 0;
/* Pad support */
static padData pad_data;
static padData old_pad_data = {0};
static int pad_old_x = 0;
static int pad_old_o = 0;
/* Move support */
static int move_connected = FALSE;
static moveContext *move_context = NULL;
u16 move_buttons = 0;
static void xmb_event_handler(u64 status, u64 param, void *user_data);
/**
* @defgroup Ecore_Psl1ght_Library_Group PSL1GHT Library Functions
* @ingroup Ecore
*
* Functions used to set up and shut down the Ecore_Psl1ght functions.
*/
/**
* Sets up the Ecore_Psl1ght library.
* @param name device target name
* @return @c 0 on failure. Otherwise, the number of times the library has
* been initialised without being shut down.
* @ingroup Ecore_PSL1GHT_Library_Group
*/
EAPI int
ecore_psl1ght_init(const char *name EINA_UNUSED)
{
videoState state;
videoResolution resolution;
int ret, camera_loaded, gem_loaded;
if (++_ecore_psl1ght_init_count != 1)
return _ecore_psl1ght_init_count;
_ecore_psl1ght_log_dom = eina_log_domain_register
("ecore_psl1ght", ECORE_PSL1GHT_DEFAULT_LOG_COLOR);
if (_ecore_psl1ght_log_dom < 0)
{
EINA_LOG_ERR("Impossible to create a log domain for the Ecore PSL1GHT module.");
return --_ecore_psl1ght_init_count;
}
if (!ecore_event_init())
{
eina_log_domain_unregister(_ecore_psl1ght_log_dom);
_ecore_psl1ght_log_dom = -1;
return --_ecore_psl1ght_init_count;
}
if (videoGetState (0, 0, &state) == 0 &&
videoGetResolution (state.displayMode.resolution, &resolution) == 0)
{
ecore_psl1ght_resolution_set (resolution.width, resolution.height);
}
else
{
ecore_event_shutdown();
eina_log_domain_unregister(_ecore_psl1ght_log_dom);
_ecore_psl1ght_log_dom = -1;
return --_ecore_psl1ght_init_count;
}
/* Pad support */
ioPadInit (7);
/* Mouse support */
ioMouseInit(2);
mouse_buttons = 0;
mouse_x = 0;
mouse_y = 0;
/* Keyboard support */
ioKbInit(2);
keyboard_leds._KbLedU.leds = 0;
keyboard_mods._KbMkeyU.mkeys = 0;
/* Initialize Move */
move_context = NULL;
move_buttons = 0;
camera_loaded = !sysModuleIsLoaded (SYSMODULE_CAMERA);
if (!camera_loaded)
ret = sysModuleLoad (SYSMODULE_CAMERA);
else
ret = 0;
if (ret == 0)
{
gem_loaded = !sysModuleIsLoaded (SYSMODULE_GEM);
if (!gem_loaded)
ret = sysModuleLoad (SYSMODULE_GEM);
if (ret == 0)
{
move_context = initMove ();
}
else {
if (gem_loaded)
sysModuleUnload (SYSMODULE_CAMERA);
}
}
sysUtilRegisterCallback (SYSUTIL_EVENT_SLOT0, xmb_event_handler, NULL);
if (ECORE_PSL1GHT_EVENT_GOT_FOCUS == 0)
{
ECORE_PSL1GHT_EVENT_GOT_FOCUS = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_LOST_FOCUS = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_EXPOSE = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = ecore_event_type_new();
ECORE_PSL1GHT_EVENT_QUIT = ecore_event_type_new();
}
mouse_x = 0;
mouse_y = 0;
return _ecore_psl1ght_init_count;
}
/**
* Shuts down the Ecore_Psl1ght library.
* @return @c The number of times the system has been initialised without
* being shut down.
* @ingroup Ecore_PSL1GHT_Library_Group
*/
EAPI int
ecore_psl1ght_shutdown(void)
{
if (--_ecore_psl1ght_init_count != 0)
return _ecore_psl1ght_init_count;
ecore_event_shutdown();
eina_log_domain_unregister(_ecore_psl1ght_log_dom);
_ecore_psl1ght_log_dom = -1;
ecore_event_type_flush(ECORE_PSL1GHT_EVENT_GOT_FOCUS,
ECORE_PSL1GHT_EVENT_LOST_FOCUS,
ECORE_PSL1GHT_EVENT_EXPOSE,
ECORE_PSL1GHT_EVENT_KEY_MODIFIERS,
ECORE_PSL1GHT_EVENT_QUIT);
ioPadEnd();
ioMouseEnd();
ioKbEnd();
if (move_context)
{
endMove (move_context);
move_context = NULL;
sysModuleUnload (SYSMODULE_CAMERA);
sysModuleUnload (SYSMODULE_GEM);
}
sysUtilUnregisterCallback(SYSUTIL_EVENT_SLOT0);
return _ecore_psl1ght_init_count;
}
static unsigned int
_ecore_psl1ght_get_time(void)
{
return (unsigned int)((unsigned long long)
(ecore_time_get() * 1000.0) & 0xffffffff);
}
static unsigned int
_ecore_psl1ght_get_modifiers(void)
{
unsigned int modifiers = 0;
if (keyboard_mods._KbMkeyU._KbMkeyS.r_shift ||
keyboard_mods._KbMkeyU._KbMkeyS.l_shift)
modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
if (keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl ||
keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl)
modifiers |= ECORE_EVENT_MODIFIER_CTRL;
if (keyboard_mods._KbMkeyU._KbMkeyS.r_alt ||
keyboard_mods._KbMkeyU._KbMkeyS.l_alt)
modifiers |= ECORE_EVENT_MODIFIER_ALT;
if (keyboard_mods._KbMkeyU._KbMkeyS.r_win ||
keyboard_mods._KbMkeyU._KbMkeyS.l_win)
modifiers |= ECORE_EVENT_MODIFIER_WIN;
if (keyboard_leds._KbLedU._KbLedS.num_lock)
modifiers |= ECORE_EVENT_LOCK_NUM;
if (keyboard_leds._KbLedU._KbLedS.caps_lock)
modifiers |= ECORE_EVENT_LOCK_CAPS;
if (keyboard_leds._KbLedU._KbLedS.scroll_lock)
modifiers |= ECORE_EVENT_LOCK_SCROLL;
return modifiers;
}
static void
_ecore_psl1ght_key_modifiers(KbMkey *mods, KbLed *leds)
{
Ecore_Psl1ght_Event_Key_Modifiers *ev;
Eina_Bool emit = EINA_FALSE;
ev = malloc(sizeof(Ecore_Psl1ght_Event_Key_Modifiers));
if (!ev) return;
if (mods->_KbMkeyU._KbMkeyS.l_shift !=
keyboard_mods._KbMkeyU._KbMkeyS.l_shift ||
mods->_KbMkeyU._KbMkeyS.r_shift !=
keyboard_mods._KbMkeyU._KbMkeyS.r_shift)
{
emit = EINA_TRUE;
ev->shift_changed = EINA_TRUE;
ev->shift = mods->_KbMkeyU._KbMkeyS.r_shift |
mods->_KbMkeyU._KbMkeyS.l_shift;
}
if (mods->_KbMkeyU._KbMkeyS.l_ctrl !=
keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl ||
mods->_KbMkeyU._KbMkeyS.r_ctrl !=
keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl)
{
emit = EINA_TRUE;
ev->ctrl_changed = EINA_TRUE;
ev->ctrl = mods->_KbMkeyU._KbMkeyS.r_ctrl |
mods->_KbMkeyU._KbMkeyS.l_ctrl;
}
if (mods->_KbMkeyU._KbMkeyS.l_alt !=
keyboard_mods._KbMkeyU._KbMkeyS.l_alt ||
mods->_KbMkeyU._KbMkeyS.r_alt !=
keyboard_mods._KbMkeyU._KbMkeyS.r_alt)
{
emit = EINA_TRUE;
ev->alt_changed = EINA_TRUE;
ev->alt = mods->_KbMkeyU._KbMkeyS.r_alt |
mods->_KbMkeyU._KbMkeyS.l_alt;
}
if (mods->_KbMkeyU._KbMkeyS.l_win !=
keyboard_mods._KbMkeyU._KbMkeyS.l_win ||
mods->_KbMkeyU._KbMkeyS.r_win !=
keyboard_mods._KbMkeyU._KbMkeyS.r_win)
{
emit = EINA_TRUE;
ev->win_changed = EINA_TRUE;
ev->win = mods->_KbMkeyU._KbMkeyS.r_win |
mods->_KbMkeyU._KbMkeyS.l_win;
}
keyboard_mods = *mods;
if (leds->_KbLedU._KbLedS.num_lock !=
keyboard_leds._KbLedU._KbLedS.num_lock)
{
emit = EINA_TRUE;
ev->num_lock_changed = EINA_TRUE;
ev->num_lock = leds->_KbLedU._KbLedS.num_lock;
}
if (leds->_KbLedU._KbLedS.caps_lock !=
keyboard_leds._KbLedU._KbLedS.caps_lock)
{
emit = EINA_TRUE;
ev->caps_lock_changed = EINA_TRUE;
ev->caps_lock = leds->_KbLedU._KbLedS.caps_lock;
}
if (leds->_KbLedU._KbLedS.scroll_lock !=
keyboard_leds._KbLedU._KbLedS.scroll_lock)
{
emit = EINA_TRUE;
ev->scroll_lock_changed = EINA_TRUE;
ev->scroll_lock = leds->_KbLedU._KbLedS.scroll_lock;
}
keyboard_leds = *leds;
if (emit)
{
ev->timestamp = _ecore_psl1ght_get_time ();
ev->modifiers = _ecore_psl1ght_get_modifiers();
ecore_event_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, ev, NULL, NULL);
}
else
{
free(ev);
}
}
static void
unicodeToUtf8(u16 w, char *utf8buf)
{
unsigned char *utf8s = (unsigned char *)utf8buf;
if ( w < 0x0080 )
{
utf8s[0] = ( unsigned char )w;
utf8s[1] = 0;
}
else if ( w < 0x0800 )
{
utf8s[0] = 0xc0 | ((w) >> 6);
utf8s[1] = 0x80 | ((w) & 0x3f);
utf8s[2] = 0;
}
else {
utf8s[0] = 0xe0 | ((w) >> 12);
utf8s[1] = 0x80 | (((w) >> 6) & 0x3f);
utf8s[2] = 0x80 | ((w) & 0x3f);
utf8s[3] = 0;
}
}
static Ecore_Event_Key *
_ecore_psl1ght_event_key(u16 key)
{
Ecore_Event_Key *ev;
char utf8[4];
u16 utf16;
unsigned int i;
ev = calloc(1, sizeof(Ecore_Event_Key));
if (!ev) return NULL;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->window = 0;
ev->event_window = 0;
ev->modifiers = _ecore_psl1ght_get_modifiers();
key &= ~KB_KEYPAD;
for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_psl1ght_keys_s); ++i)
if (keystable[i].code == key)
{
ev->keyname = keystable[i].name;
ev->key = keystable[i].name;
ev->string = keystable[i].compose;
ev->compose = keystable[i].compose;
return ev;
}
utf16 = ioKbCnvRawCode (KB_MAPPING_101, keyboard_mods, keyboard_leds, key);
unicodeToUtf8(utf16, utf8);
ev->keyname = ev->key = ev->string = ev->compose = strdup (utf8);
return ev;
}
static void
_ecore_psl1ght_mouse_move(s32 x_axis, s32 y_axis)
{
Ecore_Event_Mouse_Move *ev;
ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
if (!ev) return;
mouse_x += x_axis;
mouse_y += y_axis;
if (mouse_x < 0) mouse_x = 0;
if (mouse_y < 0) mouse_y = 0;
if (mouse_x > window_width) mouse_x = window_width;
if (mouse_y > window_height) mouse_y = window_height;
ev->window = 0;
ev->root_window = 0;
ev->event_window = 0;
ev->same_screen = 0;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->modifiers = _ecore_psl1ght_get_modifiers ();
ev->x = ev->root.x = mouse_x;
ev->y = ev->root.x = mouse_y;
ev->multi.device = 0;
ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
ev->multi.pressure = ev->multi.angle = 0;
ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
}
static void
_ecore_psl1ght_mouse_button(int button, int pressed)
{
Ecore_Event_Mouse_Button *ev;
static unsigned int previous_timestamp = 0;
ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
if (!ev) return;
ev->window = 0;
ev->root_window = 0;
ev->event_window = 0;
ev->same_screen = 0;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->modifiers = _ecore_psl1ght_get_modifiers ();
ev->buttons = button;
if (ev->timestamp - previous_timestamp <= 500)
ev->double_click = 1;
ev->triple_click = 0;
previous_timestamp = ev->timestamp;
ev->x = ev->root.x = mouse_x;
ev->y = ev->root.y = mouse_y;
ev->multi.device = 0;
ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
ev->multi.pressure = ev->multi.angle = 0;
ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
if (pressed)
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
else
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
}
static void
_ecore_psl1ght_mouse_wheel(s8 wheel, s8 tilt)
{
Ecore_Event_Mouse_Wheel *ev;
ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
if (!ev) return;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->window = 0;
ev->event_window = 0;
ev->modifiers = _ecore_psl1ght_get_modifiers ();
ev->direction = 0;
ev->z = wheel;
ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
}
static void
_ecore_psl1ght_pad_button (const char *name, int pressed)
{
Ecore_Event_Key *ev = NULL;
ev = calloc(1, sizeof(Ecore_Event_Key));
if (!ev) return;
ev->timestamp = _ecore_psl1ght_get_time ();
ev->window = 0;
ev->event_window = 0;
ev->modifiers = 0;
ev->keyname = name;
ev->key = name;
ev->string = "";
ev->compose = "";
if (pressed)
ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL);
else
ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
}
#define PAD_STICK_DEADZONE 0x20
static void
_ecore_psl1ght_poll_joypad(void)
{
padInfo padinfo;
int i;
/**/
/* Check mouse events */
ioPadGetInfo (&padinfo);
for (i = 0; i < 4; i++) /* Ignore the move */
{
if (padinfo.status[i])
{
int analog_h, analog_v;
if (ioPadGetData (i, &pad_data) != 0)
continue;
analog_h = pad_data.ANA_L_H - 0x80;
analog_v = pad_data.ANA_L_V - 0x80;
if (analog_h > PAD_STICK_DEADZONE)
analog_h -= PAD_STICK_DEADZONE;
else if (analog_h < -PAD_STICK_DEADZONE)
analog_h += PAD_STICK_DEADZONE;
else
analog_h = 0;
analog_h /= 10;
if (analog_v > PAD_STICK_DEADZONE)
analog_v -= PAD_STICK_DEADZONE;
else if (analog_v < -PAD_STICK_DEADZONE)
analog_v += PAD_STICK_DEADZONE;
else
analog_v = 0;
analog_v /= 10;
if (analog_h != 0 || analog_v != 0)
_ecore_psl1ght_mouse_move (analog_h, analog_v);
if (old_pad_data.BTN_CROSS ^ pad_data.BTN_CROSS) {
_ecore_psl1ght_pad_button ("Cross", pad_data.BTN_CROSS);
_ecore_psl1ght_mouse_button (1, pad_data.BTN_CROSS);
}
if (old_pad_data.BTN_CIRCLE ^ pad_data.BTN_CIRCLE) {
_ecore_psl1ght_pad_button ("Circle", pad_data.BTN_CIRCLE);
_ecore_psl1ght_mouse_button (3, pad_data.BTN_CIRCLE);
}
if (old_pad_data.BTN_SQUARE ^ pad_data.BTN_SQUARE)
_ecore_psl1ght_pad_button ("Square", pad_data.BTN_SQUARE);
if (old_pad_data.BTN_TRIANGLE ^ pad_data.BTN_TRIANGLE)
_ecore_psl1ght_pad_button ("Triangle", pad_data.BTN_TRIANGLE);
if (old_pad_data.BTN_UP ^ pad_data.BTN_UP)
_ecore_psl1ght_pad_button ("Up", pad_data.BTN_UP);
if (old_pad_data.BTN_DOWN ^ pad_data.BTN_DOWN)
_ecore_psl1ght_pad_button ("Down", pad_data.BTN_DOWN);
if (old_pad_data.BTN_LEFT ^ pad_data.BTN_LEFT)
_ecore_psl1ght_pad_button ("Left", pad_data.BTN_LEFT);
if (old_pad_data.BTN_RIGHT ^ pad_data.BTN_RIGHT)
_ecore_psl1ght_pad_button ("Right", pad_data.BTN_RIGHT);
if (old_pad_data.BTN_L1 ^ pad_data.BTN_L1)
_ecore_psl1ght_pad_button ("L1", pad_data.BTN_L1);
if (old_pad_data.BTN_L2 ^ pad_data.BTN_L2)
_ecore_psl1ght_pad_button ("L2", pad_data.BTN_L2);
if (old_pad_data.BTN_L3 ^ pad_data.BTN_L3)
_ecore_psl1ght_pad_button ("L3", pad_data.BTN_L3);
if (old_pad_data.BTN_R1 ^ pad_data.BTN_R1)
_ecore_psl1ght_pad_button ("R1", pad_data.BTN_R1);
if (old_pad_data.BTN_R2 ^ pad_data.BTN_R2)
_ecore_psl1ght_pad_button ("R2", pad_data.BTN_R2);
if (old_pad_data.BTN_R3 ^ pad_data.BTN_R3)
_ecore_psl1ght_pad_button ("R3", pad_data.BTN_R3);
if (old_pad_data.BTN_START ^ pad_data.BTN_START)
_ecore_psl1ght_pad_button ("Start", pad_data.BTN_START);
if (old_pad_data.BTN_SELECT ^ pad_data.BTN_SELECT)
_ecore_psl1ght_pad_button ("Select", pad_data.BTN_SELECT);
old_pad_data = pad_data;
}
}
}
static void
_ecore_psl1ght_poll_mouse(void)
{
mouseInfo mouseinfo;
u32 i;
/**/
/* Check mouse events */
ioMouseGetInfo(&mouseinfo);
if (mouseinfo.status[0] == 1 && !mouse_connected) // Connected
{
mouse_connected = TRUE;
mouse_buttons = 0;
// Old events in the queue are discarded
ioMouseClearBuf(0);
}
else if (mouseinfo.status[0] != 1 && mouse_connected) // Disconnected
{
mouse_connected = FALSE;
mouse_buttons = 0;
}
if (mouse_connected)
{
mouseDataList datalist;
ioMouseGetDataList(0, &datalist);
for (i = 0; i < datalist.count; i++)
{
u8 old_left = mouse_buttons & 1;
u8 new_left = datalist.list[i].buttons & 1;
u8 old_right = mouse_buttons & 2;
u8 new_right = datalist.list[i].buttons & 2;
u8 old_middle = mouse_buttons & 4;
u8 new_middle = datalist.list[i].buttons & 4;
if (datalist.list[i].x_axis != 0 ||
datalist.list[i].y_axis != 0)
_ecore_psl1ght_mouse_move (datalist.list[i].x_axis,
datalist.list[i].y_axis);
if (old_left != new_left)
_ecore_psl1ght_mouse_button (1, new_left);
if (old_middle != new_middle)
_ecore_psl1ght_mouse_button (2, new_middle);
if (old_right != new_right)
_ecore_psl1ght_mouse_button (3, new_right);
if (datalist.list[i].wheel != 0)
_ecore_psl1ght_mouse_wheel (datalist.list[i].wheel,
datalist.list[i].tilt);
mouse_buttons = datalist.list[i].buttons;
}
}
}
static void
_ecore_psl1ght_poll_move(void)
{
u16 new_buttons;
static int t_pressed = 0;
static int calibrated = 0;
static float prev_x = 0;
static float prev_y = 0;
static int gyro = 0;
float x, y, z;
/* Check move events */
processMove (move_context);
new_buttons = move_context->state.paddata.buttons & (~move_buttons);
move_buttons = move_context->state.paddata.buttons;
moveGet3DPosition (move_context, &x, &y, &z);
//printf ("Move 3D position is : %f, %f, %f\n", x,y,z);
switch (new_buttons) {
case 1:
gyro = !gyro;
break;
case 4:
// Move button
//printf ("Calibrating\n");
gemCalibrate (0);
calibrated = 1;
break;
case 8:
// start button
_ecore_psl1ght_mouse_move ((window_width / 2) - mouse_x, (window_height / 2) - mouse_y);
break;
}
if (calibrated)
{
float x_axis, y_axis;
if (gyro)
{
gemInertialState gem_inert;
gemGetInertialState (0, 0, 0, &gem_inert);
x_axis = -vec_array (gem_inert.gyro, 1) * 25;
y_axis = -vec_array (gem_inert.gyro, 0) * 25;
if (abs (x_axis) > 2 || abs (y_axis) > 2)
_ecore_psl1ght_mouse_move (x_axis, y_axis);
}
else {
x_axis = (x - prev_x) * 2.5;
y_axis = -(y - prev_y) * 2.5;
prev_x = x;
prev_y = y;
_ecore_psl1ght_mouse_move (x_axis, y_axis);
}
if (!t_pressed && (move_buttons & 0x2))
_ecore_psl1ght_mouse_button (1, 1);
else if (t_pressed && (move_buttons & 0x2) == 0)
_ecore_psl1ght_mouse_button (1, 0);
t_pressed = move_buttons & 0x2;
}
}
static void
_ecore_psl1ght_poll_keyboard(void)
{
KbInfo kbInfo;
int i;
/* Check keyboard events */
ioKbGetInfo(&kbInfo);
if (kbInfo.status[0] == 1 && !keyboard_connected)
{
/* Connected */
keyboard_connected = true;
// Old events in the queue are discarded
ioKbClearBuf(0);
keyboard_leds._KbLedU.leds = 0;
keyboard_mods._KbMkeyU.mkeys = 0;
keyboard_old_key = 0;
// Set raw keyboard code types to get scan codes
ioKbSetCodeType(0, KB_CODETYPE_RAW);
ioKbSetReadMode(0, KB_RMODE_INPUTCHAR);
}
else if (kbInfo.status[0] != 1 && keyboard_connected)
{
/* Disconnected keyboard */
keyboard_connected = FALSE;
}
if (keyboard_connected)
{
KbData Keys;
// Read data from the keyboard buffer
if (ioKbRead(0, &Keys) == 0 && Keys.nb_keycode > 0)
{
Ecore_Event_Key *ev = NULL;
_ecore_psl1ght_key_modifiers (&Keys.mkey, &Keys.led);
if (Keys.nb_keycode == 0 && keyboard_old_key != 0)
{
ev = _ecore_psl1ght_event_key (keyboard_old_key);
if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
}
for (i = 0; i < Keys.nb_keycode; i++)
{
if (Keys.keycode[i] != keyboard_old_key)
{
if (Keys.keycode[i] != 0)
{
ev = _ecore_psl1ght_event_key (Keys.keycode[i]);
if (ev)
ecore_event_add(ECORE_EVENT_KEY_DOWN, ev,
NULL, NULL);
}
else
{
ev = _ecore_psl1ght_event_key (keyboard_old_key);
if (ev)
ecore_event_add(ECORE_EVENT_KEY_UP, ev,
NULL, NULL);
}
keyboard_old_key = Keys.keycode[0];
}
}
}
}
}
static void
xmb_event_handler(u64 status, u64 param, void *user_data)
{
//printf ("Received event %lX\n", status);
switch (status) {
case SYSUTIL_EXIT_GAME:
ecore_event_add(ECORE_PSL1GHT_EVENT_QUIT, NULL, NULL, NULL);
break;
case SYSUTIL_DRAW_BEGIN:
ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL);
case SYSUTIL_MENU_OPEN:
ecore_event_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, NULL, NULL, NULL);
break;
case SYSUTIL_DRAW_END:
ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL);
case SYSUTIL_MENU_CLOSE:
ecore_event_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, NULL, NULL, NULL);
break;
default:
break;
}
}
EAPI void
ecore_psl1ght_poll_events(void)
{
_ecore_psl1ght_poll_joypad ();
_ecore_psl1ght_poll_mouse ();
if (move_context)
_ecore_psl1ght_poll_move ();
_ecore_psl1ght_poll_keyboard ();
sysUtilCheckCallback ();
}
EAPI void
ecore_psl1ght_resolution_set(int width, int height)
{
window_width = width;
window_height = height;
if (mouse_x > window_width) mouse_x = window_width;
if (mouse_y > window_height) mouse_y = window_height;
}
EAPI void
ecore_psl1ght_screen_resolution_get(int *w, int *h)
{
videoState state;
videoResolution resolution;
/* Get the state of the display */
if (videoGetState (0, 0, &state) == 0 &&
videoGetResolution (state.displayMode.resolution, &resolution) == 0)
{
if (w) *w = resolution.width;
if (h) *h = resolution.height;
}
else {
if (w) *w = 0;
if (h) *h = 0;
}
}
EAPI void
ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h)
{
videoDeviceInfo info;
videoResolution res;
int area = 720 * 480;
int mode_area;
int i;
if (w) *w = 720;
if (h) *h = 480;
videoGetDeviceInfo(0, 0, &info);
for (i = 0; i < info.availableModeCount; i++) {
videoGetResolution (info.availableModes[i].resolution, &res);
mode_area = res.width * res.height;
if (mode_area > area)
{
area = mode_area;
if (w) *w = res.width;
if (h) *h = res.height;
}
}
}

View File

@ -1,36 +0,0 @@
#ifndef _ECORE_PSL1GHT_PRIVATE_H
# define _ECORE_PSL1GHT_PRIVATE_H
extern int _ecore_psl1ght_log_dom;
# ifdef ECORE_PSL1GHT_DEFAULT_LOG_COLOR
# undef ECORE_PSL1GHT_DEFAULT_LOG_COLOR
# endif
# define ECORE_PSL1GHT_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
# ifdef ERR
# undef ERR
# endif
# define ERR(...) EINA_LOG_DOM_ERR(_ecore_psl1ght_log_dom, __VA_ARGS__)
# ifdef DBG
# undef DBG
# endif
# define DBG(...) EINA_LOG_DOM_DBG(_ecore_psl1ght_log_dom, __VA_ARGS__)
# ifdef INF
# undef INF
# endif
# define INF(...) EINA_LOG_DOM_INFO(_ecore_psl1ght_log_dom, __VA_ARGS__)
# ifdef WRN
# undef WRN
# endif
# define WRN(...) EINA_LOG_DOM_WARN(_ecore_psl1ght_log_dom, __VA_ARGS__)
# ifdef CRI
# undef CRI
# endif
# define CRI(...) EINA_LOG_DOM_CRIT(_ecore_psl1ght_log_dom, __VA_ARGS__)
#endif

View File

@ -1,281 +0,0 @@
#include <stdio.h>
#include <io/move.h>
#include <sys/memory.h>
#include <ppu-types.h>
#include <io/camera.h>
#include <ppu-types.h>
#include <spurs/spurs.h>
#include <sys/spu.h>
#include <sys/thread.h>
#include <sys/systime.h>
#define SPURS_DEFAULT_PREFIX_NAME "gem_spurs"
u16 oldGemPad = 0;
u16 newGemPad = 0;
u16 newGemAnalogT = 0;
extern cameraReadInfo camread;
static inline float
vec_array(vec_float4 vec, unsigned int idx)
{
union {
vec_float4 vec;
float array[4];
} v;
v.vec = vec;
if (idx > 3)
return -1;
return v.array[idx];
}
int
initMove()
{
Spurs *spurs;
gemAttribute gem_attr;
u8 gem_spu_priorities[8] = { 1, 0, 0, 0, 0, 0, 0, 0 };
int ret;
int i;
spurs = initSpurs (NULL);
if (spurs == NULL)
goto error;
printf ("preparing GemAttribute structure with spurs\n");
initAttributeGem (&gem_attr, 1, NULL, spurs, gem_spu_priorities);
gem_attr->version = 2;
gem_attr->max = 1;
gem_attr->spurs = spurs;
gem_attr->memory = NULL;
gem_attr->spu_priorities[0] = 1;
for (i = 1; i < 8; ++i)
gem_attr->spu_priorities[i] = 0;
printf ("calling GemInit with GemAttribute structure version=%d max_connect=%d spurs=%X\n",
gem_attr.version, gem_attr.max, gem_attr.spurs);
ret = gemInit (&gem_attr);
printf ("return from GemInit %X \n", ret);
if (ret)
goto error;
ret = gemPrepareCamera (128, 0.5);
printf ("GemPrepareCamera return %d exposure set to 128 and quality to 0.5\n",
ret);
if (ret)
goto error;
ret = gemReset (0);
printf ("GemReset return %X \n", ret);
if (ret)
goto error;
return ret;
error:
if (spurs)
endSpurs (spurs);
return NULL;
}
int
endMove()
{
endSpurs (spurs);
gemEnd ();
return 0;
}
int
proccessGem(int t)
{
int ret;
switch (t) {
case 0:
ret = gemUpdateStart (camread.buffer, camread.timestamp);
if (ret != 0)
{
printf ("Return from gemUpdateStart %X\n", ret);
}
break;
case 2:
ret = gemUpdateFinish ();
if (ret != 0)
{
printf ("Return from gemUpdateFinish %X\n", ret);
}
break;
case 3:
ret = gemConvertVideoFinish ();
if (ret != 0)
{
printf ("Return from gemConvertVideoFinish %X\n", ret);
}
break;
default:
ret = -1;
break;
}
return ret;
}
void
readGemPad(int num_gem)
{
gemState gem_state;
int ret;
unsigned int hues[] = { 4 << 24, 4 << 24, 4 << 24, 4 << 24 };
ret = gemGetState (0, 0, -22000, &gem_state);
newGemPad = gem_state.paddata.buttons & (~oldGemPad);
newGemAnalogT = gem_state.paddata.ANA_T;
oldGemPad = gem_state.paddata.buttons;
switch (ret) {
case 2:
gemForceRGB (num_gem, 0.5, 0.5, 0.5);
break;
case 5:
gemTrackHues (hues, NULL);
break;
default:
break;
}
}
void
readGemAccPosition(int num_gem)
{
vec_float4 position;
gemGetAccelerometerPositionInDevice (num_gem, &position);
printf (" accelerometer device coordinates [%f,%f,%f,%f]\n",
vec_array (position, 0), vec_array (position, 1), vec_array (position, 2),
vec_array (position, 3));
}
void
readGemInertial(int num_gem)
{
gemInertialState gem_inertial_state;
int ret;
ret = gemGetInertialState (num_gem, 0, -22000, &gem_inertial_state);
printf ("gemGetInertialState return %X\n", ret);
printf ("counter %d temperature %f\n", gem_inertial_state.counter,
gem_inertial_state.temperature);
printf (" accelerometer sensor [%f,%f,%f,%f]\n",
vec_array (gem_inertial_state.accelerometer, 0),
vec_array (gem_inertial_state.accelerometer, 1),
vec_array (gem_inertial_state.accelerometer, 2),
vec_array (gem_inertial_state.accelerometer, 3));
printf (" accelerometer_bias sensor [%f,%f,%f,%f]\n",
vec_array (gem_inertial_state.accelerometer_bias, 0),
vec_array (gem_inertial_state.accelerometer_bias, 1),
vec_array (gem_inertial_state.accelerometer_bias, 2),
vec_array (gem_inertial_state.accelerometer_bias, 3));
printf (" gyro sensor [%f,%f,%f,%f]\n", vec_array (gem_inertial_state.gyro,
0), vec_array (gem_inertial_state.gyro, 1),
vec_array (gem_inertial_state.gyro, 2),
vec_array (gem_inertial_state.gyro, 3));
printf (" gyro_bias sensor [%f,%f,%f,%f]\n",
vec_array (gem_inertial_state.gyro_bias, 0),
vec_array (gem_inertial_state.gyro_bias, 1),
vec_array (gem_inertial_state.gyro_bias, 2),
vec_array (gem_inertial_state.gyro_bias, 3));
}
void
readGem()
{
gemState gem_state;
proccessGem (0);
proccessGem (2);
readGemPad (0); // This will read buttons from Move
switch (newGemPad) {
case 1:
printf ("Select pressed \n");
break;
case 2:
printf ("T pressed value %d\n", newGemAnalogT);
printf
("Frame %d center of the sphere in world coordinates %f %f %f %f \n",
camread.frame, vec_array (gem_state.pos, 0), vec_array (gem_state.pos,
1), vec_array (gem_state.pos, 2), vec_array (gem_state.pos, 3));
break;
case 4:
printf ("Move pressed \n");
gemCalibrate (0);
break;
case 8:
printf ("Start pressed \n");
pos_x = 0;
pos_y = 0;
break;
case 16:
printf ("Triangle pressed \n");
getImageState ();
break;
case 32:
printf ("Circle pressed \n");
break;
case 64:
printf ("Cross pressed \n");
printf ("X,Y,Z position (mm) %f %f %f\n", vec_array (gem_state.pos, 0),
vec_array (gem_state.pos, 1), vec_array (gem_state.pos, 2));
readGemAccPosition (0);
break;
case 128:
printf ("Square pressed \n");
readGemInertial (0);
break;
default:
break;
}
}
void
getImageState()
{
int ret;
gemImageState imgState;
gemGetImageState (0, &imgState);
printf (" u [%f]\n", imgState.u);
printf (" v [%f]\n", imgState.v);
printf (" r [%f]\n", imgState.r);
printf (" projectionx [%f]\n", imgState.projectionx);
printf (" projectiony [%f]\n", imgState.projectiony);
printf (" distance [%f]\n", imgState.distance);
printf ("visible=%d r_valid=%d\n", imgState.visible, imgState.r_valid);
printf ("tiemestamp=%Ld\n", imgState.frame_time);
}

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) Antonio José Ramos Márquez (bigboss)
* Copyright (C) Youness Alaoui (KaKaRoTo)
*/
#ifndef __GEMUTIL_H__
#define __GEMUTIL_H__
#include <ppu-types.h>
#include <spurs/spurs.h>
#include <io/camera.h>
#include <io/move.h>
typedef struct
{
Spurs *spurs;
} moveContext;
#endif /* __GEMUTIL_H__ */

View File

@ -1,245 +0,0 @@
#include <stdio.h>
#include <io/move.h>
#include <sys/memory.h>
#include <ppu-types.h>
#include <io/camera.h>
#include <ppu-types.h>
#include <spurs/spurs.h>
#include <sys/thread.h>
#include <sys/systime.h>
#include "spursutil.h"
#include "moveutil.h"
u16 oldGemPad = 0;
u16 newGemPad = 0;
u16 newGemAnalogT = 0;
static void
endCamera(moveContext *context)
{
cameraStop (0);
cameraClose (0);
cameraEnd ();
sysMemContainerDestroy (context->camInfo.container);
}
static int
initCamera(moveContext *context)
{
int ret;
context->camInfo.container = NULL;
ret = cameraInit ();
printf ("cameraInit() returned %d\n", ret);
if (ret == 0)
{
cameraType type = CAM_TYPE_UNKNOWN;
ret = cameraGetType (0, &type);
if (ret == 0 && type == CAM_TYPE_PLAYSTATION_EYE)
{
context->camInfo.format = CAM_FORM_RAW8;
context->camInfo.framerate = 60;
context->camInfo.resolution = CAM_RESO_VGA;
context->camInfo.info_ver = 0x0101;
ret = sysMemContainerCreate (&context->camInfo.container, 0x200000);
printf ("sysMemContainerCreate() for camera container returned %d\n", ret);
ret = cameraOpenEx (0, &context->camInfo);
switch (ret) {
case 0:
printf ("Found me an eye, arrr!\n");
printf ("cameraOpenEx returned %08X\n", ret);
printf ("Video dimensions: %dx%d\n", context->camInfo.width, context->camInfo.height);
printf ("Buffer at %08X\n", context->camInfo.buffer);
printf ("pbuf0 Buffer at %08X\n", context->camInfo.pbuf[0]);
printf ("pbuf0 Buffer at %08X\n", context->camInfo.pbuf[1]);
printf ("context->camInfo.info_ver %X\n", context->camInfo.info_ver);
context->camRead.buffer = context->camInfo.buffer;
context->camRead.version = 0x0100;
printf ("Setting CameraReadEx %08X buffer to cameraInfoex buffer \n",
context->camRead.buffer);
break;
default:
printf ("Error %X detected opening PlayStation Eye\n", ret);
goto error;
}
}
else {
printf ("Device detected is not a PlayStation Eye and this sample need it\n");
goto error;
}
}
else {
goto error;
}
return ret;
error:
if (context->camInfo.container)
sysMemContainerDestroy (context->camInfo.container);
return ret;
}
static int
readCamera(moveContext *context)
{
int ret;
ret = cameraReadEx (0, &context->camRead);
switch (ret) {
case CAMERA_ERRO_NEED_START:
cameraReset (0);
ret = gemPrepareCamera (128, 0.5);
printf ("GemPrepareCamera return %d exposure set to 128 and quality to 0.5 before cameraStart\n",
ret);
printf ("lets go!! It's time to look your face in Sony Bravia :P\n");
ret = cameraStart (0);
printf ("cameraStart return %d \n", ret);
printf ("*******************************************\n");
printf ("* Now make sure you have a Move connected\n");
printf ("* and point it towards the camera and press\n");
printf ("* the action button to calibrate\n");
printf ("*******************************************\n");
break;
case 0:
break;
default:
printf ("error %08X ", ret);
ret = 1;
break;
}
// printf("despues de start return %d \n",ret);
if (ret == 0 && context->camRead.readcount != 0)
{
return context->camRead.readcount;
}
else {
return 0;
}
}
moveContext *
initMove()
{
moveContext *context = NULL;
Spurs *spurs;
gemAttribute gem_attr;
int ret;
int i;
spurs = initSpurs ("gem_spurs");
if (spurs == NULL)
goto error;
printf ("preparing GemAttribute structure with spurs\n");
gem_attr.version = 2;
gem_attr.max = 1;
gem_attr.spurs = spurs;
gem_attr.memory = NULL;
gem_attr.spu_priorities[0] = 1;
for (i = 1; i < 8; ++i)
gem_attr.spu_priorities[i] = 0;
printf ("calling GemInit with GemAttribute structure version=%d max_connect=%d spurs=%X\n",
gem_attr.version, gem_attr.max, gem_attr.spurs);
ret = gemInit (&gem_attr);
printf ("return from GemInit %X \n", ret);
if (ret)
goto error;
ret = gemPrepareCamera (128, 0.5);
printf ("GemPrepareCamera return %d exposure set to 128 and quality to 0.5\n",
ret);
if (ret)
goto error;
ret = gemReset (0);
printf ("GemReset return %X \n", ret);
if (ret)
goto error;
context = (moveContext *)malloc (sizeof (moveContext));
context->spurs = spurs;
ret = initCamera (context);
if (ret == 0)
return context;
error:
if (spurs)
endSpurs (spurs);
if (context)
free (context);
return NULL;
}
void
endMove(moveContext *context)
{
/* Stop Move */
gemEnd ();
/* Stop Camera */
endCamera (context);
/* Stop Spurs */
endSpurs (context->spurs);
free (context);
}
int
processMove(moveContext *context)
{
const unsigned int hues[] = { 4 << 24, 4 << 24, 4 << 24, 4 << 24 };
int ret = -1;
if (readCamera (context) > 0)
{
ret = gemUpdateStart (context->camRead.buffer, context->camRead.timestamp);
//printf ("Return from gemUpdateStart %X\n", ret);
if (ret == 0)
{
ret = gemUpdateFinish ();
//printf ("Return from gemUpdateFinish %X\n", ret);
if (ret == 0)
{
ret = gemGetState (0, STATE_LATEST_IMAGE_TIME, 0, &context->state);
switch (ret) {
case 2:
gemForceRGB (0, 0.5, 0.5, 0.5);
break;
case 5:
gemTrackHues (hues, NULL);
break;
default:
break;
}
}
}
}
return ret;
}
void
moveGet3DPosition(moveContext *context, float *x, float *y, float *z)
{
if (x)
*x = vec_array (context->state.pos, 0);
if (y)
*y = vec_array (context->state.pos, 1);
if (z)
*z = vec_array (context->state.pos, 2);
}

View File

@ -1,43 +0,0 @@
/*
* Copyright (C) Antonio José Ramos Márquez (bigboss)
* Copyright (C) Youness Alaoui (KaKaRoTo)
*/
#ifndef __MOVEUTIL_H__
#define __MOVEUTIL_H__
#include <ppu-types.h>
#include <spurs/spurs.h>
#include <io/camera.h>
#include <io/move.h>
typedef struct
{
Spurs *spurs;
cameraInfoEx camInfo;
cameraReadInfo camRead;
gemState state;
} moveContext;
static inline float
vec_array(vec_float4 vec, unsigned int idx)
{
union {
vec_float4 vec;
float array[4];
} v;
v.vec = vec;
if (idx > 3)
return -1;
return v.array[idx];
}
moveContext *initMove();
void endMove(moveContext *context);
void readGemState(moveContext *context);
int processMove(moveContext *context);
void moveGet3DPosition(moveContext *context, float *x, float *y, float *z);
#endif /* __MOVEUTIL_H__ */

View File

@ -1,62 +0,0 @@
#include "spursutil.h"
#include <sys/spu.h>
#define SPURS_DEFAULT_PREFIX_NAME "spursutil"
Spurs *
initSpurs(const char *prefix_name)
{
Spurs *spurs = NULL;
SpursAttribute attributeSpurs;
int ret;
int i;
ret = sysSpuInitialize (6, 0);
printf ("sysSpuInitialize return %d\n", ret);
/* initialize spurs */
printf ("Initializing spurs\n");
spurs = (void *)memalign (SPURS_ALIGN, sizeof (Spurs));
printf ("Initializing spurs attribute\n");
ret = spursAttributeInitialize (&attributeSpurs, 5, 250, 1000, true);
if (ret)
{
printf ("error : spursAttributeInitialize failed %x\n", ret);
goto error;
}
printf ("Setting name prefix\n");
if (!prefix_name)
prefix_name = SPURS_DEFAULT_PREFIX_NAME;
ret = spursAttributeSetNamePrefix (&attributeSpurs,
prefix_name, strlen (prefix_name));
if (ret)
{
printf ("error : spursAttributeInitialize failed %x\n", ret);
goto error;
}
printf ("Initializing with attribute\n");
ret = spursInitializeWithAttribute (spurs, &attributeSpurs);
if (ret)
{
printf ("error: spursInitializeWithAttribute failed %x\n", ret);
goto error;
}
return spurs;
error:
if (spurs)
free (spurs);
return NULL;
}
void
endSpurs(Spurs *spurs)
{
spursFinalize (spurs);
free (spurs);
}

View File

@ -1,24 +0,0 @@
/*
* Copyright (C) Antonio José Ramos Márquez (bigboss)
* Copyright (C) Youness Alaoui (KaKaRoTo)
*/
#ifndef __SPURSUTIL_H__
#define __SPURSUTIL_H__
#include <ppu-types.h>
#include <spurs/spurs.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Initialize spurs with a given name prefix (*/
Spurs *initSpurs(const char *prefix_name);
void endSpurs(Spurs *spurs);
#ifdef __cplusplus
}
#endif
#endif /* __SPURSUTIL_H__ */

View File

@ -4778,12 +4778,6 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W
}
#endif
#ifdef HAVE_ELEMENTARY_PSL1GHT
else if ((disp) && (!strcmp(disp, "ps3")))
{
enginelist[p++] = ELM_SOFTWARE_PSL1GHT;
}
#endif
#ifdef HAVE_ELEMENTARY_X
else if (!_elm_preferred_engine &&
getenv("DISPLAY") && !getenv("ELM_ENGINE"))
@ -4855,9 +4849,6 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W
#endif
#ifdef HAVE_ELEMENTARY_SDL
enginelist[p++] = ELM_SOFTWARE_SDL;
#endif
#ifdef HAVE_ELEMENTARY_PSL1GHT
enginelist[p++] = ELM_SOFTWARE_PSL1GHT;
#endif
}
else
@ -4905,9 +4896,6 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W
#endif
#ifdef HAVE_ELEMENTARY_SDL
enginelist[p++] = ELM_OPENGL_SDL;
#endif
#ifdef HAVE_ELEMENTARY_PSL1GHT
enginelist[p++] = ELM_SOFTWARE_PSL1GHT;
#endif
}
}
@ -4966,8 +4954,6 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
else if (!strcmp(enginelist[i], ELM_BUFFER))
tmp_sd.ee = ecore_evas_buffer_new(1, 1);
else if (!strcmp(enginelist[i], ELM_SOFTWARE_PSL1GHT))
tmp_sd.ee = ecore_evas_psl1ght_new(NULL, 1, 1);
else if (!strcmp(enginelist[i], ELM_DRM))
tmp_sd.ee = ecore_evas_drm_new(NULL, 0, 0, 0, 1, 1);
else if (!strncmp(enginelist[i], "shot:", 5))

View File

@ -55,7 +55,6 @@ const char *_elm_engines[] = {
"buffer",
"ews",
"opengl_cocoa",
"psl1ght",
"wayland_shm",
"wayland_egl",
"drm",
@ -2259,8 +2258,6 @@ _env_get(void)
(!strcasecmp(s, "software-fb")) ||
(!strcasecmp(s, "software_fb")))
eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB);
else if ((!strcasecmp(s, "psl1ght")))
eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_PSL1GHT);
else if ((!strcasecmp(s, "sdl")) ||
(!strcasecmp(s, "software-sdl")) ||
(!strcasecmp(s, "software_sdl")))

View File

@ -171,7 +171,6 @@ EVAS_EINA_STATIC_MODULE_DEFINE(engine, fb);
EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_generic);
EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_x11);
EVAS_EINA_STATIC_MODULE_DEFINE(engine, gl_sdl);
EVAS_EINA_STATIC_MODULE_DEFINE(engine, psl1ght);
EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_8);
EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_8_x11);
EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_ddraw);
@ -239,9 +238,6 @@ static const struct {
#ifdef EVAS_STATIC_BUILD_GL_SDL
EVAS_EINA_STATIC_MODULE_USE(engine, gl_sdl),
#endif
#ifdef EVAS_STATIC_BUILD_PSL1GHT
EVAS_EINA_STATIC_MODULE_USE(engine, psl1ght),
#endif
#ifdef EVAS_STATIC_BUILD_SOFTWARE_DDRAW
EVAS_EINA_STATIC_MODULE_USE(engine, software_ddraw),
#endif

View File

@ -1,467 +0,0 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Ecore.h>
#include "ecore_private.h"
#include <Ecore_Input.h>
#include <Ecore_Input_Evas.h>
#include <Ecore_Psl1ght.h>
#include <Evas_Engine_PSL1GHT.h>
#include <Ecore_Evas.h>
#include "ecore_evas_private.h"
#ifdef EAPI
# undef EAPI
#endif
#ifdef _WIN32
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif /* ! DLL_EXPORT */
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
# else
# define EAPI
# endif
#endif /* ! _WIN32 */
static int _ecore_evas_init_count = 0;
static Ecore_Evas *psl1ght_ee = NULL;
static Ecore_Event_Handler *ecore_evas_event_handlers[5] = {
NULL, NULL, NULL, NULL
};
static const char *ecore_evas_psl1ght_default = "EFL PSL1GHT";
static int _ecore_evas_fps_debug = 0;
static Ecore_Poller *ecore_evas_event;
static unsigned int
_ecore_evas_time_get()
{
return (unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff;
}
static Ecore_Evas *
_ecore_evas_psl1ght_match(void)
{
return psl1ght_ee;
}
static Eina_Bool
_ecore_evas_psl1ght_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Ecore_Evas *ee;
ee = _ecore_evas_psl1ght_match();
if (!ee) return ECORE_CALLBACK_PASS_ON;
/* pass on event */
_ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_ecore_evas_psl1ght_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Ecore_Evas *ee;
ee = _ecore_evas_psl1ght_match();
if (!ee) return ECORE_CALLBACK_PASS_ON;
/* pass on event */
_ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_ecore_evas_psl1ght_event_video_expose(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Ecore_Evas *ee;
int w;
int h;
ee = _ecore_evas_psl1ght_match();
if (!ee) return ECORE_CALLBACK_PASS_ON;
evas_output_size_get(ee->evas, &w, &h);
evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_ecore_evas_psl1ght_event_key_modifiers(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Evas *ee;
Ecore_Psl1ght_Event_Key_Modifiers *e = event;
ee = _ecore_evas_psl1ght_match();
if (!ee) return ECORE_CALLBACK_PASS_ON;
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_ecore_evas_psl1ght_event_quit (void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Ecore_Evas *ee;
ee = _ecore_evas_psl1ght_match();
if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
if (ee->func.fn_delete_request)
ee->func.fn_delete_request(ee);
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_ecore_evas_psl1ght_event(void *data EINA_UNUSED)
{
ecore_psl1ght_poll_events();
return ECORE_CALLBACK_RENEW;
}
static int
_ecore_evas_psl1ght_init(int w EINA_UNUSED, int h EINA_UNUSED)
{
_ecore_evas_init_count++;
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
_ecore_evas_fps_debug = 1;
// this is pretty bad: poller? and set poll time? pol time is meant to be
// adjustable for things like polling battery state, or amoutn of spare
// memory etc.
//
ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_psl1ght_event, NULL);
ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006);
if (_ecore_evas_fps_debug)
_ecore_evas_fps_debug_init();
ecore_event_evas_init();
ecore_evas_event_handlers[0] =
ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS,
_ecore_evas_psl1ght_event_got_focus, NULL);
ecore_evas_event_handlers[1] =
ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS,
_ecore_evas_psl1ght_event_lost_focus, NULL);
ecore_evas_event_handlers[2] =
ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE,
_ecore_evas_psl1ght_event_video_expose, NULL);
ecore_evas_event_handlers[3] =
ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS,
_ecore_evas_psl1ght_event_key_modifiers, NULL);
ecore_evas_event_handlers[4] =
ecore_event_handler_add(ECORE_PSL1GHT_EVENT_QUIT,
_ecore_evas_psl1ght_event_quit, NULL);
return _ecore_evas_init_count;
}
static int
_ecore_evas_psl1ght_shutdown(void)
{
_ecore_evas_init_count--;
if (_ecore_evas_init_count == 0)
{
unsigned int i;
for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler *); i++)
ecore_event_handler_del(ecore_evas_event_handlers[i]);
ecore_event_evas_shutdown();
ecore_poller_del(ecore_evas_event);
ecore_evas_event = NULL;
if (_ecore_evas_fps_debug)
_ecore_evas_fps_debug_shutdown();
}
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
return _ecore_evas_init_count;
}
static void
_ecore_evas_psl1ght_free(Ecore_Evas *ee)
{
if (psl1ght_ee == ee) psl1ght_ee = NULL;
ecore_event_window_unregister(0);
_ecore_evas_psl1ght_shutdown();
ecore_psl1ght_shutdown();
}
static void
_ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
{
ee->func.fn_delete_request = func;
}
static void
_ecore_evas_screen_resized(Ecore_Evas *ee)
{
const Evas_Device *pointer;
Ecore_Evas_Cursor *cursor;
int w, h;
/* Do not resize if the window is not fullscreen */
if (!ee->prop.fullscreen) return;
ecore_psl1ght_screen_resolution_get (&w, &h);
pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_TYPE_MOUSE);
pointer = evas_device_parent_get(pointer);
cursor = eina_hash_find(ee->prop.cursors, &pointer);
EINA_SAFETY_ON_NULL_RETURN(cursor);
if (w != ee->w || h != ee->h)
{
ee->req.w = ee->w = w;
ee->req.h = ee->h = h;
evas_output_size_set(ee->evas, ee->w, ee->h);
evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
ecore_psl1ght_resolution_set (w, h);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
_ecore_evas_time_get());
if (ee->func.fn_resize) ee->func.fn_resize(ee);
}
}
static void
_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
{
if ((w == ee->w) && (h == ee->h)) return;
ee->w = w;
ee->h = h;
evas_output_size_set(ee->evas, ee->w, ee->h);
evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
ecore_psl1ght_resolution_set (w, h);
if (ee->func.fn_resize) ee->func.fn_resize(ee);
_ecore_evas_screen_resized (ee);
}
static void
_ecore_evas_move_resize(Ecore_Evas *ee, int x EINA_UNUSED, int y EINA_UNUSED, int w, int h)
{
_ecore_evas_resize (ee, w, h);
}
static void
_ecore_evas_show(Ecore_Evas *ee)
{
ee->prop.withdrawn = EINA_FALSE;
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
if (ecore_evas_focus_device_get(ee, NULL)) return;
_ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
}
static void
_ecore_evas_screen_geometry_get(const Ecore_Evas *ee EINA_UNUSED, int *x, int *y, int *w, int *h)
{
if (x) *x = 0;
if (y) *y = 0;
ecore_psl1ght_screen_resolution_get (w, h);
}
static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
{
_ecore_evas_psl1ght_free,
NULL,
NULL,
NULL,
NULL,
_ecore_evas_psl1ght_callback_delete_request_set,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
_ecore_evas_resize,
_ecore_evas_move_resize,
NULL,
NULL,
_ecore_evas_show,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL, //transparent
NULL, // profiles_set
NULL, // profile_set
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL, // render
_ecore_evas_screen_geometry_get, // screen_geometry_get
NULL, // screen_dpi_get
NULL,
NULL, //msg_send
NULL, // pointer_xy_get
NULL, // pointer_warp
NULL, // wm_rot_preferred_rotation_set
NULL, // wm_rot_available_rotations_set
NULL, // wm_rot_manual_rotation_done_set
NULL, // wm_rot_manual_rotation_done
NULL, // aux_hints_set
NULL, // fn_animator_register
NULL, // fn_animator_unregister
NULL, // fn_evas_changed
NULL, //fn_focus_device_set
NULL, //fn_callback_focus_device_in_set
NULL, //fn_callback_focus_device_out_set
NULL, //fn_callback_device_mouse_in_set
NULL, //fn_callback_device_mouse_out_set
NULL, //fn_pointer_device_xy_get
NULL, //fn_prepare
NULL, //fn_last_tick_get
};
EAPI Ecore_Evas *
ecore_evas_psl1ght_new_internal(const char *name, int w, int h)
{
void *einfo;
Ecore_Evas *ee;
if (!name)
name = ecore_evas_psl1ght_default;
ee = calloc(1, sizeof(Ecore_Evas));
if (!ee) return NULL;
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_psl1ght_engine_func;
ee->driver = "psl1ght";
if (name) ee->name = strdup(name);
if (w < 1) w = 1;
if (h < 1) h = 1;
ee->visible = 1;
ee->w = w;
ee->h = h;
ee->prop.max.w = 0;
ee->prop.max.h = 0;
ee->prop.layer = 0;
ee->prop.borderless = EINA_TRUE;
ee->prop.override = EINA_TRUE;
ee->prop.maximized = EINA_TRUE;
ee->prop.fullscreen = EINA_FALSE;
ee->prop.withdrawn = EINA_TRUE;
ee->prop.sticky = EINA_FALSE;
ee->prop.window = 0;
/* init evas here */
ee->evas = evas_new();
evas_data_attach_set(ee->evas, ee);
evas_output_method_set(ee->evas, evas_render_method_lookup("psl1ght"));
evas_output_size_set(ee->evas, w, h);
evas_output_viewport_set(ee->evas, 0, 0, w, h);
einfo = evas_engine_info_get(ee->evas);
if (einfo)
{
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
{
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
ecore_evas_free(ee);
return NULL;
}
}
else
{
ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
ecore_evas_free(ee);
return NULL;
}
if (!ecore_psl1ght_init(name))
{
evas_free(ee->evas);
if (ee->name) free(ee->name);
free(ee);
return NULL;
}
ecore_psl1ght_resolution_set (w, h);
_ecore_evas_psl1ght_init(w, h);
ecore_event_window_register(0, ee, ee->evas,
(Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
(Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
(Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
(Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
_ecore_event_window_direct_cb_set(0, _ecore_evas_input_direct_cb);
_ecore_evas_register(ee);
psl1ght_ee = ee;
_ecore_evas_screen_resized (ee);
if (getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"))
ecore_evas_cursor_set(ee, getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"), EVAS_LAYER_MAX, 0, 0);
_ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
return ee;
}

View File

@ -1,16 +0,0 @@
#ifndef _EVAS_ENGINE_PSL1GHT_H
#define _EVAS_ENGINE_PSL1GHT_H
typedef struct _Evas_Engine_Info_PSL1GHT Evas_Engine_Info_PSL1GHT;
struct _Evas_Engine_Info_PSL1GHT
{
/* PRIVATE - don't mess with this baby or evas will poke its tongue out */
/* at you and make nasty noises */
Evas_Engine_Info magic;
/* non-blocking or blocking mode */
Evas_Engine_Render_Mode render_mode;
};
#endif

View File

@ -1,449 +0,0 @@
#include "evas_common_private.h"
#include "evas_private.h"
#include "evas_engine.h"
#include "rsxutil.h"
#include "Evas_Engine_PSL1GHT.h"
#include <malloc.h>
int _evas_engine_psl1ght_log_dom = -1;
/* function tables - filled in later (func and parent func) */
static Evas_Func func, pfunc;
/* engine struct data */
typedef struct _Render_Engine Render_Engine;
#define MAX_BUFFERS 2
struct _Render_Engine
{
Tilebuf *tb;
Tilebuf_Rect *rects;
Eina_Inlist *cur_rect;
/* RSX device context */
gcmContextData *context;
void *host_addr;
/* The buffers we will be drawing into. */
rsxBuffer buffers[MAX_BUFFERS];
int currentBuffer;
int width;
int height;
RGBA_Image *rgba_image;
uint32_t rgba_image_offset;
int end : 1;
};
/* prototypes we will use here */
static void *_output_setup(int w, int h);
/* internal engine routines */
static void *
_output_setup(int w, int h)
{
Render_Engine *re;
int i;
u16 width, height;
DATA32 *image_data = NULL;
int image_size;
printf ("_output_setup called : %dx%d\n", w, h);
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
/* Allocate a 1Mb buffer, alligned to a 1Mb boundary
* to be our shared IO memory with the RSX. */
re->host_addr = memalign (1024 * 1024, HOST_SIZE);
if (re->host_addr == NULL)
{
free (re);
return NULL;
}
re->context = initScreen (re->host_addr, HOST_SIZE);
if (re->context == NULL)
{
free (re->host_addr);
free (re);
return NULL;
}
width = w;
height = h;
setResolution (re->context, &width, &height);
re->currentBuffer = 0;
re->width = width;
re->height = height;
for (i = 0; i < MAX_BUFFERS; i++)
makeBuffer (&re->buffers[i], width, height, i);
flipBuffer(re->context, MAX_BUFFERS - 1);
re->tb = evas_common_tilebuf_new(w, h);
/* in preliminary tests 16x16 gave highest framerates */
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
/* Allocate our memaligned backbuffer */
image_size = ((w * h * sizeof(u32)) + 0xfffff) & - 0x100000;
image_data = memalign (1024 * 1024, image_size);
re->rgba_image = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
w, h, image_data, 1, EVAS_COLORSPACE_ARGB8888);
gcmMapMainMemory(image_data, image_size, &re->rgba_image_offset);
return re;
}
/* engine api this module provides */
static void
eng_output_info_setup(void *info)
{
Evas_Engine_Info_PSL1GHT *einfo = info;
einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
{
Evas_Engine_Info_PSL1GHT *info = in;
printf ("eng_setup called\n");
return _output_setup(w, h);
}
static void
eng_output_free(void *engine EINA_UNUSED, void *data)
{
Render_Engine *re;
int i;
printf ("eng_output_free called\n");
re = (Render_Engine *)data;
gcmSetWaitFlip(re->context);
for (i = 0; i < MAX_BUFFERS; i++)
rsxFree (re->buffers[i].ptr);
if (re->rgba_image)
{
DATA32 *image_data;
image_data = re->rgba_image->image.data;
evas_cache_image_drop(&re->rgba_image->cache_entry);
free (image_data);
}
freeScreen (re->context);
free (re->host_addr);
evas_common_tilebuf_free(re->tb);
if (re->rects)
evas_common_tilebuf_free_render_rects(re->rects);
free(re);
}
static void
eng_output_resize(void *engine EINA_UNUSED, void *data, int w, int h)
{
Render_Engine *re;
int i;
u16 width, height;
DATA32 *image_data;
int image_size;
printf ("eng_output_resize called : %dx%d\n", w, h);
re = (Render_Engine *)data;
width = w;
height = h;
if (setResolution (re->context, &width, &height))
{
re->width = width;
re->height = height;
gcmSetWaitFlip(re->context);
for (i = 0; i < MAX_BUFFERS; i++) {
rsxFree (re->buffers[i].ptr);
makeBuffer (&re->buffers[i], width, height, i);
}
flipBuffer(re->context, MAX_BUFFERS - 1);
evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h);
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
/* Realloc our backbuf image */
if (re->rgba_image)
{
image_data = re->rgba_image->image.data;
evas_cache_image_drop(&re->rgba_image->cache_entry);
free (image_data);
}
image_size = ((w * h * sizeof(u32)) + 0xfffff) & - 0x100000;
image_data = memalign (1024 * 1024, image_size);
re->rgba_image = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
w, h, image_data, 1, EVAS_COLORSPACE_ARGB8888);
gcmMapMainMemory(image_data, image_size, &re->rgba_image_offset);
}
}
static void
eng_output_tile_size_set(void *engine EINA_UNUSED, void *data, int w, int h)
{
Render_Engine *re;
printf ("eng_output_tile_size_set called : %dx%d\n", w, h);
re = (Render_Engine *)data;
evas_common_tilebuf_set_tile_size(re->tb, w, h);
}
static void
eng_output_redraws_rect_add(void *engine EINA_UNUSED, void *data, int x, int y, int w, int h)
{
Render_Engine *re;
//printf ("eng_output_redraws_rect_add called : %d,%d %dx%d\n", x, y, w, h);
re = (Render_Engine *)data;
evas_common_tilebuf_add_redraw(re->tb, x, y, w, h);
}
static void
eng_output_redraws_rect_del(void *engine EINA_UNUSED, void *data, int x, int y, int w, int h)
{
Render_Engine *re;
//printf ("eng_output_redraws_rect_del called : %d,%d %dx%d\n", x, y, w, h);
re = (Render_Engine *)data;
evas_common_tilebuf_del_redraw(re->tb, x, y, w, h);
}
static void
eng_output_redraws_clear(void *engine EINA_UNUSED, void *data)
{
Render_Engine *re;
//printf ("eng_output_redraws_clear called\n");
re = (Render_Engine *)data;
evas_common_tilebuf_clear(re->tb);
}
static void *
eng_output_redraws_next_update_get(void *engine EINA_UNUSED, void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch)
{
Render_Engine *re;
Tilebuf_Rect *rect;
int ux, uy, uw, uh;
re = (Render_Engine *)data;
/*printf ("eng_output_redraws_next_update_get called : %d,%d %dx%d -- %d,%d %dx%d\n",
*x, *y, *w, *h, *cx, *cy, *cw, *ch);*/
if (re->end)
{
re->end = 0;
return NULL;
}
if (!re->rects)
{
re->rects = evas_common_tilebuf_get_render_rects(re->tb);
re->cur_rect = EINA_INLIST_GET(re->rects);
}
if (!re->cur_rect)
return NULL;
rect = (Tilebuf_Rect *)re->cur_rect;
ux = rect->x; uy = rect->y; uw = rect->w; uh = rect->h;
re->cur_rect = re->cur_rect->next;
if (!re->cur_rect)
{
evas_common_tilebuf_free_render_rects(re->rects);
re->rects = NULL;
re->end = 1;
}
*x = *cx = ux;
*y = *cy = uy;
*w = *cw = uw;
*h = *ch = uh;
/*printf ("eng_output_redraws_next_update_get returning : %d,%d %dx%d -- %d,%d %dx%d\n",
*x, *y, *w, *h, *cx, *cy, *cw, *ch);*/
return re->rgba_image;
}
static void
eng_output_redraws_next_update_push(void *engine EINA_UNUSED, void *data EINA_UNUSED, void *surface EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED, Evas_Render_Mode render_mode EINA_UNUSED)
{
/* Don't do anything, we'll just coy the whole buffer when it's time to flush */
}
static void
eng_output_flush(void *engine EINA_UNUSED, void *data, Evas_Render_Mode render_mode)
{
Render_Engine *re;
rsxBuffer *buffer;
int width;
int height;
if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return;
//printf ("eng_output_flush called\n");
re = (Render_Engine *)data;
buffer = &re->buffers[re->currentBuffer];
width = re->rgba_image->cache_entry.w;
height = re->rgba_image->cache_entry.h;
/* Wait for the flip before copying the buffer */
waitFlip ();
if (re->width == width &&
re->height == height)
{
/* DMA the back buffer into the rsx buffer */
rsxSetTransferImage (re->context,
GCM_TRANSFER_MAIN_TO_LOCAL,
buffer->offset, buffer->width * sizeof(u32),
0, 0,
re->rgba_image_offset, re->width * sizeof(u32),
0, 0, re->width, re->height, sizeof(u32));
}
else
{
gcmTransferScale gcm_scale;
gcmTransferSurface gcm_surface;
gcm_surface.format = GCM_TRANSFER_SURFACE_FORMAT_A8R8G8B8;
gcm_surface.pitch = buffer->width * sizeof(u32);
gcm_surface._pad0[0] = gcm_surface._pad0[1] = 0;
gcm_surface.offset = buffer->offset;
gcm_scale.interp = GCM_TRANSFER_INTERPOLATOR_LINEAR;
gcm_scale.conversion = GCM_TRANSFER_CONVERSION_TRUNCATE;
gcm_scale.format = GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8;
gcm_scale.origin = GCM_TRANSFER_ORIGIN_CORNER;
gcm_scale.operation = GCM_TRANSFER_OPERATION_SRCCOPY;
gcm_scale.offset = re->rgba_image_offset;
gcm_scale.clipX = 0;
gcm_scale.clipY = 0;
gcm_scale.clipW = re->width;
gcm_scale.clipH = re->height;
gcm_scale.outX = 0;
gcm_scale.outY = 0;
gcm_scale.outW = re->width;
gcm_scale.outH = re->height;
gcm_scale.ratioX = rsxGetFixedSint32 ((float)width / (float)re->width);
gcm_scale.ratioY = rsxGetFixedSint32 ((float)height / (float)re->height);
gcm_scale.inX = 0;
gcm_scale.inY = 0;
gcm_scale.inW = (width & ~1); // Width must be a multiple of 2
gcm_scale.inH = height;
if (gcm_scale.inW < 2) // Minimum inW value is 2
gcm_scale.inW = 2;
if (gcm_scale.inW > 2046) // Maximum inW value is 2046
gcm_scale.inW = 2046;
if (gcm_scale.inH < 1) // Minimum inH value is 1
gcm_scale.inH = 1;
if (gcm_scale.inH > 2047) // Maximum inW value is 2047
gcm_scale.inH = 2047;
gcm_scale.pitch = sizeof(u32) * width;
rsxSetTransferScaleMode (re->context, GCM_TRANSFER_MAIN_TO_LOCAL, GCM_TRANSFER_SURFACE);
rsxSetTransferScaleSurface (re->context, &gcm_scale, &gcm_surface);
}
/* Wait for the DMA to finish */
flushRSX (re->context);
/* Flip buffer onto screen */
flipBuffer (re->context, re->currentBuffer);
re->currentBuffer = (re->currentBuffer + 1) % MAX_BUFFERS;
}
static void
eng_output_idle_flush(void *engine EINA_UNUSED, void *data)
{
Render_Engine *re;
printf ("eng_output_idle_flush called\n");
re = (Render_Engine *)data;
}
static Eina_Bool
eng_canvas_alpha_get(void *engine)
{
Render_Engine *re;
// printf ("eng_output_alpha_get called\n");
re = (Render_Engine *)engine;
return EINA_TRUE;
}
/* module advertising code */
static int
module_open(Evas_Module *em)
{
if (!em) return 0;
/* get whatever engine module we inherit from */
if (!_evas_module_engine_inherit(&pfunc, "software_generic", sizeof (Evas_Engine_Info_PSL1GHT))) return 0;
_evas_engine_psl1ght_log_dom = eina_log_domain_register
("evas-psl1ght", EVAS_DEFAULT_LOG_COLOR);
if (_evas_engine_psl1ght_log_dom < 0)
{
EINA_LOG_ERR("Can not create a module log domain.");
return 0;
}
/* store it for later use */
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
ORD(output_info_setup);
ORD(output_setup);
ORD(canvas_alpha_get);
ORD(output_free);
ORD(output_resize);
ORD(output_tile_size_set);
ORD(output_redraws_rect_add);
ORD(output_redraws_rect_del);
ORD(output_redraws_clear);
ORD(output_redraws_next_update_get);
ORD(output_redraws_next_update_push);
ORD(output_flush);
ORD(output_idle_flush);
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;
}
static void
module_close(Evas_Module *em EINA_UNUSED)
{
if (_evas_engine_psl1ght_log_dom >= 0)
{
eina_log_domain_unregister(_evas_engine_psl1ght_log_dom);
_evas_engine_psl1ght_log_dom = -1;
}
}
static Evas_Module_Api evas_modapi =
{
EVAS_MODULE_API_VERSION,
"psl1ght",
"none",
{
module_open,
module_close
}
};
EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, psl1ght);
#ifndef EVAS_STATIC_BUILD_PSL1GHT
EVAS_EINA_MODULE_DEFINE(engine, psl1ght);
#endif

View File

@ -1,30 +0,0 @@
#ifndef EVAS_ENGINE_H
#define EVAS_ENGINE_H
extern int _evas_engine_psl1ght_log_dom;
#ifdef ERR
# undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_psl1ght_log_dom, __VA_ARGS__)
#ifdef DBG
# undef DBG
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_psl1ght_log_dom, __VA_ARGS__)
#ifdef INF
# undef INF
#endif
#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_psl1ght_log_dom, __VA_ARGS__)
#ifdef WRN
# undef WRN
#endif
#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_psl1ght_log_dom, __VA_ARGS__)
#ifdef CRI
# undef CRI
#endif
#define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_psl1ght_log_dom, __VA_ARGS__)
#endif

View File

@ -1,275 +0,0 @@
/*
* This software is distributed under the terms of the MIT License
*/
#include <ppu-lv2.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <unistd.h>
#include <sysutil/video.h>
#include <rsx/gcm_sys.h>
#include <rsx/rsx.h>
#include <io/pad.h>
#include <time.h>
#include <cairo/cairo.h>
#include <math.h>
#include "rsxutil.h"
#define GCM_LABEL_INDEX 255
static void
waitRSXIdle(gcmContextData *context);
static int flipped = FALSE;
void
waitFlip()
{
if (flipped)
{
while (gcmGetFlipStatus () != 0)
usleep (200); /* Sleep, to not stress the cpu. */
gcmResetFlipStatus ();
flipped = FALSE;
}
}
int
flipBuffer(gcmContextData *context, s32 buffer)
{
if (gcmSetFlip (context, buffer) == 0)
{
rsxFlushBuffer (context);
// Prevent the RSX from continuing until the flip has finished.
gcmSetWaitFlip (context);
flipped = TRUE;
return TRUE;
}
return FALSE;
}
int
makeBuffer(rsxBuffer *buffer, u16 width, u16 height, int id)
{
int depth = sizeof(u32);
int pitch = depth * width;
int size = depth * width * height;
buffer->ptr = (uint32_t *)rsxMemalign (64, size);
if (buffer->ptr == NULL)
goto error;
if (rsxAddressToOffset (buffer->ptr, &buffer->offset) != 0)
goto error;
/* Register the display buffer with the RSX */
if (gcmSetDisplayBuffer (id, buffer->offset, pitch, width, height) != 0)
goto error;
buffer->width = width;
buffer->height = height;
buffer->id = id;
return TRUE;
error:
if (buffer->ptr != NULL)
rsxFree (buffer->ptr);
return FALSE;
}
int
copyBuffer(gcmContextData *context, rsxBuffer *source, rsxBuffer *destination)
{
rsxSetTransferData(context, GCM_TRANSFER_LOCAL_TO_LOCAL,
destination->offset,
destination->width * sizeof(u32),
source->offset,
source->width * sizeof(u32),
source->width * sizeof(u32),
source->height);
}
int
getResolution(u16 *width, u16 *height)
{
videoState state;
videoResolution resolution;
/* Get the state of the display */
if (videoGetState (0, 0, &state) == 0 &&
videoGetResolution (state.displayMode.resolution, &resolution) == 0)
{
if (width)
*width = resolution.width;
if (height)
*height = resolution.height;
return TRUE;
}
return FALSE;
}
static u8
getPreferredResolution(u16 width, u16 height)
{
videoDeviceInfo info;
videoResolution res;
int area = width * height;
int mode_area;
int min_area_diff = abs (area - (720 * 480));
int area_diff;
u8 resolution = VIDEO_RESOLUTION_480;
int i;
videoGetDeviceInfo(0, 0, &info);
for (i = 0; i < info.availableModeCount; i++) {
videoGetResolution (info.availableModes[i].resolution, &res);
mode_area = res.width * res.height;
area_diff = abs (area - mode_area);
if (area_diff < min_area_diff)
{
min_area_diff = area_diff;
resolution = info.availableModes[i].resolution;
}
}
return resolution;
}
int
setResolution(gcmContextData *context, u16 *width, u16 *height)
{
videoState state;
videoConfiguration vconfig;
videoResolution res;
u8 resolution;
resolution = getPreferredResolution (*width, *height);
/* Get the state of the display */
if (videoGetState (0, 0, &state) != 0)
return FALSE;
/* Make sure display is enabled */
if (state.state != 0)
return FALSE;
if (videoGetResolution (resolution, &res) != 0)
return FALSE;
/* Configure the buffer format to xRGB */
memset (&vconfig, 0, sizeof(videoConfiguration));
vconfig.resolution = resolution;
vconfig.format = VIDEO_BUFFER_FORMAT_XRGB;
vconfig.pitch = res.width * sizeof(u32);
vconfig.aspect = VIDEO_ASPECT_AUTO;
flushRSX(context);
if (videoConfigure (0, &vconfig, NULL, 0) != 0)
return FALSE;
*width = res.width;
*height = res.height;
return TRUE;
}
gcmContextData *
initScreen(void *host_addr, u32 size)
{
gcmContextData *context = NULL; /* Context to keep track of the RSX buffer. */
videoState state;
videoConfiguration vconfig;
videoResolution res; /* Screen Resolution */
/* Initilise Reality, which sets up the command buffer and shared IO memory */
context = rsxInit (CB_SIZE, size, host_addr);
if (context == NULL)
goto error;
/* Get the state of the display */
if (videoGetState (0, 0, &state) != 0)
goto error;
/* Make sure display is enabled */
if (state.state != 0)
goto error;
/* Get the current resolution */
if (videoGetResolution (state.displayMode.resolution, &res) != 0)
goto error;
/* Configure the buffer format to xRGB */
memset (&vconfig, 0, sizeof(videoConfiguration));
vconfig.resolution = state.displayMode.resolution;
vconfig.format = VIDEO_BUFFER_FORMAT_XRGB;
vconfig.pitch = res.width * sizeof(u32);
vconfig.aspect = state.displayMode.aspect;
flushRSX(context);
if (videoConfigure (0, &vconfig, NULL, 0) != 0)
goto error;
if (videoGetState (0, 0, &state) != 0)
goto error;
gcmSetFlipMode (GCM_FLIP_VSYNC); // Wait for VSYNC to flip
gcmResetFlipStatus();
return context;
error:
if (context)
rsxFinish (context, 0);
return NULL;
}
void
freeScreen(gcmContextData *context)
{
rsxFinish (context, 0);
}
static void
waitFinish(gcmContextData *context, u32 sLabelVal)
{
rsxSetWriteBackendLabel (context, GCM_LABEL_INDEX, sLabelVal);
rsxFlushBuffer (context);
while (*(vu32 *)gcmGetLabelAddress (GCM_LABEL_INDEX) != sLabelVal)
usleep(30);
}
static void
waitRSXIdle(gcmContextData *context)
{
static u32 sLabelVal = 1;
rsxSetWriteBackendLabel (context, GCM_LABEL_INDEX, sLabelVal);
rsxSetWaitLabel (context, GCM_LABEL_INDEX, sLabelVal);
sLabelVal++;
waitFinish(context, sLabelVal++);
}
void
flushRSX(gcmContextData *context)
{
if (flipped)
waitFlip ();
waitRSXIdle(context);
}

View File

@ -1,43 +0,0 @@
/*
* This software is distributed under the terms of the MIT License
*/
#ifndef __RSXUTIL_H__
#define __RSXUTIL_H__
#include <rsx/rsx.h>
#include <ppu-types.h>
#define CB_SIZE 0x100000
#define HOST_SIZE (32 * 1024 * 1024)
typedef struct
{
int height;
int width;
int id;
uint32_t *ptr;
// Internal stuff
uint32_t offset;
} rsxBuffer;
/* Initilize the RSX properly. Returns NULL on error */
gcmContextData *initScreen(void *host_addr, u32 size);
/* Block the PPU thread untill the previous flip operation has finished. */
void waitFlip(void);
/* Flip a buffer onto the screen. Returns TRUE on success */
int flipBuffer(gcmContextData *context, s32 buffer);
/* Create a buffer to draw into and assign it to @id. Returns NULL on error */
int makeBuffer(rsxBuffer *buffer, u16 width, u16 height, int id);
/* Copy the contents of a buffer to another buffer */
int copyBuffer(gcmContextData *context, rsxBuffer *source, rsxBuffer *destination);
/* Get current screen resolution. returns TRUE on success */
int getResolution(u16 *width, u16 *height);
/* Set screen resolution to closest matching and. returns TRUE on success */
int setResolution(gcmContextData *context, u16 *width, u16 *height);
/* Initilize the RSX properly. Returns NULL on error */
void freeScreen(gcmContextData *context);
/* Flush the RSX pipeline (any commands and wait for flip) */
void flushRSX(gcmContextData *context);
#endif /* __RSXUTIL_H__ */

View File

@ -30,9 +30,6 @@ static const char *built_engines[] = {
#ifdef BUILD_ENGINE_GL_X11
"gl_x11",
#endif
#ifdef BUILD_ENGINE_PSL1GHT
"psl1ght",
#endif
#ifdef BUILD_ENGINE_SOFTWARE_DDRAW
"software_ddraw",
#endif