From: ville.syrjala@linux.intel.com Subject: [PATCH] drm/i915: Don't clobber crtc->fb when queue_flip fails Date: Fri, 22 Feb 2013 14:17:24 +0200 Message-ID: <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: Sender: stable-owner@vger.kernel.org To: intel-gfx@lists.freedesktop.org Cc: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , stable@vger.kernel.org List-Id: intel-gfx@lists.freedesktop.org =46rom: Ville Syrj=C3=A4l=C3=A4 Point crtc->fb the the new framebuffer only after we know that the flip was succesfully queued. While at it, move the intel_fb and obj assignments a bit close to where 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. 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/i91= 5/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_crtc= *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