From patchwork Fri Oct 24 13:51:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 5147541 Return-Path: X-Original-To: patchwork-dri-devel@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 9E062C11AC for ; Fri, 24 Oct 2014 13:51:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC36A20265 for ; Fri, 24 Oct 2014 13:51:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ACA482017A for ; Fri, 24 Oct 2014 13:51:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F03B56E077; Fri, 24 Oct 2014 06:51:38 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D5866E077; Fri, 24 Oct 2014 06:51:37 -0700 (PDT) Received: by mail-wi0-f181.google.com with SMTP id n3so1313336wiv.2 for ; Fri, 24 Oct 2014 06:51:37 -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:mime-version:content-type :content-transfer-encoding; bh=Udc/S97m7XHlO9tKJN0mgXh9bywJYkSyYg5AbLnM5gY=; b=KgMYcoFirxrUfnWgdykxtIj8mVdNhnZsoPBM9zymg/M0557M8oFbj1z+z2GNOA/JZH uHHMj15b19L0+Ba/1tJkXxK+RKhmBmCBu/Y9vU8xioiuf5FU1tJTION1wsY8Oia2BJ2Y ah/6gr1XEoFM8nvIUMyzBLaOkvGt+8cXU96SNrXNKpK/wz19iQVNkBJW8Bh96WvJNQAg qHidMhJuwpsZDwttJvfHxRAPNT5UUvCgRJ2Ugm5sZGUbY1EWVzg/gMGnzKA3B2o/CCu5 /4Y7m25j04YeAKlnzP+qLoHsOe7kEh5OMQ6Oj7wb+s8ZFOKIFTaQ1WTTHfkE8AbCiuF2 ZSmw== X-Received: by 10.194.157.137 with SMTP id wm9mr5035834wjb.5.1414158696943; Fri, 24 Oct 2014 06:51:36 -0700 (PDT) Received: from jasmin.cbg.collabora.co.uk (pakora.collabora.co.uk. [93.93.133.71]) by mx.google.com with ESMTPSA id ei1sm2082840wib.20.2014.10.24.06.51.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Oct 2014 06:51:36 -0700 (PDT) From: Gustavo Padovan To: intel-gfx@lists.freedesktop.org Subject: [PATCH v4 1/5] drm/i915: create a prepare step for primary planes updates Date: Fri, 24 Oct 2014 14:51:31 +0100 Message-Id: <1414158695-31605-1-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 1.9.3 MIME-Version: 1.0 Cc: Gustavo Padovan , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.6 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 Reviewed-by: Ville Syrjälä --- 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 7d891e5..8530401 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11660,20 +11660,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); @@ -11683,7 +11679,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) @@ -11696,6 +11692,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; @@ -11772,8 +11787,6 @@ intel_commit_primary_plane(struct drm_plane *plane, intel_unpin_fb_obj(old_obj); mutex_unlock(&dev->struct_mutex); } - - return 0; } static int @@ -11814,6 +11827,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;