Compare commits

...
Sign in to create a new pull request.

10 commits

Author SHA1 Message Date
Chris Smith
424032b0ca Corrects the additon of SDLK_CONTEXT_MENU (and scancodes). 2023-01-10 13:45:54 +00:00
Chris Smith
8da70d5aa1 Adds SDLK_CONTEXT_MENU (and scancode). 2022-10-12 10:07:31 +01:00
Chris Smith
f1003e7110 Adds function SDL_JoystickGetDeviceHWID() to get the hardware ID of a joystick so devices can be uniquely referenced over program executions.
An example would be one SDL application launching another SDL application, passing it the HWID of the joystick that is to be the "primary" controller.
2021-03-18 18:40:22 +00:00
Chris Smith
f6027780aa Fixes build so it works with LibreELEC (bad unnecessary header include), dodgy sdlchecks endif() 2020-09-14 16:23:02 +01:00
Chris Smith
92272721ac Fixes Mali build. 2020-03-25 16:26:00 +00:00
Chris Smith
30cb43e6bb Restored SDL_config.h 2020-03-25 15:35:45 +00:00
Chris Smith
401fb4308e Adds Mali Sys Window Info - returns native_window (and egl_surface as a bonus). 2020-03-25 15:21:54 +00:00
Jools Wills
b5e5778aab mali-fbdev support / debian package changes
* mali-fbdev support from https://github.com/mihailescu2m/libsdl2-2.0.2-dfsg1 with changes for newer SDL
2019-02-07 20:16:12 +00:00
Jools Wills
3de856fc76 Revert "Linux joystick: Look at entire axis namespace for controls (thanks, "spaz16"!)."
This reverts commit 4cb7923f25.

see https://github.com/RetroPie/RetroPie-Setup/issues/1297
2019-02-07 20:16:12 +00:00
Jools Wills
8b464c159c silence log output for unknown input 2019-02-07 20:16:12 +00:00
29 changed files with 1106 additions and 39 deletions

View file

@ -339,6 +339,7 @@ set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
set_option(WASAPI "Use the Windows WASAPI audio 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})
dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS})
@ -1004,6 +1005,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
CheckWayland()
CheckVivante()
CheckKMSDRM()
CheckMali()
endif()
if(UNIX)

View file

@ -778,6 +778,29 @@ macro(CheckVivante)
endif(VIDEO_VIVANTE)
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_FB)
endif(VIDEO_MALI)
endmacro(CheckMali)
# Requires:
# - nada
macro(CheckOpenGLX11)

53
configure vendored
View file

@ -846,6 +846,7 @@ enable_video_x11_scrnsaver
enable_video_x11_xshape
enable_video_x11_vm
enable_video_vivante
enable_video_mali
enable_video_cocoa
enable_render_metal
enable_video_directfb
@ -1598,6 +1599,7 @@ Optional Features:
enable X11 XShape support [[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-mali use Mali EGL video driver [[default=yes]]
--enable-video-cocoa use Cocoa video driver [[default=yes]]
--enable-render-metal enable the Metal render driver [[default=yes]]
--enable-video-directfb use DirectFB video driver [[default=no]]
@ -21229,6 +21231,56 @@ $as_echo "#define SDL_VIDEO_DRIVER_VIVANTE_VDK 1" >>confdefs.h
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()
{
if test x$enable_video = xyes; then
@ -24072,6 +24124,7 @@ case "$host" in
CheckLinuxVersion
CheckRPATH
CheckVivanteVideo
CheckMaliVideo
# Set up files for the audio library
if test x$enable_audio = xyes; then

View file

@ -2037,6 +2037,35 @@ AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default
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
CheckHaikuVideo()
{
@ -3446,6 +3475,7 @@ case "$host" in
CheckLinuxVersion
CheckRPATH
CheckVivanteVideo
CheckMaliVideo
# Set up files for the audio library
if test x$enable_audio = xyes; then

17
debian/control vendored
View file

@ -13,8 +13,6 @@ Build-Depends: debhelper (>= 9),
dpkg-dev (>= 1.16.1~),
fcitx-libs-dev [linux-any],
libasound2-dev [linux-any],
libgl1-mesa-dev,
libpulse-dev,
libudev-dev [linux-any],
libdbus-1-dev [linux-any],
libibus-1.0-dev[linux-any],
@ -30,16 +28,16 @@ Build-Depends: debhelper (>= 9),
libxxf86vm-dev
Homepage: http://www.libsdl.org/
Package: libsdl2
Package: libsdl2-2.0-0
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends},
${shlibs:Depends},
libudev0 [linux-any],
libudev0 | libudev1 [linux-any],
libdbus-1-3 [linux-any]
Conflicts: libsdl-1.3-0
Replaces: libsdl-1.3-0
Conflicts: libsdl-1.3-0, libsdl2
Replaces: libsdl-1.3-0, libsdl2
Description: Simple DirectMedia Layer
SDL is a library that allows programs portable low level access to
a video framebuffer, audio output, mouse, and keyboard.
@ -51,9 +49,10 @@ Section: libdevel
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
libsdl2 (= ${binary:Version}),
libsdl2-2.0-0 (= ${binary:Version}),
libc6-dev,
libgl1-mesa-dev
libgl1-mesa-dev,
libx11-dev
Conflicts: libsdl-1.3-dev
Replaces: libsdl-1.3-dev
Description: Simple DirectMedia Layer development files
@ -68,7 +67,7 @@ Section: debug
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
libsdl2 (= ${binary:Version}),
libsdl2-2.0-0 (= ${binary:Version}),
Description: Simple DirectMedia Layer debug files
SDL is a library that allows programs portable low level access to a video
framebuffer, audio output, mouse, and keyboard.

4
debian/rules vendored
View file

@ -6,7 +6,9 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
confflags = --disable-rpath --disable-video-directfb \
--disable-nas --disable-esd --disable-arts \
--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

View file

@ -1,3 +1,4 @@
/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
@ -22,34 +23,400 @@
#ifndef SDL_config_h_
#define SDL_config_h_
#include "SDL_platform.h"
/**
* \file SDL_config.h
* \file SDL_config.h.in
*
* This is a set of defines to configure the SDL features
*/
/* Add any platform that doesn't build using the configure system. */
#if defined(__WIN32__)
#include "SDL_config_windows.h"
#elif defined(__WINRT__)
#include "SDL_config_winrt.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
#elif defined(__IPHONEOS__)
#include "SDL_config_iphoneos.h"
#elif defined(__ANDROID__)
#include "SDL_config_android.h"
#elif defined(__PSP__)
#include "SDL_config_psp.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#else
/* This is a minimal configuration just to get SDL running on new platforms. */
#include "SDL_config_minimal.h"
#endif /* platform config */
/* General platform specific identifiers */
#include "SDL_platform.h"
#ifdef USING_GENERATED_CONFIG_H
#error Wrong SDL_config.h, check your include path?
/* Make sure that this isn't included by Visual C++ */
#ifdef _MSC_VER
#error You should run hg revert SDL_config.h
#endif
/* C language features */
/* #undef const */
/* #undef inline */
/* #undef volatile */
/* C datatypes */
#ifdef __LP64__
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
#define HAVE_GCC_ATOMICS 1
/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */
/* Comment this if you want to build without any C library requirements */
#define HAVE_LIBC 1
#if HAVE_LIBC
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_ICONV_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MATH_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_WCHAR_H 1
/* #undef HAVE_PTHREAD_NP_H */
/* #undef HAVE_LIBUNWIND_H */
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#endif
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_WCSLEN 1
/* #undef HAVE_WCSLCPY */
/* #undef HAVE_WCSLCAT */
#define HAVE_WCSCMP 1
#define HAVE_STRLEN 1
/* #undef HAVE_STRLCPY */
/* #undef HAVE_STRLCAT */
/* #undef HAVE__STRREV */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
/* #undef HAVE_INDEX */
/* #undef HAVE_RINDEX */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_ITOA */
/* #undef HAVE__LTOA */
/* #undef HAVE__UITOA */
/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
/* #undef HAVE__I64TOA */
/* #undef HAVE__UI64TOA */
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
/* #undef HAVE__STRICMP */
#define HAVE_STRCASECMP 1
/* #undef HAVE__STRNICMP */
#define HAVE_STRNCASECMP 1
/* #undef HAVE_SSCANF */
#define HAVE_VSSCANF 1
/* #undef HAVE_SNPRINTF */
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI /**/
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_EXPF 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_FOPEN64 1
#define HAVE_FSEEKO 1
#define HAVE_FSEEKO64 1
#define HAVE_SIGACTION 1
#define HAVE_SA_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SYSCONF 1
/* #undef HAVE_SYSCTLBYNAME */
#define HAVE_CLOCK_GETTIME 1
/* #undef HAVE_GETPAGESIZE */
#define HAVE_MPROTECT 1
#define HAVE_ICONV 1
#define HAVE_PTHREAD_SETNAME_NP 1
/* #undef HAVE_PTHREAD_SET_NAME_NP */
#define HAVE_SEM_TIMEDWAIT 1
#define HAVE_GETAUXVAL 1
#define HAVE_POLL 1
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#endif /* HAVE_LIBC */
/* #undef HAVE_ALTIVEC_H */
#define HAVE_DBUS_DBUS_H 1
/* #undef HAVE_FCITX_FRONTEND_H */
/* #undef HAVE_IBUS_IBUS_H */
#define HAVE_IMMINTRIN_H 1
/* #undef HAVE_LIBSAMPLERATE_H */
#define HAVE_LIBUDEV_H 1
/* #undef HAVE_DDRAW_H */
/* #undef HAVE_DINPUT_H */
/* #undef HAVE_DSOUND_H */
/* #undef HAVE_DXGI_H */
/* #undef HAVE_XINPUT_H */
/* #undef HAVE_ENDPOINTVOLUME_H */
/* #undef HAVE_MMDEVICEAPI_H */
/* #undef HAVE_AUDIOCLIENT_H */
/* #undef HAVE_XINPUT_GAMEPAD_EX */
/* #undef HAVE_XINPUT_STATE_EX */
/* SDL internal assertion support */
/* #undef SDL_DEFAULT_ASSERT_LEVEL */
/* Allow disabling of core subsystems */
/* #undef SDL_ATOMIC_DISABLED */
/* #undef SDL_AUDIO_DISABLED */
/* #undef SDL_CPUINFO_DISABLED */
/* #undef SDL_EVENTS_DISABLED */
/* #undef SDL_FILE_DISABLED */
/* #undef SDL_JOYSTICK_DISABLED */
/* #undef SDL_HAPTIC_DISABLED */
/* #undef SDL_SENSOR_DISABLED */
/* #undef SDL_LOADSO_DISABLED */
/* #undef SDL_RENDER_DISABLED */
/* #undef SDL_THREADS_DISABLED */
/* #undef SDL_TIMERS_DISABLED */
/* #undef SDL_VIDEO_DISABLED */
/* #undef SDL_POWER_DISABLED */
/* #undef SDL_FILESYSTEM_DISABLED */
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_ALSA 1
/* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_ANDROID */
/* #undef SDL_AUDIO_DRIVER_ARTS */
/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
/* #undef SDL_AUDIO_DRIVER_DISK */
/* #undef SDL_AUDIO_DRIVER_DSOUND */
#define SDL_AUDIO_DRIVER_DUMMY 1
/* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */
/* #undef SDL_AUDIO_DRIVER_ESD */
/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */
/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_HAIKU */
/* #undef SDL_AUDIO_DRIVER_JACK */
/* #undef SDL_AUDIO_DRIVER_JACK_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_NACL */
/* #undef SDL_AUDIO_DRIVER_NAS */
/* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_NETBSD */
/* #undef SDL_AUDIO_DRIVER_OSS */
/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
/* #undef SDL_AUDIO_DRIVER_PAUDIO */
#define SDL_AUDIO_DRIVER_PULSEAUDIO 1
#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "libpulse-simple.so.0"
/* #undef SDL_AUDIO_DRIVER_QSA */
#define SDL_AUDIO_DRIVER_SNDIO 1
/* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
/* #undef SDL_AUDIO_DRIVER_WASAPI */
/* #undef SDL_AUDIO_DRIVER_WINMM */
/* Enable various input drivers */
#define SDL_INPUT_LINUXEV 1
#define SDL_INPUT_LINUXKD 1
/* #undef SDL_INPUT_TSLIB */
/* #undef SDL_JOYSTICK_HAIKU */
/* #undef SDL_JOYSTICK_DINPUT */
/* #undef SDL_JOYSTICK_XINPUT */
/* #undef SDL_JOYSTICK_DUMMY */
/* #undef SDL_JOYSTICK_IOKIT */
#define SDL_JOYSTICK_LINUX 1
/* #undef SDL_JOYSTICK_ANDROID */
/* #undef SDL_JOYSTICK_WINMM */
/* #undef SDL_JOYSTICK_USBHID */
/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
/* #undef SDL_JOYSTICK_HIDAPI */
/* #undef SDL_JOYSTICK_EMSCRIPTEN */
/* #undef SDL_HAPTIC_DUMMY */
/* #undef SDL_HAPTIC_ANDROID */
#define SDL_HAPTIC_LINUX 1
/* #undef SDL_HAPTIC_IOKIT */
/* #undef SDL_HAPTIC_DINPUT */
/* #undef SDL_HAPTIC_XINPUT */
/* Enable various sensor drivers */
/* #undef SDL_SENSOR_ANDROID */
#define SDL_SENSOR_DUMMY 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_DLOPEN 1
/* #undef SDL_LOADSO_DUMMY */
/* #undef SDL_LOADSO_LDG */
/* #undef SDL_LOADSO_WINDOWS */
/* Enable various threading systems */
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
/* #undef SDL_THREAD_WINDOWS */
/* Enable various timer systems */
/* #undef SDL_TIMER_HAIKU */
/* #undef SDL_TIMER_DUMMY */
#define SDL_TIMER_UNIX 1
/* #undef SDL_TIMER_WINDOWS */
/* Enable various video drivers */
/* #undef SDL_VIDEO_DRIVER_HAIKU */
/* #undef SDL_VIDEO_DRIVER_COCOA */
/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
/* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */
#define SDL_VIDEO_DRIVER_DUMMY 1
/* #undef SDL_VIDEO_DRIVER_WINDOWS */
/* #undef SDL_VIDEO_DRIVER_WAYLAND */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */
/* #undef SDL_VIDEO_DRIVER_MIR */
/* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */
/* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */
#define SDL_VIDEO_DRIVER_X11 1
/* #undef SDL_VIDEO_DRIVER_RPI */
/* #undef SDL_VIDEO_DRIVER_KMSDRM */
/* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */
/* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM */
/* #undef SDL_VIDEO_DRIVER_ANDROID */
/* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */
/* #undef SDL_VIDEO_DRIVER_MALI */
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "libXcursor.so.1"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "libXinerama.so.1"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "libXi.so.6"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "libXrandr.so.2"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "libXss.so.1"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "libXxf86vm.so.1"
#define SDL_VIDEO_DRIVER_X11_XCURSOR 1
#define SDL_VIDEO_DRIVER_X11_XDBE 1
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
/* #undef SDL_VIDEO_DRIVER_NACL */
/* #undef SDL_VIDEO_DRIVER_VIVANTE */
/* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */
/* #undef SDL_VIDEO_DRIVER_QNX */
/* #undef SDL_VIDEO_RENDER_D3D */
/* #undef SDL_VIDEO_RENDER_D3D11 */
#define SDL_VIDEO_RENDER_OGL 1
/* #undef SDL_VIDEO_RENDER_OGL_ES */
#define SDL_VIDEO_RENDER_OGL_ES2 1
/* #undef SDL_VIDEO_RENDER_DIRECTFB */
/* #undef SDL_VIDEO_RENDER_METAL */
/* Enable OpenGL support */
#define SDL_VIDEO_OPENGL 1
/* #undef SDL_VIDEO_OPENGL_ES */
#define SDL_VIDEO_OPENGL_ES2 1
/* #undef SDL_VIDEO_OPENGL_BGL */
/* #undef SDL_VIDEO_OPENGL_CGL */
#define SDL_VIDEO_OPENGL_EGL 1
#define SDL_VIDEO_OPENGL_GLX 1
/* #undef SDL_VIDEO_OPENGL_WGL */
/* #undef SDL_VIDEO_OPENGL_OSMESA */
/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
/* Enable Vulkan support */
/* #undef SDL_VIDEO_VULKAN */
/* Enable system power support */
#define SDL_POWER_LINUX 1
/* #undef SDL_POWER_WINDOWS */
/* #undef SDL_POWER_MACOSX */
/* #undef SDL_POWER_HAIKU */
/* #undef SDL_POWER_ANDROID */
/* #undef SDL_POWER_EMSCRIPTEN */
/* #undef SDL_POWER_HARDWIRED */
/* Enable system filesystem support */
/* #undef SDL_FILESYSTEM_HAIKU */
/* #undef SDL_FILESYSTEM_COCOA */
/* #undef SDL_FILESYSTEM_DUMMY */
#define SDL_FILESYSTEM_UNIX 1
/* #undef SDL_FILESYSTEM_WINDOWS */
/* #undef SDL_FILESYSTEM_NACL */
/* #undef SDL_FILESYSTEM_ANDROID */
/* #undef SDL_FILESYSTEM_EMSCRIPTEN */
/* Enable assembly routines */
#define SDL_ASSEMBLY_ROUTINES 1
/* #undef SDL_ALTIVEC_BLITTERS */
/* Enable ime support */
/* #undef SDL_USE_IME */
/* Enable dynamic udev support */
#define SDL_UDEV_DYNAMIC "libudev.so.1"
/* Enable dynamic libsamplerate support */
/* #undef SDL_LIBSAMPLERATE_DYNAMIC */
#endif /* SDL_config_h_ */

View file

@ -328,6 +328,7 @@
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
#cmakedefine SDL_VIDEO_DRIVER_MALI @SDL_VIDEO_DRIVER_MALI@
#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@
#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@

View file

@ -337,6 +337,7 @@
#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
#undef SDL_VIDEO_DRIVER_ANDROID
#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
#undef SDL_VIDEO_DRIVER_MALI
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR

View file

@ -29,6 +29,17 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#if defined(SDL_VIDEO_DRIVER_MALI)
#ifndef MALI_NATIVE_WINDOW_H
#define MALI_NATIVE_WINDOW_H
typedef struct Mali_native_window
{
unsigned short width;
unsigned short height;
} Mali_native_window;
#endif
#endif
#else /* _MSC_VER */
/* EGL headers for Visual Studio */
@ -1669,5 +1680,4 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
#endif /* __eglext_h_ */
#endif /* _MSC_VER */

View file

@ -144,6 +144,12 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
/**
* Return the HWID for the joystick at this index
* This can be called before any joysticks are opened.
*/
extern DECLSPEC const char *SDLCALL SDL_JoystickGetDeviceHWID(int device_index);
/**
* Get the USB vendor ID of a joystick, if available.
* This can be called before any joysticks are opened.

View file

@ -316,7 +316,9 @@ enum
SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD),
SDLK_CONTEXT_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CONTEXT_MENU),
};
/**

View file

@ -403,6 +403,7 @@ typedef enum
/* @} *//* Usage page 0x0C (additional media keys) */
/* Add any other keys here. */
SDL_SCANCODE_CONTEXT_MENU = 287,
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
for array bounds */

View file

@ -104,6 +104,10 @@ typedef void *EGLSurface;
#include "SDL_egl.h"
#endif
#if defined(SDL_VIDEO_DRIVER_MALI)
#include "SDL_egl.h"
#endif
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@ -126,7 +130,8 @@ typedef enum
SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID,
SDL_SYSWM_VIVANTE,
SDL_SYSWM_OS2
SDL_SYSWM_OS2,
SDL_SYSWM_MALI
} SDL_SYSWM_TYPE;
/**
@ -280,6 +285,13 @@ struct SDL_SysWMinfo
EGLNativeWindowType window;
} vivante;
#endif
#if defined(SDL_VIDEO_DRIVER_MALI)
struct
{
EGLSurface surface; /**< The Mali EGL Surface */
Mali_native_window *window; /**< The Mali window */
} mali;
#endif
/* Make sure this union is always 64 bytes (8 64-bit pointers). */
/* Be careful not to overflow this if you add a new target! */

View file

@ -396,12 +396,16 @@ SDL_EVDEV_translate_keycode(int keycode)
if (keycode < SDL_arraysize(linux_scancode_table))
scancode = linux_scancode_table[keycode];
if(keycode == KEY_CONTEXT_MENU)
scancode = SDL_SCANCODE_CONTEXT_MENU;
/*
if (scancode == SDL_SCANCODE_UNKNOWN) {
SDL_Log("The key you just pressed is not recognized by SDL. To help "
"get this fixed, please report this to the SDL forums/mailing list "
"<https://discourse.libsdl.org/> EVDEV KeyCode %d", keycode);
}
*/
return scancode;
}

View file

@ -196,6 +196,7 @@
#define SDL_JoystickNameForIndex SDL_JoystickNameForIndex_REAL
#define SDL_JoystickOpen SDL_JoystickOpen_REAL
#define SDL_JoystickName SDL_JoystickName_REAL
#define SDL_JoystickGetDeviceHWID SDL_JoystickGetDeviceHWID_REAL
#define SDL_JoystickGetDeviceGUID SDL_JoystickGetDeviceGUID_REAL
#define SDL_JoystickGetGUID SDL_JoystickGetGUID_REAL
#define SDL_JoystickGetGUIDString SDL_JoystickGetGUIDString_REAL

View file

@ -229,6 +229,7 @@ SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickOpen,(int a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_JoystickName,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetDeviceGUID,(int a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetGUID,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_JoystickGetDeviceHWID,(int a),(a),return)
SDL_DYNAPI_PROC(void,SDL_JoystickGetGUIDString,(SDL_JoystickGUID a, char *b, int c),(a,b,c),)
SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetGUIDFromString,(const char *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAttached,(SDL_Joystick *a),(a),return)

View file

@ -277,6 +277,7 @@ static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = {
SDLK_APP2,
SDLK_AUDIOREWIND,
SDLK_AUDIOFASTFORWARD,
SDLK_CONTEXT_MENU,
};
static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
@ -513,6 +514,7 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
"App2",
"AudioRewind",
"AudioFastForward",
"ContextMenu",
};
/* Taken from SDL_iconv() */

View file

@ -1448,6 +1448,21 @@ int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id)
return device_index;
}
/* return the hwid for this index */
const char * SDL_JoystickGetDeviceHWID(int device_index)
{
SDL_JoystickDriver *driver;
const char *hwid = NULL;
SDL_LockJoysticks();
if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) {
hwid = driver->GetDeviceHWID(device_index);
}
SDL_UnlockJoysticks();
return hwid;
}
SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick)
{
if (!SDL_PrivateJoystickValid(joystick)) {

View file

@ -138,6 +138,9 @@ typedef struct _SDL_JoystickDriver
/* Function to perform any system-specific joystick related cleanup */
void (*Quit)(void);
/* Function to get the hardware-id of a joystick */
const char *(*GetDeviceHWID)(int device_index);
} SDL_JoystickDriver;
/* The available joystick drivers */

View file

@ -35,6 +35,7 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <linux/joystick.h>
#include <sys/sysmacros.h>
#include "SDL_assert.h"
#include "SDL_joystick.h"
@ -73,6 +74,7 @@ typedef struct SDL_joylist_item
/* Steam Controller support */
SDL_bool m_bSteamController;
char *hwid; /* 0f34:123e */
} SDL_joylist_item;
static SDL_joylist_item *SDL_joylist = NULL;
@ -339,6 +341,9 @@ MaybeAddDevice(const char *path)
return -1;
}
sprintf( namebuf, "%x:%x", major( sb.st_rdev ), minor( sb.st_rdev ) );
item->hwid = SDL_strdup(namebuf);
item->device_instance = SDL_GetNextJoystickInstanceID();
if (SDL_joylist_tail == NULL) {
SDL_joylist = SDL_joylist_tail = item;
@ -391,6 +396,7 @@ MaybeRemoveDevice(const char *path)
SDL_free(item->path);
SDL_free(item->name);
SDL_free(item->hwid);
SDL_free(item);
return retval;
}
@ -458,6 +464,7 @@ static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickG
if ((item->path == NULL) || (item->name == NULL)) {
SDL_free(item->path);
SDL_free(item->name);
SDL_free(item->hwid);
SDL_free(item);
return SDL_FALSE;
}
@ -594,6 +601,12 @@ LINUX_JoystickGetDeviceGUID( int device_index )
return JoystickByDevIndex(device_index)->guid;
}
static const char *
LINUX_JoystickGetDeviceHWID( int device_index )
{
return JoystickByDevIndex(device_index)->hwid;
}
/* Function to perform the mapping from device index to the instance id for this index */
static SDL_JoystickID
LINUX_JoystickGetDeviceInstanceID(int device_index)
@ -670,7 +683,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd)
++joystick->nbuttons;
}
}
for (i = 0; i < ABS_MAX; ++i) {
for (i = 0; i < ABS_MISC; ++i) {
/* Skip hats */
if (i == ABS_HAT0X) {
i = ABS_HAT3Y;
@ -976,6 +989,10 @@ HandleInputEvents(SDL_Joystick * joystick)
events[i].value);
break;
case EV_ABS:
if (code >= ABS_MISC) {
break;
}
switch (code) {
case ABS_HAT0X:
case ABS_HAT0Y:
@ -1085,6 +1102,7 @@ LINUX_JoystickQuit(void)
next = item->next;
SDL_free(item->path);
SDL_free(item->name);
SDL_free(item->hwid);
SDL_free(item);
}
@ -1114,6 +1132,7 @@ SDL_JoystickDriver SDL_LINUX_JoystickDriver =
LINUX_JoystickUpdate,
LINUX_JoystickClose,
LINUX_JoystickQuit,
LINUX_JoystickGetDeviceHWID,
};
#endif /* SDL_JOYSTICK_LINUX */

View file

@ -51,7 +51,7 @@
#define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so" )
#define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so" )
#elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE
#elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_MALI || SDL_VIDEO_DRIVER_VIVANTE
/* Android */
#define DEFAULT_EGL "libEGL.so"
#define DEFAULT_OGL_ES2 "libGLESv2.so"

View file

@ -416,6 +416,7 @@ extern VideoBootStrap Android_bootstrap;
extern VideoBootStrap PSP_bootstrap;
extern VideoBootStrap RPI_bootstrap;
extern VideoBootStrap KMSDRM_bootstrap;
extern VideoBootStrap MALI_bootstrap;
extern VideoBootStrap DUMMY_bootstrap;
extern VideoBootStrap Wayland_bootstrap;
extern VideoBootStrap NACL_bootstrap;

View file

@ -97,6 +97,9 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_PSP
&PSP_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_MALI
&MALI_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_KMSDRM
&KMSDRM_bootstrap,
#endif

View 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, 0);
}
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: */

View 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 int 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: */

View file

@ -0,0 +1,341 @@
/*
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->CreateSDLWindow = 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);
// Disable cursor
fd = open("/sys/class/graphics/fbcon/cursor_blink", O_RDWR, 0);
if ( fd >= 0 ) {
write(fd, "0\n", 2 );
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);
// Enable cursor
fd = open("/sys/class/graphics/fbcon/cursor_blink", O_RDWR, 0);
if ( fd >= 0 ) {
write(fd, "1\n", 2 );
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 reference to native window */
windowdata->window = &displaydata->native_display;
/* 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)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if (info->version.major == SDL_MAJOR_VERSION &&
info->version.minor == SDL_MINOR_VERSION) {
info->subsystem = SDL_SYSWM_MALI;
info->info.mali.window = data->window;
info->info.mali.surface = data->egl_surface;
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d.%d",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
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: */

View file

@ -0,0 +1,77 @@
/*
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" // Also provides Mali_native_window
#include <EGL/egl.h>
#include <linux/vt.h>
#include <linux/fb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
typedef struct SDL_DisplayData
{
Mali_native_window native_display;
} SDL_DisplayData;
typedef struct SDL_WindowData
{
EGLSurface egl_surface;
Mali_native_window *window;
} 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: */