From patchwork Wed Sep 24 17:20:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 4968881 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 959A59F2F0 for ; Wed, 24 Sep 2014 17:21:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 502CC20158 for ; Wed, 24 Sep 2014 17:20:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0FBF820122 for ; Wed, 24 Sep 2014 17:20:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7966D6E657; Wed, 24 Sep 2014 10:20:57 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qg0-f48.google.com (mail-qg0-f48.google.com [209.85.192.48]) by gabe.freedesktop.org (Postfix) with ESMTP id D293F6E657; Wed, 24 Sep 2014 10:20:54 -0700 (PDT) Received: by mail-qg0-f48.google.com with SMTP id z107so6357585qgd.35 for ; Wed, 24 Sep 2014 10:20:54 -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=jG2yolLoZ9098tls1/NGO4eYVRArLOS7s0oog6G8V/c=; b=B4m7XxbzQOGnJD+GcD0rj7k57L/lyg8++XsKr4BjD23wecvOY4ln3FgVZGb+ZZqZkF oEVKcduQaEi41sCfcl67W602QnjhDEEx3gUEc+HQzO9xgR5YWvsG3q6xcam7hhjRSf6i 5iU1GOhZJzOZ69Jz1+IjwFzHwhbOGn8gYybldMOSFBiHKkDxwzdGCKZXWDjquUSZwXnV CNDlfcchRvqtM4SVPv8dKLOM3zw5pDDdvtpEdoDIxIMrmHI7p1B1AyIKlc7hnAXkyEPS w0AvqD3NLanPEPobJyrtEcpge2+mdScpgz9LlkyoBZyO4jahjUaVGVaY7RqCg0NQRaEV JkvA== X-Received: by 10.224.122.137 with SMTP id l9mr11555273qar.76.1411579254202; Wed, 24 Sep 2014 10:20:54 -0700 (PDT) Received: from localhost.localdomain ([191.255.48.205]) by mx.google.com with ESMTPSA id l46sm13274852qgd.27.2014.09.24.10.20.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 10:20:53 -0700 (PDT) From: Gustavo Padovan To: intel-gfx@lists.freedesktop.org Date: Wed, 24 Sep 2014 14:20:29 -0300 Message-Id: <1411579232-8668-8-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1411579232-8668-1-git-send-email-gustavo@padovan.org> References: <1411579232-8668-1-git-send-email-gustavo@padovan.org> Cc: Gustavo Padovan , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH v3 08/11] 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=-4.9 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 dfe9ad5..9dd4952 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11588,20 +11588,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); @@ -11611,7 +11607,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) @@ -11624,6 +11620,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; @@ -11700,8 +11715,6 @@ intel_commit_primary_plane(struct drm_plane *plane, intel_unpin_fb_obj(old_obj); mutex_unlock(&dev->struct_mutex); } - - return 0; } static int @@ -11742,6 +11755,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;