From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mika Kuoppala Subject: Re: [Intel-gfx] [PATCH] drm/i915: Don't clobber crtc->fb when queue_flip fails Date: Fri, 22 Feb 2013 15:46:00 +0200 Message-ID: <87sj4ofomf.fsf@gaia.fi.intel.com> References: <1361535444-14625-1-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1361535444-14625-1-git-send-email-ville.syrjala@linux.intel.com> Sender: stable-owner@vger.kernel.org To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org Cc: stable@vger.kernel.org List-Id: intel-gfx@lists.freedesktop.org ville.syrjala@linux.intel.com writes: > From: Ville Syrj=C3=A4l=C3=A4 > > Point crtc->fb the the new framebuffer only after we know that the fl= ip > was succesfully queued. > > While at it, move the intel_fb and obj assignments a bit close to whe= re > they're used. > > Cc: stable@vger.kernel.org > Signed-off-by: Ville Syrj=C3=A4l=C3=A4 > --- > It looks like Mika hit this rather easily in his ARB_robustness work. > Waiting for him to confirm whether this really fixes the pin_count > underflow bug he's seeing. Tested-by: Mika Kuoppala > drivers/gpu/drm/i915/intel_display.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i= 915/intel_display.c > index 0ff10b3..e7684f1 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -7311,9 +7311,6 @@ static int intel_crtc_page_flip(struct drm_crtc= *crtc, > intel_crtc->unpin_work =3D work; > spin_unlock_irqrestore(&dev->event_lock, flags); > =20 > - intel_fb =3D to_intel_framebuffer(fb); > - obj =3D intel_fb->obj; > - > if (atomic_read(&intel_crtc->unpin_work_count) >=3D 2) > flush_workqueue(dev_priv->wq); > =20 > @@ -7321,12 +7318,13 @@ static int intel_crtc_page_flip(struct drm_cr= tc *crtc, > if (ret) > goto cleanup; > =20 > + intel_fb =3D to_intel_framebuffer(fb); > + obj =3D intel_fb->obj; > + > /* Reference the objects for the scheduled work. */ > drm_gem_object_reference(&work->old_fb_obj->base); > drm_gem_object_reference(&obj->base); > =20 > - crtc->fb =3D fb; > - > work->pending_flip_obj =3D obj; > =20 > work->enable_stall_check =3D true; > @@ -7338,6 +7336,8 @@ static int intel_crtc_page_flip(struct drm_crtc= *crtc, > if (ret) > goto cleanup_pending; > =20 > + crtc->fb =3D fb; > + > intel_disable_fbc(dev); > intel_mark_fb_busy(obj); > mutex_unlock(&dev->struct_mutex); > --=20 > 1.7.12.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx