aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>2016-11-07 05:03:30 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-11-08 05:22:54 -0500
commit13b55664eec7b85607c4ab9d26a62b4af413a771 (patch)
tree97a0790c062714f8fe8a4a5fc462d835bd370ddf
parent7abc7d47510c75dd984380ebf819616e574c9604 (diff)
drm/atomic: add drm_atomic_set_fence_for_plane()
This new function should be used by drivers when setting a implicit fence for the plane. It abstracts the fact that the user might have chosen explicit fencing instead. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1478513013-3221-1-git-send-email-gustavo@padovan.org
-rw-r--r--drivers/gpu/drm/drm_atomic.c30
-rw-r--r--include/drm/drm_atomic.h2
-rw-r--r--include/drm/drm_plane.h2
3 files changed, 33 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index c32fb3c1d6f0..5e7395455108 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1147,6 +1147,36 @@ drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
1147EXPORT_SYMBOL(drm_atomic_set_fb_for_plane); 1147EXPORT_SYMBOL(drm_atomic_set_fb_for_plane);
1148 1148
1149/** 1149/**
1150 * drm_atomic_set_fence_for_plane - set fence for plane
1151 * @plane_state: atomic state object for the plane
1152 * @fence: dma_fence to use for the plane
1153 *
1154 * Helper to setup the plane_state fence in case it is not set yet.
1155 * By using this drivers doesn't need to worry if the user choose
1156 * implicit or explicit fencing.
1157 *
1158 * This function will not set the fence to the state if it was set
1159 * via explicit fencing interfaces on the atomic ioctl. It will
1160 * all drope the reference to the fence as we not storing it
1161 * anywhere.
1162 *
1163 * Otherwise, if plane_state->fence is not set this function we
1164 * just set it with the received implict fence.
1165 */
1166void
1167drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
1168 struct dma_fence *fence)
1169{
1170 if (plane_state->fence) {
1171 dma_fence_put(fence);
1172 return;
1173 }
1174
1175 plane_state->fence = fence;
1176}
1177EXPORT_SYMBOL(drm_atomic_set_fence_for_plane);
1178
1179/**
1150 * drm_atomic_set_crtc_for_connector - set crtc for connector 1180 * drm_atomic_set_crtc_for_connector - set crtc for connector
1151 * @conn_state: atomic state object for the connector 1181 * @conn_state: atomic state object for the connector
1152 * @crtc: crtc to use for the connector 1182 * @crtc: crtc to use for the connector
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index fc8af53b18aa..2d1e9c944b54 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -345,6 +345,8 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
345 struct drm_crtc *crtc); 345 struct drm_crtc *crtc);
346void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, 346void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
347 struct drm_framebuffer *fb); 347 struct drm_framebuffer *fb);
348void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
349 struct dma_fence *fence);
348int __must_check 350int __must_check
349drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state, 351drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
350 struct drm_crtc *crtc); 352 struct drm_crtc *crtc);
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index c5e8a0df1623..68f6d221a3da 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -59,7 +59,7 @@ struct drm_plane_state {
59 59
60 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ 60 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
61 struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ 61 struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
62 struct dma_fence *fence; 62 struct dma_fence *fence; /* do not write directly, use drm_atomic_set_fence_for_plane() */
63 63
64 /* Signed dest location allows it to be partially off screen */ 64 /* Signed dest location allows it to be partially off screen */
65 int32_t crtc_x, crtc_y; 65 int32_t crtc_x, crtc_y;