src/video/SDL_egl.c
changeset 11829 fcbafc9e443c
parent 11811 5d94cb6b24d3
child 11830 a01af1a724b3
     1.1 --- a/src/video/SDL_egl.c	Wed Jan 17 13:12:39 2018 -0800
     1.2 +++ b/src/video/SDL_egl.c	Wed Jan 17 13:17:10 2018 -0800
     1.3 @@ -44,12 +44,13 @@
     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 ( vc4 ? "libEGL.so.1" : "/opt/vc/lib/libbrcmEGL.so" )
     1.8 -#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "/opt/vc/lib/libbrcmGLESv2.so" )
     1.9 -#define ALT_EGL "/opt/vc/lib/libEGL.so"
    1.10 -#define ALT_OGL_ES2 "/opt/vc/lib/libGLESv2.so"
    1.11 -#define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "/opt/vc/lib/libbrcmGLESv2.so" )
    1.12 -#define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "/opt/vc/lib/libbrcmGLESv2.so" )
    1.13 +static const char g_rpi_opt_path[] = "/opt/vc/lib";
    1.14 +#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" )
    1.15 +#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so" )
    1.16 +#define ALT_EGL "libEGL.so"
    1.17 +#define ALT_OGL_ES2 "libGLESv2.so"
    1.18 +#define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so" )
    1.19 +#define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so" )
    1.20  
    1.21  #elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE
    1.22  /* Android */
    1.23 @@ -265,6 +266,20 @@
    1.24  #endif
    1.25  #if SDL_VIDEO_DRIVER_RPI
    1.26      SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
    1.27 +
    1.28 +    path = SDL_getenv("LD_LIBRARY_PATH");
    1.29 +    if (path) {
    1.30 +        const int path_size = SDL_strlen(path) + 1 + sizeof(g_rpi_opt_path);
    1.31 +        char *new_path = SDL_calloc(1, path_size);
    1.32 +        strcat(new_path, path);
    1.33 +        strcat(new_path, ":");
    1.34 +        strcat(new_path, g_rpi_opt_path);
    1.35 +        SDL_setenv("LD_LIBRARY_PATH", new_path, 1);
    1.36 +        SDL_free(new_path);
    1.37 +    } else {
    1.38 +        SDL_setenv("LD_LIBRARY_PATH", g_rpi_opt_path, 1);
    1.39 +    }
    1.40 +    path = NULL;
    1.41  #endif
    1.42  
    1.43      if (_this->egl_data) {