From 8b464c159ccbe46cc7153d60bf5c018fe18da18b Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Thu, 19 Jan 2017 19:36:40 +0000 Subject: [PATCH 01/12] silence log output for unknown input --- src/core/linux/SDL_evdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 5443c2198..45abbafc2 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -397,11 +397,13 @@ SDL_EVDEV_translate_keycode(int keycode) if (keycode < SDL_arraysize(linux_scancode_table)) scancode = linux_scancode_table[keycode]; + /* 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 " " EVDEV KeyCode %d", keycode); } + */ return scancode; } From 3de856fc76ff6a850a5f76b445b1d14c696c9293 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Sat, 9 Apr 2016 22:07:12 +0100 Subject: [PATCH 02/12] Revert "Linux joystick: Look at entire axis namespace for controls (thanks, "spaz16"!)." This reverts commit 4cb7923f251543c1175c1702f8cf8b4201ce9054. see https://github.com/RetroPie/RetroPie-Setup/issues/1297 --- src/joystick/linux/SDL_sysjoystick.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 06a2d9a21..81be5d843 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -670,7 +670,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 +976,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: From b5e5778aabc8b69b6269255f5642881e62a6897b Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Sun, 3 Jan 2016 21:27:57 +0000 Subject: [PATCH 03/12] mali-fbdev support / debian package changes * mali-fbdev support from https://github.com/mihailescu2m/libsdl2-2.0.2-dfsg1 with changes for newer SDL --- CMakeLists.txt | 2 + cmake/sdlchecks.cmake | 23 ++ configure | 53 +++ configure.in | 30 ++ debian/control | 17 +- ...{libsdl2.install => libsdl2-2.0-0.install} | 0 debian/rules | 4 +- include/SDL_config.h.cmake | 1 + include/SDL_config.h.in | 1 + src/video/SDL_egl.c | 2 +- src/video/SDL_sysvideo.h | 1 + src/video/SDL_video.c | 3 + src/video/mali-fbdev/SDL_maliopengles.c | 43 +++ src/video/mali-fbdev/SDL_maliopengles.h | 48 +++ src/video/mali-fbdev/SDL_malivideo.c | 323 ++++++++++++++++++ src/video/mali-fbdev/SDL_malivideo.h | 80 +++++ 16 files changed, 620 insertions(+), 11 deletions(-) rename debian/{libsdl2.install => libsdl2-2.0-0.install} (100%) create mode 100644 src/video/mali-fbdev/SDL_maliopengles.c create mode 100644 src/video/mali-fbdev/SDL_maliopengles.h create mode 100644 src/video/mali-fbdev/SDL_malivideo.c create mode 100644 src/video/mali-fbdev/SDL_malivideo.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0128c7ac7..160a0f04a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 4a2c3ed57..fdc248385 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -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 + 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: # - nada macro(CheckOpenGLX11) diff --git a/configure b/configure index aee0cb6ec..acffdb147 100755 --- a/configure +++ b/configure @@ -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 + +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 diff --git a/configure.in b/configure.in index ae866ff0c..99fbed1ca 100644 --- a/configure.in +++ b/configure.in @@ -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 + ],[ + ],[ + 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 diff --git a/debian/control b/debian/control index a3411335a..450aa2925 100644 --- a/debian/control +++ b/debian/control @@ -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. diff --git a/debian/libsdl2.install b/debian/libsdl2-2.0-0.install similarity index 100% rename from debian/libsdl2.install rename to debian/libsdl2-2.0-0.install diff --git a/debian/rules b/debian/rules index 4bde8f325..5624d6f34 100755 --- a/debian/rules +++ b/debian/rules @@ -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 diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 48dd2d41b..9ef8901a0 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -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@ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 883b6f427..7b475c29d 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -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 diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index 78abc030e..bd141eec8 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -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" diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 25862ca1b..1d1bc106d 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -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; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 336fdaa50..e13017d2b 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -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 diff --git a/src/video/mali-fbdev/SDL_maliopengles.c b/src/video/mali-fbdev/SDL_maliopengles.c new file mode 100644 index 000000000..0e4836d2e --- /dev/null +++ b/src/video/mali-fbdev/SDL_maliopengles.c @@ -0,0 +1,43 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + 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: */ + diff --git a/src/video/mali-fbdev/SDL_maliopengles.h b/src/video/mali-fbdev/SDL_maliopengles.h new file mode 100644 index 000000000..121af74f9 --- /dev/null +++ b/src/video/mali-fbdev/SDL_maliopengles.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + 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: */ diff --git a/src/video/mali-fbdev/SDL_malivideo.c b/src/video/mali-fbdev/SDL_malivideo.c new file mode 100644 index 000000000..1d076a68d --- /dev/null +++ b/src/video/mali-fbdev/SDL_malivideo.c @@ -0,0 +1,323 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + 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); + 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: */ + diff --git a/src/video/mali-fbdev/SDL_malivideo.h b/src/video/mali-fbdev/SDL_malivideo.h new file mode 100644 index 000000000..c14667fa8 --- /dev/null +++ b/src/video/mali-fbdev/SDL_malivideo.h @@ -0,0 +1,80 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + 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 +#include +#include +#include +#include +#include +#include +#include +#include + +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: */ + From 401fb4308e68b21452b3b36df96112ef5ccd4f33 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 21 Mar 2020 09:32:37 +0000 Subject: [PATCH 04/12] Adds Mali Sys Window Info - returns native_window (and egl_surface as a bonus). --- include/SDL_config.h | 415 +++++++++++++++++++++++++-- include/SDL_syswm.h | 14 +- src/video/mali-fbdev/SDL_malivideo.c | 36 ++- src/video/mali-fbdev/SDL_malivideo.h | 12 +- 4 files changed, 439 insertions(+), 38 deletions(-) diff --git a/include/SDL_config.h b/include/SDL_config.h index 32f4113ff..19272e770 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -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 @@ -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 */ +#define HAVE_IBUS_IBUS_H 1 +#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 +#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2" +/* #undef SDL_AUDIO_DRIVER_ANDROID */ +/* #undef SDL_AUDIO_DRIVER_ARTS */ +/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ +/* #undef SDL_AUDIO_DRIVER_COREAUDIO */ +#define SDL_AUDIO_DRIVER_DISK 1 +/* #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 */ +#define SDL_AUDIO_DRIVER_OSS 1 +/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ +/* #undef SDL_AUDIO_DRIVER_PAUDIO */ +/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ +/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ +/* #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 */ +#define SDL_VIDEO_DRIVER_MALI 1 +#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 */ +/* #undef SDL_VIDEO_RENDER_OGL */ +/* #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 */ +/* #undef SDL_VIDEO_OPENGL */ +/* #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 +/* #undef SDL_VIDEO_OPENGL_GLX */ +/* #undef SDL_VIDEO_OPENGL_WGL */ +/* #undef SDL_VIDEO_OPENGL_OSMESA */ +/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ + +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 + +/* 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 */ +#define SDL_USE_IME 1 + +/* Enable dynamic udev support */ +#define SDL_UDEV_DYNAMIC "libudev.so.1" + +/* Enable dynamic libsamplerate support */ +/* #undef SDL_LIBSAMPLERATE_DYNAMIC */ + #endif /* SDL_config_h_ */ diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index f1c4021cc..55cc22eab 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -104,6 +104,10 @@ typedef void *EGLSurface; #include "SDL_egl.h" #endif +#if defined(SDL_VIDEO_DRIVER_MALI) +#include "SDL_malivideo.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! */ diff --git a/src/video/mali-fbdev/SDL_malivideo.c b/src/video/mali-fbdev/SDL_malivideo.c index 1d076a68d..b1b01a570 100644 --- a/src/video/mali-fbdev/SDL_malivideo.c +++ b/src/video/mali-fbdev/SDL_malivideo.c @@ -144,7 +144,13 @@ MALI_VideoInit(_THIS) } */ close(fd); - system("setterm -cursor off"); + // 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; @@ -184,12 +190,17 @@ MALI_VideoQuit(_THIS) ioctl(fd, VT_ACTIVATE, 5); ioctl(fd, VT_ACTIVATE, 1); close(fd); - system("setterm -cursor on"); + // 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 @@ -238,6 +249,9 @@ MALI_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("mali-fbdev: Can't create EGL window surface"); } + /* Setup reference to native window */ + windowdata->display = &displaydata->native_display; + /* Setup driver data for this window */ window->driverdata = windowdata; @@ -296,15 +310,19 @@ MALI_HideWindow(_THIS, SDL_Window * window) SDL_bool MALI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { - if (info->version.major <= SDL_MAJOR_VERSION) { + 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.display = data->display; + info->info.mali.surface = data->egl_surface; return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + return SDL_FALSE; } - - /* Failed to get window manager information */ - return SDL_FALSE; } /*****************************************************************************/ diff --git a/src/video/mali-fbdev/SDL_malivideo.h b/src/video/mali-fbdev/SDL_malivideo.h index c14667fa8..36c26c2da 100644 --- a/src/video/mali-fbdev/SDL_malivideo.h +++ b/src/video/mali-fbdev/SDL_malivideo.h @@ -37,17 +37,21 @@ #include #include +typedef struct Mali_native_window +{ + unsigned short width; + unsigned short height; +} Mali_native_window; + typedef struct SDL_DisplayData { - struct { - unsigned short width; - unsigned short height; - } native_display; + Mali_native_window native_display; } SDL_DisplayData; typedef struct SDL_WindowData { EGLSurface egl_surface; + Mali_native_window *display; } SDL_WindowData; /****************************************************************************/ From 30cb43e6bbe9e74eac0161f26b1add5a0568d8e0 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 25 Mar 2020 15:35:45 +0000 Subject: [PATCH 05/12] Restored SDL_config.h --- include/SDL_config.h | 415 +++---------------------------------------- 1 file changed, 24 insertions(+), 391 deletions(-) diff --git a/include/SDL_config.h b/include/SDL_config.h index 19272e770..32f4113ff 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -1,4 +1,3 @@ -/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */ /* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga @@ -23,400 +22,34 @@ #ifndef SDL_config_h_ #define SDL_config_h_ -/** - * \file SDL_config.h.in - * - * This is a set of defines to configure the SDL features - */ - -/* General platform specific identifiers */ #include "SDL_platform.h" -/* Make sure that this isn't included by Visual C++ */ -#ifdef _MSC_VER -#error You should run hg revert SDL_config.h -#endif +/** + * \file SDL_config.h + */ -/* C language features */ -/* #undef const */ -/* #undef inline */ -/* #undef volatile */ - -/* C datatypes */ -#ifdef __LP64__ -#define SIZEOF_VOIDP 8 +/* 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 -#define SIZEOF_VOIDP 4 +/* This is a minimal configuration just to get SDL running on new platforms. */ +#include "SDL_config_minimal.h" +#endif /* platform config */ + +#ifdef USING_GENERATED_CONFIG_H +#error Wrong SDL_config.h, check your include path? #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 */ -#define HAVE_IBUS_IBUS_H 1 -#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 -#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2" -/* #undef SDL_AUDIO_DRIVER_ANDROID */ -/* #undef SDL_AUDIO_DRIVER_ARTS */ -/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ -/* #undef SDL_AUDIO_DRIVER_COREAUDIO */ -#define SDL_AUDIO_DRIVER_DISK 1 -/* #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 */ -#define SDL_AUDIO_DRIVER_OSS 1 -/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ -/* #undef SDL_AUDIO_DRIVER_PAUDIO */ -/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ -/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ -/* #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 */ -#define SDL_VIDEO_DRIVER_MALI 1 -#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 */ -/* #undef SDL_VIDEO_RENDER_OGL */ -/* #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 */ -/* #undef SDL_VIDEO_OPENGL */ -/* #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 -/* #undef SDL_VIDEO_OPENGL_GLX */ -/* #undef SDL_VIDEO_OPENGL_WGL */ -/* #undef SDL_VIDEO_OPENGL_OSMESA */ -/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ - -/* Enable Vulkan support */ -#define SDL_VIDEO_VULKAN 1 - -/* 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 */ -#define SDL_USE_IME 1 - -/* Enable dynamic udev support */ -#define SDL_UDEV_DYNAMIC "libudev.so.1" - -/* Enable dynamic libsamplerate support */ -/* #undef SDL_LIBSAMPLERATE_DYNAMIC */ #endif /* SDL_config_h_ */ From 92272721ac65a551b9b85b85b08b1c015f3f9a33 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 25 Mar 2020 16:26:00 +0000 Subject: [PATCH 06/12] Fixes Mali build. --- include/SDL_config.h | 415 +++++++++++++++++++++++++-- include/SDL_egl.h | 12 +- include/SDL_syswm.h | 2 +- src/video/mali-fbdev/SDL_malivideo.c | 4 +- src/video/mali-fbdev/SDL_malivideo.h | 10 +- 5 files changed, 407 insertions(+), 36 deletions(-) diff --git a/include/SDL_config.h b/include/SDL_config.h index 32f4113ff..2016382ae 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -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 @@ -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 */ +/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ +/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ +/* #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_ */ diff --git a/include/SDL_egl.h b/include/SDL_egl.h index d65ed437c..bd96a4c88 100644 --- a/include/SDL_egl.h +++ b/include/SDL_egl.h @@ -29,6 +29,17 @@ #include #include +#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 */ diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 55cc22eab..c50867027 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -105,7 +105,7 @@ typedef void *EGLSurface; #endif #if defined(SDL_VIDEO_DRIVER_MALI) -#include "SDL_malivideo.h" +#include "SDL_egl.h" #endif #include "begin_code.h" diff --git a/src/video/mali-fbdev/SDL_malivideo.c b/src/video/mali-fbdev/SDL_malivideo.c index b1b01a570..7c7c5a007 100644 --- a/src/video/mali-fbdev/SDL_malivideo.c +++ b/src/video/mali-fbdev/SDL_malivideo.c @@ -250,7 +250,7 @@ MALI_CreateWindow(_THIS, SDL_Window * window) } /* Setup reference to native window */ - windowdata->display = &displaydata->native_display; + windowdata->window = &displaydata->native_display; /* Setup driver data for this window */ window->driverdata = windowdata; @@ -315,7 +315,7 @@ MALI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) if (info->version.major == SDL_MAJOR_VERSION && info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_MALI; - info->info.mali.display = data->display; + info->info.mali.window = data->window; info->info.mali.surface = data->egl_surface; return SDL_TRUE; } else { diff --git a/src/video/mali-fbdev/SDL_malivideo.h b/src/video/mali-fbdev/SDL_malivideo.h index 36c26c2da..f0b7c6e5e 100644 --- a/src/video/mali-fbdev/SDL_malivideo.h +++ b/src/video/mali-fbdev/SDL_malivideo.h @@ -25,7 +25,7 @@ #include "../../SDL_internal.h" #include "../SDL_sysvideo.h" -#include "SDL_egl.h" +#include "SDL_egl.h" // Also provides Mali_native_window #include #include @@ -37,12 +37,6 @@ #include #include -typedef struct Mali_native_window -{ - unsigned short width; - unsigned short height; -} Mali_native_window; - typedef struct SDL_DisplayData { Mali_native_window native_display; @@ -51,7 +45,7 @@ typedef struct SDL_DisplayData typedef struct SDL_WindowData { EGLSurface egl_surface; - Mali_native_window *display; + Mali_native_window *window; } SDL_WindowData; /****************************************************************************/ From f6027780aa123a302f446127aefc223d7a76a832 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 14 Sep 2020 16:23:02 +0100 Subject: [PATCH 07/12] Fixes build so it works with LibreELEC (bad unnecessary header include), dodgy sdlchecks endif() --- cmake/sdlchecks.cmake | 2 +- src/video/mali-fbdev/SDL_malivideo.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index fdc248385..642def4cc 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -796,7 +796,7 @@ macro(CheckMali) 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(HAVE_VIDEO_MALI_EGL_FB) endif(VIDEO_MALI) endmacro(CheckMali) diff --git a/src/video/mali-fbdev/SDL_malivideo.h b/src/video/mali-fbdev/SDL_malivideo.h index f0b7c6e5e..bd6d95063 100644 --- a/src/video/mali-fbdev/SDL_malivideo.h +++ b/src/video/mali-fbdev/SDL_malivideo.h @@ -33,7 +33,6 @@ #include #include #include -#include #include #include From f1003e7110d27172b083e77bf77ae785ad628f24 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 18 Mar 2021 18:40:22 +0000 Subject: [PATCH 08/12] 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. --- include/SDL_joystick.h | 6 ++++++ src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/joystick/SDL_joystick.c | 15 +++++++++++++++ src/joystick/SDL_sysjoystick.h | 3 +++ src/joystick/linux/SDL_sysjoystick.c | 15 +++++++++++++++ 6 files changed, 41 insertions(+) diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h index 6e05a9c20..7f5fffe9e 100644 --- a/include/SDL_joystick.h +++ b/include/SDL_joystick.h @@ -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. diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 745421382..a902136ba 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -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 diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 0a1f3aefa..460114360 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -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) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 02903f5f9..f84a35091 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -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)) { diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h index 341669361..73e7107bf 100644 --- a/src/joystick/SDL_sysjoystick.h +++ b/src/joystick/SDL_sysjoystick.h @@ -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 */ diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 81be5d843..a06170726 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -35,6 +35,7 @@ #include #include #include +#include #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) @@ -1089,6 +1102,7 @@ LINUX_JoystickQuit(void) next = item->next; SDL_free(item->path); SDL_free(item->name); + SDL_free(item->hwid); SDL_free(item); } @@ -1118,6 +1132,7 @@ SDL_JoystickDriver SDL_LINUX_JoystickDriver = LINUX_JoystickUpdate, LINUX_JoystickClose, LINUX_JoystickQuit, + LINUX_JoystickGetDeviceHWID, }; #endif /* SDL_JOYSTICK_LINUX */ From 8da70d5aa15fa0bff59510e5953abb151bd495a5 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 12 Oct 2022 10:07:31 +0100 Subject: [PATCH 09/12] Adds SDLK_CONTEXT_MENU (and scancode). --- include/SDL_keycode.h | 4 +++- include/SDL_scancode.h | 1 + src/core/linux/SDL_evdev.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/SDL_keycode.h b/include/SDL_keycode.h index d7d5b1dbc..f9a9cee27 100644 --- a/include/SDL_keycode.h +++ b/include/SDL_keycode.h @@ -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), }; /** diff --git a/include/SDL_scancode.h b/include/SDL_scancode.h index 63871aa3b..43edee0a6 100644 --- a/include/SDL_scancode.h +++ b/include/SDL_scancode.h @@ -403,6 +403,7 @@ typedef enum /* @} *//* Usage page 0x0C (additional media keys) */ /* Add any other keys here. */ + SDL_SCANCODE_CONTEXT_MENU = 438, SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes for array bounds */ diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 45abbafc2..f1517e131 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -396,6 +396,8 @@ 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) { From 424032b0ca4ce2c73344b9346cf7d71e4265ca48 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 10 Jan 2023 13:45:54 +0000 Subject: [PATCH 10/12] Corrects the additon of SDLK_CONTEXT_MENU (and scancodes). --- include/SDL_config.h | 4 ++-- include/SDL_scancode.h | 2 +- src/events/SDL_keyboard.c | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/SDL_config.h b/include/SDL_config.h index 2016382ae..4e4198f3d 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -261,8 +261,8 @@ /* #undef SDL_AUDIO_DRIVER_OSS */ /* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ /* #undef SDL_AUDIO_DRIVER_PAUDIO */ -/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ -/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ +#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 */ diff --git a/include/SDL_scancode.h b/include/SDL_scancode.h index 43edee0a6..20c52c260 100644 --- a/include/SDL_scancode.h +++ b/include/SDL_scancode.h @@ -403,7 +403,7 @@ typedef enum /* @} *//* Usage page 0x0C (additional media keys) */ /* Add any other keys here. */ - SDL_SCANCODE_CONTEXT_MENU = 438, + SDL_SCANCODE_CONTEXT_MENU = 287, SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes for array bounds */ diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index e1295764e..b6123d5a8 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -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() */ From 3eca30e6dce7daf8e37025f80e0ee002d6fa4ecc Mon Sep 17 00:00:00 2001 From: dajoho Date: Tue, 15 Aug 2023 19:04:15 +0200 Subject: [PATCH 11/12] pandory500: fix udev bug The sunxi linux 3.x kernel reports extra axes on some (poor?) controllers, causing /dev/input and udev to report too many to SDL2. This mainly occurs when using RetroGames LTD controllers, such as The GamePad and The C64 Joystick. This patch detects the guids of these specific controllers and filters the extra axes so SDL2 does not react to them. --- src/joystick/linux/SDL_sysjoystick.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index a06170726..e8d4b6150 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -659,6 +659,9 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) unsigned long relbit[NBITS(REL_MAX)] = { 0 }; unsigned long ffbit[NBITS(FF_MAX)] = { 0 }; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + char pandoryGUID[1024]; + /* See if this device uses the new unified event API */ if ((ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) >= 0) && (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) >= 0) && @@ -683,6 +686,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) ++joystick->nbuttons; } } + for (i = 0; i < ABS_MISC; ++i) { /* Skip hats */ if (i == ABS_HAT0X) { @@ -695,6 +699,18 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) if (ioctl(fd, EVIOCGABS(i), &absinfo) < 0) { continue; } + + // Pandory500 retrogames-udev-bug skip more than two axes + SDL_JoystickGetGUIDString(joystick->hwdata->guid, pandoryGUID, sizeof(pandoryGUID)); + if ( strcmp(pandoryGUID, "03000000591c00002600000010010000") == 0 // 'Retro Games LTD THEGamepad' + || strcmp(pandoryGUID, "03000000591c00002300000010010000") == 0 // ' THEC64 Joystick THEC64 Joystick ' + ) { + if (i > 1) { + printf("Pandory: retrogames-udev-bug - skipping absolute axis: 0x%.2x\n", i); + continue; + } + } + #ifdef DEBUG_INPUT_EVENTS printf("Joystick has absolute axis: 0x%.2x\n", i); printf("Values = { %d, %d, %d, %d, %d }\n", From a474155711befb054af567e9333c21314824f710 Mon Sep 17 00:00:00 2001 From: dajoho Date: Tue, 15 Aug 2023 22:57:26 +0200 Subject: [PATCH 12/12] pandory500: fix _second_ udev bug After removing all the extra axes it appears that the remaining D-PAD Y-axis occasionally triggers a D-PAD X-axis movement. This commit detects these values and normalises them to 0. --- src/joystick/linux/.SDL_sysjoystick.c.swp | Bin 0 -> 16384 bytes src/joystick/linux/SDL_sysjoystick.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/joystick/linux/.SDL_sysjoystick.c.swp diff --git a/src/joystick/linux/.SDL_sysjoystick.c.swp b/src/joystick/linux/.SDL_sysjoystick.c.swp new file mode 100644 index 0000000000000000000000000000000000000000..e2a15d5bd0b798411d63b5b325ab53ce4b96585e GIT binary patch literal 16384 zcmeHNZERfGS$;P5jK?!$ds$Sv&>y@_)ZH1!p0SgxNa8qb*5hQS>o_Kky$RVcI&<$C z&x!BcJA3ZAwx{VXt&l*pVp}0Wt9B6rvE>h4$U;E^i62`~KP1#2q(#80D-adZBDVbK z51?I&&bjx_x09`e5GwQjm>J*q<2>)j`Fee;3)|((bf&NX01pH9Xa3&4{F}dmuRfZ9 z&2D>jPc!aMw&yifolA9pF}xTWEN)2eHn)^t++eQl$yTu$e$O|Vwaa#RH4u)?W&HSw zg@t0o@r#?KwfTmS(v$Nw&Qu`ze1kcnRxSF{D&F>5z7p1M(GhNNpoJ@b%a5NHtOo!b z(TILnDNwcf(^Fd~Pb`|Le(dP`=|>;g`eF5UL?ar}h(BO1{VQq44e9>9@^ zw;O#w)c5`Uh*qQLP9OijBK}9B=Xd+~??n8MMb8(b0pfAK7x7<;_N|8B(pP{c1s zfMfmtjQEv^|HVH3e?BO1|&Ml_-k zjc7z88qtXUFB7wY9|7=neGz^b?fd^bGr&L20H2!yUYP;d4Djd-@a<{f?P=h1)4;81 zU~U>XJ`McC6!57jU~LL`Yzp|>EbvMexSj>JvcMBr;8Yg)i7fErS>XE_;EyuE=QF_X zWq?Koa5BJl2A~Wul>xq-2JWVT-$(-=O#`(wz|+9xG;lHvye|!WXA-zK34CD^`1mB? zOaf0%0zW+oq$Yvyq=0XxfWJur-$((!p8{S@0Uu2PjTEq)0`5%!e=-65@dWUN3E*QB z!0id3J^@^r0Ny(RyqN_4A_=^f1YSx4yGh`761bEE9!mn_N#NfSz_$~?>j~hK3BXSP zG66iF0Inr~?~Mar9S6QL4*dBzusaTjaiBa7{L>il#u#vS4DiN)Q)9r)7%)8seC-JE z>qmg+j{wahz!OJ+?>+>4tFgj!?{@%iI=>p5d*k$D~b*g@p?=TO6+0w(j+=nyhY1&Cv>J0l)6$) z|7@`+*?wV1sCrNhd@e1|Roqnt%WD*E?h42ET%Q#KoA1rXmgn1+iw)*0E{i+d<&r60 zk%7bgLbGKCE6&ojy6{P3AmNi@yWFLk^crVz2W9_*(d#)m;VP=xb7a+-q*<3Wcr~ca zk>$C*B42!nR}@809q!JNevv0uzO+>?(d^!1C2v-5eY+e&Cr}d}G*EVwpdCKK- zxr6-tV!oKuCcRqD@!Xv}&C=<7{`g|vK+ffIi(6}S?i}TEuFTU1Xozs09-~~2*|yBz zG*ZPOQn&JXdjB#lL_UlaXJuYL1!;mzY zs>gaoo9`8c+YD5Z?{Qb17^+va=1;uYcgin$hF!X2nqliR!&``4XMonaJb=>j>z z-Q{*TfxH^AJtiDhb$B}*z6m9can}|#6Y|npWovV_vQ~a-tF*eU+0m@n^Mu{jtLO<` zv6$mjnYEiUTBX(PN(j_=LqXQcxHwXvH6}3O1@os+TqKrRpnQC!`tH} z<9jZg%$*?SmvBtfjNe^&W3X)-7i{}*12`sJ%L!~wM+=2wp-{9u$-7?m(~t}Gqj7xN zGja3AdZl#r%ErcOiB4)5uFgc)QyqP?bP3;mT&GVjB{m6{JpC#nt?Bm(X_rfvJ5=Y) z<}%Dg51_iRSyPzT4#S`ABDOTDj;s!U*Nch$>_VaF>lqflz^H%eRXUt&y@m<}BXig| z5xZ-s0rf&5tY!0RWyKVN-;YPb)dk1gUUmIE9(s_&e4k6DpLaYz=ePW#-|`zwA2 zmoHq`6Q`Y^b2ZEDx67q;y?(RWu3^mSdCm2EslA4bzltf1v8%`okg%vkqv`MlclDm` zxf+rNxmj9k&t1B(Q8v>)ob@;sj-y3fZ=WQ8J`j@o#3G9)3a5_8wYo1i{$uWwyn-PSp)nMtCz-YYjYua#Gx37K8#jAo&h5w7CWWsc6bIdhyW zgfq(Zl(0B8SWEw;Dko`{30tqZ%u!r&+nf=Ixh?X&Kw6w^;VUVsfeuL_JjgVJFL_gP zpSz0N#C)o9;qI7dc~a~MmpP=*u=`AMt#hJ47b5eK)jckK;kiCF0^cBMI!w4uiyBPo zWtaKn2UdNKm}`eJA>t4KYc?gf1k?r(p1XH-gs3|==u#`4L%-VImeTUmS zI?0-^^BYN!?O8!5`TJhr*i?-Mv>YZHr0Psj%L`~GypM5c2GA2!|Tufoys{pVKZdDSVAbpGpmQt!5@&S5R~=_nFkAv$p2 zj?rU*s(VsbA=SB~_iVFK$79;8!FIS03THuFm>PXkdV9j=Ha*V#dEq}kXJ)AvXy04J z4|I|HdUoigL2z5cUh$eODR%0Law~aSJagu!=1(jvo~BLKpf%^Had{Q^4&hV0j8S zIt5Hl0dHr4H?qK&vcMl?f#1#opUwimngu?Y1wN4lej(}|Y-WL{v%sY+@ZK!&RtEUH z3~(<4{B;I+Ed$)m03Xi)KbHY6W`NZU@JI%DGYxz(4SXUE+)M-SNduWQkVpe#Y2Zj2 z`1&O9l}X^`N#HY+z>AZ>`Xum93iw(I_{$XVatiQMfJgx=Dd6E0kW2w@OaON$fM1*d zsuRF-6Tr_-05>LpM<#&e1n{p(;9ru!my^INN#J*qfJ_3GYQ~y0(dk5{8$2bPXhSoao}6yz+a66cgKNG zjRSk*!1_2aKMo|vfw#widt<<#jsd?l2K@3EP#**M7+{Y9r7>V-EUbl}j9+;8e@?|& z+7oBV=ZciSe2V=2(4C9AjHd-^%Z6XT#A; zPT95j!F}b{Sz{>B5?9l`qGkYGExU&*pyW+!b?``amn~^ay*db_JkNN|&YyiaF zf}Y-hkqw=RG3hNlr!Sll&VlFi=XDq0aIU^cAI^<#hQ=%r>1#bLlOAvWeCLj@H%SAc z7yObD3_oevDCg0 zfe(|_PW6|oS@uoiCSJ&BwhiaLC2WFBtSwBernoc*U)`7MFVx-)>BVhBian-yJnmD> z=|pOda=H(FI!|Jb4kUNxs3p166%0*-xiCd~Q`{=B1L5CX)E(=E-i$m*XQ59=2T}u| z4}Um>&{Y{45-mT_UL%G#`>V*Ap!ee ziEdcp)wMyz|B2Avj|QXi-?L6Y<^TWy literal 0 HcmV?d00001 diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index e8d4b6150..44f8591b7 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -920,6 +920,9 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value) { struct axis_correct *correct; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + char pandoryGUID[1024]; + correct = &joystick->hwdata->abs_correct[which]; if (correct->used) { value *= 2; @@ -941,6 +944,17 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value) if (value > 32767) return 32767; + + // Pandory500 retrogames-udev-bug - correct spurious axis movement + SDL_JoystickGetGUIDString(joystick->hwdata->guid, pandoryGUID, sizeof(pandoryGUID)); + if ( strcmp(pandoryGUID, "03000000591c00002600000010010000") == 0 // 'Retro Games LTD THEGamepad' + || strcmp(pandoryGUID, "03000000591c00002300000010010000") == 0 // ' THEC64 Joystick THEC64 Joystick ' + ) { + if (value == 127 || value == 255) { + return 0; + } + } + return value; }