Skip to content

Commit

Permalink
Support for QNX 7.0 (thanks, Elad!).
Browse files Browse the repository at this point in the history
Fixes Bugzilla #3686.
  • Loading branch information
icculus committed Jul 1, 2017
1 parent b1fbab5 commit 22241ed
Show file tree
Hide file tree
Showing 11 changed files with 875 additions and 5 deletions.
37 changes: 36 additions & 1 deletion configure.in
Expand Up @@ -2098,6 +2098,30 @@ AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]])
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_video=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
SUMMARY_audio="${SUMMARY_audio} qsa"
fi
}

dnl Check to see if OpenGL support is desired
AC_ARG_ENABLE(video-opengl,
AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
Expand Down Expand Up @@ -2573,6 +2597,10 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]])
pthread_cflags="-D_REENTRANT"
pthread_lib=""
;;
*-*-nto*)
pthread_cflags="-D_REENTRANT"
pthread_lib=""
;;
*)
pthread_cflags="-D_REENTRANT"
pthread_lib="-lpthread"
Expand Down Expand Up @@ -3017,7 +3045,7 @@ CheckWarnAll

dnl Set up the configuration based on the host platform!
case "$host" in
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
case "$host" in
*-raspberry-linux*)
# Raspberry Pi
Expand Down Expand Up @@ -3082,6 +3110,9 @@ case "$host" in
*-*-hpux*) ARCH=hpux ;;
*-*-aix*) ARCH=aix ;;
*-*-minix*) ARCH=minix ;;
*-*-nto*) ARCH=nto
CheckQNXVideo
;;
esac
CheckVisibilityHidden
CheckDeclarationAfterStatement
Expand Down Expand Up @@ -3123,6 +3154,7 @@ case "$host" in
CheckLinuxVersion
CheckRPATH
CheckVivanteVideo

# Set up files for the audio library
if test x$enable_audio = xyes; then
case $ARCH in
Expand All @@ -3147,6 +3179,9 @@ case "$host" in
SUMMARY_audio="${SUMMARY_audio} android"
have_audio=yes
;;
nto)
CheckQNXAudio
;;
esac
fi
# Set up files for the joystick library
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config.h.in
Expand Up @@ -317,6 +317,7 @@
#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
Expand Down
1 change: 1 addition & 0 deletions src/audio/SDL_sysaudio.h
Expand Up @@ -205,6 +205,7 @@ extern AudioBootStrap FUSIONSOUND_bootstrap;
extern AudioBootStrap ANDROIDAUDIO_bootstrap;
extern AudioBootStrap PSPAUDIO_bootstrap;
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
extern AudioBootStrap QNX_bootstrap;

#endif /* SDL_sysaudio_h_ */

Expand Down
6 changes: 4 additions & 2 deletions src/audio/qsa/SDL_qsa_audio.c
Expand Up @@ -370,13 +370,13 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
this->hidden->cardno = device->cardno;
status = snd_pcm_open(&this->hidden->audio_handle,
device->cardno, device->deviceno,
iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE);
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_PLAYBACK : SND_PCM_OPEN_CAPTURE);
iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK);
}

/* Check if requested device is opened */
Expand All @@ -385,6 +385,7 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
return QSA_SetError("snd_pcm_open", status);
}

#if 0
if (!QSA_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) {
/* Disable QSA MMAP plugin for buggy audio drivers */
status =
Expand All @@ -394,6 +395,7 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
return QSA_SetError("snd_pcm_plugin_set_disable", status);
}
}
#endif

/* Try for a closest match on audio format */
format = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/dynapi/SDL_dynapi.c
Expand Up @@ -216,7 +216,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
return retval;
}

#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__QNX__)
#include <dlfcn.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{
Expand Down Expand Up @@ -302,4 +302,3 @@ SDL_InitDynamicAPI(void)
#endif /* SDL_DYNAMIC_API */

/* vi: set ts=4 sw=4 expandtab: */

1 change: 1 addition & 0 deletions src/video/SDL_sysvideo.h
Expand Up @@ -390,6 +390,7 @@ extern VideoBootStrap Wayland_bootstrap;
extern VideoBootStrap NACL_bootstrap;
extern VideoBootStrap VIVANTE_bootstrap;
extern VideoBootStrap Emscripten_bootstrap;
extern VideoBootStrap QNX_bootstrap;

extern SDL_VideoDevice *SDL_GetVideoDevice(void);
extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
Expand Down
3 changes: 3 additions & 0 deletions src/video/SDL_video.c
Expand Up @@ -111,6 +111,9 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_EMSCRIPTEN
&Emscripten_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_QNX
&QNX_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DUMMY
&DUMMY_bootstrap,
#endif
Expand Down

0 comments on commit 22241ed

Please sign in to comment.