<div dir="ltr">Thanks!<div><br></div><div>Tested-by: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 16, 2015 at 9:35 AM Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Oct 16, 2015 at 12:23 PM, Daniel Vetter <<a href="mailto:daniel.vetter@ffwll.ch" target="_blank">daniel.vetter@ffwll.ch</a>> wrote:<br>
> In<br>
><br>
> commit bbb1e52402b2a288b09ae37e8182599931c7e9df<br>
> Author: Rob Clark <<a href="mailto:robdclark@gmail.com" target="_blank">robdclark@gmail.com</a>><br>
> Date: Tue Aug 25 15:35:58 2015 -0400<br>
><br>
> drm/fb-helper: atomic restore_fbdev_mode()..<br>
><br>
> we've forgotten to do the plane->old_fb refcount dance for<br>
> pan_display_atomic, which can result in refcount leaks if the current<br>
> configuration is not from fbcon. Which apparently can happen when<br>
> vt-switching - fbcon does a pan first before a set_par.<br>
<br>
oh, whoops<br>
<br>
> OCD-align function parameters while at it.<br>
<br>
did you mean to drop that line from the commit msg, or include an<br>
extra hunk that you missed?<br>
<br>
at any rate,<br>
<br>
Reviewed-by: Rob Clark <<a href="mailto:robdclark@gmail.com" target="_blank">robdclark@gmail.com</a>><br>
<br>
> Cc: Rob Clark <<a href="mailto:robdclark@gmail.com" target="_blank">robdclark@gmail.com</a>><br>
> Cc: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@gmail.com" target="_blank">rodrigo.vivi@gmail.com</a>><br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=92483" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=92483</a><br>
> Signed-off-by: Daniel Vetter <<a href="mailto:daniel.vetter@intel.com" target="_blank">daniel.vetter@intel.com</a>><br>
> ---<br>
> drivers/gpu/drm/drm_fb_helper.c | 27 +++++++++++++++++++++++++--<br>
> 1 file changed, 25 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c<br>
> index 0ac0fcc9b0d2..b2cf28dd90fe 100644<br>
> --- a/drivers/gpu/drm/drm_fb_helper.c<br>
> +++ b/drivers/gpu/drm/drm_fb_helper.c<br>
> @@ -1249,6 +1249,8 @@ retry:<br>
><br>
> mode_set = &fb_helper->crtc_info[i].mode_set;<br>
><br>
> + mode_set->crtc->primary->old_fb = mode_set->crtc->primary->fb;<br>
> +<br>
> mode_set->x = var->xoffset;<br>
> mode_set->y = var->yoffset;<br>
><br>
> @@ -1264,13 +1266,34 @@ retry:<br>
> info->var.xoffset = var->xoffset;<br>
> info->var.yoffset = var->yoffset;<br>
><br>
> - return 0;<br>
><br>
> fail:<br>
> + for(i = 0; i < fb_helper->crtc_count; i++) {<br>
> + struct drm_mode_set *mode_set;<br>
> + struct drm_plane *plane;<br>
> +<br>
> + mode_set = &fb_helper->crtc_info[i].mode_set;<br>
> + plane = mode_set->crtc->primary;<br>
> +<br>
> + if (ret == 0) {<br>
> + struct drm_framebuffer *new_fb = plane->state->fb;<br>
> +<br>
> + if (new_fb)<br>
> + drm_framebuffer_reference(new_fb);<br>
> + plane->fb = new_fb;<br>
> + plane->crtc = plane->state->crtc;<br>
> +<br>
> + if (plane->old_fb)<br>
> + drm_framebuffer_unreference(plane->old_fb);<br>
> + }<br>
> + plane->old_fb = NULL;<br>
> + }<br>
> +<br>
> if (ret == -EDEADLK)<br>
> goto backoff;<br>
><br>
> - drm_atomic_state_free(state);<br>
> + if (ret != 0)<br>
> + drm_atomic_state_free(state);<br>
><br>
> return ret;<br>
><br>
> --<br>
> 2.5.1<br>
><br>
</blockquote></div>