aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_crtc.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 98a36e6c69ad..237bd34212db 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -469,8 +469,11 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
469 * connectors from it), hence we need to refcount the fbs across all 469 * connectors from it), hence we need to refcount the fbs across all
470 * crtcs. Atomic modeset will have saner semantics ... 470 * crtcs. Atomic modeset will have saner semantics ...
471 */ 471 */
472 drm_for_each_crtc(tmp, crtc->dev) 472 drm_for_each_crtc(tmp, crtc->dev) {
473 tmp->primary->old_fb = tmp->primary->fb; 473 struct drm_plane *plane = tmp->primary;
474
475 plane->old_fb = plane->fb;
476 }
474 477
475 fb = set->fb; 478 fb = set->fb;
476 479
@@ -481,11 +484,13 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
481 } 484 }
482 485
483 drm_for_each_crtc(tmp, crtc->dev) { 486 drm_for_each_crtc(tmp, crtc->dev) {
484 if (tmp->primary->fb) 487 struct drm_plane *plane = tmp->primary;
485 drm_framebuffer_get(tmp->primary->fb); 488
486 if (tmp->primary->old_fb) 489 if (plane->fb)
487 drm_framebuffer_put(tmp->primary->old_fb); 490 drm_framebuffer_get(plane->fb);
488 tmp->primary->old_fb = NULL; 491 if (plane->old_fb)
492 drm_framebuffer_put(plane->old_fb);
493 plane->old_fb = NULL;
489 } 494 }
490 495
491 return ret; 496 return ret;