Improve kmsdrm + rpi driver coexistence

* Ensure that DEFAULT_OGL is set correctly (fixes OpenGL)
* Silence kmsdrm driver init error when using VideoCore.
* Remove VideoCore cflags from SDL_CFLAGS; these flags are unnecessary
  and will cause conflicts when building SDL2 applications for VC4.
This commit is contained in:
Conn O'Griofa 2019-08-07 03:11:08 +01:00
parent 57b95ddd3b
commit 2db72c1511
4 changed files with 10 additions and 2 deletions

2
configure vendored
View file

@ -19859,7 +19859,7 @@ $as_echo "$have_video_rpi" >&6; }
if test x$have_video_rpi = xyes; then
CFLAGS="$CFLAGS $RPI_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
#SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"

View file

@ -1588,7 +1588,7 @@ AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=ye
if test x$have_video_rpi = xyes; then
CFLAGS="$CFLAGS $RPI_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
#SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"

View file

@ -45,6 +45,8 @@
#if SDL_VIDEO_DRIVER_RPI
/* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
#include <unistd.h>
#define DEFAULT_OGL ( vc4 ? "libGL.so.1" : "" )
#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" )
#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so" )
#define ALT_EGL "libEGL.so"

View file

@ -87,6 +87,12 @@ static int get_dricount(void)
if (!(stat(KMSDRM_DRI_PATH, &sb) == 0
&& S_ISDIR(sb.st_mode))) {
#if SDL_VIDEO_DRIVER_RPI
// exit silently if VC4 driver is not active
SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
if (!vc4)
return 0;
#endif
printf("The path %s cannot be opened or is not available\n",
KMSDRM_DRI_PATH);
return 0;