From 4fdc551209cd29267b259f809dca58ee826f528f Mon Sep 17 00:00:00 2001 From: "Miguel A. Vico" Date: Wed, 1 Feb 2017 18:15:53 -0800 Subject: [PATCH] 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 --- src/backends/native/meta-renderer-native.c | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index c64747e15..c69068805 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -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