Skip to content

Commit 22241ed

Browse files
committed
Support for QNX 7.0 (thanks, Elad!).
Fixes Bugzilla #3686.
1 parent b1fbab5 commit 22241ed

11 files changed

+875
-5
lines changed

configure.in

+36-1
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,30 @@ AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]])
20982098
fi
20992099
}
21002100

2101+
dnl Set up the QNX video driver if enabled
2102+
CheckQNXVideo()
2103+
{
2104+
if test x$enable_video = xyes; then
2105+
AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
2106+
SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
2107+
have_video=yes
2108+
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
2109+
SUMMARY_video="${SUMMARY_video} qnx"
2110+
fi
2111+
}
2112+
2113+
dnl Set up the QNX audio driver if enabled
2114+
CheckQNXAudio()
2115+
{
2116+
if test x$enable_audio = xyes; then
2117+
AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
2118+
SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
2119+
have_video=yes
2120+
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
2121+
SUMMARY_audio="${SUMMARY_audio} qsa"
2122+
fi
2123+
}
2124+
21012125
dnl Check to see if OpenGL support is desired
21022126
AC_ARG_ENABLE(video-opengl,
21032127
AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
@@ -2573,6 +2597,10 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]])
25732597
pthread_cflags="-D_REENTRANT"
25742598
pthread_lib=""
25752599
;;
2600+
*-*-nto*)
2601+
pthread_cflags="-D_REENTRANT"
2602+
pthread_lib=""
2603+
;;
25762604
*)
25772605
pthread_cflags="-D_REENTRANT"
25782606
pthread_lib="-lpthread"
@@ -3017,7 +3045,7 @@ CheckWarnAll
30173045

30183046
dnl Set up the configuration based on the host platform!
30193047
case "$host" in
3020-
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
3048+
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
30213049
case "$host" in
30223050
*-raspberry-linux*)
30233051
# Raspberry Pi
@@ -3082,6 +3110,9 @@ case "$host" in
30823110
*-*-hpux*) ARCH=hpux ;;
30833111
*-*-aix*) ARCH=aix ;;
30843112
*-*-minix*) ARCH=minix ;;
3113+
*-*-nto*) ARCH=nto
3114+
CheckQNXVideo
3115+
;;
30853116
esac
30863117
CheckVisibilityHidden
30873118
CheckDeclarationAfterStatement
@@ -3123,6 +3154,7 @@ case "$host" in
31233154
CheckLinuxVersion
31243155
CheckRPATH
31253156
CheckVivanteVideo
3157+
31263158
# Set up files for the audio library
31273159
if test x$enable_audio = xyes; then
31283160
case $ARCH in
@@ -3147,6 +3179,9 @@ case "$host" in
31473179
SUMMARY_audio="${SUMMARY_audio} android"
31483180
have_audio=yes
31493181
;;
3182+
nto)
3183+
CheckQNXAudio
3184+
;;
31503185
esac
31513186
fi
31523187
# Set up files for the joystick library

include/SDL_config.h.in

+1
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@
317317
#undef SDL_VIDEO_DRIVER_NACL
318318
#undef SDL_VIDEO_DRIVER_VIVANTE
319319
#undef SDL_VIDEO_DRIVER_VIVANTE_VDK
320+
#undef SDL_VIDEO_DRIVER_QNX
320321

321322
#undef SDL_VIDEO_RENDER_D3D
322323
#undef SDL_VIDEO_RENDER_D3D11

src/audio/SDL_sysaudio.h

+1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ extern AudioBootStrap FUSIONSOUND_bootstrap;
205205
extern AudioBootStrap ANDROIDAUDIO_bootstrap;
206206
extern AudioBootStrap PSPAUDIO_bootstrap;
207207
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
208+
extern AudioBootStrap QNX_bootstrap;
208209

209210
#endif /* SDL_sysaudio_h_ */
210211

src/audio/qsa/SDL_qsa_audio.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,13 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
370370
this->hidden->cardno = device->cardno;
371371
status = snd_pcm_open(&this->hidden->audio_handle,
372372
device->cardno, device->deviceno,
373-
iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE);
373+
iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK);
374374
} else {
375375
/* Open system default audio device */
376376
status = snd_pcm_open_preferred(&this->hidden->audio_handle,
377377
&this->hidden->cardno,
378378
&this->hidden->deviceno,
379-
iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE);
379+
iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK);
380380
}
381381

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

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

398400
/* Try for a closest match on audio format */
399401
format = 0;

src/dynapi/SDL_dynapi.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
216216
return retval;
217217
}
218218

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

304304
/* vi: set ts=4 sw=4 expandtab: */
305-

src/video/SDL_sysvideo.h

+1
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ extern VideoBootStrap Wayland_bootstrap;
390390
extern VideoBootStrap NACL_bootstrap;
391391
extern VideoBootStrap VIVANTE_bootstrap;
392392
extern VideoBootStrap Emscripten_bootstrap;
393+
extern VideoBootStrap QNX_bootstrap;
393394

394395
extern SDL_VideoDevice *SDL_GetVideoDevice(void);
395396
extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);

src/video/SDL_video.c

+3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ static VideoBootStrap *bootstrap[] = {
111111
#if SDL_VIDEO_DRIVER_EMSCRIPTEN
112112
&Emscripten_bootstrap,
113113
#endif
114+
#if SDL_VIDEO_DRIVER_QNX
115+
&QNX_bootstrap,
116+
#endif
114117
#if SDL_VIDEO_DRIVER_DUMMY
115118
&DUMMY_bootstrap,
116119
#endif

0 commit comments

Comments
 (0)