From patchwork Fri Jul 3 18:40:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 6716581 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A74339F38C for ; Fri, 3 Jul 2015 18:41:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8F2D20801 for ; Fri, 3 Jul 2015 18:41:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D9BF520800 for ; Fri, 3 Jul 2015 18:41:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C0FC96E616; Fri, 3 Jul 2015 11:41:49 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qg0-f41.google.com (mail-qg0-f41.google.com [209.85.192.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 88D246E615 for ; Fri, 3 Jul 2015 11:41:48 -0700 (PDT) Received: by qget71 with SMTP id t71so49505237qge.2 for ; Fri, 03 Jul 2015 11:41:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JpowPprf8r7S8KfPsZKZt1232JhtpwrhK2QoA4s5WI0=; b=IO9WupBR1fvEzZ3KPSYDYTBdS0MehkOhmL7AIB7uJ2M9gXoaFrTGoByl2MT2b/tRiE z5I/xbs5kuWTuHbVCP5AJnJHLn2s38xffCJ0koP+wt45EdbQVLpuvmuI3QnW65vswmJx cXgl7VgtCQk9wEz8mzgZvRPIwE2aKuSSaWchWsqG3+8lqFuXSyBUYluSPBjUFcR4PXew OMzYIznz6XdSWCMGmHKPc85lELHoOkYp4ArZKeX6qAETu8brm2ZVWD7wQCEEig145EW0 8+3uB11LH9r1oOFIiFmUsj6vcA2kAZNO+IXPRkri+54QKCmtjJNBBMB4HyCSLhbwO3I6 +4Sg== X-Received: by 10.55.31.22 with SMTP id f22mr74395586qkf.33.1435948907533; Fri, 03 Jul 2015 11:41:47 -0700 (PDT) Received: from localhost.localdomain (r130-pw-tresbarras.ibys.com.br. [189.76.1.243]) by mx.google.com with ESMTPSA id w68sm4829047qge.18.2015.07.03.11.41.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jul 2015 11:41:46 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Fri, 3 Jul 2015 15:40:54 -0300 Message-Id: <1435948854-4943-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <20150703182304.GW14231@nuc-i3427.alporthouse.com> References: <20150703182304.GW14231@nuc-i3427.alporthouse.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 8/8] drm/i915: protect FBC functions with FBC checks X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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: Paulo Zanoni Now all the functions called by other files check whether FBC has been initialized. This allows us to drop the checks on the static functions. v2: - s/HAS_FBC/dev_priv->display.enable_fbc/ everywhere but the init function (Chris). Suggested-by: Chris Wilson Signed-off-by: Paulo Zanoni Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/intel_fbc.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) I'm not 100% sure this is what Chris was asking for v2, so please clarify if this is not what we want. diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c index cc9b7ef..65f08e3 100644 --- a/drivers/gpu/drm/i915/intel_fbc.c +++ b/drivers/gpu/drm/i915/intel_fbc.c @@ -388,9 +388,6 @@ static void intel_fbc_enable(struct drm_crtc *crtc) WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock)); - if (!dev_priv->display.enable_fbc) - return; - intel_fbc_cancel_work(dev_priv); work = kzalloc(sizeof(*work), GFP_KERNEL); @@ -430,9 +427,6 @@ static void __intel_fbc_disable(struct drm_device *dev) intel_fbc_cancel_work(dev_priv); - if (!dev_priv->display.disable_fbc) - return; - dev_priv->display.disable_fbc(dev); dev_priv->fbc.crtc = NULL; } @@ -447,6 +441,9 @@ void intel_fbc_disable(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; + if (!dev_priv->display.enable_fbc) + return; + mutex_lock(&dev_priv->fbc.lock); __intel_fbc_disable(dev); mutex_unlock(&dev_priv->fbc.lock); @@ -463,6 +460,9 @@ void intel_fbc_disable_crtc(struct intel_crtc *crtc) struct drm_device *dev = crtc->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; + if (!dev_priv->display.enable_fbc) + return; + mutex_lock(&dev_priv->fbc.lock); if (dev_priv->fbc.crtc == crtc) __intel_fbc_disable(dev); @@ -661,6 +661,9 @@ void intel_fbc_cleanup_cfb(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; + if (!dev_priv->display.enable_fbc) + return; + mutex_lock(&dev_priv->fbc.lock); __intel_fbc_cleanup_cfb(dev); mutex_unlock(&dev_priv->fbc.lock); @@ -708,9 +711,6 @@ static void __intel_fbc_update(struct drm_device *dev) const struct drm_display_mode *adjusted_mode; unsigned int max_width, max_height; - if (!HAS_FBC(dev)) - return; - WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock)); /* disable framebuffer compression in vGPU */ @@ -857,6 +857,9 @@ void intel_fbc_update(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; + if (!dev_priv->display.enable_fbc) + return; + mutex_lock(&dev_priv->fbc.lock); __intel_fbc_update(dev); mutex_unlock(&dev_priv->fbc.lock); @@ -869,6 +872,9 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv, struct drm_device *dev = dev_priv->dev; unsigned int fbc_bits; + if (!dev_priv->display.enable_fbc) + return; + if (origin == ORIGIN_GTT) return; @@ -895,6 +901,9 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv, { struct drm_device *dev = dev_priv->dev; + if (!dev_priv->display.enable_fbc) + return; + mutex_lock(&dev_priv->fbc.lock); if (!dev_priv->fbc.busy_bits)