src/video/SDL_egl.c
changeset 11676 591e138c5a04
parent 11553 b89649d1a7a5
child 11677 aed6a9ff3c99
     1.1 --- a/src/video/SDL_egl.c	Sat Nov 04 09:03:20 2017 -0700
     1.2 +++ b/src/video/SDL_egl.c	Sat Nov 04 09:04:19 2017 -0700
     1.3 @@ -44,12 +44,12 @@
     1.4  
     1.5  #if SDL_VIDEO_DRIVER_RPI
     1.6  /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
     1.7 -#define DEFAULT_EGL "/opt/vc/lib/libbrcmEGL.so"
     1.8 -#define DEFAULT_OGL_ES2 "/opt/vc/lib/libbrcmGLESv2.so"
     1.9 +#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "/opt/vc/lib/libbrcmEGL.so" )
    1.10 +#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "/opt/vc/lib/libbrcmGLESv2.so" )
    1.11  #define ALT_EGL "/opt/vc/lib/libEGL.so"
    1.12  #define ALT_OGL_ES2 "/opt/vc/lib/libGLESv2.so"
    1.13 -#define DEFAULT_OGL_ES_PVR "/opt/vc/lib/libGLES_CM.so"
    1.14 -#define DEFAULT_OGL_ES "/opt/vc/lib/libGLESv1_CM.so"
    1.15 +#define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "/opt/vc/lib/libbrcmGLESv2.so" )
    1.16 +#define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "/opt/vc/lib/libbrcmGLESv2.so" )
    1.17  
    1.18  #elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE
    1.19  /* Android */
    1.20 @@ -256,6 +256,9 @@
    1.21  #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
    1.22      const char *d3dcompiler;
    1.23  #endif
    1.24 +#if SDL_VIDEO_DRIVER_RPI
    1.25 +    SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
    1.26 +#endif
    1.27  
    1.28      if (_this->egl_data) {
    1.29          return SDL_SetError("OpenGL ES context already created");
    1.30 @@ -295,7 +298,7 @@
    1.31                  path = DEFAULT_OGL_ES2;
    1.32                  egl_dll_handle = SDL_LoadObject(path);
    1.33  #ifdef ALT_OGL_ES2
    1.34 -                if (egl_dll_handle == NULL) {
    1.35 +                if (egl_dll_handle == NULL && !vc4) {
    1.36                      path = ALT_OGL_ES2;
    1.37                      egl_dll_handle = SDL_LoadObject(path);
    1.38                  }
    1.39 @@ -308,6 +311,12 @@
    1.40                      path = DEFAULT_OGL_ES_PVR;
    1.41                      egl_dll_handle = SDL_LoadObject(path);
    1.42                  }
    1.43 +#ifdef ALT_OGL_ES2
    1.44 +                if (egl_dll_handle == NULL && !vc4) {
    1.45 +                    path = ALT_OGL_ES2;
    1.46 +                    egl_dll_handle = SDL_LoadObject(path);
    1.47 +                }
    1.48 +#endif
    1.49              }
    1.50          }
    1.51  #ifdef DEFAULT_OGL         
    1.52 @@ -339,7 +348,7 @@
    1.53          dll_handle = SDL_LoadObject(path);
    1.54  
    1.55  #ifdef ALT_EGL
    1.56 -        if (dll_handle == NULL) {
    1.57 +        if (dll_handle == NULL && !vc4) {
    1.58              path = ALT_EGL;
    1.59              dll_handle = SDL_LoadObject(path);
    1.60          }