From patchwork Fri Feb 22 12:17:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ville Syrjala X-Patchwork-Id: 2175831 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id C3A47DFABD for ; Fri, 22 Feb 2013 12:20:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 857ADE6A99 for ; Fri, 22 Feb 2013 04:20:40 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C3B2E6A99 for ; Fri, 22 Feb 2013 04:17:38 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 22 Feb 2013 04:17:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,715,1355126400"; d="scan'208";a="294616023" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by fmsmga002.fm.intel.com with SMTP; 22 Feb 2013 04:17:35 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 22 Feb 2013 14:17:35 +0200 From: ville.syrjala@linux.intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 22 Feb 2013 14:17:24 +0200 Message-Id: <1361535444-14625-1-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Cc: stable@vger.kernel.org Subject: [Intel-gfx] [PATCH] drm/i915: Don't clobber crtc->fb when queue_flip fails X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org From: Ville Syrjälä 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älä Tested-by: Mika Kuoppala --- 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/i915/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 = work; spin_unlock_irqrestore(&dev->event_lock, flags); - intel_fb = to_intel_framebuffer(fb); - obj = intel_fb->obj; - if (atomic_read(&intel_crtc->unpin_work_count) >= 2) flush_workqueue(dev_priv->wq); @@ -7321,12 +7318,13 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, if (ret) goto cleanup; + intel_fb = to_intel_framebuffer(fb); + obj = 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); - crtc->fb = fb; - work->pending_flip_obj = obj; work->enable_stall_check = true; @@ -7338,6 +7336,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, if (ret) goto cleanup_pending; + crtc->fb = fb; + intel_disable_fbc(dev); intel_mark_fb_busy(obj); mutex_unlock(&dev->struct_mutex);