aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2014-11-21 15:28:31 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-11-27 09:38:15 -0500
commit6ddd388ab222b66b596342becc76d5031c0e2fc8 (patch)
treea13411bc126896dc7a4a61a442657beb02ef59eb /include
parent3009c0377f25c29852b218a6933a969d02cbdc5d (diff)
drm/atomic: track bitmask of planes attached to crtc
Chasing plane->state->crtc of planes that are *not* part of the same atomic update is racy, making it incredibly awkward (or impossible) to do something simple like iterate over all planes and figure out which ones are attached to a crtc. Solve this by adding a bitmask of currently attached planes in the crtc-state. Note that the transitional helpers do not maintain the plane_mask. But they only support the legacy ioctls, which have sufficient brute-force locking around plane updates that they can continue to loop over all planes to see what is attached to a crtc the old way. Signed-off-by: Rob Clark <robdclark@gmail.com> [danvet: - Drop comments about locking in set_crtc_for_plane since they're a bit misleading - we already should hold lock for the current crtc. - Also WARN_ON if get_state on the old crtc fails since that should have been done already. - Squash in fixup to check get_plane_state return value, reported by Dan Carpenter and acked by Rob Clark.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_atomic.h4
-rw-r--r--include/drm/drm_crtc.h14
2 files changed, 13 insertions, 5 deletions
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index e224ccfa11ca..ad2229574dd9 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -46,8 +46,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
46 struct drm_connector *connector); 46 struct drm_connector *connector);
47 47
48int __must_check 48int __must_check
49drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, 49drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state,
50 struct drm_crtc *crtc); 50 struct drm_plane *plane, struct drm_crtc *crtc);
51void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, 51void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
52 struct drm_framebuffer *fb); 52 struct drm_framebuffer *fb);
53int __must_check 53int __must_check
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index b459e8fbbc25..4cf6905b57f5 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -231,6 +231,7 @@ struct drm_atomic_state;
231 * struct drm_crtc_state - mutable CRTC state 231 * struct drm_crtc_state - mutable CRTC state
232 * @enable: whether the CRTC should be enabled, gates all other state 232 * @enable: whether the CRTC should be enabled, gates all other state
233 * @mode_changed: for use by helpers and drivers when computing state updates 233 * @mode_changed: for use by helpers and drivers when computing state updates
234 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
234 * @last_vblank_count: for helpers and drivers to capture the vblank of the 235 * @last_vblank_count: for helpers and drivers to capture the vblank of the
235 * update to ensure framebuffer cleanup isn't done too early 236 * update to ensure framebuffer cleanup isn't done too early
236 * @planes_changed: for use by helpers and drivers when computing state updates 237 * @planes_changed: for use by helpers and drivers when computing state updates
@@ -247,6 +248,13 @@ struct drm_crtc_state {
247 bool planes_changed : 1; 248 bool planes_changed : 1;
248 bool mode_changed : 1; 249 bool mode_changed : 1;
249 250
251 /* attached planes bitmask:
252 * WARNING: transitional helpers do not maintain plane_mask so
253 * drivers not converted over to atomic helpers should not rely
254 * on plane_mask being accurate!
255 */
256 u32 plane_mask;
257
250 /* last_vblank_count: for vblank waits before cleanup */ 258 /* last_vblank_count: for vblank waits before cleanup */
251 u32 last_vblank_count; 259 u32 last_vblank_count;
252 260
@@ -438,7 +446,7 @@ struct drm_crtc {
438 * @state: backpointer to global drm_atomic_state 446 * @state: backpointer to global drm_atomic_state
439 */ 447 */
440struct drm_connector_state { 448struct drm_connector_state {
441 struct drm_crtc *crtc; 449 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */
442 450
443 struct drm_encoder *best_encoder; 451 struct drm_encoder *best_encoder;
444 452
@@ -673,8 +681,8 @@ struct drm_connector {
673 * @state: backpointer to global drm_atomic_state 681 * @state: backpointer to global drm_atomic_state
674 */ 682 */
675struct drm_plane_state { 683struct drm_plane_state {
676 struct drm_crtc *crtc; 684 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
677 struct drm_framebuffer *fb; 685 struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
678 struct fence *fence; 686 struct fence *fence;
679 687
680 /* Signed dest location allows it to be partially off screen */ 688 /* Signed dest location allows it to be partially off screen */