[mutter/wip/texture-purge-on-nvidia: 64/66] renderer/native: Inhibit eglSwapBuffer() after EGLStream page flip failed



commit bd8dc452315acef984e439b45a55075552010a85
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Jan 4 11:45:21 2019 +0100

    renderer/native: Inhibit eglSwapBuffer() after EGLStream page flip failed
    
    Continue to render as normal, but inhibit eglSwapBuffers() until a page flip
    succeeded. This will result in an old frame being presented, but will avoid the
    deadlock in eglSwapBuffers() that happens if called after a failed page flip.
    We should for the most part already avoid this by retrying the page flip after
    a timeout, but still inhibit just in case.

 src/backends/native/meta-renderer-native.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index a3711b707..98a5bfe70 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -96,8 +96,6 @@ typedef struct _MetaRendererNativeGpuData
 #ifdef HAVE_EGL_DEVICE
   struct {
     EGLDeviceEXT device;
-
-    gboolean no_egl_output_drm_flip_event;
   } egl;
 #endif
 
@@ -171,6 +169,8 @@ typedef struct _MetaOnscreenNative
     EGLStreamKHR stream;
 
     MetaDumbBuffer dumb_fb;
+
+    gboolean last_flip_failed;
   } egl;
 #endif
 
@@ -1294,8 +1294,6 @@ flip_egl_stream (MetaOnscreenNative *onscreen_native,
   renderer_gpu_data =
     meta_renderer_native_get_gpu_data (onscreen_native->renderer_native,
                                        onscreen_native->render_gpu);
-  if (renderer_gpu_data->egl.no_egl_output_drm_flip_event)
-    return FALSE;
 
   closure_container =
     meta_gpu_kms_wrap_flip_closure (onscreen_native->render_gpu, flip_closure);
@@ -1322,7 +1320,7 @@ flip_egl_stream (MetaOnscreenNative *onscreen_native,
             {
               g_warning ("Failed to flip EGL stream (%s), inhibiting eglSwapBuffers()",
                          error->message);
-              renderer_gpu_data->egl.no_egl_output_drm_flip_event = TRUE;
+              onscreen_native->egl.last_flip_failed = TRUE;
 
               g_error_free (error);
               meta_gpu_kms_flip_closure_container_free (closure_container);
@@ -1339,6 +1337,14 @@ flip_egl_stream (MetaOnscreenNative *onscreen_native,
             }
 
         }
+      else
+        {
+          if (onscreen_native->egl.last_flip_failed)
+            {
+              g_warning ("EGL stream flip succeeded, uninhibiting eglSwapBuffers()");
+              onscreen_native->egl.last_flip_failed = FALSE;
+            }
+        }
       break;
     }
 
@@ -1915,9 +1921,12 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
 
   update_secondary_gpu_state_pre_swap_buffers (onscreen);
 
-  parent_vtable->onscreen_swap_buffers_with_damage (onscreen,
-                                                    rectangles,
-                                                    n_rectangles);
+  if (!onscreen_native->egl.last_flip_failed)
+    {
+      parent_vtable->onscreen_swap_buffers_with_damage (onscreen,
+                                                        rectangles,
+                                                        n_rectangles);
+    }
 
   /*
    * Wait for the flip callback before continuing, as we might have started the


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]