From patchwork Tue May 23 00:14:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9741679 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 CF9D660392 for ; Tue, 23 May 2017 01:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C54832877A for ; Tue, 23 May 2017 01:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA3232877F; Tue, 23 May 2017 01:03:43 +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 797232877D for ; Tue, 23 May 2017 01:03:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5F376E2E6; Tue, 23 May 2017 01:01:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 077E989DA3 for ; Tue, 23 May 2017 00:15:26 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id 99so6669552lfu.2 for ; Mon, 22 May 2017 17:15:25 -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=c03qGi8V2crDNZa+lcvFxhKOLPqhiHysY6/6w3k/SEg=; b=sJIkNDfPr/L8jr1CWNWWkL1N/QJjK51ntLYzjL66EMpTFglBaXPGAftWVpLkUIFkUT TlD5ZaT5MA6A2wKlT2zC5Owx/MxLAPtM0TZgewBDZSiOxq8f+qF7Np08mBS1gxVuMcmL j5st/UZ5stWof88/hvE2fNmqeh32S3FhZLHJAXu+waOLnk3HT++HPMq3ig94HRP4jVjA bGYd1vDaZH5q9I26L5s07nIUj96Nwz8htyAAHijyndWjCczbPewCOlP1tvFsMs1HEQmh NPsqgAGsGPce9jVt/5fzANwPE7nmD4ZnGQ3cQdeU76OFaeyuRt2L7nheLH9S0NL3l0Rv t5Gg== 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=c03qGi8V2crDNZa+lcvFxhKOLPqhiHysY6/6w3k/SEg=; b=IgT/xsbdmeN7LV9RfOwz/3qil/jmOAlkFTCAhOxfupsoltaKvDD39J88SkiuntStHx JkJLwPNUSxRm6LHUZB6HTxCgvy+EO2BAnzscn+JOxoqXC37bauJFaAb0ETN8QmK+8c9T 5IEuEO33z5EMDhFwEajNZcXl83iT+ygIj6bHeYmj8QIgH3960sndtXiTHdGnqYQlJgOk vWfMlC6p3/B83z7lo4q03h9yy2n3onD6N9wmSc/nqfZpteoghRBSTkuiOjMAKLUQJh6A qL39yvd8enp/2vPTbs6YWk5bNxhJU6PJ44R++h9ZYzAabqLX8A4sIvDDavR8Ua5Q2MiZ EPgA== X-Gm-Message-State: AODbwcD91sBL2SpRb3L5G5drulStHCGE2yv+V420b+5uFZU7rNS+Cn5d HOVvYJiKPipFHA== X-Received: by 10.25.203.72 with SMTP id b69mr4816783lfg.84.1495498524498; Mon, 22 May 2017 17:15:24 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-175.pppoe.spdop.ru. [109.252.91.175]) by smtp.gmail.com with ESMTPSA id v30sm3440904ljd.9.2017.05.22.17.15.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 17:15:24 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen Subject: [PATCH 10/22] drm/tegra: Disable plane if it is invisible Date: Tue, 23 May 2017 03:14:25 +0300 Message-Id: <3d3369e37dea96ce65430657a0bcec2935befbfb.1495498184.git.digetx@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Tue, 23 May 2017 00:59:38 +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 --- 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 2e01a2dfc5cd..1f9d8d43bec3 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -558,6 +558,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) { @@ -572,6 +589,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; @@ -611,8 +631,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) @@ -620,16 +638,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 = {