@ -156,7 +156,7 @@ out:
free ( formats ) ;
free ( formats ) ;
}
}
struct wlr_egl * wlr_egl_create ( EGLenum platform , void * remote_display ) {
struct wlr_egl * wlr_egl_create _with_drm_fd( int drm_fd ) {
struct wlr_egl * egl = calloc ( 1 , sizeof ( struct wlr_egl ) ) ;
struct wlr_egl * egl = calloc ( 1 , sizeof ( struct wlr_egl ) ) ;
if ( egl = = NULL ) {
if ( egl = = NULL ) {
wlr_log_errno ( WLR_ERROR , " Allocation failed " ) ;
wlr_log_errno ( WLR_ERROR , " Allocation failed " ) ;
@ -173,12 +173,10 @@ struct wlr_egl *wlr_egl_create(EGLenum platform, void *remote_display) {
return NULL ;
return NULL ;
}
}
if ( platform = = EGL_PLATFORM_GBM_KHR ) {
if ( ! check_egl_ext ( client_exts_str , " EGL_KHR_platform_gbm " ) ) {
if ( ! check_egl_ext ( client_exts_str , " EGL_KHR_platform_gbm " ) ) {
wlr_log ( WLR_ERROR , " EGL_KHR_platform_gbm not supported " ) ;
wlr_log ( WLR_ERROR , " EGL_KHR_platform_gbm not supported " ) ;
return NULL ;
return NULL ;
}
}
}
if ( ! check_egl_ext ( client_exts_str , " EGL_EXT_platform_base " ) ) {
if ( ! check_egl_ext ( client_exts_str , " EGL_EXT_platform_base " ) ) {
wlr_log ( WLR_ERROR , " EGL_EXT_platform_base not supported " ) ;
wlr_log ( WLR_ERROR , " EGL_EXT_platform_base not supported " ) ;
@ -206,8 +204,14 @@ struct wlr_egl *wlr_egl_create(EGLenum platform, void *remote_display) {
goto error ;
goto error ;
}
}
egl - > display = egl - > procs . eglGetPlatformDisplayEXT ( platform ,
egl - > gbm_device = gbm_create_device ( drm_fd ) ;
remote_display , NULL ) ;
if ( ! egl - > gbm_device ) {
wlr_log ( WLR_ERROR , " Failed to create GBM device " ) ;
goto error ;
}
egl - > display = egl - > procs . eglGetPlatformDisplayEXT ( EGL_PLATFORM_GBM_KHR ,
egl - > gbm_device , NULL ) ;
if ( egl - > display = = EGL_NO_DISPLAY ) {
if ( egl - > display = = EGL_NO_DISPLAY ) {
wlr_log ( WLR_ERROR , " Failed to create EGL display " ) ;
wlr_log ( WLR_ERROR , " Failed to create EGL display " ) ;
goto error ;
goto error ;