removed QNX support.
This commit is contained in:
parent
b6604a456f
commit
5cedc2f1ff
22 changed files with 5 additions and 1641 deletions
47
configure
vendored
47
configure
vendored
|
@ -18125,14 +18125,7 @@ case "$host" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
INCLUDE="-I$srcdir/include"
|
INCLUDE="-I$srcdir/include"
|
||||||
|
INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos"
|
||||||
case "$host" in
|
|
||||||
*-*-nto-qnx*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-haiku*)
|
*-*-haiku*)
|
||||||
|
@ -24507,32 +24500,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_OFFSCREEN 1" >>confdefs.h
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckQNXVideo()
|
|
||||||
{
|
|
||||||
if test x$enable_video = xyes; then
|
|
||||||
|
|
||||||
printf "%s\n" "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h
|
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
|
|
||||||
have_video=yes
|
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
|
|
||||||
SUMMARY_video="${SUMMARY_video} qnx"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckQNXAudio()
|
|
||||||
{
|
|
||||||
if test x$enable_audio = xyes; then
|
|
||||||
|
|
||||||
printf "%s\n" "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h
|
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
|
|
||||||
have_audio=yes
|
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
|
|
||||||
SUMMARY_audio="${SUMMARY_audio} qsa"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check whether --enable-video-opengl was given.
|
# Check whether --enable-video-opengl was given.
|
||||||
if test ${enable_video_opengl+y}
|
if test ${enable_video_opengl+y}
|
||||||
then :
|
then :
|
||||||
|
@ -25727,10 +25694,6 @@ fi
|
||||||
pthread_cflags="-D_REENTRANT"
|
pthread_cflags="-D_REENTRANT"
|
||||||
pthread_lib=""
|
pthread_lib=""
|
||||||
;;
|
;;
|
||||||
*-*-nto*)
|
|
||||||
pthread_cflags="-D_REENTRANT"
|
|
||||||
pthread_lib=""
|
|
||||||
;;
|
|
||||||
*-*-emscripten*)
|
*-*-emscripten*)
|
||||||
pthread_cflags="-D_REENTRANT -pthread"
|
pthread_cflags="-D_REENTRANT -pthread"
|
||||||
pthread_lib="-pthread"
|
pthread_lib="-pthread"
|
||||||
|
@ -27201,7 +27164,7 @@ CheckEventSignals
|
||||||
have_locale=no
|
have_locale=no
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
|
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-android*)
|
*-*-android*)
|
||||||
# Android
|
# Android
|
||||||
|
@ -27237,9 +27200,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
|
||||||
*-*-hpux*) ARCH=hpux ;;
|
*-*-hpux*) ARCH=hpux ;;
|
||||||
*-*-aix*) ARCH=aix ;;
|
*-*-aix*) ARCH=aix ;;
|
||||||
*-*-minix*) ARCH=minix ;;
|
*-*-minix*) ARCH=minix ;;
|
||||||
*-*-nto*) ARCH=nto
|
|
||||||
CheckQNXVideo
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
CheckVisibilityHidden
|
CheckVisibilityHidden
|
||||||
CheckWerror
|
CheckWerror
|
||||||
|
@ -27337,9 +27297,6 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h
|
||||||
|
|
||||||
have_audio=yes
|
have_audio=yes
|
||||||
;;
|
;;
|
||||||
nto)
|
|
||||||
CheckQNXAudio
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
# Set up files for the joystick library
|
# Set up files for the joystick library
|
||||||
|
|
46
configure.ac
46
configure.ac
|
@ -88,15 +88,7 @@ esac
|
||||||
|
|
||||||
dnl Set up the compiler and linker flags
|
dnl Set up the compiler and linker flags
|
||||||
INCLUDE="-I$srcdir/include"
|
INCLUDE="-I$srcdir/include"
|
||||||
|
INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos"
|
||||||
dnl Don't use our khronos headers on QNX.
|
|
||||||
case "$host" in
|
|
||||||
*-*-nto-qnx*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
dnl use CXX for linker on Haiku
|
dnl use CXX for linker on Haiku
|
||||||
case "$host" in
|
case "$host" in
|
||||||
|
@ -2162,30 +2154,6 @@ CheckOffscreenVideo()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
dnl Set up the QNX video driver if enabled
|
|
||||||
CheckQNXVideo()
|
|
||||||
{
|
|
||||||
if test x$enable_video = xyes; then
|
|
||||||
AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
|
|
||||||
SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
|
|
||||||
have_video=yes
|
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
|
|
||||||
SUMMARY_video="${SUMMARY_video} qnx"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dnl Set up the QNX audio driver if enabled
|
|
||||||
CheckQNXAudio()
|
|
||||||
{
|
|
||||||
if test x$enable_audio = xyes; then
|
|
||||||
AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
|
|
||||||
SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
|
|
||||||
have_audio=yes
|
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
|
|
||||||
SUMMARY_audio="${SUMMARY_audio} qsa"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dnl Check to see if OpenGL support is desired
|
dnl Check to see if OpenGL support is desired
|
||||||
AC_ARG_ENABLE(video-opengl,
|
AC_ARG_ENABLE(video-opengl,
|
||||||
[AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [default=yes]])],
|
[AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [default=yes]])],
|
||||||
|
@ -2806,10 +2774,6 @@ dnl This is used on Linux for glibc binary compatibility (Doh!)
|
||||||
pthread_cflags="-D_REENTRANT"
|
pthread_cflags="-D_REENTRANT"
|
||||||
pthread_lib=""
|
pthread_lib=""
|
||||||
;;
|
;;
|
||||||
*-*-nto*)
|
|
||||||
pthread_cflags="-D_REENTRANT"
|
|
||||||
pthread_lib=""
|
|
||||||
;;
|
|
||||||
*-*-emscripten*)
|
*-*-emscripten*)
|
||||||
pthread_cflags="-D_REENTRANT -pthread"
|
pthread_cflags="-D_REENTRANT -pthread"
|
||||||
pthread_lib="-pthread"
|
pthread_lib="-pthread"
|
||||||
|
@ -3436,7 +3400,7 @@ have_locale=no
|
||||||
|
|
||||||
dnl Set up the configuration based on the host platform!
|
dnl Set up the configuration based on the host platform!
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
|
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-android*)
|
*-*-android*)
|
||||||
# Android
|
# Android
|
||||||
|
@ -3470,9 +3434,6 @@ case "$host" in
|
||||||
*-*-hpux*) ARCH=hpux ;;
|
*-*-hpux*) ARCH=hpux ;;
|
||||||
*-*-aix*) ARCH=aix ;;
|
*-*-aix*) ARCH=aix ;;
|
||||||
*-*-minix*) ARCH=minix ;;
|
*-*-minix*) ARCH=minix ;;
|
||||||
*-*-nto*) ARCH=nto
|
|
||||||
CheckQNXVideo
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
CheckVisibilityHidden
|
CheckVisibilityHidden
|
||||||
CheckWerror
|
CheckWerror
|
||||||
|
@ -3562,9 +3523,6 @@ case "$host" in
|
||||||
|
|
||||||
have_audio=yes
|
have_audio=yes
|
||||||
;;
|
;;
|
||||||
nto)
|
|
||||||
CheckQNXAudio
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
# Set up files for the joystick library
|
# Set up files for the joystick library
|
||||||
|
|
|
@ -200,11 +200,6 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
|
||||||
typedef void (*SDL_KernelMemoryBarrierFunc)();
|
typedef void (*SDL_KernelMemoryBarrierFunc)();
|
||||||
#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
||||||
#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
||||||
#elif 0 /* defined(__QNXNTO__) */
|
|
||||||
#include <sys/cpuinline.h>
|
|
||||||
|
|
||||||
#define SDL_MemoryBarrierRelease() __cpu_membarrier()
|
|
||||||
#define SDL_MemoryBarrierAcquire() __cpu_membarrier()
|
|
||||||
#else
|
#else
|
||||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__)
|
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__)
|
||||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||||
|
|
|
@ -305,7 +305,6 @@
|
||||||
#cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC @SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC@
|
#cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC @SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC@
|
||||||
#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
|
#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
|
||||||
#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
|
#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
|
||||||
#cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@
|
|
||||||
#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@
|
#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@
|
||||||
#cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@
|
#cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@
|
||||||
#cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@
|
#cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@
|
||||||
|
@ -394,7 +393,6 @@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
|
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
|
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
|
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_QNX @SDL_VIDEO_DRIVER_QNX@
|
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_RISCOS @SDL_VIDEO_DRIVER_RISCOS@
|
#cmakedefine SDL_VIDEO_DRIVER_RISCOS @SDL_VIDEO_DRIVER_RISCOS@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_PSP @SDL_VIDEO_DRIVER_PSP@
|
#cmakedefine SDL_VIDEO_DRIVER_PSP @SDL_VIDEO_DRIVER_PSP@
|
||||||
#cmakedefine SDL_VIDEO_DRIVER_PS2 @SDL_VIDEO_DRIVER_PS2@
|
#cmakedefine SDL_VIDEO_DRIVER_PS2 @SDL_VIDEO_DRIVER_PS2@
|
||||||
|
|
|
@ -292,7 +292,6 @@
|
||||||
#undef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC
|
#undef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC
|
||||||
#undef SDL_AUDIO_DRIVER_PULSEAUDIO
|
#undef SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||||
#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
|
#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
|
||||||
#undef SDL_AUDIO_DRIVER_QSA
|
|
||||||
#undef SDL_AUDIO_DRIVER_WASAPI
|
#undef SDL_AUDIO_DRIVER_WASAPI
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
|
@ -388,7 +387,6 @@
|
||||||
#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
|
#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
|
||||||
#undef SDL_VIDEO_DRIVER_VIVANTE
|
#undef SDL_VIDEO_DRIVER_VIVANTE
|
||||||
#undef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
#undef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
||||||
#undef SDL_VIDEO_DRIVER_QNX
|
|
||||||
#undef SDL_VIDEO_DRIVER_RISCOS
|
#undef SDL_VIDEO_DRIVER_RISCOS
|
||||||
|
|
||||||
#undef SDL_VIDEO_RENDER_D3D
|
#undef SDL_VIDEO_RENDER_D3D
|
||||||
|
|
|
@ -45,9 +45,6 @@ static const AudioBootStrap *const bootstrap[] = {
|
||||||
#if SDL_AUDIO_DRIVER_NETBSD
|
#if SDL_AUDIO_DRIVER_NETBSD
|
||||||
&NETBSDAUDIO_bootstrap,
|
&NETBSDAUDIO_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_QSA
|
|
||||||
&QSAAUDIO_bootstrap,
|
|
||||||
#endif
|
|
||||||
#if SDL_AUDIO_DRIVER_WASAPI
|
#if SDL_AUDIO_DRIVER_WASAPI
|
||||||
&WASAPI_bootstrap,
|
&WASAPI_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -186,7 +186,6 @@ extern AudioBootStrap PULSEAUDIO_bootstrap;
|
||||||
extern AudioBootStrap ALSA_bootstrap;
|
extern AudioBootStrap ALSA_bootstrap;
|
||||||
extern AudioBootStrap NETBSDAUDIO_bootstrap;
|
extern AudioBootStrap NETBSDAUDIO_bootstrap;
|
||||||
extern AudioBootStrap DSP_bootstrap;
|
extern AudioBootStrap DSP_bootstrap;
|
||||||
extern AudioBootStrap QSAAUDIO_bootstrap;
|
|
||||||
extern AudioBootStrap WASAPI_bootstrap;
|
extern AudioBootStrap WASAPI_bootstrap;
|
||||||
extern AudioBootStrap DSOUND_bootstrap;
|
extern AudioBootStrap DSOUND_bootstrap;
|
||||||
extern AudioBootStrap WINMM_bootstrap;
|
extern AudioBootStrap WINMM_bootstrap;
|
||||||
|
|
|
@ -1,627 +0,0 @@
|
||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2022 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* !!! FIXME: streamline this a little by removing all the
|
|
||||||
* !!! FIXME: if (capture) {} else {} sections that are identical
|
|
||||||
* !!! FIXME: except for one flag.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* !!! FIXME: can this target support hotplugging? */
|
|
||||||
/* !!! FIXME: ...does SDL even support QNX? */
|
|
||||||
|
|
||||||
#include "../../SDL_internal.h"
|
|
||||||
|
|
||||||
#if SDL_AUDIO_DRIVER_QSA
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sched.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/neutrino.h>
|
|
||||||
#include <sys/asoundlib.h>
|
|
||||||
|
|
||||||
#include "SDL_timer.h"
|
|
||||||
#include "SDL_audio.h"
|
|
||||||
#include "../../core/unix/SDL_poll.h"
|
|
||||||
#include "../SDL_audio_c.h"
|
|
||||||
#include "SDL_qsa_audio.h"
|
|
||||||
|
|
||||||
/* default channel communication parameters */
|
|
||||||
#define DEFAULT_CPARAMS_RATE 44100
|
|
||||||
#define DEFAULT_CPARAMS_VOICES 1
|
|
||||||
|
|
||||||
#define DEFAULT_CPARAMS_FRAG_SIZE 4096
|
|
||||||
#define DEFAULT_CPARAMS_FRAGS_MIN 1
|
|
||||||
#define DEFAULT_CPARAMS_FRAGS_MAX 1
|
|
||||||
|
|
||||||
/* List of found devices */
|
|
||||||
#define QSA_MAX_DEVICES 32
|
|
||||||
#define QSA_MAX_NAME_LENGTH 81+16 /* Hardcoded in QSA, can't be changed */
|
|
||||||
|
|
||||||
typedef struct _QSA_Device
|
|
||||||
{
|
|
||||||
char name[QSA_MAX_NAME_LENGTH]; /* Long audio device name for SDL */
|
|
||||||
int cardno;
|
|
||||||
int deviceno;
|
|
||||||
} QSA_Device;
|
|
||||||
|
|
||||||
QSA_Device qsa_playback_device[QSA_MAX_DEVICES];
|
|
||||||
uint32_t qsa_playback_devices;
|
|
||||||
|
|
||||||
QSA_Device qsa_capture_device[QSA_MAX_DEVICES];
|
|
||||||
uint32_t qsa_capture_devices;
|
|
||||||
|
|
||||||
static SDL_INLINE int
|
|
||||||
QSA_SetError(const char *fn, int status)
|
|
||||||
{
|
|
||||||
return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* !!! FIXME: does this need to be here? Does the SDL version not work? */
|
|
||||||
static void
|
|
||||||
QSA_ThreadInit(_THIS)
|
|
||||||
{
|
|
||||||
/* Increase default 10 priority to 25 to avoid jerky sound */
|
|
||||||
struct sched_param param;
|
|
||||||
if (SchedGet(0, 0, ¶m) != -1) {
|
|
||||||
param.sched_priority = param.sched_curpriority + 15;
|
|
||||||
SchedSet(0, 0, SCHED_NOCHANGE, ¶m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PCM channel parameters initialize function */
|
|
||||||
static void
|
|
||||||
QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
|
|
||||||
{
|
|
||||||
SDL_zerop(cpars);
|
|
||||||
cpars->channel = SND_PCM_CHANNEL_PLAYBACK;
|
|
||||||
cpars->mode = SND_PCM_MODE_BLOCK;
|
|
||||||
cpars->start_mode = SND_PCM_START_DATA;
|
|
||||||
cpars->stop_mode = SND_PCM_STOP_STOP;
|
|
||||||
cpars->format.format = SND_PCM_SFMT_S16_LE;
|
|
||||||
cpars->format.interleave = 1;
|
|
||||||
cpars->format.rate = DEFAULT_CPARAMS_RATE;
|
|
||||||
cpars->format.voices = DEFAULT_CPARAMS_VOICES;
|
|
||||||
cpars->buf.block.frag_size = DEFAULT_CPARAMS_FRAG_SIZE;
|
|
||||||
cpars->buf.block.frags_min = DEFAULT_CPARAMS_FRAGS_MIN;
|
|
||||||
cpars->buf.block.frags_max = DEFAULT_CPARAMS_FRAGS_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function waits until it is possible to write a full sound buffer */
|
|
||||||
static void
|
|
||||||
QSA_WaitDevice(_THIS)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
|
|
||||||
/* Setup timeout for playing one fragment equal to 2 seconds */
|
|
||||||
/* If timeout occurred than something wrong with hardware or driver */
|
|
||||||
/* For example, Vortex 8820 audio driver stucks on second DAC because */
|
|
||||||
/* it doesn't exist ! */
|
|
||||||
result = SDL_IOReady(this->hidden->audio_fd,
|
|
||||||
this->iscapture ? SDL_IOR_READ : SDL_IOR_WRITE,
|
|
||||||
2 * 1000);
|
|
||||||
switch (result) {
|
|
||||||
case -1:
|
|
||||||
SDL_SetError("QSA: SDL_IOReady() failed: %s", strerror(errno));
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
SDL_SetError("QSA: timeout on buffer waiting occurred");
|
|
||||||
this->hidden->timeout_on_wait = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this->hidden->timeout_on_wait = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
QSA_PlayDevice(_THIS)
|
|
||||||
{
|
|
||||||
snd_pcm_channel_status_t cstatus;
|
|
||||||
int written;
|
|
||||||
int status;
|
|
||||||
int towrite;
|
|
||||||
void *pcmbuffer;
|
|
||||||
|
|
||||||
if (!SDL_AtomicGet(&this->enabled) || !this->hidden) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
towrite = this->spec.size;
|
|
||||||
pcmbuffer = this->hidden->pcm_buf;
|
|
||||||
|
|
||||||
/* Write the audio data, checking for EAGAIN (buffer full) and underrun */
|
|
||||||
do {
|
|
||||||
written =
|
|
||||||
snd_pcm_plugin_write(this->hidden->audio_handle, pcmbuffer,
|
|
||||||
towrite);
|
|
||||||
if (written != towrite) {
|
|
||||||
/* Check if samples playback got stuck somewhere in hardware or in */
|
|
||||||
/* the audio device driver */
|
|
||||||
if ((errno == EAGAIN) && (written == 0)) {
|
|
||||||
if (this->hidden->timeout_on_wait != 0) {
|
|
||||||
SDL_SetError("QSA: buffer playback timeout");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for errors or conditions */
|
|
||||||
if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
|
|
||||||
/* Let a little CPU time go by and try to write again */
|
|
||||||
SDL_Delay(1);
|
|
||||||
|
|
||||||
/* if we wrote some data */
|
|
||||||
towrite -= written;
|
|
||||||
pcmbuffer += written * this->spec.channels;
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
if ((errno == EINVAL) || (errno == EIO)) {
|
|
||||||
SDL_zero(cstatus);
|
|
||||||
if (!this->iscapture) {
|
|
||||||
cstatus.channel = SND_PCM_CHANNEL_PLAYBACK;
|
|
||||||
} else {
|
|
||||||
cstatus.channel = SND_PCM_CHANNEL_CAPTURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
status =
|
|
||||||
snd_pcm_plugin_status(this->hidden->audio_handle,
|
|
||||||
&cstatus);
|
|
||||||
if (status < 0) {
|
|
||||||
QSA_SetError("snd_pcm_plugin_status", status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((cstatus.status == SND_PCM_STATUS_UNDERRUN) ||
|
|
||||||
(cstatus.status == SND_PCM_STATUS_READY)) {
|
|
||||||
if (!this->iscapture) {
|
|
||||||
status =
|
|
||||||
snd_pcm_plugin_prepare(this->hidden->
|
|
||||||
audio_handle,
|
|
||||||
SND_PCM_CHANNEL_PLAYBACK);
|
|
||||||
} else {
|
|
||||||
status =
|
|
||||||
snd_pcm_plugin_prepare(this->hidden->
|
|
||||||
audio_handle,
|
|
||||||
SND_PCM_CHANNEL_CAPTURE);
|
|
||||||
}
|
|
||||||
if (status < 0) {
|
|
||||||
QSA_SetError("snd_pcm_plugin_prepare", status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* we wrote all remaining data */
|
|
||||||
towrite -= written;
|
|
||||||
pcmbuffer += written * this->spec.channels;
|
|
||||||
}
|
|
||||||
} while ((towrite > 0) && SDL_AtomicGet(&this->enabled));
|
|
||||||
|
|
||||||
/* If we couldn't write, assume fatal error for now */
|
|
||||||
if (towrite != 0) {
|
|
||||||
SDL_OpenedAudioDeviceDisconnected(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Uint8 *
|
|
||||||
QSA_GetDeviceBuf(_THIS)
|
|
||||||
{
|
|
||||||
return this->hidden->pcm_buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
QSA_CloseDevice(_THIS)
|
|
||||||
{
|
|
||||||
if (this->hidden->audio_handle != NULL) {
|
|
||||||
if (!this->iscapture) {
|
|
||||||
/* Finish playing available samples */
|
|
||||||
snd_pcm_plugin_flush(this->hidden->audio_handle,
|
|
||||||
SND_PCM_CHANNEL_PLAYBACK);
|
|
||||||
} else {
|
|
||||||
/* Cancel unread samples during capture */
|
|
||||||
snd_pcm_plugin_flush(this->hidden->audio_handle,
|
|
||||||
SND_PCM_CHANNEL_CAPTURE);
|
|
||||||
}
|
|
||||||
snd_pcm_close(this->hidden->audio_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_free(this->hidden->pcm_buf);
|
|
||||||
SDL_free(this->hidden);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
QSA_OpenDevice(_THIS, const char *devname)
|
|
||||||
{
|
|
||||||
const QSA_Device *device = (const QSA_Device *) this->handle;
|
|
||||||
SDL_bool iscapture = this->iscapture;
|
|
||||||
int status = 0;
|
|
||||||
int format = 0;
|
|
||||||
SDL_AudioFormat test_format;
|
|
||||||
snd_pcm_channel_setup_t csetup;
|
|
||||||
snd_pcm_channel_params_t cparams;
|
|
||||||
|
|
||||||
/* Initialize all variables that we clean on shutdown */
|
|
||||||
this->hidden =
|
|
||||||
(struct SDL_PrivateAudioData *) SDL_calloc(1,
|
|
||||||
(sizeof
|
|
||||||
(struct
|
|
||||||
SDL_PrivateAudioData)));
|
|
||||||
if (this->hidden == NULL) {
|
|
||||||
return SDL_OutOfMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize channel transfer parameters to default */
|
|
||||||
QSA_InitAudioParams(&cparams);
|
|
||||||
|
|
||||||
if (device != NULL) {
|
|
||||||
/* Open requested audio device */
|
|
||||||
this->hidden->deviceno = device->deviceno;
|
|
||||||
this->hidden->cardno = device->cardno;
|
|
||||||
status = snd_pcm_open(&this->hidden->audio_handle,
|
|
||||||
device->cardno, device->deviceno,
|
|
||||||
iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK);
|
|
||||||
} else {
|
|
||||||
/* Open system default audio device */
|
|
||||||
status = snd_pcm_open_preferred(&this->hidden->audio_handle,
|
|
||||||
&this->hidden->cardno,
|
|
||||||
&this->hidden->deviceno,
|
|
||||||
iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if requested device is opened */
|
|
||||||
if (status < 0) {
|
|
||||||
this->hidden->audio_handle = NULL;
|
|
||||||
return QSA_SetError("snd_pcm_open", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try for a closest match on audio format */
|
|
||||||
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
|
|
||||||
/* if match found set format to equivalent QSA format */
|
|
||||||
switch (test_format) {
|
|
||||||
case AUDIO_U8:
|
|
||||||
format = SND_PCM_SFMT_U8;
|
|
||||||
break;
|
|
||||||
case AUDIO_S8:
|
|
||||||
format = SND_PCM_SFMT_S8;
|
|
||||||
break;
|
|
||||||
case AUDIO_S16LSB:
|
|
||||||
format = SND_PCM_SFMT_S16_LE;
|
|
||||||
break;
|
|
||||||
case AUDIO_S16MSB:
|
|
||||||
format = SND_PCM_SFMT_S16_BE;
|
|
||||||
break;
|
|
||||||
case AUDIO_U16LSB:
|
|
||||||
format = SND_PCM_SFMT_U16_LE;
|
|
||||||
break;
|
|
||||||
case AUDIO_U16MSB:
|
|
||||||
format = SND_PCM_SFMT_U16_BE;
|
|
||||||
break;
|
|
||||||
case AUDIO_S32LSB:
|
|
||||||
format = SND_PCM_SFMT_S32_LE;
|
|
||||||
break;
|
|
||||||
case AUDIO_S32MSB:
|
|
||||||
format = SND_PCM_SFMT_S32_BE;
|
|
||||||
break;
|
|
||||||
case AUDIO_F32LSB:
|
|
||||||
format = SND_PCM_SFMT_FLOAT_LE;
|
|
||||||
break;
|
|
||||||
case AUDIO_F32MSB:
|
|
||||||
format = SND_PCM_SFMT_FLOAT_BE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* assumes test_format not 0 on success */
|
|
||||||
/* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */
|
|
||||||
if (!test_format) {
|
|
||||||
return SDL_SetError("%s: Unsupported audio format", "qsa");
|
|
||||||
}
|
|
||||||
this->spec.format = test_format;
|
|
||||||
|
|
||||||
/* Set the audio format */
|
|
||||||
cparams.format.format = format;
|
|
||||||
|
|
||||||
/* Set mono/stereo/4ch/6ch/8ch audio */
|
|
||||||
cparams.format.voices = this->spec.channels;
|
|
||||||
|
|
||||||
/* Set rate */
|
|
||||||
cparams.format.rate = this->spec.freq;
|
|
||||||
|
|
||||||
/* Setup the transfer parameters according to cparams */
|
|
||||||
status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams);
|
|
||||||
if (status < 0) {
|
|
||||||
return QSA_SetError("snd_pcm_plugin_params", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure channel is setup right one last time */
|
|
||||||
SDL_zero(csetup);
|
|
||||||
if (!this->iscapture) {
|
|
||||||
csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
|
|
||||||
} else {
|
|
||||||
csetup.channel = SND_PCM_CHANNEL_CAPTURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup an audio channel */
|
|
||||||
if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) {
|
|
||||||
return SDL_SetError("QSA: Unable to setup channel");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calculate the final parameters for this audio specification */
|
|
||||||
SDL_CalculateAudioSpec(&this->spec);
|
|
||||||
|
|
||||||
this->hidden->pcm_len = this->spec.size;
|
|
||||||
|
|
||||||
if (this->hidden->pcm_len == 0) {
|
|
||||||
this->hidden->pcm_len =
|
|
||||||
csetup.buf.block.frag_size * this->spec.channels *
|
|
||||||
(snd_pcm_format_width(format) / 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate memory to the audio buffer and initialize with silence
|
|
||||||
* (Note that buffer size must be a multiple of fragment size, so find
|
|
||||||
* closest multiple)
|
|
||||||
*/
|
|
||||||
this->hidden->pcm_buf =
|
|
||||||
(Uint8 *) SDL_malloc(this->hidden->pcm_len);
|
|
||||||
if (this->hidden->pcm_buf == NULL) {
|
|
||||||
return SDL_OutOfMemory();
|
|
||||||
}
|
|
||||||
SDL_memset(this->hidden->pcm_buf, this->spec.silence,
|
|
||||||
this->hidden->pcm_len);
|
|
||||||
|
|
||||||
/* get the file descriptor */
|
|
||||||
if (!this->iscapture) {
|
|
||||||
this->hidden->audio_fd =
|
|
||||||
snd_pcm_file_descriptor(this->hidden->audio_handle,
|
|
||||||
SND_PCM_CHANNEL_PLAYBACK);
|
|
||||||
} else {
|
|
||||||
this->hidden->audio_fd =
|
|
||||||
snd_pcm_file_descriptor(this->hidden->audio_handle,
|
|
||||||
SND_PCM_CHANNEL_CAPTURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->hidden->audio_fd < 0) {
|
|
||||||
return QSA_SetError("snd_pcm_file_descriptor", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Prepare an audio channel */
|
|
||||||
if (!this->iscapture) {
|
|
||||||
/* Prepare audio playback */
|
|
||||||
status =
|
|
||||||
snd_pcm_plugin_prepare(this->hidden->audio_handle,
|
|
||||||
SND_PCM_CHANNEL_PLAYBACK);
|
|
||||||
} else {
|
|
||||||
/* Prepare audio capture */
|
|
||||||
status =
|
|
||||||
snd_pcm_plugin_prepare(this->hidden->audio_handle,
|
|
||||||
SND_PCM_CHANNEL_CAPTURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status < 0) {
|
|
||||||
return QSA_SetError("snd_pcm_plugin_prepare", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We're really ready to rock and roll. :-) */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
QSA_DetectDevices(void)
|
|
||||||
{
|
|
||||||
uint32_t it;
|
|
||||||
uint32_t cards;
|
|
||||||
uint32_t devices;
|
|
||||||
int32_t status;
|
|
||||||
|
|
||||||
/* Detect amount of available devices */
|
|
||||||
/* this value can be changed in the runtime */
|
|
||||||
cards = snd_cards();
|
|
||||||
|
|
||||||
/* If io-audio manager is not running we will get 0 as number */
|
|
||||||
/* of available audio devices */
|
|
||||||
if (cards == 0) {
|
|
||||||
/* We have no any available audio devices */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* !!! FIXME: code duplication */
|
|
||||||
/* Find requested devices by type */
|
|
||||||
{ /* output devices */
|
|
||||||
/* Playback devices enumeration requested */
|
|
||||||
for (it = 0; it < cards; it++) {
|
|
||||||
devices = 0;
|
|
||||||
do {
|
|
||||||
status =
|
|
||||||
snd_card_get_longname(it,
|
|
||||||
qsa_playback_device
|
|
||||||
[qsa_playback_devices].name,
|
|
||||||
QSA_MAX_NAME_LENGTH);
|
|
||||||
if (status == EOK) {
|
|
||||||
snd_pcm_t *handle;
|
|
||||||
|
|
||||||
/* Add device number to device name */
|
|
||||||
sprintf(qsa_playback_device[qsa_playback_devices].name +
|
|
||||||
SDL_strlen(qsa_playback_device
|
|
||||||
[qsa_playback_devices].name), " d%d",
|
|
||||||
devices);
|
|
||||||
|
|
||||||
/* Store associated card number id */
|
|
||||||
qsa_playback_device[qsa_playback_devices].cardno = it;
|
|
||||||
|
|
||||||
/* Check if this device id could play anything */
|
|
||||||
status =
|
|
||||||
snd_pcm_open(&handle, it, devices,
|
|
||||||
SND_PCM_OPEN_PLAYBACK);
|
|
||||||
if (status == EOK) {
|
|
||||||
qsa_playback_device[qsa_playback_devices].deviceno =
|
|
||||||
devices;
|
|
||||||
status = snd_pcm_close(handle);
|
|
||||||
if (status == EOK) {
|
|
||||||
/* Note that spec is NULL, because we are required to open the device before
|
|
||||||
* acquiring the mix format, making this information inaccessible at
|
|
||||||
* enumeration time
|
|
||||||
*/
|
|
||||||
SDL_AddAudioDevice(SDL_FALSE, qsa_playback_device[qsa_playback_devices].name, NULL, &qsa_playback_device[qsa_playback_devices]);
|
|
||||||
qsa_playback_devices++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Check if we got end of devices list */
|
|
||||||
if (status == -ENOENT) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if we reached maximum devices count */
|
|
||||||
if (qsa_playback_devices >= QSA_MAX_DEVICES) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
devices++;
|
|
||||||
} while (1);
|
|
||||||
|
|
||||||
/* Check if we reached maximum devices count */
|
|
||||||
if (qsa_playback_devices >= QSA_MAX_DEVICES) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{ /* capture devices */
|
|
||||||
/* Capture devices enumeration requested */
|
|
||||||
for (it = 0; it < cards; it++) {
|
|
||||||
devices = 0;
|
|
||||||
do {
|
|
||||||
status =
|
|
||||||
snd_card_get_longname(it,
|
|
||||||
qsa_capture_device
|
|
||||||
[qsa_capture_devices].name,
|
|
||||||
QSA_MAX_NAME_LENGTH);
|
|
||||||
if (status == EOK) {
|
|
||||||
snd_pcm_t *handle;
|
|
||||||
|
|
||||||
/* Add device number to device name */
|
|
||||||
sprintf(qsa_capture_device[qsa_capture_devices].name +
|
|
||||||
SDL_strlen(qsa_capture_device
|
|
||||||
[qsa_capture_devices].name), " d%d",
|
|
||||||
devices);
|
|
||||||
|
|
||||||
/* Store associated card number id */
|
|
||||||
qsa_capture_device[qsa_capture_devices].cardno = it;
|
|
||||||
|
|
||||||
/* Check if this device id could play anything */
|
|
||||||
status =
|
|
||||||
snd_pcm_open(&handle, it, devices,
|
|
||||||
SND_PCM_OPEN_CAPTURE);
|
|
||||||
if (status == EOK) {
|
|
||||||
qsa_capture_device[qsa_capture_devices].deviceno =
|
|
||||||
devices;
|
|
||||||
status = snd_pcm_close(handle);
|
|
||||||
if (status == EOK) {
|
|
||||||
/* Note that spec is NULL, because we are required to open the device before
|
|
||||||
* acquiring the mix format, making this information inaccessible at
|
|
||||||
* enumeration time
|
|
||||||
*/
|
|
||||||
SDL_AddAudioDevice(SDL_TRUE, qsa_capture_device[qsa_capture_devices].name, NULL, &qsa_capture_device[qsa_capture_devices]);
|
|
||||||
qsa_capture_devices++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Check if we got end of devices list */
|
|
||||||
if (status == -ENOENT) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if we reached maximum devices count */
|
|
||||||
if (qsa_capture_devices >= QSA_MAX_DEVICES) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
devices++;
|
|
||||||
} while (1);
|
|
||||||
|
|
||||||
/* Check if we reached maximum devices count */
|
|
||||||
if (qsa_capture_devices >= QSA_MAX_DEVICES) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
QSA_Deinitialize(void)
|
|
||||||
{
|
|
||||||
/* Clear devices array on shutdown */
|
|
||||||
/* !!! FIXME: we zero these on init...any reason to do it here? */
|
|
||||||
SDL_zeroa(qsa_playback_device);
|
|
||||||
SDL_zeroa(qsa_capture_device);
|
|
||||||
qsa_playback_devices = 0;
|
|
||||||
qsa_capture_devices = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static SDL_bool
|
|
||||||
QSA_Init(SDL_AudioDriverImpl * impl)
|
|
||||||
{
|
|
||||||
/* Clear devices array */
|
|
||||||
SDL_zeroa(qsa_playback_device);
|
|
||||||
SDL_zeroa(qsa_capture_device);
|
|
||||||
qsa_playback_devices = 0;
|
|
||||||
qsa_capture_devices = 0;
|
|
||||||
|
|
||||||
/* Set function pointers */
|
|
||||||
/* DeviceLock and DeviceUnlock functions are used default, */
|
|
||||||
/* provided by SDL, which uses pthread_mutex for lock/unlock */
|
|
||||||
impl->DetectDevices = QSA_DetectDevices;
|
|
||||||
impl->OpenDevice = QSA_OpenDevice;
|
|
||||||
impl->ThreadInit = QSA_ThreadInit;
|
|
||||||
impl->WaitDevice = QSA_WaitDevice;
|
|
||||||
impl->PlayDevice = QSA_PlayDevice;
|
|
||||||
impl->GetDeviceBuf = QSA_GetDeviceBuf;
|
|
||||||
impl->CloseDevice = QSA_CloseDevice;
|
|
||||||
impl->Deinitialize = QSA_Deinitialize;
|
|
||||||
|
|
||||||
impl->HasCaptureSupport = SDL_TRUE;
|
|
||||||
|
|
||||||
return SDL_TRUE; /* this audio target is available. */
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioBootStrap QSAAUDIO_bootstrap = {
|
|
||||||
"qsa", "QNX QSA Audio", QSA_Init, SDL_FALSE
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* SDL_AUDIO_DRIVER_QSA */
|
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2022 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_QSA_AUDIO_H__
|
|
||||||
#define __SDL_QSA_AUDIO_H__
|
|
||||||
|
|
||||||
#include <sys/asoundlib.h>
|
|
||||||
|
|
||||||
#include "../SDL_sysaudio.h"
|
|
||||||
|
|
||||||
/* Hidden "this" pointer for the audio functions */
|
|
||||||
#define _THIS SDL_AudioDevice* this
|
|
||||||
|
|
||||||
struct SDL_PrivateAudioData
|
|
||||||
{
|
|
||||||
/* The audio device handle */
|
|
||||||
int cardno;
|
|
||||||
int deviceno;
|
|
||||||
snd_pcm_t *audio_handle;
|
|
||||||
|
|
||||||
/* The audio file descriptor */
|
|
||||||
int audio_fd;
|
|
||||||
|
|
||||||
/* Select timeout status */
|
|
||||||
uint32_t timeout_on_wait;
|
|
||||||
|
|
||||||
/* Raw mixing buffer */
|
|
||||||
Uint8 *pcm_buf;
|
|
||||||
Uint32 pcm_len;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* __SDL_QSA_AUDIO_H__ */
|
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
|
@ -54,10 +54,6 @@
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__QNXNTO__)
|
|
||||||
#include <sys/syspage.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__arm__)
|
#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__arm__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -476,8 +472,6 @@ CPU_haveNEON(void)
|
||||||
if (elf_aux_info(AT_HWCAP, (void *)&hasneon, (int)sizeof(hasneon)) != 0)
|
if (elf_aux_info(AT_HWCAP, (void *)&hasneon, (int)sizeof(hasneon)) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
return ((hasneon & HWCAP_NEON) == HWCAP_NEON);
|
return ((hasneon & HWCAP_NEON) == HWCAP_NEON);
|
||||||
#elif defined(__QNXNTO__)
|
|
||||||
return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON;
|
|
||||||
#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
|
#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
|
||||||
return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON);
|
return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON);
|
||||||
#elif defined(__LINUX__)
|
#elif defined(__LINUX__)
|
||||||
|
|
|
@ -334,7 +334,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__QNX__)
|
#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
|
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,14 +19,10 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* We won't get fseeko64 on QNX if _LARGEFILE64_SOURCE is defined, but the
|
|
||||||
configure script knows the C runtime has it and enables it. */
|
|
||||||
#ifndef __QNXNTO__
|
|
||||||
/* Need this so Linux systems define fseek64o, ftell64o and off64_t */
|
/* Need this so Linux systems define fseek64o, ftell64o and off64_t */
|
||||||
#ifndef _LARGEFILE64_SOURCE
|
#ifndef _LARGEFILE64_SOURCE
|
||||||
#define _LARGEFILE64_SOURCE
|
#define _LARGEFILE64_SOURCE
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../SDL_internal.h"
|
#include "../SDL_internal.h"
|
||||||
|
|
||||||
|
@ -37,7 +33,6 @@
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIMITS_H
|
#ifdef HAVE_LIMITS_H
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
#include "SDL_filesystem.h"
|
#include "SDL_filesystem.h"
|
||||||
#include "SDL_rwops.h"
|
#include "SDL_rwops.h"
|
||||||
|
|
||||||
/* QNX's /proc/self/exefile is a text file and not a symlink. */
|
|
||||||
#if !defined(__QNXNTO__)
|
|
||||||
static char *
|
static char *
|
||||||
readSymLink(const char *path)
|
readSymLink(const char *path)
|
||||||
{
|
{
|
||||||
|
@ -76,8 +74,6 @@ readSymLink(const char *path)
|
||||||
SDL_free(retval);
|
SDL_free(retval);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__OPENBSD__)
|
#if defined(__OPENBSD__)
|
||||||
static char *search_path_for_binary(const char *bin)
|
static char *search_path_for_binary(const char *bin)
|
||||||
|
@ -228,8 +224,6 @@ SDL_GetBasePath(void)
|
||||||
retval = readSymLink("/proc/curproc/file");
|
retval = readSymLink("/proc/curproc/file");
|
||||||
#elif defined(__NETBSD__)
|
#elif defined(__NETBSD__)
|
||||||
retval = readSymLink("/proc/curproc/exe");
|
retval = readSymLink("/proc/curproc/exe");
|
||||||
#elif defined(__QNXNTO__)
|
|
||||||
retval = SDL_LoadFile("/proc/self/exefile", NULL);
|
|
||||||
#else
|
#else
|
||||||
retval = readSymLink("/proc/self/exe"); /* linux. */
|
retval = readSymLink("/proc/self/exe"); /* linux. */
|
||||||
if (retval == NULL) {
|
if (retval == NULL) {
|
||||||
|
|
|
@ -470,7 +470,6 @@ extern VideoBootStrap DUMMY_evdev_bootstrap;
|
||||||
extern VideoBootStrap Wayland_bootstrap;
|
extern VideoBootStrap Wayland_bootstrap;
|
||||||
extern VideoBootStrap VIVANTE_bootstrap;
|
extern VideoBootStrap VIVANTE_bootstrap;
|
||||||
extern VideoBootStrap Emscripten_bootstrap;
|
extern VideoBootStrap Emscripten_bootstrap;
|
||||||
extern VideoBootStrap QNX_bootstrap;
|
|
||||||
extern VideoBootStrap OFFSCREEN_bootstrap;
|
extern VideoBootStrap OFFSCREEN_bootstrap;
|
||||||
extern VideoBootStrap NGAGE_bootstrap;
|
extern VideoBootStrap NGAGE_bootstrap;
|
||||||
|
|
||||||
|
|
|
@ -119,9 +119,6 @@ static VideoBootStrap *bootstrap[] = {
|
||||||
#if SDL_VIDEO_DRIVER_EMSCRIPTEN
|
#if SDL_VIDEO_DRIVER_EMSCRIPTEN
|
||||||
&Emscripten_bootstrap,
|
&Emscripten_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
#if SDL_VIDEO_DRIVER_QNX
|
|
||||||
&QNX_bootstrap,
|
|
||||||
#endif
|
|
||||||
#if SDL_VIDEO_DRIVER_OFFSCREEN
|
#if SDL_VIDEO_DRIVER_OFFSCREEN
|
||||||
&OFFSCREEN_bootstrap,
|
&OFFSCREEN_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,285 +0,0 @@
|
||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 2017 BlackBerry Limited
|
|
||||||
|
|
||||||
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"
|
|
||||||
#include "sdl_qnx.h"
|
|
||||||
|
|
||||||
static EGLDisplay egl_disp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detertmines the pixel format to use based on the current display and EGL
|
|
||||||
* configuration.
|
|
||||||
* @param egl_conf EGL configuration to use
|
|
||||||
* @return A SCREEN_FORMAT* constant for the pixel format to use
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
chooseFormat(EGLConfig egl_conf)
|
|
||||||
{
|
|
||||||
EGLint buffer_bit_depth;
|
|
||||||
EGLint alpha_bit_depth;
|
|
||||||
|
|
||||||
eglGetConfigAttrib(egl_disp, egl_conf, EGL_BUFFER_SIZE, &buffer_bit_depth);
|
|
||||||
eglGetConfigAttrib(egl_disp, egl_conf, EGL_ALPHA_SIZE, &alpha_bit_depth);
|
|
||||||
|
|
||||||
switch (buffer_bit_depth) {
|
|
||||||
case 32:
|
|
||||||
return SCREEN_FORMAT_RGBX8888;
|
|
||||||
case 24:
|
|
||||||
return SCREEN_FORMAT_RGB888;
|
|
||||||
case 16:
|
|
||||||
switch (alpha_bit_depth) {
|
|
||||||
case 4:
|
|
||||||
return SCREEN_FORMAT_RGBX4444;
|
|
||||||
case 1:
|
|
||||||
return SCREEN_FORMAT_RGBA5551;
|
|
||||||
default:
|
|
||||||
return SCREEN_FORMAT_RGB565;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerates the supported EGL configurations and chooses a suitable one.
|
|
||||||
* @param[out] pconf The chosen configuration
|
|
||||||
* @param[out] pformat The chosen pixel format
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
glGetConfig(EGLConfig *pconf, int *pformat)
|
|
||||||
{
|
|
||||||
EGLConfig egl_conf = (EGLConfig)0;
|
|
||||||
EGLConfig *egl_configs;
|
|
||||||
EGLint egl_num_configs;
|
|
||||||
EGLint val;
|
|
||||||
EGLBoolean rc;
|
|
||||||
EGLint i;
|
|
||||||
|
|
||||||
// Determine the numbfer of configurations.
|
|
||||||
rc = eglGetConfigs(egl_disp, NULL, 0, &egl_num_configs);
|
|
||||||
if (rc != EGL_TRUE) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (egl_num_configs == 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allocate enough memory for all configurations.
|
|
||||||
egl_configs = SDL_malloc(egl_num_configs * sizeof(*egl_configs));
|
|
||||||
if (egl_configs == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the list of configurations.
|
|
||||||
rc = eglGetConfigs(egl_disp, egl_configs, egl_num_configs,
|
|
||||||
&egl_num_configs);
|
|
||||||
if (rc != EGL_TRUE) {
|
|
||||||
SDL_free(egl_configs);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find a good configuration.
|
|
||||||
for (i = 0; i < egl_num_configs; i++) {
|
|
||||||
eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_SURFACE_TYPE, &val);
|
|
||||||
if (!(val & EGL_WINDOW_BIT)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_RENDERABLE_TYPE, &val);
|
|
||||||
if (!(val & EGL_OPENGL_ES2_BIT)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_DEPTH_SIZE, &val);
|
|
||||||
if (val == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
egl_conf = egl_configs[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_free(egl_configs);
|
|
||||||
*pconf = egl_conf;
|
|
||||||
*pformat = chooseFormat(egl_conf);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the EGL library.
|
|
||||||
* @param _THIS
|
|
||||||
* @param name unused
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
glLoadLibrary(_THIS, const char *name)
|
|
||||||
{
|
|
||||||
EGLNativeDisplayType disp_id = EGL_DEFAULT_DISPLAY;
|
|
||||||
|
|
||||||
egl_disp = eglGetDisplay(disp_id);
|
|
||||||
if (egl_disp == EGL_NO_DISPLAY) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eglInitialize(egl_disp, NULL, NULL) == EGL_FALSE) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds the address of an EGL extension function.
|
|
||||||
* @param proc Function name
|
|
||||||
* @return Function address
|
|
||||||
*/
|
|
||||||
void *
|
|
||||||
glGetProcAddress(_THIS, const char *proc)
|
|
||||||
{
|
|
||||||
return eglGetProcAddress(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Associates the given window with the necessary EGL structures for drawing and
|
|
||||||
* displaying content.
|
|
||||||
* @param _THIS
|
|
||||||
* @param window The SDL window to create the context for
|
|
||||||
* @return A pointer to the created context, if successful, NULL on error
|
|
||||||
*/
|
|
||||||
SDL_GLContext
|
|
||||||
glCreateContext(_THIS, SDL_Window *window)
|
|
||||||
{
|
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
|
||||||
EGLContext context;
|
|
||||||
EGLSurface surface;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
EGLint client_version[2];
|
|
||||||
EGLint none;
|
|
||||||
} egl_ctx_attr = {
|
|
||||||
.client_version = { EGL_CONTEXT_CLIENT_VERSION, 2 },
|
|
||||||
.none = EGL_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
struct {
|
|
||||||
EGLint render_buffer[2];
|
|
||||||
EGLint none;
|
|
||||||
} egl_surf_attr = {
|
|
||||||
.render_buffer = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER },
|
|
||||||
.none = EGL_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
context = eglCreateContext(egl_disp, impl->conf, EGL_NO_CONTEXT,
|
|
||||||
(EGLint *)&egl_ctx_attr);
|
|
||||||
if (context == EGL_NO_CONTEXT) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
surface = eglCreateWindowSurface(egl_disp, impl->conf, impl->window,
|
|
||||||
(EGLint *)&egl_surf_attr);
|
|
||||||
if (surface == EGL_NO_SURFACE) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
eglMakeCurrent(egl_disp, surface, surface, context);
|
|
||||||
|
|
||||||
impl->surface = surface;
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a new value for the number of frames to display before swapping buffers.
|
|
||||||
* @param _THIS
|
|
||||||
* @param interval New interval value
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
glSetSwapInterval(_THIS, int interval)
|
|
||||||
{
|
|
||||||
if (eglSwapInterval(egl_disp, interval) != EGL_TRUE) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swaps the EGL buffers associated with the given window
|
|
||||||
* @param _THIS
|
|
||||||
* @param window Window to swap buffers for
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
glSwapWindow(_THIS, SDL_Window *window)
|
|
||||||
{
|
|
||||||
/* !!! FIXME: should we migrate this all over to use SDL_egl.c? */
|
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
|
||||||
return eglSwapBuffers(egl_disp, impl->surface) == EGL_TRUE ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Makes the given context the current one for drawing operations.
|
|
||||||
* @param _THIS
|
|
||||||
* @param window SDL window associated with the context (maybe NULL)
|
|
||||||
* @param context The context to activate
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
glMakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
|
|
||||||
{
|
|
||||||
window_impl_t *impl;
|
|
||||||
EGLSurface surface = NULL;
|
|
||||||
|
|
||||||
if (window) {
|
|
||||||
impl = (window_impl_t *)window->driverdata;
|
|
||||||
surface = impl->surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eglMakeCurrent(egl_disp, surface, surface, context) != EGL_TRUE) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys a context.
|
|
||||||
* @param _THIS
|
|
||||||
* @param context The context to destroy
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
glDeleteContext(_THIS, SDL_GLContext context)
|
|
||||||
{
|
|
||||||
eglDestroyContext(egl_disp, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Terminates access to the EGL library.
|
|
||||||
* @param _THIS
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
glUnloadLibrary(_THIS)
|
|
||||||
{
|
|
||||||
eglTerminate(egl_disp);
|
|
||||||
}
|
|
|
@ -1,133 +0,0 @@
|
||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 2017 BlackBerry Limited
|
|
||||||
|
|
||||||
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"
|
|
||||||
#include "../../events/SDL_keyboard_c.h"
|
|
||||||
#include "SDL_scancode.h"
|
|
||||||
#include "SDL_events.h"
|
|
||||||
#include "sdl_qnx.h"
|
|
||||||
#include <sys/keycodes.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A map thta translates Screen key names to SDL scan codes.
|
|
||||||
* This map is incomplete, but should include most major keys.
|
|
||||||
*/
|
|
||||||
static int key_to_sdl[] = {
|
|
||||||
[KEYCODE_SPACE] = SDL_SCANCODE_SPACE,
|
|
||||||
[KEYCODE_APOSTROPHE] = SDL_SCANCODE_APOSTROPHE,
|
|
||||||
[KEYCODE_COMMA] = SDL_SCANCODE_COMMA,
|
|
||||||
[KEYCODE_MINUS] = SDL_SCANCODE_MINUS,
|
|
||||||
[KEYCODE_PERIOD] = SDL_SCANCODE_PERIOD,
|
|
||||||
[KEYCODE_SLASH] = SDL_SCANCODE_SLASH,
|
|
||||||
[KEYCODE_ZERO] = SDL_SCANCODE_0,
|
|
||||||
[KEYCODE_ONE] = SDL_SCANCODE_1,
|
|
||||||
[KEYCODE_TWO] = SDL_SCANCODE_2,
|
|
||||||
[KEYCODE_THREE] = SDL_SCANCODE_3,
|
|
||||||
[KEYCODE_FOUR] = SDL_SCANCODE_4,
|
|
||||||
[KEYCODE_FIVE] = SDL_SCANCODE_5,
|
|
||||||
[KEYCODE_SIX] = SDL_SCANCODE_6,
|
|
||||||
[KEYCODE_SEVEN] = SDL_SCANCODE_7,
|
|
||||||
[KEYCODE_EIGHT] = SDL_SCANCODE_8,
|
|
||||||
[KEYCODE_NINE] = SDL_SCANCODE_9,
|
|
||||||
[KEYCODE_SEMICOLON] = SDL_SCANCODE_SEMICOLON,
|
|
||||||
[KEYCODE_EQUAL] = SDL_SCANCODE_EQUALS,
|
|
||||||
[KEYCODE_LEFT_BRACKET] = SDL_SCANCODE_LEFTBRACKET,
|
|
||||||
[KEYCODE_BACK_SLASH] = SDL_SCANCODE_BACKSLASH,
|
|
||||||
[KEYCODE_RIGHT_BRACKET] = SDL_SCANCODE_RIGHTBRACKET,
|
|
||||||
[KEYCODE_GRAVE] = SDL_SCANCODE_GRAVE,
|
|
||||||
[KEYCODE_A] = SDL_SCANCODE_A,
|
|
||||||
[KEYCODE_B] = SDL_SCANCODE_B,
|
|
||||||
[KEYCODE_C] = SDL_SCANCODE_C,
|
|
||||||
[KEYCODE_D] = SDL_SCANCODE_D,
|
|
||||||
[KEYCODE_E] = SDL_SCANCODE_E,
|
|
||||||
[KEYCODE_F] = SDL_SCANCODE_F,
|
|
||||||
[KEYCODE_G] = SDL_SCANCODE_G,
|
|
||||||
[KEYCODE_H] = SDL_SCANCODE_H,
|
|
||||||
[KEYCODE_I] = SDL_SCANCODE_I,
|
|
||||||
[KEYCODE_J] = SDL_SCANCODE_J,
|
|
||||||
[KEYCODE_K] = SDL_SCANCODE_K,
|
|
||||||
[KEYCODE_L] = SDL_SCANCODE_L,
|
|
||||||
[KEYCODE_M] = SDL_SCANCODE_M,
|
|
||||||
[KEYCODE_N] = SDL_SCANCODE_N,
|
|
||||||
[KEYCODE_O] = SDL_SCANCODE_O,
|
|
||||||
[KEYCODE_P] = SDL_SCANCODE_P,
|
|
||||||
[KEYCODE_Q] = SDL_SCANCODE_Q,
|
|
||||||
[KEYCODE_R] = SDL_SCANCODE_R,
|
|
||||||
[KEYCODE_S] = SDL_SCANCODE_S,
|
|
||||||
[KEYCODE_T] = SDL_SCANCODE_T,
|
|
||||||
[KEYCODE_U] = SDL_SCANCODE_U,
|
|
||||||
[KEYCODE_V] = SDL_SCANCODE_V,
|
|
||||||
[KEYCODE_W] = SDL_SCANCODE_W,
|
|
||||||
[KEYCODE_X] = SDL_SCANCODE_X,
|
|
||||||
[KEYCODE_Y] = SDL_SCANCODE_Y,
|
|
||||||
[KEYCODE_Z] = SDL_SCANCODE_Z,
|
|
||||||
[KEYCODE_UP] = SDL_SCANCODE_UP,
|
|
||||||
[KEYCODE_DOWN] = SDL_SCANCODE_DOWN,
|
|
||||||
[KEYCODE_LEFT] = SDL_SCANCODE_LEFT,
|
|
||||||
[KEYCODE_PG_UP] = SDL_SCANCODE_PAGEUP,
|
|
||||||
[KEYCODE_PG_DOWN] = SDL_SCANCODE_PAGEDOWN,
|
|
||||||
[KEYCODE_RIGHT] = SDL_SCANCODE_RIGHT,
|
|
||||||
[KEYCODE_RETURN] = SDL_SCANCODE_RETURN,
|
|
||||||
[KEYCODE_TAB] = SDL_SCANCODE_TAB,
|
|
||||||
[KEYCODE_ESCAPE] = SDL_SCANCODE_ESCAPE,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called from the event dispatcher when a keyboard event is encountered.
|
|
||||||
* Translates the event such that it can be handled by SDL.
|
|
||||||
* @param event Screen keyboard event
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
handleKeyboardEvent(screen_event_t event)
|
|
||||||
{
|
|
||||||
int val;
|
|
||||||
SDL_Scancode scancode;
|
|
||||||
|
|
||||||
// Get the key value.
|
|
||||||
if (screen_get_event_property_iv(event, SCREEN_PROPERTY_SYM, &val) < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip unrecognized keys.
|
|
||||||
if ((val < 0) || (val >= SDL_TABLESIZE(key_to_sdl))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Translate to an SDL scan code.
|
|
||||||
scancode = key_to_sdl[val];
|
|
||||||
if (scancode == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get event flags (key state).
|
|
||||||
if (screen_get_event_property_iv(event, SCREEN_PROPERTY_FLAGS, &val) < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Propagate the event to SDL.
|
|
||||||
// FIXME:
|
|
||||||
// Need to handle more key states (such as key combinations).
|
|
||||||
if (val & KEY_DOWN) {
|
|
||||||
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
|
|
||||||
} else {
|
|
||||||
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 2017 BlackBerry Limited
|
|
||||||
|
|
||||||
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_QNX_H__
|
|
||||||
#define __SDL_QNX_H__
|
|
||||||
|
|
||||||
#include "../SDL_sysvideo.h"
|
|
||||||
#include <screen/screen.h>
|
|
||||||
#include <EGL/egl.h>
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
screen_window_t window;
|
|
||||||
EGLSurface surface;
|
|
||||||
EGLConfig conf;
|
|
||||||
} window_impl_t;
|
|
||||||
|
|
||||||
extern void handleKeyboardEvent(screen_event_t event);
|
|
||||||
|
|
||||||
extern int glGetConfig(EGLConfig *pconf, int *pformat);
|
|
||||||
extern int glLoadLibrary(_THIS, const char *name);
|
|
||||||
void *glGetProcAddress(_THIS, const char *proc);
|
|
||||||
extern SDL_GLContext glCreateContext(_THIS, SDL_Window *window);
|
|
||||||
extern int glSetSwapInterval(_THIS, int interval);
|
|
||||||
extern int glSwapWindow(_THIS, SDL_Window *window);
|
|
||||||
extern int glMakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
|
||||||
extern void glDeleteContext(_THIS, SDL_GLContext context);
|
|
||||||
extern void glUnloadLibrary(_THIS);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,358 +0,0 @@
|
||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 2017 BlackBerry Limited
|
|
||||||
|
|
||||||
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"
|
|
||||||
#include "../SDL_sysvideo.h"
|
|
||||||
#include "sdl_qnx.h"
|
|
||||||
|
|
||||||
static screen_context_t context;
|
|
||||||
static screen_event_t event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the QNX video plugin.
|
|
||||||
* Creates the Screen context and event handles used for all window operations
|
|
||||||
* by the plugin.
|
|
||||||
* @param _THIS
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
videoInit(_THIS)
|
|
||||||
{
|
|
||||||
SDL_VideoDisplay display;
|
|
||||||
|
|
||||||
if (screen_create_context(&context, 0) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (screen_create_event(&event) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_zero(display);
|
|
||||||
|
|
||||||
if (SDL_AddVideoDisplay(&display, SDL_FALSE) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_this->num_displays = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
videoQuit(_THIS)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new native Screen window and associates it with the given SDL
|
|
||||||
* window.
|
|
||||||
* @param _THIS
|
|
||||||
* @param window SDL window to initialize
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
createWindow(_THIS, SDL_Window *window)
|
|
||||||
{
|
|
||||||
window_impl_t *impl;
|
|
||||||
int size[2];
|
|
||||||
int numbufs;
|
|
||||||
int format;
|
|
||||||
int usage;
|
|
||||||
|
|
||||||
impl = SDL_calloc(1, sizeof(*impl));
|
|
||||||
if (impl == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a native window.
|
|
||||||
if (screen_create_window(&impl->window, context) < 0) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the native window's size to match the SDL window.
|
|
||||||
size[0] = window->w;
|
|
||||||
size[1] = window->h;
|
|
||||||
|
|
||||||
if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE,
|
|
||||||
size) < 0) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE,
|
|
||||||
size) < 0) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create window buffer(s).
|
|
||||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
|
||||||
if (glGetConfig(&impl->conf, &format) < 0) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
numbufs = 2;
|
|
||||||
|
|
||||||
usage = SCREEN_USAGE_OPENGL_ES2;
|
|
||||||
if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_USAGE,
|
|
||||||
&usage) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
format = SCREEN_FORMAT_RGBX8888;
|
|
||||||
numbufs = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set pixel format.
|
|
||||||
if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_FORMAT,
|
|
||||||
&format) < 0) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create buffer(s).
|
|
||||||
if (screen_create_window_buffers(impl->window, numbufs) < 0) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->driverdata = impl;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
if (impl->window) {
|
|
||||||
screen_destroy_window(impl->window);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_free(impl);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a pointer to the Screen buffer associated with the given window. Note
|
|
||||||
* that the buffer is actually created in createWindow().
|
|
||||||
* @param _THIS
|
|
||||||
* @param window SDL window to get the buffer for
|
|
||||||
* @param[out] pixles Holds a pointer to the window's buffer
|
|
||||||
* @param[out] format Holds the pixel format for the buffer
|
|
||||||
* @param[out] pitch Holds the number of bytes per line
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
createWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
|
|
||||||
void ** pixels, int *pitch)
|
|
||||||
{
|
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
|
||||||
screen_buffer_t buffer;
|
|
||||||
|
|
||||||
// Get a pointer to the buffer's memory.
|
|
||||||
if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS,
|
|
||||||
(void **)&buffer) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER,
|
|
||||||
pixels) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set format and pitch.
|
|
||||||
if (screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE,
|
|
||||||
pitch) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*format = SDL_PIXELFORMAT_RGB888;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Informs the window manager that the window needs to be updated.
|
|
||||||
* @param _THIS
|
|
||||||
* @param window The window to update
|
|
||||||
* @param rects An array of reectangular areas to update
|
|
||||||
* @param numrects Rect array length
|
|
||||||
* @return 0 if successful, -1 on error
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
updateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects,
|
|
||||||
int numrects)
|
|
||||||
{
|
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
|
||||||
screen_buffer_t buffer;
|
|
||||||
|
|
||||||
if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS,
|
|
||||||
(void **)&buffer) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
screen_post_window(impl->window, buffer, numrects, (int *)rects, 0);
|
|
||||||
screen_flush_context(context, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the main event loop.
|
|
||||||
* @param _THIS
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
pumpEvents(_THIS)
|
|
||||||
{
|
|
||||||
int type;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
if (screen_get_event(context, event, 0) < 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type)
|
|
||||||
< 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == SCREEN_EVENT_NONE) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case SCREEN_EVENT_KEYBOARD:
|
|
||||||
handleKeyboardEvent(event);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the size of the native window using the geometry of the SDL window.
|
|
||||||
* @param _THIS
|
|
||||||
* @param window SDL window to update
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
setWindowSize(_THIS, SDL_Window *window)
|
|
||||||
{
|
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
|
||||||
int size[2];
|
|
||||||
|
|
||||||
size[0] = window->w;
|
|
||||||
size[1] = window->h;
|
|
||||||
|
|
||||||
screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE, size);
|
|
||||||
screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE,
|
|
||||||
size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Makes the native window associated with the given SDL window visible.
|
|
||||||
* @param _THIS
|
|
||||||
* @param window SDL window to update
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
showWindow(_THIS, SDL_Window *window)
|
|
||||||
{
|
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
|
||||||
const int visible = 1;
|
|
||||||
|
|
||||||
screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE,
|
|
||||||
&visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Makes the native window associated with the given SDL window invisible.
|
|
||||||
* @param _THIS
|
|
||||||
* @param window SDL window to update
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
hideWindow(_THIS, SDL_Window *window)
|
|
||||||
{
|
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
|
||||||
const int visible = 0;
|
|
||||||
|
|
||||||
screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE,
|
|
||||||
&visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys the native window associated with the given SDL window.
|
|
||||||
* @param _THIS
|
|
||||||
* @param window SDL window that is being destroyed
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
destroyWindow(_THIS, SDL_Window *window)
|
|
||||||
{
|
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
|
||||||
|
|
||||||
if (impl) {
|
|
||||||
screen_destroy_window(impl->window);
|
|
||||||
window->driverdata = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frees the plugin object created by createDevice().
|
|
||||||
* @param device Plugin object to free
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
deleteDevice(SDL_VideoDevice *device)
|
|
||||||
{
|
|
||||||
SDL_free(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the QNX video plugin used by SDL.
|
|
||||||
* @param devindex Unused
|
|
||||||
* @return Initialized device if successful, NULL otherwise
|
|
||||||
*/
|
|
||||||
static SDL_VideoDevice *
|
|
||||||
createDevice(int devindex)
|
|
||||||
{
|
|
||||||
SDL_VideoDevice *device;
|
|
||||||
|
|
||||||
device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
|
|
||||||
if (device == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
device->driverdata = NULL;
|
|
||||||
device->VideoInit = videoInit;
|
|
||||||
device->VideoQuit = videoQuit;
|
|
||||||
device->CreateSDLWindow = createWindow;
|
|
||||||
device->CreateWindowFramebuffer = createWindowFramebuffer;
|
|
||||||
device->UpdateWindowFramebuffer = updateWindowFramebuffer;
|
|
||||||
device->SetWindowSize = setWindowSize;
|
|
||||||
device->ShowWindow = showWindow;
|
|
||||||
device->HideWindow = hideWindow;
|
|
||||||
device->PumpEvents = pumpEvents;
|
|
||||||
device->DestroyWindow = destroyWindow;
|
|
||||||
|
|
||||||
device->GL_LoadLibrary = glLoadLibrary;
|
|
||||||
device->GL_GetProcAddress = glGetProcAddress;
|
|
||||||
device->GL_CreateContext = glCreateContext;
|
|
||||||
device->GL_SetSwapInterval = glSetSwapInterval;
|
|
||||||
device->GL_SwapWindow = glSwapWindow;
|
|
||||||
device->GL_MakeCurrent = glMakeCurrent;
|
|
||||||
device->GL_DeleteContext = glDeleteContext;
|
|
||||||
device->GL_UnloadLibrary = glUnloadLibrary;
|
|
||||||
|
|
||||||
device->free = deleteDevice;
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoBootStrap QNX_bootstrap = {
|
|
||||||
"qnx", "QNX Screen",
|
|
||||||
createDevice
|
|
||||||
};
|
|
|
@ -41,8 +41,6 @@
|
||||||
#define DEFAULT_OPENGL "libGL.so"
|
#define DEFAULT_OPENGL "libGL.so"
|
||||||
#elif defined(__MACOSX__)
|
#elif defined(__MACOSX__)
|
||||||
#define DEFAULT_OPENGL "/opt/X11/lib/libGL.1.dylib"
|
#define DEFAULT_OPENGL "/opt/X11/lib/libGL.1.dylib"
|
||||||
#elif defined(__QNXNTO__)
|
|
||||||
#define DEFAULT_OPENGL "libGL.so.3"
|
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_OPENGL "libGL.so.1"
|
#define DEFAULT_OPENGL "libGL.so.1"
|
||||||
#endif
|
#endif
|
||||||
|
|
5
test/configure
vendored
5
test/configure
vendored
|
@ -3641,11 +3641,6 @@ fi
|
||||||
SYS_GL_LIBS="-lOSMesa"
|
SYS_GL_LIBS="-lOSMesa"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-qnx*)
|
|
||||||
EXE=""
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lGLES_CM"
|
|
||||||
;;
|
|
||||||
*-*-emscripten*)
|
*-*-emscripten*)
|
||||||
EXE=".bc"
|
EXE=".bc"
|
||||||
MATHLIB=""
|
MATHLIB=""
|
||||||
|
|
|
@ -59,11 +59,6 @@ case "$host" in
|
||||||
SYS_GL_LIBS="-lOSMesa"
|
SYS_GL_LIBS="-lOSMesa"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-qnx*)
|
|
||||||
EXE=""
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lGLES_CM"
|
|
||||||
;;
|
|
||||||
*-*-emscripten*)
|
*-*-emscripten*)
|
||||||
dnl This should really be .js, but we need to specify extra flags when compiling to js
|
dnl This should really be .js, but we need to specify extra flags when compiling to js
|
||||||
EXE=".bc"
|
EXE=".bc"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue