drm_atomic_helper_wait_for_fences() computes the next vblank start time
(for single-CRTC commits) and uses it to set an advisory deadline on the
incoming plane fences before waiting.

Expose this logic as drm_atomic_helper_set_fence_deadline() so drivers
with custom commit plumbing can reuse the same deadline calculation and
fence annotation without open-coding it.

No functional change intended: drm_atomic_helper_wait_for_fences()
continues to set the same deadlines as before, now via the exported
helper.

Cc: <[email protected]>
Signed-off-by: Matthew Brost <[email protected]>
---
 drivers/gpu/drm/drm_atomic_helper.c | 11 ++++++++---
 include/drm/drm_atomic_helper.h     |  3 +++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index cc1f0c102414..321fad478ee0 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1770,11 +1770,15 @@ void drm_atomic_helper_commit_modeset_enables(struct 
drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_enables);
 
 /*
+ * drm_atomic_helper_set_fence_deadline() - set fence deadlines
+ * @dev: DRM device
+ * @state: atomic state object being committed
+ *
  * For atomic updates which touch just a single CRTC, calculate the time of the
  * next vblank, and inform all the fences of the deadline.
  */
-static void set_fence_deadline(struct drm_device *dev,
-                              struct drm_atomic_state *state)
+void drm_atomic_helper_set_fence_deadline(struct drm_device *dev,
+                                         struct drm_atomic_state *state)
 {
        struct drm_crtc *crtc;
        struct drm_crtc_state *new_crtc_state;
@@ -1809,6 +1813,7 @@ static void set_fence_deadline(struct drm_device *dev,
                dma_fence_set_deadline(new_plane_state->fence, vbltime);
        }
 }
+EXPORT_SYMBOL(drm_atomic_helper_set_fence_deadline);
 
 /**
  * drm_atomic_helper_wait_for_fences - wait for fences stashed in plane state
@@ -1839,7 +1844,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device 
*dev,
        struct drm_plane_state *new_plane_state;
        int i, ret;
 
-       set_fence_deadline(dev, state);
+       drm_atomic_helper_set_fence_deadline(dev, state);
 
        for_each_new_plane_in_state(state, plane, new_plane_state, i) {
                if (!new_plane_state->fence)
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index e154ee4f0696..401e83ab408d 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -186,6 +186,9 @@ int drm_atomic_helper_page_flip_target(
                                uint32_t target,
                                struct drm_modeset_acquire_ctx *ctx);
 
+void drm_atomic_helper_set_fence_deadline(struct drm_device *dev,
+                                         struct drm_atomic_state *state);
+
 /**
  * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to 
CRTC
  * @plane: the loop cursor
-- 
2.34.1

Reply via email to