MetaRendererNative: Properly handle EGLOutput acquire errors

Whenever an EGLOutput consumer is temporary unable to handle
eglStreamConsumerAcquire() operations (e.g. during a VT-switch),
an EGL_RESOURCE_BUSY_EXT error is generated.

This change adds the appropriate error handling to flip_egl_stream() in
order to recover from such errors.

https://bugzilla.gnome.org/show_bug.cgi?id=779112
This commit is contained in:
Miguel A. Vico 2017-02-01 18:15:53 -08:00 committed by Jonas Ådahl
parent 58043cbc8b
commit 4fdc551209

View File

@ -520,7 +520,7 @@ flip_closure_destroyed (MetaRendererView *view)
}
#ifdef HAVE_EGL_DEVICE
static void
static gboolean
flip_egl_stream (MetaRendererNative *renderer_native,
MetaOnscreenNative *onscreen_native,
GClosure *flip_closure)
@ -536,29 +536,34 @@ flip_egl_stream (MetaRendererNative *renderer_native,
GError *error = NULL;
if (renderer_native->egl.no_egl_output_drm_flip_event)
return;
return FALSE;
acquire_attribs = (EGLAttrib[]) {
EGL_DRM_FLIP_EVENT_DATA_NV,
(EGLAttrib) flip_closure,
EGL_NONE
};
if (!meta_egl_stream_consumer_acquire_attrib (egl,
egl_renderer->edpy,
onscreen_native->egl.stream,
acquire_attribs,
&error))
{
g_warning ("Failed to flip EGL stream (%s), relying on clock from now on",
error->message);
if (error->domain != META_EGL_ERROR ||
error->code != EGL_RESOURCE_BUSY_EXT)
{
g_warning ("Failed to flip EGL stream (%s), relying on clock from "
"now on", error->message);
renderer_native->egl.no_egl_output_drm_flip_event = TRUE;
}
g_error_free (error);
renderer_native->egl.no_egl_output_drm_flip_event = TRUE;
return;
return FALSE;
}
g_closure_ref (flip_closure);
return;
return TRUE;
}
#endif /* HAVE_EGL_DEVICE */
@ -598,8 +603,10 @@ meta_onscreen_native_flip_crtc (MetaOnscreenNative *onscreen_native,
break;
#ifdef HAVE_EGL_DEVICE
case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
flip_egl_stream (renderer_native, onscreen_native, flip_closure);
onscreen_native->pending_flips++;
if (flip_egl_stream (renderer_native,
onscreen_native,
flip_closure))
onscreen_native->pending_flips++;
*fb_in_use = TRUE;
break;
#endif