aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_atomic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_atomic.c')
-rw-r--r--drivers/gpu/drm/drm_atomic.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index ba49b5ca822f..ff5f034cc405 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -344,7 +344,8 @@ EXPORT_SYMBOL(drm_atomic_get_connector_state);
344 344
345/** 345/**
346 * drm_atomic_set_crtc_for_plane - set crtc for plane 346 * drm_atomic_set_crtc_for_plane - set crtc for plane
347 * @plane_state: atomic state object for the plane 347 * @state: the incoming atomic state
348 * @plane: the plane whose incoming state to update
348 * @crtc: crtc to use for the plane 349 * @crtc: crtc to use for the plane
349 * 350 *
350 * Changing the assigned crtc for a plane requires us to grab the lock and state 351 * Changing the assigned crtc for a plane requires us to grab the lock and state
@@ -357,20 +358,35 @@ EXPORT_SYMBOL(drm_atomic_get_connector_state);
357 * sequence must be restarted. All other errors are fatal. 358 * sequence must be restarted. All other errors are fatal.
358 */ 359 */
359int 360int
360drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, 361drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state,
361 struct drm_crtc *crtc) 362 struct drm_plane *plane, struct drm_crtc *crtc)
362{ 363{
364 struct drm_plane_state *plane_state =
365 drm_atomic_get_plane_state(state, plane);
363 struct drm_crtc_state *crtc_state; 366 struct drm_crtc_state *crtc_state;
364 367
368 if (WARN_ON(IS_ERR(plane_state)))
369 return PTR_ERR(plane_state);
370
371 if (plane_state->crtc) {
372 crtc_state = drm_atomic_get_crtc_state(plane_state->state,
373 plane_state->crtc);
374 if (WARN_ON(IS_ERR(crtc_state)))
375 return PTR_ERR(crtc_state);
376
377 crtc_state->plane_mask &= ~(1 << drm_plane_index(plane));
378 }
379
380 plane_state->crtc = crtc;
381
365 if (crtc) { 382 if (crtc) {
366 crtc_state = drm_atomic_get_crtc_state(plane_state->state, 383 crtc_state = drm_atomic_get_crtc_state(plane_state->state,
367 crtc); 384 crtc);
368 if (IS_ERR(crtc_state)) 385 if (IS_ERR(crtc_state))
369 return PTR_ERR(crtc_state); 386 return PTR_ERR(crtc_state);
387 crtc_state->plane_mask |= (1 << drm_plane_index(plane));
370 } 388 }
371 389
372 plane_state->crtc = crtc;
373
374 if (crtc) 390 if (crtc)
375 DRM_DEBUG_KMS("Link plane state %p to [CRTC:%d]\n", 391 DRM_DEBUG_KMS("Link plane state %p to [CRTC:%d]\n",
376 plane_state, crtc->base.id); 392 plane_state, crtc->base.id);