From patchwork Wed Jun 14 23:18:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9787733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 42D1A602CB for ; Thu, 15 Jun 2017 00:57:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 373C6284DC for ; Thu, 15 Jun 2017 00:57:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29DC7284ED; Thu, 15 Jun 2017 00:57:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2F56284DC for ; Thu, 15 Jun 2017 00:57:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6CE96E64D; Thu, 15 Jun 2017 00:57:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x244.google.com (mail-lf0-x244.google.com [IPv6:2a00:1450:4010:c07::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F4706E632 for ; Wed, 14 Jun 2017 23:19:05 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id v20so1609789lfa.2 for ; Wed, 14 Jun 2017 16:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=YiB0k9y6eP6KLhsAurcI7KlL8VOjAPmwAQlD1N/qpqY=; b=ab77y+GlUbcpuwBtE+7o3Nbq4YeI68UUf5MdbI+UXBk4+4wbu15Xe+p0khjTSZ7bIz 6RIiUkdwbQcqoqCOoLco9RlhsmeIkdc9AlyL5RdgEXH/lnjX/1JASSXZokDu9bKgt5vr ZpPnHzvzvktq7blUTy0YdTLdSf8u0JAlKTYorbtJfja+yfgBgAEioO6iD1qSwn3BZNvU yfoEj+0aGtCG4YRyErH7h/RtK9m/OzokLWjIBwtxTMmRnG4xuPmapOri97isbrxyDiW3 5Bx3VfM1L3+vBdcGqyB0frAF+Bkv6PgjHLD6n+QWWnhLVEEJUhS6KBxB/dYy4rzont96 78/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=YiB0k9y6eP6KLhsAurcI7KlL8VOjAPmwAQlD1N/qpqY=; b=mNum+Vks6NYedeFI1SQBIPE38UInXnJz7tD/LOUW49sUYvMbPDz27/poTLMaP/U1Or 3brMwRHasi4wbaHl2tVTyV/SROBImR2Ezlijdg6khAlGzAEVt3LMFJM+YqDf/8qjrl5Q 4MxURj5y5Aax3xHvHyzcRwf7iL+HzCFOWkhwnHSEvHRhIRnS3yli9mQXApN4syax1MNv 4MRUJfLUWn5ZpR4cdGxXvlW95W2s/2rG/e0Q8wd74aYIQFvPc2TEe2jx469AMFBQSNpr 2K54uz2aRuJf5/IMmYeJe2mchYNCiUXeTRx+CM6seC5YiIY9R3A7IiHDe55wwWc/bBJ3 x42A== X-Gm-Message-State: AKS2vOxpzo2KsxgUbC5PDNe0YzIFoMqAoB+OKrogMqH0bvbN+2aIWufo 7aIrsDWuoZC5mw== X-Received: by 10.46.88.3 with SMTP id m3mr709439ljb.69.1497482343577; Wed, 14 Jun 2017 16:19:03 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-7.pppoe.spdop.ru. [109.252.91.7]) by smtp.gmail.com with ESMTPSA id i24sm290165ljb.63.2017.06.14.16.19.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 16:19:02 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen , Erik Faye-Lund Subject: [PATCH v3 08/20] drm/tegra: dc: Disable plane if it is invisible Date: Thu, 15 Jun 2017 02:18:31 +0300 Message-Id: <413bf65cb0ae08b9acbaf4490713ca848a4cf521.1497480757.git.digetx@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Thu, 15 Jun 2017 00:57:20 +0000 Cc: linux-tegra@vger.kernel.org, DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Tegra20 if plane has width or height equal to 0, it will be infinitely wide or tall. Let's disable the plane if it is invisible on atomic state committing to fix the issue. The Rockchip DRM driver does the same. Signed-off-by: Dmitry Osipenko Reviewed-by: Erik Faye-Lund --- drivers/gpu/drm/tegra/dc.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index a7a7cce1afd0..c875f11786b9 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -559,6 +559,23 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, return 0; } +static void tegra_dc_disable_window(struct tegra_dc *dc, int index) +{ + unsigned long flags; + u32 value; + + spin_lock_irqsave(&dc->lock, flags); + + value = WINDOW_A_SELECT << index; + tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); + + value = tegra_dc_readl(dc, DC_WIN_WIN_OPTIONS); + value &= ~WIN_ENABLE; + tegra_dc_writel(dc, value, DC_WIN_WIN_OPTIONS); + + spin_unlock_irqrestore(&dc->lock, flags); +} + static void tegra_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { @@ -573,6 +590,9 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, if (!plane->state->crtc || !plane->state->fb) return; + if (!plane->state->visible) + return tegra_dc_disable_window(dc, p->index); + memset(&window, 0, sizeof(window)); window.src.x = plane->state->src.x1 >> 16; window.src.y = plane->state->src.y1 >> 16; @@ -612,8 +632,6 @@ static void tegra_plane_atomic_disable(struct drm_plane *plane, { struct tegra_plane *p = to_tegra_plane(plane); struct tegra_dc *dc; - unsigned long flags; - u32 value; /* rien ne va plus */ if (!old_state || !old_state->crtc) @@ -621,16 +639,7 @@ static void tegra_plane_atomic_disable(struct drm_plane *plane, dc = to_tegra_dc(old_state->crtc); - spin_lock_irqsave(&dc->lock, flags); - - value = WINDOW_A_SELECT << p->index; - tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); - - value = tegra_dc_readl(dc, DC_WIN_WIN_OPTIONS); - value &= ~WIN_ENABLE; - tegra_dc_writel(dc, value, DC_WIN_WIN_OPTIONS); - - spin_unlock_irqrestore(&dc->lock, flags); + tegra_dc_disable_window(dc, p->index); } static const struct drm_plane_helper_funcs tegra_primary_plane_helper_funcs = {