drm/fb-helper: Fix fb refcounting in pan_display_atomic
In
commit bbb1e52402
Author: Rob Clark <robdclark@gmail.com>
Date: Tue Aug 25 15:35:58 2015 -0400
drm/fb-helper: atomic restore_fbdev_mode()..
we've forgotten to do the plane->old_fb refcount dance for
pan_display_atomic, which can result in refcount leaks if the current
configuration is not from fbcon. Which apparently can happen when
vt-switching - fbcon does a pan first before a set_par.
OCD-align function parameters while at it.
v2: Actually git add the OCD.
Cc: Rob Clark <robdclark@gmail.com>
Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92483
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1445015490-27682-1-git-send-email-daniel.vetter@ffwll.ch
Tested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
16e910df19
commit
a0fb6ad7ae
|
@ -1245,6 +1245,8 @@ retry:
|
||||||
|
|
||||||
mode_set = &fb_helper->crtc_info[i].mode_set;
|
mode_set = &fb_helper->crtc_info[i].mode_set;
|
||||||
|
|
||||||
|
mode_set->crtc->primary->old_fb = mode_set->crtc->primary->fb;
|
||||||
|
|
||||||
mode_set->x = var->xoffset;
|
mode_set->x = var->xoffset;
|
||||||
mode_set->y = var->yoffset;
|
mode_set->y = var->yoffset;
|
||||||
|
|
||||||
|
@ -1260,12 +1262,33 @@ retry:
|
||||||
info->var.xoffset = var->xoffset;
|
info->var.xoffset = var->xoffset;
|
||||||
info->var.yoffset = var->yoffset;
|
info->var.yoffset = var->yoffset;
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
for(i = 0; i < fb_helper->crtc_count; i++) {
|
||||||
|
struct drm_mode_set *mode_set;
|
||||||
|
struct drm_plane *plane;
|
||||||
|
|
||||||
|
mode_set = &fb_helper->crtc_info[i].mode_set;
|
||||||
|
plane = mode_set->crtc->primary;
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
struct drm_framebuffer *new_fb = plane->state->fb;
|
||||||
|
|
||||||
|
if (new_fb)
|
||||||
|
drm_framebuffer_reference(new_fb);
|
||||||
|
plane->fb = new_fb;
|
||||||
|
plane->crtc = plane->state->crtc;
|
||||||
|
|
||||||
|
if (plane->old_fb)
|
||||||
|
drm_framebuffer_unreference(plane->old_fb);
|
||||||
|
}
|
||||||
|
plane->old_fb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == -EDEADLK)
|
if (ret == -EDEADLK)
|
||||||
goto backoff;
|
goto backoff;
|
||||||
|
|
||||||
|
if (ret != 0)
|
||||||
drm_atomic_state_free(state);
|
drm_atomic_state_free(state);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue