Skip to contentSkip to conversation

drm: export atomic wait_for_vblanks helper

PATCH In review Rob Clark 2 participants 2 messages Nov 10, 2014

Subsystems (2)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 drm: export atomic wait_for_vblanks helper

---
I'll need this helper for msm async commit, and I suspect other drivers will as well.

 drivers/gpu/drm/drm_atomic_helper.c | 16 +++++++++++++---
 include/drm/drm_atomic_helper.h     |  3 +++
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +13 -3
index ca839bd..9032fd5 100644
@@ -754,8 +754,17 @@ static void wait_for_fences(struct drm_device *dev,
 	}
 }
 
-static void
-wait_for_vblanks(struct drm_device *dev, struct drm_atomic_state *old_state)
+/**
+ * drm_atomic_helper_wait_for_vblanks - wait for vblank on crtcs
+ * @dev: DRM device
+ * @old_state: the just-applied driver state object
+ *
+ * Helper to, after atomic commit, wait for vblanks on all effected crtcs
+ * (ie. before cleaning up old crtcs)
+ */
+void
+drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
+		struct drm_atomic_state *old_state)
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *old_crtc_state;
@@ -800,6 +809,7 @@ wait_for_vblanks(struct drm_device *dev, struct drm_atomic_state *old_state)
 		drm_crtc_vblank_put(crtc);
 	}
 }
+EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks);
 
 /**
  * drm_atomic_helper_commit - commit validated state object
@@ -859,7 +869,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,
 
 	drm_atomic_helper_commit_post_planes(dev, state);
 
-	wait_for_vblanks(dev, state);
+	drm_atomic_helper_wait_for_vblanks(dev, state);
 
 	drm_atomic_helper_cleanup_planes(dev, state);
 
include/drm/drm_atomic_helper.h +3 -0
index 67e3c46..64b4e91 100644
@@ -34,6 +34,9 @@ int drm_atomic_helper_commit(struct drm_device *dev,
 			     struct drm_atomic_state *state,
 			     bool async);
 
+void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
+					struct drm_atomic_state *old_state);
+
 void drm_atomic_helper_commit_pre_planes(struct drm_device *dev,
 					 struct drm_atomic_state *state);
 void drm_atomic_helper_commit_post_planes(struct drm_device *dev,
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Rob Clark

---
I'll need this helper for msm async commit, and I suspect other drivers will as well.

Yeah, makes sense. Some nits to clarify the kerneldoc below, with that addressed this is

Quoted 10 lines
 drivers/gpu/drm/drm_atomic_helper.c | 16 +++++++++++++---
 include/drm/drm_atomic_helper.h     |  3 +++
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +0 -0
index ca839bd..9032fd5 100644

drivers/gpu/drm/drm_atomic_helper.c static void wait_for_fences(struct drm_device *dev, · line 760

Quoted 9 lines
drivers/gpu/drm/drm_atomic_helper.c +4 -2
@@ -754,8 +754,17 @@ static void wait_for_fences(struct drm_device *dev,
 	}
 }
 
-static void
-wait_for_vblanks(struct drm_device *dev, struct drm_atomic_state *old_state)
+/**
+ * drm_atomic_helper_wait_for_vblanks - wait for vblank on crtcs
+ * @dev: DRM device
+ * @old_state: the just-applied driver state object

I think both for consistency and clarity we should copypaste the kerneldoc I've used everyhwere else:

* @old_state: atomic state object with old state structures

Maybe we should also clarify the kerneldoc of the swap_state helper function a bit, dunno. Now that I read it again it's not really a shining beacon of great docs ;-)

drivers/gpu/drm/drm_atomic_helper.c static void wait_for_fences(struct drm_device *dev, · line 763

Quoted 3 lines
drivers/gpu/drm/drm_atomic_helper.c +3 -0
+ *
+ * Helper to, after atomic commit, wait for vblanks on all effected crtcs
+ * (ie. before cleaning up old crtcs)

Missing full stop, and s/crtcs/framebuffers using
drm_atomic_helper_cleanup_planes()/

Quoted 41 lines
drivers/gpu/drm/drm_atomic_helper.c +6 -1
+ */
+void
+drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
+		struct drm_atomic_state *old_state)
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *old_crtc_state;
@@ -800,6 +809,7 @@ wait_for_vblanks(struct drm_device *dev, struct drm_atomic_state *old_state)
 		drm_crtc_vblank_put(crtc);
 	}
 }
+EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks);
 
 /**
  * drm_atomic_helper_commit - commit validated state object
@@ -859,7 +869,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,
 
 	drm_atomic_helper_commit_post_planes(dev, state);
 
-	wait_for_vblanks(dev, state);
+	drm_atomic_helper_wait_for_vblanks(dev, state);
 
 	drm_atomic_helper_cleanup_planes(dev, state);
 
include/drm/drm_atomic_helper.h +3 -0
index 67e3c46..64b4e91 100644
@@ -34,6 +34,9 @@ int drm_atomic_helper_commit(struct drm_device *dev,
 			     struct drm_atomic_state *state,
 			     bool async);
 
+void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
+					struct drm_atomic_state *old_state);
+
 void drm_atomic_helper_commit_pre_planes(struct drm_device *dev,
 					 struct drm_atomic_state *state);
 void drm_atomic_helper_commit_post_planes(struct drm_device *dev,
Signature · 1 line
1.9.3
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel