[Mesa-dev] [PATCH 3/4] atomic: Duplicate fence before SwapBuffers

Daniel Stone daniels at collabora.com
Tue May 2 10:52:08 UTC 2017


Duplicating the fence before we flush means that the implementation can
know that the fence needs to be CPU-visible. After flush it may be too
late.

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 drm-atomic.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drm-atomic.c b/drm-atomic.c
index 65caacd..25e04b1 100644
--- a/drm-atomic.c
+++ b/drm-atomic.c
@@ -230,16 +230,12 @@ static int atomic_run(const struct gbm *gbm, const struct egl *egl)
 		 */
 		gpu_fence = create_fence(egl, EGL_NO_NATIVE_FENCE_FD_ANDROID);
 		assert(gpu_fence);
-
-		eglSwapBuffers(egl->display, egl->surface);
-
-		/* after swapbuffers, gpu_fence should be flushed, so safe
-		 * to get fd:
-		 */
 		drm.kms_in_fence_fd = egl->eglDupNativeFenceFDANDROID(egl->display, gpu_fence);
 		egl->eglDestroySyncKHR(egl->display, gpu_fence);
 		assert(drm.kms_in_fence_fd != -1);
 
+		eglSwapBuffers(egl->display, egl->surface);
+
 		next_bo = gbm_surface_lock_front_buffer(gbm->surface);
 		fb = drm_fb_get_from_bo(next_bo);
 		if (!fb) {
-- 
2.12.2



More information about the mesa-dev mailing list