From patchwork Thu Nov 29 16:24:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 10704867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC91D13AD for ; Thu, 29 Nov 2018 16:24:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A31AB2F617 for ; Thu, 29 Nov 2018 16:24:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 978232F61A; Thu, 29 Nov 2018 16:24:47 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 5292F2F617 for ; Thu, 29 Nov 2018 16:24:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 298846E55C; Thu, 29 Nov 2018 16:24:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id A37E26E55C for ; Thu, 29 Nov 2018 16:24:40 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id z28so2388977edi.8 for ; Thu, 29 Nov 2018 08:24:40 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=4CbqgO1I1aYz0jR9vMTOUa+q81ChVKD94ZA9TqsS5uQ=; b=idaHbWduPDzetMWYIJxk+fhhUwezUHLhG35pUXPCwTcBFv4XLbx37sc42OvXSaEZ3v dNgVc/ZlvU4NMwVZRgMr3vJwrGW3OEKWckSWIrVrZTF+IT+0pKpHsfIlAEidfKtg2UvY +DJrONBRZDfp2PUdilwzXdESPWr1xJmrmMkH8cGi4wsnIaMw7l3UfowKAhMJLf+TJDxZ 6y84x9N9svZd3bMg9v1XEXFKxDshi0mECNae/K6ayoZDw7T21G+6emSqIO846DoNnEE2 fS2qEnEfPRmFobK1IkbUqW1pFD4S5vxrCAymgqPQgM3k/OSF7Mx+CYvZmPrr+/Z1n/Lg loHA== X-Gm-Message-State: AA+aEWasLPn84TF9lHl2iXspGfq99j9tiKq6Zgj5A10jJ1NJyo6rBtI/ VtiC3cXFDk284Dif3UKbMI0= X-Google-Smtp-Source: AFSGD/WuoFB0jAkGbDajolcHIak9/TUzuqFFUWqNE975clvwl/cnE5KrpEXOWhgmtwpiT7zt4EC12Q== X-Received: by 2002:a50:f284:: with SMTP id f4mr2213308edm.77.1543508679184; Thu, 29 Nov 2018 08:24:39 -0800 (PST) Received: from localhost (pD9E51040.dip0.t-ipconnect.de. [217.229.16.64]) by smtp.gmail.com with ESMTPSA id k26-v6sm414187ejv.59.2018.11.29.08.24.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Nov 2018 08:24:38 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH v2 2/2] drm/tegra: dc: Don't clean up unused display controller Date: Thu, 29 Nov 2018 17:24:35 +0100 Message-Id: <20181129162435.20443-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181129162435.20443-1-thierry.reding@gmail.com> References: <20181129162435.20443-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, Dmitry Osipenko , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding Display controllers that don't own any windows and which therefore aren't currently being assigned a primary plane are not registered as a CRTC with the DRM framework. They request neither a syncpoint nor an interrupt because they don't use them, so avoid cleaning up those resources. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f80e82e16475..607a6ea17ecc 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1978,6 +1978,23 @@ static irqreturn_t tegra_dc_irq(int irq, void *data) return IRQ_HANDLED; } +static bool tegra_dc_has_window_groups(struct tegra_dc *dc) +{ + unsigned int i; + + if (!dc->soc->wgrps) + return true; + + for (i = 0; i < dc->soc->num_wgrps; i++) { + const struct tegra_windowgroup_soc *wgrp = &dc->soc->wgrps[i]; + + if (wgrp->dc == dc->pipe && wgrp->num_windows > 0) + return true; + } + + return false; +} + static int tegra_dc_init(struct host1x_client *client) { struct drm_device *drm = dev_get_drvdata(client->parent); @@ -1993,22 +2010,8 @@ static int tegra_dc_init(struct host1x_client *client) * assign a primary plane to them, which in turn will cause KMS to * crash. */ - if (dc->soc->wgrps) { - bool has_wgrps = false; - unsigned int i; - - for (i = 0; i < dc->soc->num_wgrps; i++) { - const struct tegra_windowgroup_soc *wgrp = &dc->soc->wgrps[i]; - - if (wgrp->dc == dc->pipe && wgrp->num_windows > 0) { - has_wgrps = true; - break; - } - } - - if (!has_wgrps) - return 0; - } + if (!tegra_dc_has_window_groups(dc)) + return 0; dc->syncpt = host1x_syncpt_request(client, flags); if (!dc->syncpt) @@ -2094,6 +2097,9 @@ static int tegra_dc_exit(struct host1x_client *client) struct tegra_dc *dc = host1x_client_to_dc(client); int err; + if (!tegra_dc_has_window_groups(dc)) + return 0; + devm_free_irq(dc->dev, dc->irq, dc); err = tegra_dc_rgb_exit(dc);