mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
gl: window-gbm: Restore CRTC on close
This simply try and restore the state of the CRTC when the window is closed. This is a bit cosmetic, but it allow resuming fbcon when we exit.
This commit is contained in:
parent
46b503d674
commit
f7d5dff921
1 changed files with 21 additions and 0 deletions
|
@ -110,6 +110,22 @@ gst_gl_window_gbm_egl_close (GstGLWindow * window)
|
|||
{
|
||||
GstGLWindowGBMEGL *window_egl = GST_GL_WINDOW_GBM_EGL (window);
|
||||
|
||||
if (window_egl->saved_crtc) {
|
||||
GstGLDisplayGBM *display = (GstGLDisplayGBM *) window->display;
|
||||
drmModeCrtc *crtc = window_egl->saved_crtc;
|
||||
gint err;
|
||||
|
||||
err = drmModeSetCrtc (display->drm_fd, crtc->crtc_id, crtc->buffer_id,
|
||||
crtc->x, crtc->y, &(display->drm_mode_connector->connector_id), 1,
|
||||
&crtc->mode);
|
||||
if (err)
|
||||
GST_ERROR_OBJECT (window, "Failed to restore previous CRTC mode: %s",
|
||||
g_strerror (errno));
|
||||
|
||||
drmModeFreeCrtc (crtc);
|
||||
window_egl->saved_crtc = NULL;
|
||||
}
|
||||
|
||||
if (window_egl->gbm_surf != NULL) {
|
||||
if (window_egl->current_bo != NULL) {
|
||||
gbm_surface_release_buffer (window_egl->gbm_surf, window_egl->current_bo);
|
||||
|
@ -205,6 +221,11 @@ draw_cb (gpointer data)
|
|||
gbm_surface_lock_front_buffer (window_egl->gbm_surf);
|
||||
framebuf = gst_gl_gbm_drm_fb_get_from_bo (window_egl->current_bo);
|
||||
|
||||
/* Save the CRTC state */
|
||||
if (!window_egl->saved_crtc)
|
||||
window_egl->saved_crtc =
|
||||
drmModeGetCrtc (display->drm_fd, display->crtc_id);
|
||||
|
||||
/* Configure CRTC to show this first BO. */
|
||||
ret = drmModeSetCrtc (display->drm_fd, display->crtc_id, framebuf->fb_id,
|
||||
0, 0, &(display->drm_mode_connector->connector_id), 1,
|
||||
|
|
Loading…
Reference in a new issue