From patchwork Wed Sep 3 15:49:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 4835561 Return-Path: X-Original-To: patchwork-linux-pm@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 6BD80C033A for ; Wed, 3 Sep 2014 15:54:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 534F520220 for ; Wed, 3 Sep 2014 15:54:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2EBF820160 for ; Wed, 3 Sep 2014 15:54:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756417AbaICPxX (ORCPT ); Wed, 3 Sep 2014 11:53:23 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:52894 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755513AbaICPwy (ORCPT ); Wed, 3 Sep 2014 11:52:54 -0400 Received: by mail-wi0-f178.google.com with SMTP id r20so10127200wiv.5 for ; Wed, 03 Sep 2014 08:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=hsYHx+aqAdSOkX1SEadT94NzXR94SQ7zKKIZfDQdpWk=; b=gOs477x7Wk8+mEq5K2BqaBv8VW++UcgtdVTe4I2FcLKS3kGJ5p84oxtnYqtBAtHKUb 0ntH8myrD5eabkFcxiw75ZmtjiwxRt9e515ZiZaxAhk9WGnnSvk7N511UNW2MzKwNtgT 3cs2DPm4vhJqvWLb5egJAfi82LnF/ogZVNYsqQcaQgH0IjJbt/dTaFw6x7onbbho8Qn3 t7NIHu61agKeLHUFFB+z29Vd4i5kGbK6u0y3qx+wB/VY4J74xFm8lbRsQyIS8h86Pms/ 5SwqHLXVBk+4wBSrSnRpnZbDbzP3HaLKxCDaii8plcrS/k3bXsk3KseOJ3XcBPXDIZeb wP/A== X-Received: by 10.194.58.83 with SMTP id o19mr49137715wjq.20.1409759572780; Wed, 03 Sep 2014 08:52:52 -0700 (PDT) Received: from cizrna.lan (37-48-33-23.tmcz.cz. [37.48.33.23]) by mx.google.com with ESMTPSA id m9sm16359497wjz.35.2014.09.03.08.52.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Sep 2014 08:52:51 -0700 (PDT) From: Tomeu Vizoso To: linux-pm@vger.kernel.org Cc: Thierry Reding , =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Stephen Warren , "Rafael J. Wysocki" , Pavel Machek , Len Brown , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas , Mikko Perttunen , Tomeu Vizoso Subject: [REPOST PATCH v4 2/2] drm/tegra: Request memory bandwidth for the display controller Date: Wed, 3 Sep 2014 17:49:33 +0200 Message-Id: <1409759373-22696-3-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1409759373-22696-1-git-send-email-tomeu.vizoso@collabora.com> References: <1409759373-22696-1-git-send-email-tomeu.vizoso@collabora.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 For now the amount requested is based solely on the current mode's refresh rate. Signed-off-by: Tomeu Vizoso Acked-by: Pavel Machek --- v4: * Use vertical refresh rate when calculating the bandwidth requirement v3: * Fixed the bandwidth calculation, and have the units be mbps --- drivers/gpu/drm/tegra/dc.c | 15 +++++++++++++++ drivers/gpu/drm/tegra/drm.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 6553fd2..8a3fee8 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -9,6 +9,7 @@ #include #include +#include #include #include "dc.h" @@ -753,6 +754,8 @@ static void tegra_crtc_disable(struct drm_crtc *crtc) } drm_vblank_off(drm, dc->pipe); + + pm_qos_update_request(&dc->qos_request, PM_QOS_DEFAULT_VALUE); } static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, @@ -839,6 +842,7 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, struct tegra_dc *dc = to_tegra_dc(crtc); struct tegra_dc_window window; u32 value; + unsigned long bandwidth; int err; drm_vblank_pre_modeset(crtc->dev, dc->pipe); @@ -879,6 +883,12 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, if (err < 0) dev_err(dc->dev, "failed to enable root plane\n"); + bandwidth = window.stride[0] * window.dst.h * 8; + bandwidth *= drm_mode_vrefresh(mode); + bandwidth /= 1024 * 1024; + + pm_qos_update_request(&dc->qos_request, bandwidth); + return 0; } @@ -1499,6 +1509,9 @@ static int tegra_dc_probe(struct platform_device *pdev) return err; } + pm_qos_add_request(&dc->qos_request, PM_QOS_MEMORY_BANDWIDTH, + PM_QOS_DEFAULT_VALUE); + platform_set_drvdata(pdev, dc); return 0; @@ -1509,6 +1522,8 @@ static int tegra_dc_remove(struct platform_device *pdev) struct tegra_dc *dc = platform_get_drvdata(pdev); int err; + pm_qos_remove_request(&dc->qos_request); + err = host1x_client_unregister(&dc->client); if (err < 0) { dev_err(&pdev->dev, "failed to unregister host1x client: %d\n", diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index e89c70f..a99e533d 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -120,6 +121,8 @@ struct tegra_dc { struct drm_pending_vblank_event *event; const struct tegra_dc_soc_info *soc; + + struct pm_qos_request qos_request; }; static inline struct tegra_dc *