[PATCH 15/19] drm/plane-helper: Add async mode to prepare_fb

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

 



Currently all helpers use ->prepare_fb for synchronous state updates,
so we need the driver callback to wait for any outstanding rendering.

But with async commit we really only want to reserve the framebuffer,
but not stall for rendering. That should be done in the asynchronous
worker.

So add a boolean for this.

Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 drivers/gpu/drm/drm_atomic_helper.c | 12 +++++++++---
 drivers/gpu/drm/drm_crtc_helper.c   |  2 +-
 drivers/gpu/drm/drm_plane_helper.c  |  4 ++--
 include/drm/drm_atomic_helper.h     |  3 ++-
 include/drm/drm_plane_helper.h      |  3 ++-
 5 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 1b13394cf020..9f7c45b91fe2 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -673,7 +673,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,
 	if (async)
 		return -EBUSY;
 
-	ret = drm_atomic_helper_prepare_planes(dev, state);
+	ret = drm_atomic_helper_prepare_planes(dev, state, false);
 	if (ret)
 		return ret;
 
@@ -719,16 +719,22 @@ EXPORT_SYMBOL(drm_atomic_helper_commit);
  * drm_atomic_helper_prepare_planes - prepare plane resources after commit
  * @dev: DRM device
  * @state: atomic state object with old state structures
+ * @async: asynchronous commit
  *
  * This function prepares plane state, specifically framebuffers, for the new
  * configuration. If any failure is encountered this function will call
  * ->cleanup_fb on any already successfully prepared framebuffer.
  *
+ * If @async is true the driver callbacks should not wait for outstanding
+ * render, but instead ensure that the asynchronous commit work item is stalled
+ * sufficiently long.
+ *
  * Returns:
  * 0 on success, negative error code on failure.
  */
 int drm_atomic_helper_prepare_planes(struct drm_device *dev,
-				     struct drm_atomic_state *state)
+				     struct drm_atomic_state *state,
+				     bool async)
 {
 	int nplanes = dev->mode_config.num_total_plane;
 	int ret, i;
@@ -746,7 +752,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,
 		fb = state->plane_states[i]->fb;
 
 		if (fb && funcs->prepare_fb) {
-			ret = funcs->prepare_fb(plane, fb);
+			ret = funcs->prepare_fb(plane, fb, async);
 			if (ret)
 				goto fail;
 		}
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 7e838104e72e..1382842782f3 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -993,7 +993,7 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 	}
 
 	if (plane_funcs->prepare_fb) {
-		ret = plane_funcs->prepare_fb(plane, plane_state->fb);
+		ret = plane_funcs->prepare_fb(plane, plane_state->fb, false);
 		if (ret)
 			goto fail;
 	}
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 7befbf017afe..6903f50012c5 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -435,7 +435,7 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
 	}
 
 	if (plane_funcs->prepare_fb) {
-		ret = plane_funcs->prepare_fb(plane, fb);
+		ret = plane_funcs->prepare_fb(plane, fb, false);
 		if (ret)
 			goto fail;
 	}
@@ -514,7 +514,7 @@ int drm_plane_helper_disable(struct drm_plane *plane)
 	}
 
 	if (plane_funcs->prepare_fb) {
-		ret = plane_funcs->prepare_fb(plane, fb);
+		ret = plane_funcs->prepare_fb(plane, fb, false);
 		if (ret)
 			goto fail;
 	}
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 8cd6fe7a48e5..0f48e0ffb614 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -40,7 +40,8 @@ void drm_atomic_helper_commit_post_planes(struct drm_device *dev,
 					  struct drm_atomic_state *old_state);
 
 int drm_atomic_helper_prepare_planes(struct drm_device *dev,
-				     struct drm_atomic_state *state);
+				     struct drm_atomic_state *state,
+				     bool async);
 void drm_atomic_helper_commit_planes(struct drm_device *dev,
 				     struct drm_atomic_state *state);
 void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index a6f3a8ed3394..48543149055b 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -49,7 +49,8 @@
  */
 struct drm_plane_helper_funcs {
 	int (*prepare_fb)(struct drm_plane *plane,
-			  struct drm_framebuffer *fb);
+			  struct drm_framebuffer *fb,
+			  bool async);
 	void (*cleanup_fb)(struct drm_plane *plane,
 			   struct drm_framebuffer *fb);
 
-- 
2.0.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux