@@ -470,12 +470,19 @@ static bool check_egl_client_extension(const char *name, size_t name_len)
470470
471471static EGLDisplay get_egl_display (EGLenum platform , void * native )
472472{
473+ RARCH_LOG ("[EGL] get_egl_display(platform=0x%x, native=%p)\n" , (unsigned )platform , native );
474+
475+ RARCH_LOG ("[EGL] DISPLAY=%s\n" , getenv ("DISPLAY" ));
476+ RARCH_LOG ("[EGL] EGL_PLATFORM=%s\n" , getenv ("EGL_PLATFORM" ));
477+ RARCH_LOG ("[EGL] WAYLAND_DISPLAY=%s\n" , getenv ("WAYLAND_DISPLAY" ));
478+ RARCH_LOG ("[EGL] XDG_DIR=%s\n" , getenv ("XDG_DIR" ));
479+ RARCH_LOG ("[EGL] XDG_RUNTIME_DIR=%s\n" , getenv ("XDG_RUNTIME_DIR" ));
480+ RARCH_LOG ("[EGL] XKB_CONFIG_ROOT=%s\n" , getenv ("XKB_CONFIG_ROOT" ));
481+
473482 if (platform != EGL_NONE )
474483 {
475- /* If the client library supports at least EGL 1.5, then we can call
476- * eglGetPlatformDisplay. Otherwise, see if eglGetPlatformDisplayEXT
477- * is available. */
478484#if defined(EGL_VERSION_1_5 )
485+ RARCH_LOG ("[EGL] Checking for EGL 1.5 support...\n" );
479486 if (check_egl_version (1 , 5 ))
480487 {
481488 typedef EGLDisplay (EGLAPIENTRY * pfn_eglGetPlatformDisplay )
@@ -485,40 +492,66 @@ static EGLDisplay get_egl_display(EGLenum platform, void *native)
485492 RARCH_LOG ("[EGL] Found EGL client version >= 1.5, trying eglGetPlatformDisplay.\n" );
486493 ptr_eglGetPlatformDisplay = (pfn_eglGetPlatformDisplay )
487494 _egl_get_proc_address ("eglGetPlatformDisplay" );
495+ RARCH_LOG ("[EGL] eglGetPlatformDisplay symbol=%p\n" , (void * )ptr_eglGetPlatformDisplay );
488496
489497 if (ptr_eglGetPlatformDisplay )
490498 {
491499 EGLDisplay dpy = ptr_eglGetPlatformDisplay (platform , native , NULL );
492500 if (dpy != EGL_NO_DISPLAY )
501+ {
502+ RARCH_LOG ("[EGL] eglGetPlatformDisplay succeeded: %p\n" , (void * )dpy );
493503 return dpy ;
504+ }
505+ else
506+ {
507+ EGLint err = eglGetError ();
508+ RARCH_ERR ("[EGL] eglGetPlatformDisplay failed, error=0x%x\n" , err );
509+ }
494510 }
495511 }
496512#endif /* defined(EGL_VERSION_1_5) */
497513
498514#if defined(EGL_EXT_platform_base )
515+ RARCH_LOG ("[EGL] Checking for EGL_EXT_platform_base...\n" );
499516 if (check_egl_client_extension ("EGL_EXT_platform_base" , STRLEN_CONST ("EGL_EXT_platform_base" )))
500517 {
501518 PFNEGLGETPLATFORMDISPLAYEXTPROC ptr_eglGetPlatformDisplayEXT ;
502519
503520 RARCH_LOG ("[EGL] Found EGL_EXT_platform_base, trying eglGetPlatformDisplayEXT.\n" );
504521 ptr_eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC )
505522 _egl_get_proc_address ("eglGetPlatformDisplayEXT" );
523+ RARCH_LOG ("[EGL] eglGetPlatformDisplayEXT symbol=%p\n" , (void * )ptr_eglGetPlatformDisplayEXT );
506524
507525 if (ptr_eglGetPlatformDisplayEXT )
508526 {
509527 EGLDisplay dpy = ptr_eglGetPlatformDisplayEXT (platform , native , NULL );
510528 if (dpy != EGL_NO_DISPLAY )
529+ {
530+ RARCH_LOG ("[EGL] eglGetPlatformDisplayEXT succeeded: %p\n" , (void * )dpy );
511531 return dpy ;
532+ }
533+ else
534+ {
535+ EGLint err = eglGetError ();
536+ RARCH_ERR ("[EGL] eglGetPlatformDisplayEXT failed, error=0x%x\n" , err );
537+ }
512538 }
513539 }
514540#endif /* defined(EGL_EXT_platform_base) */
515541 }
516542
517- /* Either the caller didn't provide a platform type, or the EGL
518- * implementation doesn't support eglGetPlatformDisplay. In this case, try
519- * eglGetDisplay and hope for the best. */
520- RARCH_LOG ("[EGL] Falling back to eglGetDisplay.\n" );
521- return _egl_get_display ((EGLNativeDisplayType ) native );
543+ RARCH_LOG ("[EGL] Falling back to eglGetDisplay(native=%p)\n" , native );
544+ EGLDisplay dpy = _egl_get_display ((EGLNativeDisplayType ) native );
545+ if (dpy == EGL_NO_DISPLAY )
546+ {
547+ EGLint err = eglGetError ();
548+ RARCH_ERR ("[EGL] eglGetDisplay failed, error=0x%x\n" , err );
549+ }
550+ else
551+ {
552+ RARCH_LOG ("[EGL] eglGetDisplay succeeded: %p\n" , (void * )dpy );
553+ }
554+ return dpy ;
522555}
523556
524557bool egl_get_native_visual_id (egl_ctx_data_t * egl , EGLint * value )
0 commit comments