Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363610

[RFC 6/6] drm/fence: support fence_collection on atomic commit

From Gustavo Padovan <gustavo@padovan.org>
Newsgroups linux.kernel
Subject [RFC 6/6] drm/fence: support fence_collection on atomic commit
Date 2016-03-23 19:50 +0100
Message-ID <rfW0W-7z3-9@gated-at.bofh.it> (permalink)
References <rfW0V-7z3-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Let atomic_commit() wait on a collection of fences before proceed with
the scanout.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/drm_atomic.c        | 9 +++++++++
 drivers/gpu/drm/drm_atomic_helper.c | 9 +++++----
 include/drm/drm_crtc.h              | 2 +-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 8bc364c..28a65d1 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -29,6 +29,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_plane_helper.h>
+#include <linux/sync_file.h>
 
 /**
  * drm_atomic_state_default_release -
@@ -795,6 +796,14 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
 		return -EINVAL;
 	}
 
+#ifdef CONFIG_SYNC_FILE
+	if (state->fence_fd >= 0) {
+		state->fences = sync_file_fences_get(state->fence_fd);
+		if (!state->fences)
+			return -EINVAL;
+	}
+#endif
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 4f91f84..a6e34b6 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -977,14 +977,12 @@ static void wait_for_fences(struct drm_device *dev,
 	int i;
 
 	for_each_plane_in_state(state, plane, plane_state, i) {
-		if (!plane->state->fence)
+		if (!plane->state->fences)
 			continue;
 
 		WARN_ON(!plane->state->fb);
 
-		fence_wait(plane->state->fence, false);
-		fence_put(plane->state->fence);
-		plane->state->fence = NULL;
+		fence_collection_wait(plane->state->fences);
 	}
 }
 
@@ -2654,6 +2652,9 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
 {
 	if (state->fb)
 		drm_framebuffer_unreference(state->fb);
+
+	if (state->fences)
+		fence_collection_put(state->fences);
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state);
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index a8f6ec0..c221c28 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1257,7 +1257,7 @@ struct drm_plane_state {
 
 	struct drm_crtc *crtc;   /* do not write directly, use drm_atomic_set_crtc_for_plane() */
 	struct drm_framebuffer *fb;  /* do not write directly, use drm_atomic_set_fb_for_plane() */
-	struct fence *fence;
+	struct fence_collection *fences;
 	int fence_fd;
 
 	/* Signed dest location allows it to be partially off screen */
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/6] drm/fences: add in-fences to DRM Gustavo Padovan <gustavo@padovan.org> - 2016-03-23 19:50 +0100
  [RFC 6/6] drm/fence: support fence_collection on atomic commit Gustavo Padovan <gustavo@padovan.org> - 2016-03-23 19:50 +0100
  [RFC 5/6] dma-buf/fence: add fence_collection_wait() Gustavo Padovan <gustavo@padovan.org> - 2016-03-23 19:50 +0100
  [RFC 4/6] dma-buf/fence: add fence_collection_put() Gustavo Padovan <gustavo@padovan.org> - 2016-03-23 19:50 +0100
  [RFC 3/6] dma-buf/sync_file: add sync_file_fences_get() Gustavo Padovan <gustavo@padovan.org> - 2016-03-23 19:50 +0100
  [RFC 1/6] drm/fence: add FENCE_FD property to planes Gustavo Padovan <gustavo@padovan.org> - 2016-03-23 19:50 +0100
  Re: [RFC 0/6] drm/fences: add in-fences to DRM Maarten Lankhorst <maarten.lankhorst@linux.intel.com> - 2016-03-24 08:30 +0100
    Re: [RFC 0/6] drm/fences: add in-fences to DRM Gustavo Padovan <gustavo@padovan.org> - 2016-03-24 15:40 +0100
  Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <inki.dae@samsung.com> - 2016-03-24 09:20 +0100
    Re: [RFC 0/6] drm/fences: add in-fences to DRM Gustavo Padovan <gustavo@padovan.org> - 2016-03-24 15:50 +0100
      Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <inki.dae@samsung.com> - 2016-03-25 00:10 +0100
    Re: [RFC 0/6] drm/fences: add in-fences to DRM Rob Clark <robdclark@gmail.com> - 2016-03-24 16:50 +0100
      Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <inki.dae@samsung.com> - 2016-03-25 00:50 +0100
        Re: [RFC 0/6] drm/fences: add in-fences to DRM Rob Clark <robdclark@gmail.com> - 2016-03-25 13:00 +0100
          Re: [RFC 0/6] drm/fences: add in-fences to DRM Daniel Stone <daniel@fooishbar.org> - 2016-03-25 13:20 +0100
            Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <inki.dae@samsung.com> - 2016-03-28 03:30 +0200
              Re: [RFC 0/6] drm/fences: add in-fences to DRM Daniel Stone <daniel@fooishbar.org> - 2016-03-28 15:30 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <inki.dae@samsung.com> - 2016-03-29 04:20 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Rob Clark <robdclark@gmail.com> - 2016-03-29 15:30 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <inki.dae@samsung.com> - 2016-03-31 09:50 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Daniel Stone <daniel@fooishbar.org> - 2016-03-31 11:40 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <inki.dae@samsung.com> - 2016-03-31 12:10 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Daniel Stone <daniel@fooishbar.org> - 2016-03-31 13:00 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <daeinki@gmail.com> - 2016-03-31 13:30 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Daniel Stone <daniel@fooishbar.org> - 2016-03-31 13:50 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Rob Clark <robdclark@gmail.com> - 2016-03-31 16:20 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Daniel Vetter <daniel@ffwll.ch> - 2016-03-31 12:10 +0200
                Re: [RFC 0/6] drm/fences: add in-fences to DRM Inki Dae <daeinki@gmail.com> - 2016-03-31 13:50 +0200

csiph-web