gl/gbm: allow headless mode

Don't require an output for the GBM backend.

https://bugzilla.gnome.org/show_bug.cgi?id=794716
This commit is contained in:
freyr 2018-07-30 10:03:11 +03:00 committed by Matthew Waters
parent 5576475e0f
commit 810d560a2f
2 changed files with 18 additions and 5 deletions

View file

@ -400,8 +400,7 @@ gst_gl_display_gbm_new (void)
display->drm_fd = drm_fd;
if (!gst_gl_display_gbm_setup_drm (display)) {
GST_ERROR ("Failed to initialize DRM");
goto cleanup;
GST_WARNING ("Failed to initialize DRM");
}
if (!gst_gl_display_gbm_setup_gbm (display)) {

View file

@ -149,6 +149,12 @@ draw_cb (gpointer data)
.revents = 0,
};
/* No display connected */
if (!display->drm_mode_info) {
GST_ERROR ("No display connected");
return;
};
/* Rendering, page flipping etc. are connect this way:
*
* The frames are stored in buffer objects (BOs). Inside the eglSwapBuffers()
@ -295,6 +301,15 @@ gst_gl_window_gbm_init_surface (GstGLWindowGBMEGL * window_egl)
GstGLContext *context = gst_gl_window_get_context (window);
GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
EGLint gbm_format;
int hdisplay, vdisplay;
if (drm_mode_info) {
vdisplay = drm_mode_info->vdisplay;
hdisplay = drm_mode_info->hdisplay;
} else {
vdisplay = 0;
hdisplay = 0;
}
/* With GBM-based EGL displays and configs, the native visual ID
* is a GBM pixel format. */
@ -308,11 +323,10 @@ gst_gl_window_gbm_init_surface (GstGLWindowGBMEGL * window_egl)
/* Create a GBM surface that shall contain the BOs we are
* going to render into. */
window_egl->gbm_surf = gbm_surface_create (display->gbm_dev,
drm_mode_info->hdisplay, drm_mode_info->vdisplay, gbm_format,
hdisplay, vdisplay, gbm_format,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
gst_gl_window_resize (window, drm_mode_info->hdisplay,
drm_mode_info->vdisplay);
gst_gl_window_resize (window, hdisplay, vdisplay);
GST_DEBUG ("Successfully created GBM surface");