From patchwork Mon Jan 25 08:18:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Hewitt X-Patchwork-Id: 12043057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D47CAC433E0 for ; Mon, 25 Jan 2021 08:18:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F82C224DE for ; Mon, 25 Jan 2021 08:18:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F82C224DE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6269889F61; Mon, 25 Jan 2021 08:18:12 +0000 (UTC) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by gabe.freedesktop.org (Postfix) with ESMTPS id 957F689F55; Mon, 25 Jan 2021 08:18:10 +0000 (UTC) Received: by mail-wr1-x429.google.com with SMTP id 6so11273277wri.3; Mon, 25 Jan 2021 00:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Y7QSAI4exnMwTSIl2D/guBzjw3QSq7D2XfoHWDkim0M=; b=kz5X1h6DqSqeV6eliWhiDPYDhC/5Vb+VoxkBn2I420H7P49skPLRYqgfpy4f78qbr/ c5yj6Fk29J7lf+Fjnowbz8gNGIkVBkt8/Wuery3OFtJI2sfmIr94lMufUrC1aCG999U7 UOgZNCFrpeMAFMOF6GY93vEi8n7J0GPb+MQ8ADVe6SKgJzhydqAA1WaTIq5UXXR1v0pq EZmu2x/+3cCej4t0CYQoyblwOT1n76QH2ggxx8SM6LphJ3e6hObPgfl2pkVo/zBGynon kovYuruRtDQ5tEugsYLd1Bo1gxPQId/F2EuJMOCc0m4kt5ZtWPhpjRmbkdfS6JvVvMfq 9yAg== 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; bh=Y7QSAI4exnMwTSIl2D/guBzjw3QSq7D2XfoHWDkim0M=; b=dNAbhwtV/IOMZUrA2hb4rvD5SDu6ZiCDSe3Cq/3mKHlnbw76yZZVi3dq4mSeZ94xcJ 2y8wZ2mdeiLN0L8fKFnxhDtgPku1/H8MdHJsGiXhaEOVjyfqPL1BYD/MQ2jla7cXVFaC 6jwoehOHJI1BaIEA+C+sqjeTU0ikKzi9QjvcB7slcNBjbK6aO6VpOkrVXnaMu3zJ0M32 LFCr8E6MRnrm4yadjI8DZBg/WwNusJXgFqXcPDLdxSUwPdUN/EVJgX4PsI4XWSUY16NT FBmTsMj54VEBmy2mC8oboRZBA2wG5Ig3MvKoYWLBNiQz9X7vZ2oNgyQPtqC7bbeF+uUq JfPg== X-Gm-Message-State: AOAM530knfjNQyyFRVy4sIV7ovsj/ZktTv+8wC0w1zePgIDI3qtLWMa9 auTOFovAvXP5ZEFe3KfMj5k= X-Google-Smtp-Source: ABdhPJw+CnX1ojnwI5+Km+6OVd8qHBN/eVrDsmFJRtBQmrYurXcm6CNStkvdgbes0Df3GJB6yjz5zg== X-Received: by 2002:a5d:5913:: with SMTP id v19mr10731wrd.207.1611562689269; Mon, 25 Jan 2021 00:18:09 -0800 (PST) Received: from localhost.localdomain ([87.200.95.144]) by smtp.gmail.com with ESMTPSA id m12sm20286798wmc.10.2021.01.25.00.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 00:18:08 -0800 (PST) From: Christian Hewitt To: Qiang Yu , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/lima: add governor data with pre-defined thresholds Date: Mon, 25 Jan 2021 08:18:04 +0000 Message-Id: <20210125081804.13016-1-christianshewitt@gmail.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Hewitt , Lukasz Luba , Steven Price MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This patch adapts the panfrost pre-defined thresholds change [0] to the lima driver to improve real-world performance. The upthreshold value has been set to ramp GPU frequency to max freq faster (compared to panfrost) to compensate for the lower overall performance of utgard devices. [0] https://patchwork.kernel.org/project/dri-devel/patch/20210121170445.19761-1-lukasz.luba@arm.com/ Signed-off-by: Christian Hewitt --- I have been using Kodi as my test application. If you scroll in library views with hundreds of list items and the panfrost values the slow GPU ramp up is quite noticeable and the GUI feels sluggish. As everything lima runs on is inherently slower than panfrost using devices I believe it's better to ramp up to max freq quicker. drivers/gpu/drm/lima/lima_devfreq.c | 10 +++++++++- drivers/gpu/drm/lima/lima_devfreq.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lima_devfreq.c index 5686ad4aaf7c..c9854315a0b5 100644 --- a/drivers/gpu/drm/lima/lima_devfreq.c +++ b/drivers/gpu/drm/lima/lima_devfreq.c @@ -163,8 +163,16 @@ int lima_devfreq_init(struct lima_device *ldev) lima_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); + /* + * Setup default thresholds for the simple_ondemand governor. + * The values are chosen based on experiments. + */ + ldevfreq->gov_data.upthreshold = 20; + ldevfreq->gov_data.downdifferential = 5; + devfreq = devm_devfreq_add_device(dev, &lima_devfreq_profile, - DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); + DEVFREQ_GOV_SIMPLE_ONDEMAND, + &ldevfreq->gov_data); if (IS_ERR(devfreq)) { dev_err(dev, "Couldn't initialize GPU devfreq\n"); ret = PTR_ERR(devfreq); diff --git a/drivers/gpu/drm/lima/lima_devfreq.h b/drivers/gpu/drm/lima/lima_devfreq.h index 2d9b3008ce77..b0c7c736e81a 100644 --- a/drivers/gpu/drm/lima/lima_devfreq.h +++ b/drivers/gpu/drm/lima/lima_devfreq.h @@ -4,6 +4,7 @@ #ifndef __LIMA_DEVFREQ_H__ #define __LIMA_DEVFREQ_H__ +#include #include #include @@ -18,6 +19,7 @@ struct lima_devfreq { struct opp_table *clkname_opp_table; struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; + struct devfreq_simple_ondemand_data gov_data; ktime_t busy_time; ktime_t idle_time;