From patchwork Mon Sep 22 22:23:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 4951061 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6E6AEBEEA5 for ; Mon, 22 Sep 2014 22:23:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9732E2024C for ; Mon, 22 Sep 2014 22:23:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8D04320254 for ; Mon, 22 Sep 2014 22:23:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 378EC6E511; Mon, 22 Sep 2014 15:23:40 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qa0-f50.google.com (mail-qa0-f50.google.com [209.85.216.50]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F6EC6E50D; Mon, 22 Sep 2014 15:23:38 -0700 (PDT) Received: by mail-qa0-f50.google.com with SMTP id j7so820968qaq.23 for ; Mon, 22 Sep 2014 15:23:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XumCwYqCs+MmgjO5GwHJaOHnj15G0pceuHT7KA+C39c=; b=b4u9jn/Lku/rllx6PjUMkHTcdLYlFhx8qvYKyEJ15mHRx2wVYH/VJ2Dsf3DpqLZSaa vrc8ZnKGt8SEYXHsAyfUEfPOYKu0r2ZoKrk3UHEM9Hr+IqjloEfsds14+CfVisR6Wic3 GHP1bWM/w6HOoJtMBpLl7gkHXThlRHz0zP2sbHtu2TC3ZB4YKYPtzkC9ApArnhQiT205 q6GENC0ite+3bD+nryxLaPsYZbbektn/TIS8rvULHojZPauSbJz6/DGAL0S0rMkkt6VV KW3fjiwHTuZVJZpQzmFE/dZ/NBm7ik1RCben7Xl7U/z/l2OSOm0I82dN91vVS7181QKu FV9w== X-Received: by 10.224.115.139 with SMTP id i11mr12615644qaq.86.1411424618083; Mon, 22 Sep 2014 15:23:38 -0700 (PDT) Received: from localhost.localdomain ([179.110.222.152]) by mx.google.com with ESMTPSA id o7sm8903631qay.4.2014.09.22.15.23.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Sep 2014 15:23:37 -0700 (PDT) From: Gustavo Padovan To: intel-gfx@lists.freedesktop.org Date: Mon, 22 Sep 2014 19:23:15 -0300 Message-Id: <1411424597-31662-8-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1411424597-31662-1-git-send-email-gustavo@padovan.org> References: <1411424597-31662-1-git-send-email-gustavo@padovan.org> Cc: Gustavo Padovan , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH v2 08/10] drm/i915: create a prepare step for primary planes updates X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan Take out the pin_fb code so commit phase can't fail anymore. Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/i915/intel_display.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 0f4cb20..f7ca7ab 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11437,20 +11437,16 @@ intel_check_primary_plane(struct drm_plane *plane, } static int -intel_commit_primary_plane(struct drm_plane *plane, - struct intel_plane_state *state) +intel_prepare_primary_plane(struct drm_plane *plane, + struct intel_plane_state *state) { struct drm_crtc *crtc = state->crtc; struct drm_framebuffer *fb = state->fb; struct drm_device *dev = crtc->dev; - struct drm_i915_private *dev_priv = dev->dev_private; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); enum pipe pipe = intel_crtc->pipe; - struct drm_framebuffer *old_fb = plane->fb; struct drm_i915_gem_object *obj = intel_fb_obj(fb); struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); - struct intel_plane *intel_plane = to_intel_plane(plane); - struct drm_rect *src = &state->src; int ret; intel_crtc_wait_for_pending_flips(crtc); @@ -11460,7 +11456,7 @@ intel_commit_primary_plane(struct drm_plane *plane, return -EBUSY; } - if (plane->fb != fb) { + if (old_obj != obj) { mutex_lock(&dev->struct_mutex); ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); if (ret == 0) @@ -11473,6 +11469,25 @@ intel_commit_primary_plane(struct drm_plane *plane, } } + return 0; +} + +static void +intel_commit_primary_plane(struct drm_plane *plane, + struct intel_plane_state *state) +{ + struct drm_crtc *crtc = state->crtc; + struct drm_framebuffer *fb = state->fb; + struct drm_device *dev = crtc->dev; + struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + enum pipe pipe = intel_crtc->pipe; + struct drm_framebuffer *old_fb = plane->fb; + struct drm_i915_gem_object *obj = intel_fb_obj(fb); + struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); + struct intel_plane *intel_plane = to_intel_plane(plane); + struct drm_rect *src = &state->src; + crtc->primary->fb = fb; crtc->x = src->x1; crtc->y = src->y1; @@ -11544,8 +11559,6 @@ intel_commit_primary_plane(struct drm_plane *plane, intel_unpin_fb_obj(old_obj); mutex_unlock(&dev->struct_mutex); } - - return 0; } static int @@ -11586,6 +11599,10 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc, if (ret) return ret; + ret = intel_prepare_primary_plane(plane, &state); + if (ret) + return ret; + intel_commit_primary_plane(plane, &state); return 0;