Check-in [9c70cbac31]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:slightly better egl init in jsmpeg driver
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9c70cbac31f302253d8dc8191832c0b2595daf81
User & Date: chw 2019-04-14 16:04:07
Context
2019-04-14
16:59
rgb masks in visual on win32, again check-in: 60b57398a4 user: chw tags: trunk
16:04
slightly better egl init in jsmpeg driver check-in: 9c70cbac31 user: chw tags: trunk
04:08
fix jvm detection in tclJBlend (aarch64/arm64) check-in: a018dd4b5a user: chw tags: trunk
Changes

Changes to jni/SDL2/src/video/SDL_egl.c.

435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
    } else {
        *_this->gl_config.driver_path = '\0';
    }
    
    return 0;
}

static int
SDL_EGL_ChooseConfigEx(_THIS, SDL_bool pbuffer) 
{
/* 64 seems nice. */
    EGLint attribs[64];
    EGLint found_configs = 0, value;
#ifdef SDL_VIDEO_DRIVER_KMSDRM
    /* Intel EGL on KMS/DRM (al least) returns invalid configs that confuse the bitdiff search used */







|







435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
    } else {
        *_this->gl_config.driver_path = '\0';
    }
    
    return 0;
}

int
SDL_EGL_ChooseConfigEx(_THIS, SDL_bool pbuffer) 
{
/* 64 seems nice. */
    EGLint attribs[64];
    EGLint found_configs = 0, value;
#ifdef SDL_VIDEO_DRIVER_KMSDRM
    /* Intel EGL on KMS/DRM (al least) returns invalid configs that confuse the bitdiff search used */

Changes to jni/SDL2/src/video/SDL_egl_c.h.

97
98
99
100
101
102
103

104
105
106
107
108
109
110
extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
/* SDL_EGL_LoadLibrary can get a display for a specific platform (EGL_PLATFORM_*)
 * or, if 0 is passed, let the implementation decide.
 */
extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform);
extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc);
extern void SDL_EGL_UnloadLibrary(_THIS);

extern int SDL_EGL_ChooseConfig(_THIS);
extern int SDL_EGL_SetSwapInterval(_THIS, int interval);
extern int SDL_EGL_GetSwapInterval(_THIS);
extern void SDL_EGL_DeleteContext(_THIS, SDL_GLContext context);
extern EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw);
extern EGLSurface *SDL_EGL_CreatePbufferSurface(_THIS, int width, int height);
extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface);







>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
/* SDL_EGL_LoadLibrary can get a display for a specific platform (EGL_PLATFORM_*)
 * or, if 0 is passed, let the implementation decide.
 */
extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform);
extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc);
extern void SDL_EGL_UnloadLibrary(_THIS);
extern int SDL_EGL_ChooseConfigEx(_THIS, SDL_bool pbuffer);
extern int SDL_EGL_ChooseConfig(_THIS);
extern int SDL_EGL_SetSwapInterval(_THIS, int interval);
extern int SDL_EGL_GetSwapInterval(_THIS);
extern void SDL_EGL_DeleteContext(_THIS, SDL_GLContext context);
extern EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw);
extern EGLSurface *SDL_EGL_CreatePbufferSurface(_THIS, int width, int height);
extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface);

Changes to jni/SDL2/src/video/jsmpeg/SDL_jsmpeg.c.

768
769
770
771
772
773
774


















775
776
777
778
779
780



781
782
783
784
785
786
787
....
1277
1278
1279
1280
1281
1282
1283

1284
1285

1286
1287
1288
1289
1290
1291
1292
    context = SDL_EGL_CreateContext(_this, data->egl_surface);
    return context;
}

static int
JSMPEG_GL_LoadLibrary(_THIS, const char *path)
{


















    if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0) < 0) {
        SDL_EGL_UnloadLibrary(_this);
        return -1;
    }
    SDL_EGL_ChooseConfig(_this);
    return 0;



}

#elif SDL_VIDEO_OPENGL_WGL

extern LPTSTR SDL_Appname;
extern HINSTANCE SDL_Instance;

................................................................................
    if (data == NULL) {
        return SDL_OutOfMemory();
    }

#if SDL_VIDEO_OPENGL_EGL
    if (!_this->egl_data) {
        if (SDL_GL_LoadLibrary(NULL) < 0) {

            SDL_free(data);
            return -1;

        }
    }
    if ((window->flags & SDL_WINDOW_OPENGL) || hidden) {
        if (!_this->egl_data) {
            SDL_free(data);
            SDL_SetError("no EGL support available");
            return -1;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




|
|
>
>
>







 







>
|
|
>







768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
....
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
    context = SDL_EGL_CreateContext(_this, data->egl_surface);
    return context;
}

static int
JSMPEG_GL_LoadLibrary(_THIS, const char *path)
{
#if 0
    /*
     * This would be the way to go real headless: hard wire the
     * EGL_PLATFORM=surfaceless but it seems that the current
     * mesa-libEGL is buggy and crashes in eglCreatePbufferSurface().
     */

#ifndef EGL_PLATFORM_SURFACELESS_MESA
#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
#endif

    if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, EGL_PLATFORM_SURFACELESS_MESA) == 0) {
        if (SDL_EGL_ChooseConfigEx(_this, SDL_TRUE) == 0) {
            return 0;
        }
    }
    SDL_EGL_UnloadLibrary(_this);
#endif
    if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0) < 0) {
        SDL_EGL_UnloadLibrary(_this);
        return -1;
    }
    if (SDL_EGL_ChooseConfigEx(_this, SDL_TRUE) == 0) {
        return 0;
    }
    SDL_EGL_UnloadLibrary(_this);
    return -1;
}

#elif SDL_VIDEO_OPENGL_WGL

extern LPTSTR SDL_Appname;
extern HINSTANCE SDL_Instance;

................................................................................
    if (data == NULL) {
        return SDL_OutOfMemory();
    }

#if SDL_VIDEO_OPENGL_EGL
    if (!_this->egl_data) {
        if (SDL_GL_LoadLibrary(NULL) < 0) {
            if (window->flags & SDL_WINDOW_OPENGL) {
                SDL_free(data);
                return -1;
            }
        }
    }
    if ((window->flags & SDL_WINDOW_OPENGL) || hidden) {
        if (!_this->egl_data) {
            SDL_free(data);
            SDL_SetError("no EGL support available");
            return -1;