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