kms: gracefully handle NULL save_state at cleanup

If we failed to save any crtc state then we skip trying to restore the
old state at cleanup.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2012-01-23 15:39:10 +00:00
parent 1a638b6fd6
commit 0f33c942f2

View File

@ -297,13 +297,15 @@ _cogl_winsys_egl_cleanup_context (CoglDisplay *display)
CoglRenderer *renderer = display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglRendererKMS *kms_renderer = egl_renderer->platform;
int ret;
/* Restore the saved CRTC - this failing should not propagate an error */
ret = drmModeSetCrtc (kms_renderer->fd,
if (kms_display->saved_crtc)
{
int ret = drmModeSetCrtc (kms_renderer->fd,
kms_display->saved_crtc->crtc_id,
kms_display->saved_crtc->buffer_id,
kms_display->saved_crtc->x, kms_display->saved_crtc->y,
kms_display->saved_crtc->x,
kms_display->saved_crtc->y,
&kms_display->connector->connector_id, 1,
&kms_display->saved_crtc->mode);
if (ret)
@ -311,6 +313,7 @@ _cogl_winsys_egl_cleanup_context (CoglDisplay *display)
drmModeFreeCrtc (kms_display->saved_crtc);
}
}
static void
_cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)