Compare commits
9 commits
master
...
mali-2.0.5
Author | SHA1 | Date | |
---|---|---|---|
|
4829339b22 | ||
|
52a096b30b | ||
|
0eefab146e | ||
|
9bad63d9c2 | ||
|
095850a7b5 | ||
|
3caa427794 | ||
|
cdc0fdd405 | ||
|
8b3fdd0b17 | ||
|
ee6a7785ec |
19 changed files with 653 additions and 93 deletions
|
@ -306,6 +306,7 @@ endforeach()
|
||||||
set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
|
set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
|
||||||
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
|
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
|
||||||
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
|
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
|
||||||
|
set_option(VIDEO_MALI "Use Mali EGL video driver" ${UNIX_SYS})
|
||||||
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})
|
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})
|
||||||
|
|
||||||
# TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here
|
# TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here
|
||||||
|
@ -859,6 +860,7 @@ elseif(UNIX AND NOT APPLE)
|
||||||
CheckOpenGLESX11()
|
CheckOpenGLESX11()
|
||||||
CheckWayland()
|
CheckWayland()
|
||||||
CheckVivante()
|
CheckVivante()
|
||||||
|
CheckMali()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LINUX)
|
if(LINUX)
|
||||||
|
|
|
@ -743,6 +743,29 @@ macro(CheckVivante)
|
||||||
endif(VIDEO_VIVANTE)
|
endif(VIDEO_VIVANTE)
|
||||||
endmacro(CheckVivante)
|
endmacro(CheckVivante)
|
||||||
|
|
||||||
|
# Requires:
|
||||||
|
# - n/a
|
||||||
|
macro(CheckMali)
|
||||||
|
if(VIDEO_MALI)
|
||||||
|
check_c_source_compiles("
|
||||||
|
#define LINUX
|
||||||
|
#define EGL_API_FB
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
int main(int argc, char** argv) {}" HAVE_VIDEO_MALI_EGL_FB)
|
||||||
|
if(HAVE_VIDEO_MALI_EGL_FB)
|
||||||
|
set(HAVE_VIDEO_MALI TRUE)
|
||||||
|
set(HAVE_SDL_VIDEO TRUE)
|
||||||
|
|
||||||
|
file(GLOB MALI_SOURCES ${SDL2_SOURCE_DIR}/src/video/mali-fbdev/*.c)
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} ${MALI_SOURCES})
|
||||||
|
set(SDL_VIDEO_DRIVER_MALI 1)
|
||||||
|
set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB")
|
||||||
|
list(APPEND EXTRA_LIBS EGL)
|
||||||
|
endif(HAVE_VIDEO_MALI_EGL_MALI)
|
||||||
|
endif(VIDEO_MALI)
|
||||||
|
endmacro(CheckMali)
|
||||||
|
|
||||||
|
|
||||||
# Requires:
|
# Requires:
|
||||||
# - nada
|
# - nada
|
||||||
macro(CheckOpenGLX11)
|
macro(CheckOpenGLX11)
|
||||||
|
|
53
configure
vendored
53
configure
vendored
|
@ -837,6 +837,7 @@ enable_video_x11_scrnsaver
|
||||||
enable_video_x11_xshape
|
enable_video_x11_xshape
|
||||||
enable_video_x11_vm
|
enable_video_x11_vm
|
||||||
enable_video_vivante
|
enable_video_vivante
|
||||||
|
enable_video_mali
|
||||||
enable_video_cocoa
|
enable_video_cocoa
|
||||||
enable_video_directfb
|
enable_video_directfb
|
||||||
enable_directfb_shared
|
enable_directfb_shared
|
||||||
|
@ -1572,6 +1573,7 @@ Optional Features:
|
||||||
enable X11 XShape support [[default=yes]]
|
enable X11 XShape support [[default=yes]]
|
||||||
--enable-video-x11-vm use X11 VM extension for fullscreen [[default=yes]]
|
--enable-video-x11-vm use X11 VM extension for fullscreen [[default=yes]]
|
||||||
--enable-video-vivante use Vivante EGL video driver [[default=yes]]
|
--enable-video-vivante use Vivante EGL video driver [[default=yes]]
|
||||||
|
--enable-video-mali use Mali EGL video driver [[default=yes]]
|
||||||
--enable-video-cocoa use Cocoa video driver [[default=yes]]
|
--enable-video-cocoa use Cocoa video driver [[default=yes]]
|
||||||
--enable-video-directfb use DirectFB video driver [[default=no]]
|
--enable-video-directfb use DirectFB video driver [[default=no]]
|
||||||
--enable-directfb-shared
|
--enable-directfb-shared
|
||||||
|
@ -20701,6 +20703,56 @@ $as_echo "#define SDL_VIDEO_DRIVER_VIVANTE_VDK 1" >>confdefs.h
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckMaliVideo()
|
||||||
|
{
|
||||||
|
# Check whether --enable-video-mali was given.
|
||||||
|
if test "${enable_video_mali+set}" = set; then :
|
||||||
|
enableval=$enable_video_mali;
|
||||||
|
else
|
||||||
|
enable_video_mali=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x$enable_video = xyes -a x$enable_video_mali = xyes; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mali FB API" >&5
|
||||||
|
$as_echo_n "checking for Mali FB API... " >&6; }
|
||||||
|
have_mali_egl=no
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#define LINUX
|
||||||
|
#define EGL_API_FB
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
|
||||||
|
have_mali_egl=yes
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_mali_egl" >&5
|
||||||
|
$as_echo "$have_mali_egl" >&6; }
|
||||||
|
|
||||||
|
if test x$have_mali_egl = xyes; then
|
||||||
|
|
||||||
|
$as_echo "#define SDL_VIDEO_DRIVER_MALI 1" >>confdefs.h
|
||||||
|
|
||||||
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
|
||||||
|
SOURCES="$SOURCES $srcdir/src/video/mali-fbdev/*.c"
|
||||||
|
SUMMARY_video="${SUMMARY_video} mali"
|
||||||
|
have_video=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
CheckHaikuVideo()
|
CheckHaikuVideo()
|
||||||
{
|
{
|
||||||
if test x$enable_video = xyes; then
|
if test x$enable_video = xyes; then
|
||||||
|
@ -23156,6 +23208,7 @@ case "$host" in
|
||||||
CheckLinuxVersion
|
CheckLinuxVersion
|
||||||
CheckRPATH
|
CheckRPATH
|
||||||
CheckVivanteVideo
|
CheckVivanteVideo
|
||||||
|
CheckMaliVideo
|
||||||
# Set up files for the audio library
|
# Set up files for the audio library
|
||||||
if test x$enable_audio = xyes; then
|
if test x$enable_audio = xyes; then
|
||||||
case $ARCH in
|
case $ARCH in
|
||||||
|
|
30
configure.in
30
configure.in
|
@ -1784,6 +1784,35 @@ AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dnl Set up the Mali video driver if enabled
|
||||||
|
CheckMaliVideo()
|
||||||
|
{
|
||||||
|
AC_ARG_ENABLE(video-mali,
|
||||||
|
AC_HELP_STRING([--enable-video-mali], [use Mali EGL video driver [[default=yes]]]),
|
||||||
|
, enable_video_mali=yes)
|
||||||
|
if test x$enable_video = xyes -a x$enable_video_mali = xyes; then
|
||||||
|
AC_MSG_CHECKING(for Mali FB API)
|
||||||
|
have_mali_egl=no
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#define LINUX
|
||||||
|
#define EGL_API_FB
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
],[
|
||||||
|
],[
|
||||||
|
have_mali_egl=yes
|
||||||
|
])
|
||||||
|
AC_MSG_RESULT($have_mali_egl)
|
||||||
|
|
||||||
|
if test x$have_mali_egl = xyes; then
|
||||||
|
AC_DEFINE(SDL_VIDEO_DRIVER_MALI, 1, [ ])
|
||||||
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
|
||||||
|
SOURCES="$SOURCES $srcdir/src/video/mali-fbdev/*.c"
|
||||||
|
SUMMARY_video="${SUMMARY_video} mali"
|
||||||
|
have_video=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
dnl Set up the Haiku video driver if enabled
|
dnl Set up the Haiku video driver if enabled
|
||||||
CheckHaikuVideo()
|
CheckHaikuVideo()
|
||||||
{
|
{
|
||||||
|
@ -2987,6 +3016,7 @@ case "$host" in
|
||||||
CheckLinuxVersion
|
CheckLinuxVersion
|
||||||
CheckRPATH
|
CheckRPATH
|
||||||
CheckVivanteVideo
|
CheckVivanteVideo
|
||||||
|
CheckMaliVideo
|
||||||
# Set up files for the audio library
|
# Set up files for the audio library
|
||||||
if test x$enable_audio = xyes; then
|
if test x$enable_audio = xyes; then
|
||||||
case $ARCH in
|
case $ARCH in
|
||||||
|
|
17
debian/control
vendored
17
debian/control
vendored
|
@ -12,8 +12,6 @@ Build-Depends: debhelper (>= 9),
|
||||||
dh-autoreconf,
|
dh-autoreconf,
|
||||||
dpkg-dev (>= 1.16.1~),
|
dpkg-dev (>= 1.16.1~),
|
||||||
libasound2-dev [linux-any],
|
libasound2-dev [linux-any],
|
||||||
libgl1-mesa-dev,
|
|
||||||
libpulse-dev,
|
|
||||||
libudev-dev [linux-any],
|
libudev-dev [linux-any],
|
||||||
libdbus-1-dev [linux-any],
|
libdbus-1-dev [linux-any],
|
||||||
libibus-1.0-dev[linux-any],
|
libibus-1.0-dev[linux-any],
|
||||||
|
@ -30,16 +28,16 @@ Build-Depends: debhelper (>= 9),
|
||||||
libxxf86vm-dev
|
libxxf86vm-dev
|
||||||
Homepage: http://www.libsdl.org/
|
Homepage: http://www.libsdl.org/
|
||||||
|
|
||||||
Package: libsdl2
|
Package: libsdl2-2.0-0
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Multi-Arch: same
|
Multi-Arch: same
|
||||||
Pre-Depends: ${misc:Pre-Depends}
|
Pre-Depends: ${misc:Pre-Depends}
|
||||||
Depends: ${misc:Depends},
|
Depends: ${misc:Depends},
|
||||||
${shlibs:Depends},
|
${shlibs:Depends},
|
||||||
libudev0 [linux-any],
|
libudev0 | libudev1 [linux-any],
|
||||||
libdbus-1-3 [linux-any]
|
libdbus-1-3 [linux-any]
|
||||||
Conflicts: libsdl-1.3-0
|
Conflicts: libsdl-1.3-0, libsdl2
|
||||||
Replaces: libsdl-1.3-0
|
Replaces: libsdl-1.3-0, libsdl2
|
||||||
Description: Simple DirectMedia Layer
|
Description: Simple DirectMedia Layer
|
||||||
SDL is a library that allows programs portable low level access to
|
SDL is a library that allows programs portable low level access to
|
||||||
a video framebuffer, audio output, mouse, and keyboard.
|
a video framebuffer, audio output, mouse, and keyboard.
|
||||||
|
@ -51,9 +49,10 @@ Section: libdevel
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Multi-Arch: same
|
Multi-Arch: same
|
||||||
Depends: ${misc:Depends},
|
Depends: ${misc:Depends},
|
||||||
libsdl2 (= ${binary:Version}),
|
libsdl2-2.0-0 (= ${binary:Version}),
|
||||||
libc6-dev,
|
libc6-dev,
|
||||||
libgl1-mesa-dev
|
libgl1-mesa-dev,
|
||||||
|
libx11-dev
|
||||||
Conflicts: libsdl-1.3-dev
|
Conflicts: libsdl-1.3-dev
|
||||||
Replaces: libsdl-1.3-dev
|
Replaces: libsdl-1.3-dev
|
||||||
Description: Simple DirectMedia Layer development files
|
Description: Simple DirectMedia Layer development files
|
||||||
|
@ -68,7 +67,7 @@ Section: debug
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Multi-Arch: same
|
Multi-Arch: same
|
||||||
Depends: ${misc:Depends},
|
Depends: ${misc:Depends},
|
||||||
libsdl2 (= ${binary:Version}),
|
libsdl2-2.0-0 (= ${binary:Version}),
|
||||||
Description: Simple DirectMedia Layer debug files
|
Description: Simple DirectMedia Layer debug files
|
||||||
SDL is a library that allows programs portable low level access to a video
|
SDL is a library that allows programs portable low level access to a video
|
||||||
framebuffer, audio output, mouse, and keyboard.
|
framebuffer, audio output, mouse, and keyboard.
|
||||||
|
|
4
debian/rules
vendored
4
debian/rules
vendored
|
@ -6,7 +6,9 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
|
||||||
confflags = --disable-rpath --disable-video-directfb \
|
confflags = --disable-rpath --disable-video-directfb \
|
||||||
--disable-nas --disable-esd --disable-arts \
|
--disable-nas --disable-esd --disable-arts \
|
||||||
--disable-alsa-shared --disable-pulseaudio-shared \
|
--disable-alsa-shared --disable-pulseaudio-shared \
|
||||||
--disable-x11-shared
|
--disable-x11-shared --disable-video-opengl --enable-video-opengles --enable-video-mali \
|
||||||
|
--disable-esd --disable-pulseaudio \
|
||||||
|
--disable-input-tslib
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --parallel
|
dh $@ --parallel
|
||||||
|
|
|
@ -283,6 +283,7 @@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
|
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
|
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
|
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
|
||||||
|
#cmakedefine SDL_VIDEO_DRIVER_MALI @SDL_VIDEO_DRIVER_MALI@
|
||||||
|
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
|
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
|
||||||
|
|
|
@ -291,6 +291,7 @@
|
||||||
#undef SDL_VIDEO_DRIVER_RPI
|
#undef SDL_VIDEO_DRIVER_RPI
|
||||||
#undef SDL_VIDEO_DRIVER_ANDROID
|
#undef SDL_VIDEO_DRIVER_ANDROID
|
||||||
#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
|
#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
|
||||||
|
#undef SDL_VIDEO_DRIVER_MALI
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
|
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
|
||||||
|
|
|
@ -314,20 +314,9 @@ ALSA_PlayDevice(_THIS)
|
||||||
swizzle_alsa_channels(this, this->hidden->mixbuf, frames_left);
|
swizzle_alsa_channels(this, this->hidden->mixbuf, frames_left);
|
||||||
|
|
||||||
while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
|
while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
|
||||||
int status;
|
/* !!! FIXME: This works, but needs more testing before going live */
|
||||||
|
/* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */
|
||||||
/* This wait is a work-around for a hang when USB devices are
|
int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle,
|
||||||
unplugged. Normally it should not result in any waiting,
|
|
||||||
but in the case of a USB unplug, it serves as a way to
|
|
||||||
join the playback thread after the timeout occurs */
|
|
||||||
status = ALSA_snd_pcm_wait(this->hidden->pcm_handle, 1000);
|
|
||||||
if (status == 0) {
|
|
||||||
/*fprintf(stderr, "ALSA timeout waiting for available buffer space\n");*/
|
|
||||||
SDL_OpenedAudioDeviceDisconnected(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = ALSA_snd_pcm_writei(this->hidden->pcm_handle,
|
|
||||||
sample_buf, frames_left);
|
sample_buf, frames_left);
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ typedef struct SDL_EVDEV_PrivateData
|
||||||
int num_devices;
|
int num_devices;
|
||||||
int ref_count;
|
int ref_count;
|
||||||
int console_fd;
|
int console_fd;
|
||||||
int kb_mode;
|
int old_kb_mode;
|
||||||
} SDL_EVDEV_PrivateData;
|
} SDL_EVDEV_PrivateData;
|
||||||
|
|
||||||
#define _THIS SDL_EVDEV_PrivateData *_this
|
#define _THIS SDL_EVDEV_PrivateData *_this
|
||||||
|
@ -126,23 +126,8 @@ static Uint8 EVDEV_MouseButtons[] = {
|
||||||
SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */
|
SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* EVDEV_consoles[] = {
|
|
||||||
/* "/proc/self/fd/0",
|
|
||||||
"/dev/tty",
|
|
||||||
"/dev/tty0", */ /* the tty ioctl's prohibit these */
|
|
||||||
"/dev/tty1",
|
|
||||||
"/dev/tty2",
|
|
||||||
"/dev/tty3",
|
|
||||||
"/dev/tty4",
|
|
||||||
"/dev/tty5",
|
|
||||||
"/dev/tty6",
|
|
||||||
"/dev/tty7", /* usually X is spawned in tty7 */
|
|
||||||
"/dev/vc/0",
|
|
||||||
"/dev/console"
|
|
||||||
};
|
|
||||||
|
|
||||||
static int SDL_EVDEV_is_console(int fd) {
|
static int SDL_EVDEV_is_console(int fd) {
|
||||||
int type;
|
char type;
|
||||||
|
|
||||||
return isatty(fd) && ioctl(fd, KDGKBTYPE, &type) == 0 &&
|
return isatty(fd) && ioctl(fd, KDGKBTYPE, &type) == 0 &&
|
||||||
(type == KB_101 || type == KB_84);
|
(type == KB_101 || type == KB_84);
|
||||||
|
@ -159,58 +144,19 @@ static int SDL_EVDEV_mute_keyboard(int tty_fd, int* old_kb_mode)
|
||||||
return SDL_SetError("Failed to get keyboard mode during muting");
|
return SDL_SetError("Failed to get keyboard mode during muting");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: atm this absolutely ruins the vt, and KDSKBMUTE isn't implemented
|
|
||||||
in the kernel */
|
|
||||||
/*
|
|
||||||
if (ioctl(tty_fd, KDSKBMODE, K_OFF) < 0) {
|
if (ioctl(tty_fd, KDSKBMODE, K_OFF) < 0) {
|
||||||
return SDL_SetError("Failed to set keyboard mode during muting");
|
return SDL_SetError("Failed to set keyboard mode during muting");
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore the keyboard mode for given tty */
|
/* Restore the keyboard mode for given tty */
|
||||||
static void SDL_EVDEV_unmute_keyboard(int tty_fd, int kb_mode)
|
static void SDL_EVDEV_unmute_keyboard(int tty_fd, int old_kb_mode)
|
||||||
{
|
{
|
||||||
/* read above */
|
if (ioctl(tty_fd, KDSKBMODE, old_kb_mode) < 0) {
|
||||||
/*
|
SDL_Log("Failed to set keyboard mode");
|
||||||
if (ioctl(tty_fd, KDSKBMODE, kb_mode) < 0) {
|
|
||||||
SDL_Log("Failed to unmute keyboard");
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
static int SDL_EVDEV_get_active_tty()
|
|
||||||
{
|
|
||||||
int i, fd, ret, tty = 0;
|
|
||||||
char tiocl;
|
|
||||||
struct vt_stat vt_state;
|
|
||||||
char path[PATH_MAX + 1];
|
|
||||||
|
|
||||||
for(i = 0; i < SDL_arraysize(EVDEV_consoles); i++) {
|
|
||||||
fd = open(EVDEV_consoles[i], O_RDONLY);
|
|
||||||
|
|
||||||
if (fd < 0 && !SDL_EVDEV_is_console(fd))
|
|
||||||
break;
|
|
||||||
|
|
||||||
tiocl = TIOCL_GETFGCONSOLE;
|
|
||||||
if ((ret = ioctl(fd, TIOCLINUX, &tiocl)) >= 0)
|
|
||||||
tty = ret + 1;
|
|
||||||
else if (ioctl(fd, VT_GETSTATE, &vt_state) == 0)
|
|
||||||
tty = vt_state.v_active;
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
if (tty) {
|
|
||||||
sprintf(path, "/dev/tty%u", tty);
|
|
||||||
fd = open(path, O_RDONLY);
|
|
||||||
if (fd >= 0 && SDL_EVDEV_is_console(fd))
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return SDL_SetError("Failed to determine active tty");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -243,13 +189,14 @@ SDL_EVDEV_Init(void)
|
||||||
/* TODO: Scan the devices manually, like a caveman */
|
/* TODO: Scan the devices manually, like a caveman */
|
||||||
#endif /* SDL_USE_LIBUDEV */
|
#endif /* SDL_USE_LIBUDEV */
|
||||||
|
|
||||||
/* We need a physical terminal (not PTS) to be able to translate key
|
/* This might fail if we're not connected to a tty (e.g. on the Steam Link) */
|
||||||
code to symbols via the kernel tables */
|
_this->console_fd = open("/dev/tty", O_RDONLY);
|
||||||
_this->console_fd = SDL_EVDEV_get_active_tty();
|
|
||||||
|
|
||||||
/* Mute the keyboard so keystrokes only generate evdev events and do not
|
/* Mute the keyboard so keystrokes only generate evdev events and do not
|
||||||
leak through to the console */
|
leak through to the console */
|
||||||
SDL_EVDEV_mute_keyboard(_this->console_fd, &_this->kb_mode);
|
if (_this->console_fd >= 0) {
|
||||||
|
SDL_EVDEV_mute_keyboard(_this->console_fd, &_this->old_kb_mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_this->ref_count += 1;
|
_this->ref_count += 1;
|
||||||
|
@ -273,7 +220,7 @@ SDL_EVDEV_Quit(void)
|
||||||
#endif /* SDL_USE_LIBUDEV */
|
#endif /* SDL_USE_LIBUDEV */
|
||||||
|
|
||||||
if (_this->console_fd >= 0) {
|
if (_this->console_fd >= 0) {
|
||||||
SDL_EVDEV_unmute_keyboard(_this->console_fd, _this->kb_mode);
|
SDL_EVDEV_unmute_keyboard(_this->console_fd, _this->old_kb_mode);
|
||||||
close(_this->console_fd);
|
close(_this->console_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +266,8 @@ void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class,
|
||||||
#ifdef SDL_INPUT_LINUXKD
|
#ifdef SDL_INPUT_LINUXKD
|
||||||
/* this logic is pulled from kbd_keycode() in drivers/tty/vt/keyboard.c in the
|
/* this logic is pulled from kbd_keycode() in drivers/tty/vt/keyboard.c in the
|
||||||
Linux kernel source */
|
Linux kernel source */
|
||||||
static void SDL_EVDEV_do_text_input(unsigned short keycode) {
|
static void SDL_EVDEV_do_text_input(unsigned short keycode)
|
||||||
|
{
|
||||||
char shift_state;
|
char shift_state;
|
||||||
int locks_state;
|
int locks_state;
|
||||||
struct kbentry kbe;
|
struct kbentry kbe;
|
||||||
|
@ -343,6 +291,12 @@ static void SDL_EVDEV_do_text_input(unsigned short keycode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (kbe.kb_value == K_HOLE || kbe.kb_value == K_NOSUCHMAP) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kbe.kb_value ^= 0xf000;
|
||||||
|
|
||||||
type = KTYP(kbe.kb_value);
|
type = KTYP(kbe.kb_value);
|
||||||
|
|
||||||
if (type < 0xf0) {
|
if (type < 0xf0) {
|
||||||
|
@ -571,11 +525,13 @@ SDL_EVDEV_translate_keycode(int keycode)
|
||||||
if (keycode < SDL_arraysize(linux_scancode_table))
|
if (keycode < SDL_arraysize(linux_scancode_table))
|
||||||
scancode = linux_scancode_table[keycode];
|
scancode = linux_scancode_table[keycode];
|
||||||
|
|
||||||
|
/*
|
||||||
if (scancode == SDL_SCANCODE_UNKNOWN) {
|
if (scancode == SDL_SCANCODE_UNKNOWN) {
|
||||||
SDL_Log("The key you just pressed is not recognized by SDL. To help "
|
SDL_Log("The key you just pressed is not recognized by SDL. To help "
|
||||||
"get this fixed, please report this to the SDL mailing list "
|
"get this fixed, please report this to the SDL mailing list "
|
||||||
"<sdl@libsdl.org> EVDEV KeyCode %d\n", keycode);
|
"<sdl@libsdl.org> EVDEV KeyCode %d\n", keycode);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return scancode;
|
return scancode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,7 +459,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd)
|
||||||
++joystick->nbuttons;
|
++joystick->nbuttons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < ABS_MAX; ++i) {
|
for (i = 0; i < ABS_MISC; ++i) {
|
||||||
/* Skip hats */
|
/* Skip hats */
|
||||||
if (i == ABS_HAT0X) {
|
if (i == ABS_HAT0X) {
|
||||||
i = ABS_HAT3Y;
|
i = ABS_HAT3Y;
|
||||||
|
@ -720,6 +720,10 @@ HandleInputEvents(SDL_Joystick * joystick)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EV_ABS:
|
case EV_ABS:
|
||||||
|
if (code >= ABS_MISC) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case ABS_HAT0X:
|
case ABS_HAT0X:
|
||||||
case ABS_HAT0Y:
|
case ABS_HAT0Y:
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#define DEFAULT_OGL_ES_PVR "/opt/vc/lib/libGLES_CM.so"
|
#define DEFAULT_OGL_ES_PVR "/opt/vc/lib/libGLES_CM.so"
|
||||||
#define DEFAULT_OGL_ES "/opt/vc/lib/libGLESv1_CM.so"
|
#define DEFAULT_OGL_ES "/opt/vc/lib/libGLESv1_CM.so"
|
||||||
|
|
||||||
#elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE
|
#elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_MALI || SDL_VIDEO_DRIVER_VIVANTE
|
||||||
/* Android */
|
/* Android */
|
||||||
#define DEFAULT_EGL "libEGL.so"
|
#define DEFAULT_EGL "libEGL.so"
|
||||||
#define DEFAULT_OGL_ES2 "libGLESv2.so"
|
#define DEFAULT_OGL_ES2 "libGLESv2.so"
|
||||||
|
|
|
@ -402,6 +402,9 @@ extern VideoBootStrap PSP_bootstrap;
|
||||||
#if SDL_VIDEO_DRIVER_RPI
|
#if SDL_VIDEO_DRIVER_RPI
|
||||||
extern VideoBootStrap RPI_bootstrap;
|
extern VideoBootStrap RPI_bootstrap;
|
||||||
#endif
|
#endif
|
||||||
|
#if SDL_VIDEO_DRIVER_MALI
|
||||||
|
extern VideoBootStrap MALI_bootstrap;
|
||||||
|
#endif
|
||||||
#if SDL_VIDEO_DRIVER_DUMMY
|
#if SDL_VIDEO_DRIVER_DUMMY
|
||||||
extern VideoBootStrap DUMMY_bootstrap;
|
extern VideoBootStrap DUMMY_bootstrap;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -103,6 +103,9 @@ static VideoBootStrap *bootstrap[] = {
|
||||||
#if SDL_VIDEO_DRIVER_RPI
|
#if SDL_VIDEO_DRIVER_RPI
|
||||||
&RPI_bootstrap,
|
&RPI_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
#if SDL_VIDEO_DRIVER_MALI
|
||||||
|
&MALI_bootstrap,
|
||||||
|
#endif
|
||||||
#if SDL_VIDEO_DRIVER_NACL
|
#if SDL_VIDEO_DRIVER_NACL
|
||||||
&NACL_bootstrap,
|
&NACL_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
|
43
src/video/mali-fbdev/SDL_maliopengles.c
Normal file
43
src/video/mali-fbdev/SDL_maliopengles.c
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
#if SDL_VIDEO_DRIVER_MALI && SDL_VIDEO_OPENGL_EGL
|
||||||
|
|
||||||
|
#include "SDL_maliopengles.h"
|
||||||
|
#include "SDL_malivideo.h"
|
||||||
|
|
||||||
|
/* EGL implementation of SDL OpenGL support */
|
||||||
|
|
||||||
|
int
|
||||||
|
MALI_GLES_LoadLibrary(_THIS, const char *path)
|
||||||
|
{
|
||||||
|
return SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_EGL_CreateContext_impl(MALI)
|
||||||
|
SDL_EGL_SwapWindow_impl(MALI)
|
||||||
|
SDL_EGL_MakeCurrent_impl(MALI)
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_DRIVER_MALI && SDL_VIDEO_OPENGL_EGL */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
48
src/video/mali-fbdev/SDL_maliopengles.h
Normal file
48
src/video/mali-fbdev/SDL_maliopengles.h
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
#ifndef _SDL_maliopengles_h
|
||||||
|
#define _SDL_maliopengles_h
|
||||||
|
|
||||||
|
#if SDL_VIDEO_DRIVER_MALI && SDL_VIDEO_OPENGL_EGL
|
||||||
|
|
||||||
|
#include "../SDL_sysvideo.h"
|
||||||
|
#include "../SDL_egl_c.h"
|
||||||
|
|
||||||
|
/* OpenGLES functions */
|
||||||
|
#define MALI_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||||
|
#define MALI_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||||
|
#define MALI_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||||
|
#define MALI_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||||
|
#define MALI_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||||
|
#define MALI_GLES_DeleteContext SDL_EGL_DeleteContext
|
||||||
|
|
||||||
|
extern int MALI_GLES_LoadLibrary(_THIS, const char *path);
|
||||||
|
extern SDL_GLContext MALI_GLES_CreateContext(_THIS, SDL_Window * window);
|
||||||
|
extern void MALI_GLES_SwapWindow(_THIS, SDL_Window * window);
|
||||||
|
extern int MALI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_DRIVER_MALI && SDL_VIDEO_OPENGL_EGL */
|
||||||
|
|
||||||
|
#endif /* _SDL_maliopengles_h */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
323
src/video/mali-fbdev/SDL_malivideo.c
Normal file
323
src/video/mali-fbdev/SDL_malivideo.c
Normal file
|
@ -0,0 +1,323 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
#if SDL_VIDEO_DRIVER_MALI
|
||||||
|
|
||||||
|
/* SDL internals */
|
||||||
|
#include "../SDL_sysvideo.h"
|
||||||
|
#include "SDL_version.h"
|
||||||
|
#include "SDL_syswm.h"
|
||||||
|
#include "SDL_loadso.h"
|
||||||
|
#include "SDL_events.h"
|
||||||
|
#include "../../events/SDL_events_c.h"
|
||||||
|
|
||||||
|
#ifdef SDL_INPUT_LINUXEV
|
||||||
|
#include "../../core/linux/SDL_evdev.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "SDL_malivideo.h"
|
||||||
|
#include "SDL_maliopengles.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
MALI_Available(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
MALI_Destroy(SDL_VideoDevice * device)
|
||||||
|
{
|
||||||
|
if (device->driverdata != NULL) {
|
||||||
|
SDL_free(device->driverdata);
|
||||||
|
device->driverdata = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static SDL_VideoDevice *
|
||||||
|
MALI_Create()
|
||||||
|
{
|
||||||
|
SDL_VideoDevice *device;
|
||||||
|
|
||||||
|
/* Initialize SDL_VideoDevice structure */
|
||||||
|
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||||
|
if (device == NULL) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
device->driverdata = NULL;
|
||||||
|
|
||||||
|
/* Setup amount of available displays and current display */
|
||||||
|
device->num_displays = 0;
|
||||||
|
|
||||||
|
/* Set device free function */
|
||||||
|
device->free = MALI_Destroy;
|
||||||
|
|
||||||
|
/* Setup all functions which we can handle */
|
||||||
|
device->VideoInit = MALI_VideoInit;
|
||||||
|
device->VideoQuit = MALI_VideoQuit;
|
||||||
|
device->GetDisplayModes = MALI_GetDisplayModes;
|
||||||
|
device->SetDisplayMode = MALI_SetDisplayMode;
|
||||||
|
device->CreateWindow = MALI_CreateWindow;
|
||||||
|
device->SetWindowTitle = MALI_SetWindowTitle;
|
||||||
|
device->SetWindowPosition = MALI_SetWindowPosition;
|
||||||
|
device->SetWindowSize = MALI_SetWindowSize;
|
||||||
|
device->ShowWindow = MALI_ShowWindow;
|
||||||
|
device->HideWindow = MALI_HideWindow;
|
||||||
|
device->DestroyWindow = MALI_DestroyWindow;
|
||||||
|
device->GetWindowWMInfo = MALI_GetWindowWMInfo;
|
||||||
|
|
||||||
|
device->GL_LoadLibrary = MALI_GLES_LoadLibrary;
|
||||||
|
device->GL_GetProcAddress = MALI_GLES_GetProcAddress;
|
||||||
|
device->GL_UnloadLibrary = MALI_GLES_UnloadLibrary;
|
||||||
|
device->GL_CreateContext = MALI_GLES_CreateContext;
|
||||||
|
device->GL_MakeCurrent = MALI_GLES_MakeCurrent;
|
||||||
|
device->GL_SetSwapInterval = MALI_GLES_SetSwapInterval;
|
||||||
|
device->GL_GetSwapInterval = MALI_GLES_GetSwapInterval;
|
||||||
|
device->GL_SwapWindow = MALI_GLES_SwapWindow;
|
||||||
|
device->GL_DeleteContext = MALI_GLES_DeleteContext;
|
||||||
|
|
||||||
|
device->PumpEvents = MALI_PumpEvents;
|
||||||
|
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoBootStrap MALI_bootstrap = {
|
||||||
|
"mali",
|
||||||
|
"Mali EGL Video Driver",
|
||||||
|
MALI_Available,
|
||||||
|
MALI_Create
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* SDL Video and Display initialization/handling functions */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
MALI_VideoInit(_THIS)
|
||||||
|
{
|
||||||
|
SDL_VideoDisplay display;
|
||||||
|
SDL_DisplayMode current_mode;
|
||||||
|
SDL_DisplayData *data;
|
||||||
|
struct fb_var_screeninfo vinfo;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
|
||||||
|
if (data == NULL) {
|
||||||
|
return SDL_OutOfMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
fd = open("/dev/fb0", O_RDWR, 0);
|
||||||
|
if (fd < 0) {
|
||||||
|
return SDL_SetError("mali-fbdev: Could not open framebuffer device");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) {
|
||||||
|
MALI_VideoQuit(_this);
|
||||||
|
return SDL_SetError("mali-fbdev: Could not get framebuffer information");
|
||||||
|
}
|
||||||
|
/* Enable triple buffering */
|
||||||
|
/*
|
||||||
|
vinfo.yres_virtual = vinfo.yres * 3;
|
||||||
|
if (ioctl(fd, FBIOPUT_VSCREENINFO, vinfo) == -1) {
|
||||||
|
printf("mali-fbdev: Error setting VSCREENINFO\n");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
close(fd);
|
||||||
|
system("setterm -cursor off");
|
||||||
|
|
||||||
|
data->native_display.width = vinfo.xres;
|
||||||
|
data->native_display.height = vinfo.yres;
|
||||||
|
|
||||||
|
SDL_zero(current_mode);
|
||||||
|
current_mode.w = vinfo.xres;
|
||||||
|
current_mode.h = vinfo.yres;
|
||||||
|
/* FIXME: Is there a way to tell the actual refresh rate? */
|
||||||
|
current_mode.refresh_rate = 60;
|
||||||
|
/* 32 bpp for default */
|
||||||
|
//current_mode.format = SDL_PIXELFORMAT_ABGR8888;
|
||||||
|
current_mode.format = SDL_PIXELFORMAT_RGBX8888;
|
||||||
|
|
||||||
|
current_mode.driverdata = NULL;
|
||||||
|
|
||||||
|
SDL_zero(display);
|
||||||
|
display.desktop_mode = current_mode;
|
||||||
|
display.current_mode = current_mode;
|
||||||
|
display.driverdata = data;
|
||||||
|
|
||||||
|
SDL_AddVideoDisplay(&display);
|
||||||
|
|
||||||
|
#ifdef SDL_INPUT_LINUXEV
|
||||||
|
if (SDL_EVDEV_Init() < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MALI_VideoQuit(_THIS)
|
||||||
|
{
|
||||||
|
/* Clear the framebuffer and ser cursor on again */
|
||||||
|
int fd = open("/dev/tty", O_RDWR);
|
||||||
|
ioctl(fd, VT_ACTIVATE, 5);
|
||||||
|
ioctl(fd, VT_ACTIVATE, 1);
|
||||||
|
close(fd);
|
||||||
|
system("setterm -cursor on");
|
||||||
|
|
||||||
|
#ifdef SDL_INPUT_LINUXEV
|
||||||
|
SDL_EVDEV_Quit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MALI_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
|
{
|
||||||
|
/* Only one display mode available, the current one */
|
||||||
|
SDL_AddDisplayMode(display, &display->current_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
MALI_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
MALI_CreateWindow(_THIS, SDL_Window * window)
|
||||||
|
{
|
||||||
|
SDL_WindowData *windowdata;
|
||||||
|
SDL_DisplayData *displaydata;
|
||||||
|
|
||||||
|
displaydata = SDL_GetDisplayDriverData(0);
|
||||||
|
|
||||||
|
/* Allocate window internal data */
|
||||||
|
windowdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
|
||||||
|
if (windowdata == NULL) {
|
||||||
|
return SDL_OutOfMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Windows have one size for now */
|
||||||
|
window->w = displaydata->native_display.width;
|
||||||
|
window->h = displaydata->native_display.height;
|
||||||
|
|
||||||
|
/* OpenGL ES is the law here */
|
||||||
|
window->flags |= SDL_WINDOW_OPENGL;
|
||||||
|
|
||||||
|
if (!_this->egl_data) {
|
||||||
|
if (SDL_GL_LoadLibrary(NULL) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) &displaydata->native_display);
|
||||||
|
|
||||||
|
if (windowdata->egl_surface == EGL_NO_SURFACE) {
|
||||||
|
MALI_VideoQuit(_this);
|
||||||
|
return SDL_SetError("mali-fbdev: Can't create EGL window surface");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup driver data for this window */
|
||||||
|
window->driverdata = windowdata;
|
||||||
|
|
||||||
|
/* One window, it always has focus */
|
||||||
|
SDL_SetMouseFocus(window);
|
||||||
|
SDL_SetKeyboardFocus(window);
|
||||||
|
|
||||||
|
/* Window has been successfully created */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MALI_DestroyWindow(_THIS, SDL_Window * window)
|
||||||
|
{
|
||||||
|
SDL_WindowData *data;
|
||||||
|
|
||||||
|
data = window->driverdata;
|
||||||
|
if (data) {
|
||||||
|
if (data->egl_surface != EGL_NO_SURFACE) {
|
||||||
|
SDL_EGL_DestroySurface(_this, data->egl_surface);
|
||||||
|
data->egl_surface = EGL_NO_SURFACE;
|
||||||
|
}
|
||||||
|
SDL_free(data);
|
||||||
|
}
|
||||||
|
window->driverdata = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MALI_SetWindowTitle(_THIS, SDL_Window * window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MALI_SetWindowPosition(_THIS, SDL_Window * window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MALI_SetWindowSize(_THIS, SDL_Window * window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MALI_ShowWindow(_THIS, SDL_Window * window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MALI_HideWindow(_THIS, SDL_Window * window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* SDL Window Manager function */
|
||||||
|
/*****************************************************************************/
|
||||||
|
SDL_bool
|
||||||
|
MALI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
|
||||||
|
{
|
||||||
|
if (info->version.major <= SDL_MAJOR_VERSION) {
|
||||||
|
return SDL_TRUE;
|
||||||
|
} else {
|
||||||
|
SDL_SetError("application not compiled with SDL %d.%d\n",
|
||||||
|
SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Failed to get window manager information */
|
||||||
|
return SDL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* SDL event functions */
|
||||||
|
/*****************************************************************************/
|
||||||
|
void MALI_PumpEvents(_THIS)
|
||||||
|
{
|
||||||
|
#ifdef SDL_INPUT_LINUXEV
|
||||||
|
SDL_EVDEV_Poll();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_DRIVER_MALI */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
80
src/video/mali-fbdev/SDL_malivideo.h
Normal file
80
src/video/mali-fbdev/SDL_malivideo.h
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SDL_malivideo_h
|
||||||
|
#define _SDL_malivideo_h
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
#include "../SDL_sysvideo.h"
|
||||||
|
|
||||||
|
#include "SDL_egl.h"
|
||||||
|
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#include <linux/vt.h>
|
||||||
|
#include <linux/fb.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stropts.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct SDL_DisplayData
|
||||||
|
{
|
||||||
|
struct {
|
||||||
|
unsigned short width;
|
||||||
|
unsigned short height;
|
||||||
|
} native_display;
|
||||||
|
} SDL_DisplayData;
|
||||||
|
|
||||||
|
typedef struct SDL_WindowData
|
||||||
|
{
|
||||||
|
EGLSurface egl_surface;
|
||||||
|
} SDL_WindowData;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
/* SDL_VideoDevice functions declaration */
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* Display and window functions */
|
||||||
|
int MALI_VideoInit(_THIS);
|
||||||
|
void MALI_VideoQuit(_THIS);
|
||||||
|
void MALI_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
|
||||||
|
int MALI_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
|
int MALI_CreateWindow(_THIS, SDL_Window * window);
|
||||||
|
void MALI_SetWindowTitle(_THIS, SDL_Window * window);
|
||||||
|
void MALI_SetWindowPosition(_THIS, SDL_Window * window);
|
||||||
|
void MALI_SetWindowSize(_THIS, SDL_Window * window);
|
||||||
|
void MALI_ShowWindow(_THIS, SDL_Window * window);
|
||||||
|
void MALI_HideWindow(_THIS, SDL_Window * window);
|
||||||
|
void MALI_DestroyWindow(_THIS, SDL_Window * window);
|
||||||
|
|
||||||
|
/* Window manager function */
|
||||||
|
SDL_bool MALI_GetWindowWMInfo(_THIS, SDL_Window * window,
|
||||||
|
struct SDL_SysWMinfo *info);
|
||||||
|
|
||||||
|
/* Event functions */
|
||||||
|
void MALI_PumpEvents(_THIS);
|
||||||
|
|
||||||
|
#endif /* _SDL_malivideo_h */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue