From patchwork Mon Jan 6 03:07:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 46618E77197 for ; Mon, 6 Jan 2025 03:39:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD6F710E56B; Mon, 6 Jan 2025 03:39:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SDQMG6VQ"; dkim-atps=neutral Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD81910E56C for ; Mon, 6 Jan 2025 03:39:09 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5d437235769so5181434a12.2 for ; Sun, 05 Jan 2025 19:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736134688; x=1736739488; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=swDuQmaW1jB5oxxfqZCzBvZatK3qx5WhH7+L/hnGQig=; b=SDQMG6VQosjLBBICHrt3pW/hrrwgZd08lALHzNKnDcuXZ8x2N+6jYZA6cGpTq9wBPe hvd4KS5zssH2ZBK52LdpmgwYCnHBwkWc5hqEER1SiDIPwu6+dVsbNRrIt+iy8QpAOCUb 3E3ZVT5cmLKjoZ+vsilz59HqsiJpANOFOH+kPbrAKdU3R1nal/VXT4Ibmd0lktt+e1Vl kmTbAntAqeMyJvmelM6shL+CVL0bpazivrOq9rWaasuEDoka4pySuHFFdP+PNtP5xvPO qqF2NdrOOSbb041w3ehzZWrexW7WwjgbY+QHaci79xj/gUKrgis6GYCqI8RUgwCks6BF EB4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736134688; x=1736739488; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=swDuQmaW1jB5oxxfqZCzBvZatK3qx5WhH7+L/hnGQig=; b=p8nNC8TrjPKsIap1itsiASCZ2O3yy6+We7iaJEErrHxq8M7poOFhgRV/JywmR5dVtH V2hHIs1LvZbrjZvL4R3wd9n/DqMat+ObAyxTBxS6QPOdEKhYukF4r14rN+qmfZbDEZ69 PBrDc4g5A1wQ6obTNb0OUcTatHr3+Fr8SM7d8Tv8OLh9aieSDiP7nHcjhfv1rBJM2769 YeIvWZOMA59Gt+imJq4c0+0jvY7LMYi7EE3PA4+J2Cg3l9aiVZSLMNVXsK6ccqxE6Qsr lMHZzRLWuwTcTW6Z1yo8A+qrnNTz8giDuV63nj78gYjaCeK0erPewYUJKpBcibM75Y0O v4AA== X-Forwarded-Encrypted: i=1; AJvYcCVTYVlJTU1aotiZMRhXb2jxBUtKL6h6xByC7rUXYDNWJNvJ9bY1vB+umXrhH6qrA+fG7BSjnaQeols=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxWBWK3aSQRDKcNJKP2NVYdtdzVAfSmBlHExrphBhyxm+7PA3yf VaDogIQUZE3IsbVGiA+LTyow2ZVUe/sg0IpkhSajYt3nJ5FNDXpWuXcpK/O0GXozIPRmhmXmzD9 /FFc= X-Gm-Gg: ASbGnctUrhnL0llBiZLC8ouj/BZgBsDhp1a13l330ayUQEe+qlSV4L96Q7eaDJPwTTQ IVWoBquyavi+T2zT1hHqmuR+lNv/QFUxFmq3QmLzQQoCSp+IfWrSoXVqjxW7/DmciGfsWD51iVg Mfu5q7du99eh6o/oVPTEGDm4bwUb7AqXq1yFTG8Of+APbNBHw7wjcJGdy1AHqtgoUDMH1ekxKpQ 7vYTR2bh0p3xjYYHq3t7XmZI8yclNPfz0/RMiKMttDhaucMWOwP0bhrdx6OpUgB X-Google-Smtp-Source: AGHT+IG2M9aFMxTan3YopooGfdGfRiY0x82IbSXTPZPHiw0oye/j77ngPHUTAEzUD74f992i8cdiWg== X-Received: by 2002:a05:6512:2350:b0:542:1bdd:511a with SMTP id 2adb3069b0e04-542295322ebmr14373018e87.13.1736132862909; Sun, 05 Jan 2025 19:07:42 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:41 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:35 +0200 Subject: [PATCH v4 1/9] drm/msm/dpu: extract bandwidth aggregation function MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-1-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2664; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Ranvcf9s/bstJI3Eo8F/WLE+D4NDgHgD/Z08d8sAtcc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBne0j4V7gMlJS+NZnYUb5mxgwM/JXVWs//nPIj4 PCukzy/PrmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3tI+AAKCRCLPIo+Aiko 1bVyB/0SPP/7XFYWq88gWJAZjJWFRNQJGXsz8SOcFvxdRxFETxTsGsqNHsA7zgTTuYwj2lldlZx +4nNrS/qJc17QHWTeUS5YUguRQOpTIulHxY2JwTiXsYSn9mvHGHWLYKU4yXb4c6R5KYyUkj1itn OHfFJerRzaWcdgeJQ2klEC/wRAPUqBq5cOUTxerirAKadMKgc8oPVMV32M09nQfTOOuGL3IOHRj xzs5KCKmwOk9xQMbGybB+NFvA+RDMVkgmljgaX93tuyhWEqid4c2BPdMRB/M79pCIQaZ96dFk1A DytTmjIzZq5Jy6UdXsdTaADceNhPU0qBv4LUPKTOlFDb+r4g X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In preparation to refactoring the dpu_core_perf debugfs interface, extract the bandwidth aggregation function from _dpu_core_perf_crtc_update_bus(). Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 45 +++++++++++++++------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 6f0a37f954fe8797a4e3a34e7876a93d5e477642..c7ac1140e79dbf48566a89fa4d70f6bec69d1d81 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -210,36 +210,41 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, return 0; } -static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, - struct drm_crtc *crtc) +static void dpu_core_perf_aggregate(struct drm_device *ddev, + enum dpu_crtc_client_type curr_client_type, + struct dpu_core_perf_params *perf) { - struct dpu_core_perf_params perf = { 0 }; - enum dpu_crtc_client_type curr_client_type - = dpu_crtc_get_client_type(crtc); - struct drm_crtc *tmp_crtc; struct dpu_crtc_state *dpu_cstate; - int i, ret = 0; - u64 avg_bw; - - if (!kms->num_paths) - return 0; + struct drm_crtc *tmp_crtc; - drm_for_each_crtc(tmp_crtc, crtc->dev) { + drm_for_each_crtc(tmp_crtc, ddev) { if (tmp_crtc->enabled && - curr_client_type == - dpu_crtc_get_client_type(tmp_crtc)) { + curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) { dpu_cstate = to_dpu_crtc_state(tmp_crtc->state); - perf.max_per_pipe_ib = max(perf.max_per_pipe_ib, - dpu_cstate->new_perf.max_per_pipe_ib); + perf->max_per_pipe_ib = max(perf->max_per_pipe_ib, + dpu_cstate->new_perf.max_per_pipe_ib); - perf.bw_ctl += dpu_cstate->new_perf.bw_ctl; + perf->bw_ctl += dpu_cstate->new_perf.bw_ctl; - DRM_DEBUG_ATOMIC("crtc=%d bw=%llu paths:%d\n", - tmp_crtc->base.id, - dpu_cstate->new_perf.bw_ctl, kms->num_paths); + DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n", + tmp_crtc->base.id, + dpu_cstate->new_perf.bw_ctl); } } +} + +static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, + struct drm_crtc *crtc) +{ + struct dpu_core_perf_params perf = { 0 }; + int i, ret = 0; + u64 avg_bw; + + if (!kms->num_paths) + return 0; + + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); avg_bw = perf.bw_ctl; do_div(avg_bw, (kms->num_paths * 1000)); /*Bps_to_icc*/ From patchwork Mon Jan 6 03:07:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3F465E77198 for ; Mon, 6 Jan 2025 04:07:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A92E110E12B; Mon, 6 Jan 2025 04:07:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="E9VDqo2P"; dkim-atps=neutral Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1616210E12B for ; Mon, 6 Jan 2025 04:07:54 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5d7e3f1fc01so241721a12.2 for ; Sun, 05 Jan 2025 20:07:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736136413; x=1736741213; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=V2frQ7frjJisKF4fY9Mlmay17Gex/iMexCWUihejiXI=; b=E9VDqo2PNWYJAnyoU3m4E48UXeS7ig2Dci+pS7SnhJo6EQo6lNl3abiyXef5zJiJPK FB/wyMVa5ayQphsn1hW3b3WLoRw/n4BQHBFVeihmvYkQNidElmtcvtMr8+0ikM2CZFgr terb2xSlaIZzmDM1IUdTPuvQ0xGus+jFxhDXIjk18PIHhSgS2m2aNhgrd3uFg1YGjJLN bXEe7FIrkxB4e0Fnw00LomPyhRPqWCblYPoJdy8PTMQQLImF0h8B2Ha2fFweRfwKEpJj ip5NkRazOJy2r+gHRsaJC61Rxxyskqwi7V585p1sVlLDhAplcDzrBzBZmBGwFilTzVDI +hwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736136413; x=1736741213; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V2frQ7frjJisKF4fY9Mlmay17Gex/iMexCWUihejiXI=; b=YcrhoPNI1DAEIZLRyHyqvpp75R0BojZbVMfFYplsR/FnYeN5HOEcEKVk5+kVMMf4jA LQO27qdGNf+uI6ie/Ql05VIiNPJpPEzU01SkACFzfXr0TM9vY0wGAWwMXxinWZLOmIWd 96FdjubtaRY/Dmdxmw1U9IwZEp//VXCpbNUco3j4S8iCX8kv+rD8Ch9H1JQdE5ycYB6g rohBupgb/L7Ejl4zpaDSrmBTxW4+JEUfGpRe35mHiOqHfSYsDZ9mkXv2/1ZWN8cj5r7k AsXGU2W8SeJcL5QoVXM9FB7KIEIWpwnbmvZTyK4I2BjsWVTgY8sA+fpdT79ZeF6HZIbs v23A== X-Forwarded-Encrypted: i=1; AJvYcCXhJoPvhtsRhfd+agbRPsOvQE/mAtfFP6WlFEUcgTP2CXHquwWOz/XA86NjdNLvtON2qZbJ3etR/I8=@lists.freedesktop.org X-Gm-Message-State: AOJu0YwCstwOGYCvDYKxPUkSDbGwKTkKHlZWGRPvfcnca7YLv2PlF33x t4bPpJh0teeQ0+seylFBR8+PYw2DjDdN4ASC290R+w9g590ANj8qk5s6wgCncf/fCtMTdPdFAkn bdsI= X-Gm-Gg: ASbGncsp+JvXFoRD2QcXW2VuAgSETQlivHPkJbhx0dFqq7BXGB9cDoAd+pbqAS50Boc Q018Xp0qZLiSIaXAwGhb1CktDhysIHaALMpyjXQtiv/fzjNy26ag9VRsICBjfu41ZZ6zBBpcSI0 FWB+XN8I+0cjU6D9GCQWcpC3RGUcQV9mO92Ecc40Zb9mAbcIOPVuXAoQ4dN3+YTHYRklqRlhKLr OZrfrSITr5esdSx5EG5GNvSu+hqnR5crMtUVirmILJhg9XOVt6GVnC9I78RuNZ4 X-Google-Smtp-Source: AGHT+IGoFsQl+dE5DLTgXkjBCinLyHxxWlry1wlU/1uPByNsy3ri1wr2sp6D9riVVoPCTLcSQPRJig== X-Received: by 2002:a05:6512:1055:b0:53f:167e:390f with SMTP id 2adb3069b0e04-5422956bd7dmr17510177e87.53.1736132865280; Sun, 05 Jan 2025 19:07:45 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:44 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:36 +0200 Subject: [PATCH v4 2/9] drm/msm/dpu: remove duplicate code calculating sum of bandwidths MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-2-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4681; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=e5UbVaT7LzeJrygH1gMv3eM7lgsU2vrSsGS5cybMORE=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ3q1x4/tO/YoBR99nD9lue3PU76Sf5M3JCip6nVdz2VpT LvNy1fayWjMwsDIxSArpsjiU9AyNWZTctiHHVPrYQaxMoFMYeDiFICJ9D9l/ytTuOb11BL3f8uY ArvuJyi3NmzfasejxH5yK8e8C9rPppu5LukUe81mW/U9WWvawQk3lD5vN0g3fBdefa1Pdm7bUi0 B0+oJsbphRxp2VeWxcFTfUJG2DDps/n7TkXTJvd26Ust+hKo9zFpVXfpt4hWBPWJ9bjxxwVW2D2 4kVabd6G+WWFagc36qQsT5A1dDquR/hLFuDWC7/6WaxdRxQfrXDf+4PgSfVz3C1ODzVztiRdgPr obYrO3H2vIYZvK6++1UiNO+L7FW1f0zd0Z/qHLTlNuyH3pWLKnilLLcuemo9aPj1+4Inzhb8TY8 bF9h25kao3o2rsCehdo2Rb/fCDR5WXKekLT8euvZN/lvAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The code in dpu_core_perf_crtc_check() mostly duplicates code in dpu_core_perf_aggregate(). Remove the duplication by reusing the latter function. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 94 +++++++++++---------------- 1 file changed, 38 insertions(+), 56 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index c7ac1140e79dbf48566a89fa4d70f6bec69d1d81..f0d490afb53be2f4bc706af91da05bb893a5fe34 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -140,6 +140,30 @@ static void _dpu_core_perf_calc_crtc(const struct dpu_core_perf *core_perf, perf->max_per_pipe_ib, perf->bw_ctl); } +static void dpu_core_perf_aggregate(struct drm_device *ddev, + enum dpu_crtc_client_type curr_client_type, + struct dpu_core_perf_params *perf) +{ + struct dpu_crtc_state *dpu_cstate; + struct drm_crtc *tmp_crtc; + + drm_for_each_crtc(tmp_crtc, ddev) { + if (tmp_crtc->enabled && + curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) { + dpu_cstate = to_dpu_crtc_state(tmp_crtc->state); + + perf->max_per_pipe_ib = max(perf->max_per_pipe_ib, + dpu_cstate->new_perf.max_per_pipe_ib); + + perf->bw_ctl += dpu_cstate->new_perf.bw_ctl; + + DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n", + tmp_crtc->base.id, + dpu_cstate->new_perf.bw_ctl); + } + } +} + /** * dpu_core_perf_crtc_check - validate performance of the given crtc state * @crtc: Pointer to crtc @@ -150,11 +174,9 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { u32 bw, threshold; - u64 bw_sum_of_intfs = 0; - enum dpu_crtc_client_type curr_client_type; struct dpu_crtc_state *dpu_cstate; - struct drm_crtc *tmp_crtc; struct dpu_kms *kms; + struct dpu_core_perf_params perf; if (!crtc || !state) { DPU_ERROR("invalid crtc\n"); @@ -172,68 +194,28 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, /* obtain new values */ _dpu_core_perf_calc_crtc(&kms->perf, crtc, state, &dpu_cstate->new_perf); - bw_sum_of_intfs = dpu_cstate->new_perf.bw_ctl; - curr_client_type = dpu_crtc_get_client_type(crtc); - - drm_for_each_crtc(tmp_crtc, crtc->dev) { - if (tmp_crtc->enabled && - dpu_crtc_get_client_type(tmp_crtc) == curr_client_type && - tmp_crtc != crtc) { - struct dpu_crtc_state *tmp_cstate = - to_dpu_crtc_state(tmp_crtc->state); - - DRM_DEBUG_ATOMIC("crtc:%d bw:%llu ctrl:%d\n", - tmp_crtc->base.id, tmp_cstate->new_perf.bw_ctl, - tmp_cstate->bw_control); - - bw_sum_of_intfs += tmp_cstate->new_perf.bw_ctl; - } + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); - /* convert bandwidth to kb */ - bw = DIV_ROUND_UP_ULL(bw_sum_of_intfs, 1000); - DRM_DEBUG_ATOMIC("calculated bandwidth=%uk\n", bw); + /* convert bandwidth to kb */ + bw = DIV_ROUND_UP_ULL(perf.bw_ctl, 1000); + DRM_DEBUG_ATOMIC("calculated bandwidth=%uk\n", bw); - threshold = kms->perf.perf_cfg->max_bw_high; + threshold = kms->perf.perf_cfg->max_bw_high; - DRM_DEBUG_ATOMIC("final threshold bw limit = %d\n", threshold); + DRM_DEBUG_ATOMIC("final threshold bw limit = %d\n", threshold); - if (!threshold) { - DPU_ERROR("no bandwidth limits specified\n"); - return -E2BIG; - } else if (bw > threshold) { - DPU_ERROR("exceeds bandwidth: %ukb > %ukb\n", bw, - threshold); - return -E2BIG; - } + if (!threshold) { + DPU_ERROR("no bandwidth limits specified\n"); + return -E2BIG; + } else if (bw > threshold) { + DPU_ERROR("exceeds bandwidth: %ukb > %ukb\n", bw, + threshold); + return -E2BIG; } return 0; } -static void dpu_core_perf_aggregate(struct drm_device *ddev, - enum dpu_crtc_client_type curr_client_type, - struct dpu_core_perf_params *perf) -{ - struct dpu_crtc_state *dpu_cstate; - struct drm_crtc *tmp_crtc; - - drm_for_each_crtc(tmp_crtc, ddev) { - if (tmp_crtc->enabled && - curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) { - dpu_cstate = to_dpu_crtc_state(tmp_crtc->state); - - perf->max_per_pipe_ib = max(perf->max_per_pipe_ib, - dpu_cstate->new_perf.max_per_pipe_ib); - - perf->bw_ctl += dpu_cstate->new_perf.bw_ctl; - - DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n", - tmp_crtc->base.id, - dpu_cstate->new_perf.bw_ctl); - } - } -} - static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, struct drm_crtc *crtc) { From patchwork Mon Jan 6 03:07:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C8880E77197 for ; Mon, 6 Jan 2025 03:15:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 483BA10E06D; Mon, 6 Jan 2025 03:15:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="xMuzq3p5"; dkim-atps=neutral Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9EA2310E06D for ; Mon, 6 Jan 2025 03:15:01 +0000 (UTC) Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5d88c355e0dso5887687a12.0 for ; Sun, 05 Jan 2025 19:15:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736133240; x=1736738040; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DHORIO6iI0h0xBdzN/DxPXJ3YyQzxG7ieDWttD2a0a0=; b=xMuzq3p5+poFoxQVZhk2iOxHuXotKGfbeFr2jJpjEA2gHZQtddeB6YihPK3BldyiTw pV7o6txBb6J6dJv532/Y4wAnSKd+yniTVqy0+fUA81C/k+SbYkHqboPBODOpaYxU1u9q Ygyj3xJve0rMVLJnoUhyXtccyOO8Zm+FrUzb5r15uwr417ZVQsIvZUO0yQj7/x2REIV2 0OtxGVMs4IDLnZTFlqOQ1CI93mjJobv4pBk6/XxcIuxhJ+fXGkE0rWKTbI0WCYrEXdkM MUNFkUbThMVqBR0Vzua5I0tEImOLzh1+L6uztmdVDuG5iLzycWkG8wvCuivPzosKoy83 pgkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736133240; x=1736738040; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DHORIO6iI0h0xBdzN/DxPXJ3YyQzxG7ieDWttD2a0a0=; b=m3SGxucvCLZf1V1BhZt7+14saNQQpXu/9tKBJ6L6zuPRjLkvuiKTQtbKH2tilKUTXx +wf2gM+TvDy/EiUCO8CaIN0lxrhGiOrupxuQShdTbrsxDWyc39BSX+/pqo7O+lvdc8au NOLOXDQ91JDwl6ugzkOifPnqLUMJ+2iOYYeiq+0AEizLtxX2a2iOVJIGs9HMTYRIsB5y ev4qXK0F0WW+WFpk1oaDssNvwDAs/MdVWZUVj0ou0eifMi4FMbXDPhRgjG93A1DItOEY yXOpLeiIz0808iW2PnvYX/nL89ULSvSd5N3mE+0hwXHmFSebPkldKKKzq/0jDX8nBcq7 qggA== X-Forwarded-Encrypted: i=1; AJvYcCWNrLAZUmN0wsdmW5qfe4phVfuA5XENUtH3EJTNOc1IbynkQxsHnqAv+xN4+v/9Dgic12b7OssBCwU=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzJUXnwRoMRP6BCesLitzOSua3cNktPn05RjT8JGNBwOB1Ixwod zmmAJSLr0HIqQFzNI0IkLWce5UXfoi/VoxI+jo51TVESLl1QceLSTGEsEoZAQrBECx5VRc4pTFS NyYI= X-Gm-Gg: ASbGncuRhmU8RA09M6H6CwgVd9yLsf0k9Vc6Z0iqnpUb2fmvIL83+qJam8Xkxy4iYWF yRMVb6ph4O8uf8uJECEAHfZIOkUebZoHLygEos0DguLQpuOmDROx9FsPEV8D46gahGlFVFcqEL9 NTgGw8SZvD1YZ3o9DyxfLJn7TR50Z8GJBVOznD1PxoKZ44Pc0HhkDl08KhH9fkJvhuTy7x6Ffqh AdKgzSxNR9rfNqkyvv6lA92w8T0/7yv+RWylQukHPDUdfO53Zg55fnCv991v3VC X-Google-Smtp-Source: AGHT+IFeKnvUXg4rQjtvUDrdsCyS0VoSHNamlaIcrDr+nFLxLcf5MDcnBUzENvp+YCaaH3LgEiIlEw== X-Received: by 2002:a05:6512:628b:b0:542:6f59:f85f with SMTP id 2adb3069b0e04-5426f59f97fmr1444030e87.2.1736132867639; Sun, 05 Jan 2025 19:07:47 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:46 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:37 +0200 Subject: [PATCH v4 3/9] drm/msm/dpu: change ib values to u32 MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-3-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2991; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=TTyO9vUJiSzSKuNCLaOk8E6Md2+vo7CigvDNmDQ5dQs=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBne0j5aWLiZNIYu1U6N2nvPJazCBEqQO/PYqrD8 mJvRYv6UeCJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3tI+QAKCRCLPIo+Aiko 1X2tB/wJxl1N7EusjgzyUZ5t1JmlEMWYpjphupru0vUy0hFSvAm8SwwDZLpZbuPhNYfNXntq7KB 7b8ZQVe0fb7LyBe1UWe6Pe/cVo+DpO1KuH1nxoyLbqE7/Oqtl2WBbMWatJWqPrwBmSALQuQT83z PZW5EmZH+lsaoISEQAUshn4cpwXUnBQ7qgmi+P8uP4nf7Ou5NeQJ1idIhXP8xDv7vFPcEcZODST sCXZQQ/p0xBchFuH2gCIBFKvDO0ps3xuUpto+tcxDD9xQM0nLkxPVumf9shNCH27Bcw1wrxGZ5w P/hCtu0fw1jBVgEGEPF2qJSJTBbORgC+r9K56k/UIeVbTOX/ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The IB values in core_perf calculations (max_per_pipe_ib, fix_core_ib_vote) are expressed in KBps and are passed to icc_set_bw without additional division. Change type of those values to u32. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index f0d490afb53be2f4bc706af91da05bb893a5fe34..7263ab63a692554cd51a7fd91bd6250330179240 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -135,7 +135,7 @@ static void _dpu_core_perf_calc_crtc(const struct dpu_core_perf *core_perf, } DRM_DEBUG_ATOMIC( - "crtc=%d clk_rate=%llu core_ib=%llu core_ab=%llu\n", + "crtc=%d clk_rate=%llu core_ib=%u core_ab=%llu\n", crtc->base.id, perf->core_clk_rate, perf->max_per_pipe_ib, perf->bw_ctl); } @@ -477,7 +477,7 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) (u32 *)perf, &dpu_core_perf_mode_fops); debugfs_create_u64("fix_core_clk_rate", 0600, entry, &perf->fix_core_clk_rate); - debugfs_create_u64("fix_core_ib_vote", 0600, entry, + debugfs_create_u32("fix_core_ib_vote", 0600, entry, &perf->fix_core_ib_vote); debugfs_create_u64("fix_core_ab_vote", 0600, entry, &perf->fix_core_ab_vote); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 451bf8021114d9d4a2dfdbb81ed4150fc559c681..ca4595b4ec217697849af02446b23ed0857a0295 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -19,7 +19,7 @@ * @core_clk_rate: core clock rate request */ struct dpu_core_perf_params { - u64 max_per_pipe_ib; + u32 max_per_pipe_ib; u64 bw_ctl; u64 core_clk_rate; }; @@ -50,7 +50,7 @@ struct dpu_core_perf { struct dpu_core_perf_tune perf_tune; u32 enable_bw_release; u64 fix_core_clk_rate; - u64 fix_core_ib_vote; + u32 fix_core_ib_vote; u64 fix_core_ab_vote; }; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 7191b1a6d41b3a96f956d199398f12b2923e8c82..8a523eb308630943871c2e075d3d0d9094606d05 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1487,7 +1487,7 @@ static int dpu_crtc_debugfs_state_show(struct seq_file *s, void *v) seq_printf(s, "core_clk_rate: %llu\n", dpu_crtc->cur_perf.core_clk_rate); seq_printf(s, "bw_ctl: %llu\n", dpu_crtc->cur_perf.bw_ctl); - seq_printf(s, "max_per_pipe_ib: %llu\n", + seq_printf(s, "max_per_pipe_ib: %u\n", dpu_crtc->cur_perf.max_per_pipe_ib); return 0; From patchwork Mon Jan 6 03:07:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9A9C4E77198 for ; Mon, 6 Jan 2025 03:08:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB7FF10E563; Mon, 6 Jan 2025 03:08:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DtCJcLMd"; dkim-atps=neutral Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9294310E563 for ; Mon, 6 Jan 2025 03:08:51 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-53e384e3481so13291241e87.2 for ; Sun, 05 Jan 2025 19:08:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736132870; x=1736737670; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oZO2/JK1vJqeJvxJrlYDZUuiJ755Y2NffqKG//AhfG8=; b=DtCJcLMdZHKuc3JWxmcxfYrKBz3UGQHxZO0dKv7IPhax3K+C0/e/ug4bG2EcsRZ1ji ixE6mff5qkvnq7C4UUZj9InzxPpZKLDRc1e1D4RpawqVD6kdENHKVziv8PA/OBLK4Hoj vAvhejarfZjAdFTqW3lxk7CnEYVrNxAL1ewjftoa944y9lrSKdFbART4ZJiR/nMSaEk9 1iqMcNrjBD+lzqkjUvbZ9OvDJ07nYZqM9uwdi3/8s2Ri1JIuPNcDxnAap6FcmHRJetzm 4kfg6y048pcEHcfhJtb/pMhIlDOPg58Qe7LigsqzBJyLNgqJgyrejnjT4uJlGE8p5bw2 fTJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736132870; x=1736737670; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oZO2/JK1vJqeJvxJrlYDZUuiJ755Y2NffqKG//AhfG8=; b=YYe6il6t1IMBjIBer/D+LvvVLEbwZqHzBmY+qTiRcUtOzbpnwLnfzdotJVvo6lpS4+ k31W720s/A8zEVr3CL4gcStsRUheRmZjW+SCLFRdt1jN8MEHOvJdmYqZqfz+gQuKGDsa OfDTNj6mSlsanc59/b9qyCoopHnLbx+sjJMo1he6l+YZRWk6CgHgpGiGRxBGM2AjJsOn 288AjAKHYQQ3kBgLqyudMneN2JQQtHc6MMtdKPyiCxLQfDCi191qBBP028Rj07A0yhPp DYi8813b8q2Opk6J/JJCK8LjL2tbIQDgB92XF61ok0DuGzjISEMXhioC7CIcLRRcTeQC 2p5A== X-Forwarded-Encrypted: i=1; AJvYcCVDJ10iODU3FsernenhayLUDGqIaHKtu1wZ80co/GvPxxPsbuvEWR78x1Ib2B6YVKMorXZC01FruWM=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yw7WZz3R845IL/S/dMg4SFvr0fEzF2k3XstOl5QVo2U0nImwu0D s4g7MtRdoEp4/VcXTVPCFtRu5UTJpqw/b04MfYCtXEZO89wOn2RM2ux9pbxGzMrQ6z74WRJOxi9 BxOM= X-Gm-Gg: ASbGncvLrczF2x3qgqL6F5gA/D4/tU8TmKxm09VyXzHZmLhT6DlXjtgdIubaw6DkC9U iw2XUWCKKKsAQpdq59ysC+1MpucZHctrAnUJ4GsyOD6HLg68Ife5GNGEmzlWrKcwhaYCliVf01I FTR/nLfofZI1nzFHc0J8pf2RxnL7zzedZvye/BKg9y7UQCz5xGZdGDQoYt85LCTbLkrEKGizLoW oaiZwiMUxdKxHSS+amL12srtiV0Cq5TNXdct+StbOAOEnJ2EqKa0/z1oJ1N2nyX X-Google-Smtp-Source: AGHT+IGVNTbTo11ia3rI1vyhLprYs/ETfaR9ehq23gsHe9NwxJ01d9hxUtMjVjVfY/pmtpVerV1+Sw== X-Received: by 2002:a05:6512:3e1e:b0:540:1d6c:f1bf with SMTP id 2adb3069b0e04-542295254a0mr16112607e87.11.1736132869972; Sun, 05 Jan 2025 19:07:49 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:48 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:38 +0200 Subject: [PATCH v4 4/9] drm/msm/dpu: make fix_core_ab_vote consistent with fix_core_ib_vote MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-4-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2302; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=JMIpMFmUuSjIWpzC5uW4TfFD57Bcj868StpQVqk4CIM=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBne0j5yJtIKct8p9ZxKlcKTed0ff/2fXsxmYZkR cqjaLxugFmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3tI+QAKCRCLPIo+Aiko 1QJRB/91HLihkUTCkNJfedXqBJP7HeE1u9hlmhHKfhrQs34HNSx/8F3/rsHVSOHqMSkRKnvOGoG nLK6HfX8ZrPrRU7I3hD0nD4AGRkLsA9TjhY4xq3cG+icaLQAbt218LGaW7EyQmd/61/VkFY/Cu4 iTEB7oMMawkw6Mh7PU6y0acf5owjOVOp4bRFJlm+sXdMwlevTKQIXHL62yYFA0HxfpivnfGuTai 8Rs/rSfzKrHBJALsCt0IAS3jnkdtlnyfOVquR/lYPYiccngjOxzI5A2J5zWQW7Ww50csO1Y0qbq lrMwch96EW9kWy6TJ+aBv3oXAEz9az0/zppFJePMpF9NNuVF X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The fix_core_ab_vote is an average bandwidth value, used for bandwidth overrides in several cases. However there is an internal inconsistency: fix_core_ib_vote is defined in KBps, while fix_core_ab_vote is defined in Bps. Fix that by changing the type of the variable to u32 and using * 1000ULL multiplier when setting up the dpu_core_perf_params::bw_ctl value. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 7263ab63a692554cd51a7fd91bd6250330179240..7cabc8f26908cfd2dbbffebd7c70fc37d9159733 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -125,7 +125,7 @@ static void _dpu_core_perf_calc_crtc(const struct dpu_core_perf *core_perf, perf->max_per_pipe_ib = 0; perf->core_clk_rate = 0; } else if (core_perf->perf_tune.mode == DPU_PERF_MODE_FIXED) { - perf->bw_ctl = core_perf->fix_core_ab_vote; + perf->bw_ctl = core_perf->fix_core_ab_vote * 1000ULL; perf->max_per_pipe_ib = core_perf->fix_core_ib_vote; perf->core_clk_rate = core_perf->fix_core_clk_rate; } else { @@ -479,7 +479,7 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) &perf->fix_core_clk_rate); debugfs_create_u32("fix_core_ib_vote", 0600, entry, &perf->fix_core_ib_vote); - debugfs_create_u64("fix_core_ab_vote", 0600, entry, + debugfs_create_u32("fix_core_ab_vote", 0600, entry, &perf->fix_core_ab_vote); return 0; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index ca4595b4ec217697849af02446b23ed0857a0295..5e07119c14c6a9ed3413d0eaddbd93df5cc3f79d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -51,7 +51,7 @@ struct dpu_core_perf { u32 enable_bw_release; u64 fix_core_clk_rate; u32 fix_core_ib_vote; - u64 fix_core_ab_vote; + u32 fix_core_ab_vote; }; int dpu_core_perf_crtc_check(struct drm_crtc *crtc, From patchwork Mon Jan 6 03:07:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DAE62E77199 for ; Mon, 6 Jan 2025 03:08:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AA8610E55E; Mon, 6 Jan 2025 03:08:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="T7XB294/"; dkim-atps=neutral Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0920D10E566 for ; Mon, 6 Jan 2025 03:08:53 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53e3a227b82so12894903e87.0 for ; Sun, 05 Jan 2025 19:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736132871; x=1736737671; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=a5CrB3VVs4RubiecuAESwKhvETynOyoovj9hYHIh994=; b=T7XB294/lbDqrG+KNvw4WsjT/EsOEevylr+ZRSfM1Vv0T89oCFUPz3UNWJOvmGxaz/ Alldf+sK28uT75KECP7DMrXMnmwqRtNjDjn6dXAhkBIQZnLIpsAtpen48zwAQzQYMsLO 6gsUrukdoyHMmf6JWg8pDhuOOdQrj+ty8QRt20yFdM/5rd7e0d9JaacWs40Mu14x8iz/ F08ui7uZbnmydU+hk9y7+eNS0JVFsq5BNdpje7S/Ga8kMCFhTiOA3CGc2taHMN91AJ3b BBWKfS3aNdTxKVliOYvm+hDYlPHO2xuCfdp8P+hnm2rRLqF6td39OmHw8cMNHwwSOVgv yrBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736132871; x=1736737671; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a5CrB3VVs4RubiecuAESwKhvETynOyoovj9hYHIh994=; b=GM+B4M953YHgyKlQ/YQXhcQZbY+LSykxir1AzOUo7+j/arQDYrPjcNRZR1NsHwekLK Y2TL2V6wn6QIq5wkixgGF0wNyOUl1Qn2W012BSy7DaFwmknlik6kb5Nq5LKXaV6itoXT mvk2FsQNB/LGV8XDrgfAJiKZvJwvLcjjR+KhUBqeVgn9EGcWqNbYjKOfFDoO3M60OPgl PKKOB4gD8yeZAjeaIQdA+HJEP97ZIoqW+Wy9093d2eRpqVoLqV8tbaC9AQ8oiGUnSUiw hm6vUpg2313RaNOJq/9EaIzCqAzPoJcy2JU3UMr6kcLFAkmei3wPuG7Ch5mFAoQJmlOL 59Dg== X-Forwarded-Encrypted: i=1; AJvYcCW/lxE2YaDD5t51y7y0/X2OoPXBbYUs5aFRIuyGWF9ZSuNa/PzcUR7WNHKCMKz4sG8rZGNnm6FGyqc=@lists.freedesktop.org X-Gm-Message-State: AOJu0YwO70z3axAVlSU9HERetGFbK6aFKLfVtidXKoVk+/BPsxTCHO9o 0l/em15ZS6n+QITULhWnZJ2nDZtT7jF8BpIM29qFJankhK4mNKhcxfs6uIysVoU= X-Gm-Gg: ASbGncttKU0KZumIwMiHEnh2GlkRcAkE2lVOobrrNfkF3y1GX6KzvgSmMz18BRsnTCX o/dVP9AtIauytNywXh6A8ApcmJUpMKMoimeHk2WyFLCAi7yC0tPGRhsfVpRc9xmu/H5p+7Q/QU+ /izS+5Yn0CgNOTKODxOhqBAwS03P3GR+r0MchQU1GXguPORfxAvvQTf49GRPJOBmcuWb7fH7QFf qfh4IDhXNo1uLaNULLXR8rl2sJAF/kxZFIwugSKoD+JLV1P0owpjNYHEU/qr+E9 X-Google-Smtp-Source: AGHT+IHzx6/+7iGF1P0U7GWJ28wdjB2danjMCVHHo/L2A4YNnr8iSGE26LZqT4t39m0vn1B4eunyiQ== X-Received: by 2002:a05:6512:3352:b0:542:2972:4dee with SMTP id 2adb3069b0e04-54229724e2amr12217322e87.46.1736132871412; Sun, 05 Jan 2025 19:07:51 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:50 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:39 +0200 Subject: [PATCH v4 5/9] drm/msm/dpu: also use KBps for bw_ctl output MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-5-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1889; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=KJrUekUQHpsltHpQlGGp+aa7hsu1HP/5xOuInMxMEys=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBne0j5AyXKui86uo80O6nJIzR09aronJqlcaPRc n3a4bydiG2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3tI+QAKCRCLPIo+Aiko 1Q51B/9LaocYG/L2mMpfx5wBR3PisMBgyCmDdcxoHwEvhA7kQT/cQWQz70Bj2xpCVxp7gb0vJ6d aFdgE4IQyA2z9UDFRsX1i/Ti+S2kfW+0IgI7onaWQpH5Ec1PgIRTOAW5rGCc5UuMTTyfomkN0nA COg0eejJV5sMHcx5I6W5EXU7F4AmT7L0yvYYoZI91hCCsTfg36p00MzUdtqn/4MB3CvrIrhDVXQ v+28+lOWN9DcMKnhOXz8BO9kE2n/ZGGd+pTkB7g8OM+yiTGRTQerVBFzIUN7w8VokmNosPutKl7 g03NputU4t+ibPynj6fsWAEHOS0FiHBnoTwJvoEQiGg6GD+1 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Change debugfs and log entries to use KBps / u32 for bw_ctl and similar data. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 5 +++-- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 7cabc8f26908cfd2dbbffebd7c70fc37d9159733..b93f7556f187d46b325a689ad01ec177cecbc37a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -135,9 +135,10 @@ static void _dpu_core_perf_calc_crtc(const struct dpu_core_perf *core_perf, } DRM_DEBUG_ATOMIC( - "crtc=%d clk_rate=%llu core_ib=%u core_ab=%llu\n", + "crtc=%d clk_rate=%llu core_ib=%u core_ab=%u\n", crtc->base.id, perf->core_clk_rate, - perf->max_per_pipe_ib, perf->bw_ctl); + perf->max_per_pipe_ib, + (u32)DIV_ROUND_UP_ULL(perf->bw_ctl, 1000)); } static void dpu_core_perf_aggregate(struct drm_device *ddev, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 8a523eb308630943871c2e075d3d0d9094606d05..ac3c6c5ad1cec3856f0eff2ed71153d3c2dc279e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1486,7 +1486,8 @@ static int dpu_crtc_debugfs_state_show(struct seq_file *s, void *v) seq_printf(s, "intf_mode: %d\n", dpu_crtc_get_intf_mode(crtc)); seq_printf(s, "core_clk_rate: %llu\n", dpu_crtc->cur_perf.core_clk_rate); - seq_printf(s, "bw_ctl: %llu\n", dpu_crtc->cur_perf.bw_ctl); + seq_printf(s, "bw_ctl: %uk\n", + (u32)DIV_ROUND_UP_ULL(dpu_crtc->cur_perf.bw_ctl, 1000)); seq_printf(s, "max_per_pipe_ib: %u\n", dpu_crtc->cur_perf.max_per_pipe_ib); From patchwork Mon Jan 6 03:07:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 544CFE77197 for ; Mon, 6 Jan 2025 03:15:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC62B10E568; Mon, 6 Jan 2025 03:15:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OwD+82ZQ"; dkim-atps=neutral Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFB3C10E568 for ; Mon, 6 Jan 2025 03:15:49 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-aa68b513abcso2598648066b.0 for ; Sun, 05 Jan 2025 19:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736133288; x=1736738088; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=d59Z3qrLfT2qIqzs5o3r/0E9tuM8fjfJdM+IihJasEc=; b=OwD+82ZQBFLEoC/PkVFIQzq1gCiCFe6ouWlq7xVxOQkpigyCLOyxS+kIkXTW5DUKxr Kj+44ep66ON0NK7u1ViBWWzkWACN3tyBrVAryT31Lc3twZmP3d2sneSph9iXTexYUGip +gxXA9lye1N7fL+PoyhAc0S7NRjPPg8eu+uq98SqRjy6BcMJE1vpkA0E52Cupccezoua SqJQKc9Cn4e1mjkoGCvGvCNmwdFUDy6MwEVuiUpHlr5/hfYkc8ve2H4dRV4G7oJhWL0T yrWR0P22BHPVI6vkyH4jHJtZfuvEFxceqC+BN19ChhLjv+UOYdJZ+QxcxJUEQTPYtuO8 ui9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736133288; x=1736738088; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d59Z3qrLfT2qIqzs5o3r/0E9tuM8fjfJdM+IihJasEc=; b=P7imNNEQHTvW9U/Ecp2bgp3o0WaZgKwi6BY2S1fzm80rKUJdXeIzSG2t7bNS1hP7HV ndxEfA2peb6Tf5ovItgehpnZ5Zni1VmzrLUCpxcL4QcmO53SoJ4zy3/EPwK65Qifzpar jVywgABk5lDWFgZUxla/5mTfj/8rgSm2eEbjiNuFGNLBwN7Mw/yLzCfaqyoXqM84SpbP 1VJJ5NUJl/0mYRramg5x0PqMxzlV9A7MMRAgJhuIWpUxq/FVGHnkrNKEysvAL6TwFYRu 8n/JAqkH6PkD+I6fsCGxYdfapUlsR7Gr4h4X53RPNOIhh5m9UYnqYyfth0Q7qW286JMh LzdQ== X-Forwarded-Encrypted: i=1; AJvYcCWtvBaDd2ITYsRMrlmBXIao6BqAWljaLs6a0XEQYxZeUqG8iqjkSTb2Pno0gGOch+EXR4Anb086kXg=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxbER0zAb/tSkW7cW/9THYVftUFlhbQyaiGxjWDZOCbvJW/rim8 LKvDaREbZrLZjgaRIAAFWqmYUcS4xjrI2EBzmJ9x3UXVZK2P3RnIpusz0w0FMqU3CHB5tnAVbNe Ed8E= X-Gm-Gg: ASbGncsy/0SnYREtNHgyiP4HhelT9FniwhPa7Qc94FiZjxkb4fIQcJjNfAFshCduGn8 CL3aJkfdcjniS4VYSJnWIyA6ufHiYem8UifUL3zOU4ynyKK7bZKhL5UQBLGTQzMmYaEcy2GQ6ai KrPJSE0rzwKo0hUedKcJQgTrmWie37kFOGU5T62dF+Hk3M5j5eotNbdRnS+bjBmepsYk7peAOlV BlGLhFTBRpS/W4eJguJt68QFe2h2aJmjXT8j1VdRrj+1A6oSKaIY133MIDme8s2 X-Google-Smtp-Source: AGHT+IFKzrJdZbp0VnGmVQddnrS76dcPqx2IOwskz9x2OymOvb0Kcx3KnUojFYk6Yq6nsT7bEn53Og== X-Received: by 2002:a05:6512:3d22:b0:540:1fcd:1d8a with SMTP id 2adb3069b0e04-5422957afa2mr15539769e87.55.1736132873732; Sun, 05 Jan 2025 19:07:53 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:52 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:40 +0200 Subject: [PATCH v4 6/9] drm/msm/dpu: rename average bandwidth-related debugfs files MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-6-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1292; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=3GO6BKanzbIFpcGY1492/FnGV+oGzdC81viLdgF4XKU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBne0j5W7DE/CqwnIGp5JjlR3b+5azAW4JhRlYR6 23i+RdJ8RWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3tI+QAKCRCLPIo+Aiko 1YfJB/9R2mnaUTtPtDTK/pDYG4hf85YzZerMGxPbZ/HA9Mx3dw0AQY5dAaa+YHc/xw4zay7CshX StUPZEny53hjKaiSUjY1mm/dgtLpiFd2wqFGIoUAyewCCLarWRzzunyexzz/TOa7A3vFRDH0nW2 omoYghdwkQLSApGVE/Gg2vSrpIL/8MC+H+Jze9O0ujL8e83QLqHF9MSByLxZKJ5fY5/QpyYcsUV XpjEeR0KkaWLLZKV9izhb4F9Wbe8P2TUwHgdH8YvaxwxfKSJsa2B/2+8fQXgc5oQ6AnifuDO4Yt tvFgPS5AjR+kCokydIdwAROQuzTzNNOtZE0s1uNHCiVatmC+ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Rename the debugfs files to match their purpose and the patter provided by other bandwidth and clock-related files: threshold_high -> max_core_ab threshold_low -> low_core_ab Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index b93f7556f187d46b325a689ad01ec177cecbc37a..70f43e8359caee2082f2ca9944a17a6a20aa3d49 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -464,9 +464,9 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) &perf->core_clk_rate); debugfs_create_u32("enable_bw_release", 0600, entry, (u32 *)&perf->enable_bw_release); - debugfs_create_u32("threshold_low", 0400, entry, + debugfs_create_u32("low_core_ab", 0400, entry, (u32 *)&perf->perf_cfg->max_bw_low); - debugfs_create_u32("threshold_high", 0400, entry, + debugfs_create_u32("max_core_ab", 0400, entry, (u32 *)&perf->perf_cfg->max_bw_high); debugfs_create_u32("min_core_ib", 0400, entry, (u32 *)&perf->perf_cfg->min_core_ib); From patchwork Mon Jan 6 03:07:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 6CA2CE77198 for ; Mon, 6 Jan 2025 03:08:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EAA5310E567; Mon, 6 Jan 2025 03:08:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="q25OOSZW"; dkim-atps=neutral Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA81210E566 for ; Mon, 6 Jan 2025 03:08:57 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-3022c6155edso81967951fa.2 for ; Sun, 05 Jan 2025 19:08:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736132876; x=1736737676; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BUBRF+7dphUIBvaHeuE5P4CwKEJFwHHGIe7GdZDUN/4=; b=q25OOSZW0+fAi67ET1s+6P0NXzrTLLVYJn/2pOPTAekBv9EwBq2+SuB87ML+bRmgbs oNIH5cia3X2gQCFJ/W+XtQSp+2xt2V0+RzE7REheaoAFiiF4jIeJ0e7tQQ/dzCb2MU8G ub1OK+tFXioiHcPIS26wcTm5GL/+H2YKPb9JS14Y2nYxm7noQOu38SLA2T4chvI0hj4U 0o96RifH63XhpvdUjPhocB4mxuCtVIF1uWe6FvUxMmfhGo+WEFMF1C3OwN1UydU5B8yw e/6iT/GzsxEIXHSSqGQhyCdoZ/GRGsmCSkt/G37wpkgymeVRcGuGowl4Kh0pwaLpe7TY cWyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736132876; x=1736737676; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BUBRF+7dphUIBvaHeuE5P4CwKEJFwHHGIe7GdZDUN/4=; b=Vgwr4KDKUK9ZKe5LQ8qUyjZpgWJRlOoaw/jO/kb/DG4UnNFWjBNKeiOZa/ACLOcYsr 8eKUyQl3V7lX35pwsKytjU78a5iq2gRISL92t59pf1TCuNCyEVfIKf1pG4byFmozJQnm Q5ErvQtrW4LdVxjDMsUvIadwNfJAZdHFarXB7aMUXovc/NZqCXVN1tyys5hYF+Wuupix 2nSHStSfLczVCvYUG040X+mtAY0XhjCmgyR2d1p088EPhEaVa2MBvWQqTkuC6DXM8MIP YL3gid5AzmwQPusDlDAUTgzr/o14SchgwPRRmoaSv2qkB1mW9h66+Eex8l4SJbleuOoW rWGg== X-Forwarded-Encrypted: i=1; AJvYcCWtQZQbG2hEi9KRPDXp2cDywV/6lntxMYK26GmE/uV8ZBdHmAfwSMr3vFdXQRqtY5MvlCbODqD4NNg=@lists.freedesktop.org X-Gm-Message-State: AOJu0YyjRg9LB/OswVLAu8/Qhmf67Ygtk6eaaSX9d1KSZ+xNhhfkhykO aO5G/ZSU/HzFeETzfxOcrKL0Os2k4f20DG0jwI/1/6bajIVQ2o6boKu1Yw8Vtd2xaYae1ySWZ0A RjY0= X-Gm-Gg: ASbGnctVFbJt5sAD5PJ0O4szN4APBGRuEjwki5Q/O80Yz9tP2b3PxlrvLzuogGNzhMz WQdf/7bLuIkRigzntZRSKhg0JkTFkhJmpgJTjA6U38wY476E2g/+3fSTlFQGJKi+IMJ6FSCUgTg pVoyrT8TG0/QoqUO9T3PcKdOstqBdiGnIQ/aZYzPz6n3lX5TUm83tWajrf8tSLHQrSMxPWATReZ B9NNYBGbHP89ExlNhOpCRNhXQhXEWzt2DPTOfQzjtkvWRUD6kb26vNtm3ER+VX2 X-Google-Smtp-Source: AGHT+IHK7ZCjCmaBz957EJ1YPzDsKQb5wVe2PN7c1gzn1PSJw+qSdoYIjT1J5sq1xrC+jKC144tETQ== X-Received: by 2002:a05:6512:3f1a:b0:53e:350a:7298 with SMTP id 2adb3069b0e04-5422953ad7amr14156586e87.25.1736132876085; Sun, 05 Jan 2025 19:07:56 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:54 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:41 +0200 Subject: [PATCH v4 7/9] drm/msm/dpu: handle perf mode in _dpu_core_perf_crtc_update_bus() MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-7-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3204; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=pAykJVSPbhOX5dwvl8G/jrVUqtiroa+GlHDm/8cLuCk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBne0j5g8KcjDuZJxWzkiplt1Kts7LQtp6hMIPNC pQOAdjyzWyJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3tI+QAKCRCLPIo+Aiko 1ePCCACRGyNBo5mLQxszxR5CuVNLwpNnrpdcVa5Xc8QZ9DQTFn8Xp6tc8z/ihv0E8VhducssM6Q NY/ziole3EI3iTYOmbeLbE4yDXI0Hq5KIuvlVslFoWBg32IXQj9xd/7Pm9gqkhuSXCRFa234w23 FLXfwYSc+P+xI/ks0i6RYbpaLGnWi+R2PVR7xTbmx5ILQM0R0jtwTmV1v4VEvkNUVG+f8YMpi8M G3mMBvOd1XbR0om4c+jl9xp31jRJt+vTe2TPL58+xkfxaiFzTiQavjmkuCI/poo7Ru6xqcS5rtL 4wRxIeeoNy6ZRF8flRm53V/vYs3VFmbxjNJzt9tk2xQcQspx X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Move perf mode handling for the bandwidth to _dpu_core_perf_crtc_update_bus() rather than overriding per-CRTC data and then aggregating known values. Note, this changes the fix_core_ab_vote. Previously it would be multiplied per the CRTC number, now it will be used directly for interconnect voting. This better reflects user requirements in the case of different resolutions being set on different CRTCs: instead of using the same bandwidth for each CRTC (which is incorrect) user can now calculate overall bandwidth required by all outputs and use that value. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 40 +++++++++++++-------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 70f43e8359caee2082f2ca9944a17a6a20aa3d49..7ff3405c6867556a8dc776783b91f1da6c86ef3f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -118,22 +118,9 @@ static void _dpu_core_perf_calc_crtc(const struct dpu_core_perf *core_perf, return; } - memset(perf, 0, sizeof(struct dpu_core_perf_params)); - - if (core_perf->perf_tune.mode == DPU_PERF_MODE_MINIMUM) { - perf->bw_ctl = 0; - perf->max_per_pipe_ib = 0; - perf->core_clk_rate = 0; - } else if (core_perf->perf_tune.mode == DPU_PERF_MODE_FIXED) { - perf->bw_ctl = core_perf->fix_core_ab_vote * 1000ULL; - perf->max_per_pipe_ib = core_perf->fix_core_ib_vote; - perf->core_clk_rate = core_perf->fix_core_clk_rate; - } else { - perf->bw_ctl = _dpu_core_perf_calc_bw(perf_cfg, crtc); - perf->max_per_pipe_ib = perf_cfg->min_dram_ib; - perf->core_clk_rate = _dpu_core_perf_calc_clk(perf_cfg, crtc, state); - } - + perf->bw_ctl = _dpu_core_perf_calc_bw(perf_cfg, crtc); + perf->max_per_pipe_ib = perf_cfg->min_dram_ib; + perf->core_clk_rate = _dpu_core_perf_calc_clk(perf_cfg, crtc, state); DRM_DEBUG_ATOMIC( "crtc=%d clk_rate=%llu core_ib=%u core_ab=%u\n", crtc->base.id, perf->core_clk_rate, @@ -222,18 +209,29 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, { struct dpu_core_perf_params perf = { 0 }; int i, ret = 0; - u64 avg_bw; + u32 avg_bw; + u32 peak_bw; if (!kms->num_paths) return 0; - dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); + if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) { + avg_bw = 0; + peak_bw = 0; + } else if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) { + avg_bw = kms->perf.fix_core_ab_vote; + peak_bw = kms->perf.fix_core_ib_vote; + } else { + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); + + avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ + peak_bw = perf.max_per_pipe_ib; + } - avg_bw = perf.bw_ctl; - do_div(avg_bw, (kms->num_paths * 1000)); /*Bps_to_icc*/ + avg_bw /= kms->num_paths; for (i = 0; i < kms->num_paths; i++) - icc_set_bw(kms->path[i], avg_bw, perf.max_per_pipe_ib); + icc_set_bw(kms->path[i], avg_bw, peak_bw); return ret; } From patchwork Mon Jan 6 03:07:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BE7D2E77197 for ; Mon, 6 Jan 2025 03:15:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42D6D10E565; Mon, 6 Jan 2025 03:15:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="tY/AFcee"; dkim-atps=neutral Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 75ED410E566 for ; Mon, 6 Jan 2025 03:15:09 +0000 (UTC) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-385ddcfc97bso11837477f8f.1 for ; Sun, 05 Jan 2025 19:15:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736133248; x=1736738048; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yM2i2HYStAdSWG3sjjBGG9Ljxx9LDMbO6ArSQ2Ldm5s=; b=tY/AFcee9uEBDoZW0qoRs/g77n5XHkUV4y7ZZY+QEdJ8cmR2X0cua3+aqEsLN+NmWk v3O1BpxV9hWAS5jZaCujqGWyDVwh0LdKLjZ54omcZbtLKIczs66I37FEk+MCkQcMO6p2 D1+Scey7B+1lbnuDvEPvMPZqK7No2o5zGiVJVUjHW/Oio8U6wzVnnqeO6Uiefe5iuCMP EJyKlz75x865jSNaZauzxTAj/3sd+LT+EKu7jJUc/9E8i3gPjgIRfOKoNLOhVmdYcQqo hZ7HRQ5yiN+oasCZTkUUV45/RhNv3r7qqfdqeCCoImHuN85lbBw1RSxfLmE8MiAtRh+Y 34iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736133248; x=1736738048; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yM2i2HYStAdSWG3sjjBGG9Ljxx9LDMbO6ArSQ2Ldm5s=; b=pTAd7hGKX1LixPJk8zDVPvcjY2bzOHgcsB972xOQGv48G4cHj8yHzv1EUcWqo+h2+F z378dXqb+82NpXDynyQEvtMA4XqxYeipBVw8haXAC6UhcKSbold7Cq25kPX7eJk39c+i bBVoyxteLZbvlfTvwnRdBEys5s1ZvaCU2EtHDTdiFLIl7rlyL5DFfJsoj+vPQArxBUJ3 GGGapBbW0N1N0dEL8gBJHDQulFMY00ESs2uccI7Ll7e37Mry0ncK8xXpfS1IkApg5HiP 2g8hA7lrj+OiT2xrszkoZvp2JNbv2Bsg7hnRTu7Svd7eQm8wpK8ln2ba+3de4ESv61vg ndow== X-Forwarded-Encrypted: i=1; AJvYcCXwckgbwgUia9LD+g9SMacAS/UH6VzqvqznNYIl0wSaLStQwedCKcFiwq6Ly/fhjVMK8obT9i6pBAA=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yyia5DnHTCUt6q7kaaLTwXU/C8IyG3+3n0uKuBsJ4AH6+hqZbgi zPbIy+weYbv6r/1KBtame/WiPkJE55NoXAtxxPQnK/cIrCMfVYVUfh3tkihTetm48fIktgfGrVb WNds= X-Gm-Gg: ASbGncueO2YRjVyjrL623NvkGcP0fQ11R7j4GRJCLOIvKrDwFw7hhg5rQ1e8zleo/D8 EzUczC6bJ+ZsjwVRLGqM5UquQKWXta90vpgbEueeGOAqc851Q2GvyGyqKbYFtWBKDZBbCnby5Ih GwjwF59m86c8Fhhk+uEvzEbYZRQ5o/AOOr72ECFY8IeFADpw7JG7Cp/rKL8xQRTpWx7mhOX0A8X 7lj7yabLX/656kqDvV04OuDuUE7LLY5r8PpSLpVPuOZlb/aUd4TB6fHns5OVrRI X-Google-Smtp-Source: AGHT+IHioDxU4q4Pl3d58Vp5gu9z+6/Xod18Avh5lpeGfTJ9Hh1MCjsdaanLjqQRRYfO3hUvefwjJw== X-Received: by 2002:a05:6512:68e:b0:540:3566:5397 with SMTP id 2adb3069b0e04-54229530300mr18509766e87.22.1736132877544; Sun, 05 Jan 2025 19:07:57 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:56 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:42 +0200 Subject: [PATCH v4 8/9] drm/msm/dpu: rework core_perf debugfs overrides MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-8-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6299; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=8ApQQYwIW4aOZjRGxNwryHLmbasSwJB0LRH46YetCSU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBne0j5Mi6VClvRmq3zBh2lGjncCTcohiF8id1VY 3G+z5EHhJiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3tI+QAKCRCLPIo+Aiko 1doBB/9tSmBOB2fTQ8UKjU94WtOgR8MaCSQI1yH2JjRw0MXFSQYgNAgrnVxeDme0r1bAkstEzmU OHj4o2R2ou5UZeOUXR9gv8j9YlHVOKCq+lCWDMqhhux7mhv7qzx306dvzEUeXLG/Qm2pWbLsqP5 LF+CKjP+h2cbTosVH9n/rqKf1OA8NjdgtUMiIeG97BRIoyCZsjlcgzGOMOJe/jcfhN+rrSituot ssZ/ou8JhNR5Skg9r/dH/iG7Y9xHCnv6T5m1D8nmVrQ38iKcA0cn3kiYLrhwRyF6WMr1WYBsUDi jVYUYciUTIGtGPmX7x5DWu8jOUZqg5aVqM97IpREUAcWpFo4 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently debugfs provides separate 'modes' to override calculated MDP_CLK rate and interconnect bandwidth votes. Change that to allow overriding individual values (e.g. one can override just clock or just average bandwidth vote). The maximum values allowed for those entries by the platform can be read from the 'max_core_ab' and 'max_core_clk_rate' files in debugfs. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 87 +++------------------------ drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 10 --- 2 files changed, 9 insertions(+), 88 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 7ff3405c6867556a8dc776783b91f1da6c86ef3f..913eb4c01abe10c1ed84215fbbee50abd69e9317 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -17,20 +17,6 @@ #include "dpu_crtc.h" #include "dpu_core_perf.h" -/** - * enum dpu_perf_mode - performance tuning mode - * @DPU_PERF_MODE_NORMAL: performance controlled by user mode client - * @DPU_PERF_MODE_MINIMUM: performance bounded by minimum setting - * @DPU_PERF_MODE_FIXED: performance bounded by fixed setting - * @DPU_PERF_MODE_MAX: maximum value, used for error checking - */ -enum dpu_perf_mode { - DPU_PERF_MODE_NORMAL, - DPU_PERF_MODE_MINIMUM, - DPU_PERF_MODE_FIXED, - DPU_PERF_MODE_MAX -}; - /** * _dpu_core_perf_calc_bw() - to calculate BW per crtc * @perf_cfg: performance configuration @@ -215,18 +201,16 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, if (!kms->num_paths) return 0; - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) { - avg_bw = 0; - peak_bw = 0; - } else if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) { + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); + + avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ + peak_bw = perf.max_per_pipe_ib; + + if (kms->perf.fix_core_ab_vote) avg_bw = kms->perf.fix_core_ab_vote; - peak_bw = kms->perf.fix_core_ib_vote; - } else { - dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); - avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ - peak_bw = perf.max_per_pipe_ib; - } + if (kms->perf.fix_core_ib_vote) + peak_bw = kms->perf.fix_core_ib_vote; avg_bw /= kms->num_paths; @@ -275,12 +259,9 @@ static u64 _dpu_core_perf_get_core_clk_rate(struct dpu_kms *kms) struct drm_crtc *crtc; struct dpu_crtc_state *dpu_cstate; - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) + if (kms->perf.fix_core_clk_rate) return kms->perf.fix_core_clk_rate; - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) - return kms->perf.max_core_clk_rate; - clk_rate = 0; drm_for_each_crtc(crtc, kms->dev) { if (crtc->enabled) { @@ -396,54 +377,6 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, #ifdef CONFIG_DEBUG_FS -static ssize_t _dpu_core_perf_mode_write(struct file *file, - const char __user *user_buf, size_t count, loff_t *ppos) -{ - struct dpu_core_perf *perf = file->private_data; - u32 perf_mode = 0; - int ret; - - ret = kstrtouint_from_user(user_buf, count, 0, &perf_mode); - if (ret) - return ret; - - if (perf_mode >= DPU_PERF_MODE_MAX) - return -EINVAL; - - if (perf_mode == DPU_PERF_MODE_FIXED) { - DRM_INFO("fix performance mode\n"); - } else if (perf_mode == DPU_PERF_MODE_MINIMUM) { - /* run the driver with max clk and BW vote */ - DRM_INFO("minimum performance mode\n"); - } else if (perf_mode == DPU_PERF_MODE_NORMAL) { - /* reset the perf tune params to 0 */ - DRM_INFO("normal performance mode\n"); - } - perf->perf_tune.mode = perf_mode; - - return count; -} - -static ssize_t _dpu_core_perf_mode_read(struct file *file, - char __user *buff, size_t count, loff_t *ppos) -{ - struct dpu_core_perf *perf = file->private_data; - int len; - char buf[128]; - - len = scnprintf(buf, sizeof(buf), - "mode %d\n", - perf->perf_tune.mode); - - return simple_read_from_buffer(buff, count, ppos, buf, len); -} - -static const struct file_operations dpu_core_perf_mode_fops = { - .open = simple_open, - .read = _dpu_core_perf_mode_read, - .write = _dpu_core_perf_mode_write, -}; - /** * dpu_core_perf_debugfs_init - initialize debugfs for core performance context * @dpu_kms: Pointer to the dpu_kms struct @@ -472,8 +405,6 @@ int dpu_core_perf_debugfs_init(struct dpu_kms *dpu_kms, struct dentry *parent) (u32 *)&perf->perf_cfg->min_llcc_ib); debugfs_create_u32("min_dram_ib", 0400, entry, (u32 *)&perf->perf_cfg->min_dram_ib); - debugfs_create_file("perf_mode", 0600, entry, - (u32 *)perf, &dpu_core_perf_mode_fops); debugfs_create_u64("fix_core_clk_rate", 0600, entry, &perf->fix_core_clk_rate); debugfs_create_u32("fix_core_ib_vote", 0600, entry, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 5e07119c14c6a9ed3413d0eaddbd93df5cc3f79d..9d8516ca32d162b1e277ec88067e5c21abeb2017 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -24,20 +24,11 @@ struct dpu_core_perf_params { u64 core_clk_rate; }; -/** - * struct dpu_core_perf_tune - definition of performance tuning control - * @mode: performance mode - */ -struct dpu_core_perf_tune { - u32 mode; -}; - /** * struct dpu_core_perf - definition of core performance context * @perf_cfg: Platform-specific performance configuration * @core_clk_rate: current core clock rate * @max_core_clk_rate: maximum allowable core clock rate - * @perf_tune: debug control for performance tuning * @enable_bw_release: debug control for bandwidth release * @fix_core_clk_rate: fixed core clock request in Hz used in mode 2 * @fix_core_ib_vote: fixed core ib vote in bps used in mode 2 @@ -47,7 +38,6 @@ struct dpu_core_perf { const struct dpu_perf_cfg *perf_cfg; u64 core_clk_rate; u64 max_core_clk_rate; - struct dpu_core_perf_tune perf_tune; u32 enable_bw_release; u64 fix_core_clk_rate; u32 fix_core_ib_vote; From patchwork Mon Jan 6 03:07:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13926913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B1EB5E77198 for ; Mon, 6 Jan 2025 03:09:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E25D10E562; Mon, 6 Jan 2025 03:09:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="bntuE3f7"; dkim-atps=neutral Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CB1F10E568 for ; Mon, 6 Jan 2025 03:09:01 +0000 (UTC) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-53e399e3310so16617884e87.1 for ; Sun, 05 Jan 2025 19:09:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736132880; x=1736737680; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XukaOp5kKwWAqg5NiIi7HtnqJ9SLo3eszJ1zykIQEx4=; b=bntuE3f7X5/cgKzwSxLyzCXiJhAUnEnpkCnDa9Jv7nY2JFvpaQyXup0OByIedV9YQQ MH4xF0aMLldeoc7B3t9zBWdF1Xp1TjeNG4G2ghjevytIufFauvLOluf05DN3dku8KEYp povMlbe6INAk8ieqoLZdfQaTB2/KwuYVETMtAsKBJEhs3/9Dcefsy1zARua+51NHsp8s dC1Bd49SKYc1x9GmE5jQRSc0SRYjJZzEAXqJk2hLmvpRVqQLcjxFhBQGWRlO2MxCL8VV rhMYW4qgvlGRBru4P5m3OndkkUYoSYR5uycJzyCyxuhT+KWC68Rk1ASUtKK0XRzbFXZ8 vEUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736132880; x=1736737680; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XukaOp5kKwWAqg5NiIi7HtnqJ9SLo3eszJ1zykIQEx4=; b=kILuQTlOVDlkih8QeyxwIChQ/m88X7sjuGQslqGLOvLe5pyMndXFvpY7toEtR5hKys M71asiGzeTo18VFl6BOtaPNNrq4bBSPRjDc5P3U2kIqexeD5RCVOwttOpUMROvuTOmdq /cKLfkjHd71pIPGcouL5Tbw2wCCwUXLmJxL8w5LGskviIm9udLCJzNXjhRfo+Z8rdiCb u33WCX7C3U+VpxqvuGRLUeVtCJXg3Epq263411uecNDgsJv/RS5qfKqdpaNzgp75J9O8 1X3/c2xVFZ7vaoC++WNqkMCXsLQ5NTkKRjCX0RwYO/0wKH5aCSxy5niI9NCQ/3x7k8Is 7gug== X-Forwarded-Encrypted: i=1; AJvYcCVgl5j3C6Fl8BLrDBtIG78NGDgnfurjayT7dQX80dz/R7M6Uot70vm31YVeudsBp48iTPOM2EKcFMg=@lists.freedesktop.org X-Gm-Message-State: AOJu0YyY+OXEGXXV2snDUiu9+OuTuD6Jdx5n8qGYjgoXoqd2NK06agVn jykIMwjAx3fI1mnYZoiEI6GmCBCU643FUhlIw5XkmXJ4+GATQaPgQUvAWWvzo8A= X-Gm-Gg: ASbGncvqgY6UbWEfUXkrMT3Jmo7O//xwt6L9v5ufCz18BjpUn8JY79vtvdcZ0bbXxTN F0osQkx/DgSTHLeavo/jbMrNkxuhrAGy2+NWckUCFT9uqh/A5j5WZXIt8GhIV3+KiMVEgeTIO39 AnxvNRpJZQp3dBVsVuxRNYqWAx+V3WuL6O/Dc8k+nd4v4LFYNmm81QcURvGhmZRv1J7QKihO9y7 pj4kgKXMSYl95n+EvILuRbkPmPtJDJBFWKmUxW8vYLkE7ciLqNMMQuamz6spRmN X-Google-Smtp-Source: AGHT+IEkdMFrx+gMaYrx+eU+YMeJPPbOTnZsUuE+YoLKhJrZxYZeIybum6/sNXmAaVyK/0mdIZnONA== X-Received: by 2002:a05:6512:b86:b0:542:1b63:2e52 with SMTP id 2adb3069b0e04-542295229f2mr16665749e87.6.1736132879923; Sun, 05 Jan 2025 19:07:59 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301efsm4869016e87.247.2025.01.05.19.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 19:07:58 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 05:07:43 +0200 Subject: [PATCH v4 9/9] drm/msm/dpu: drop dpu_core_perf_params::max_per_pipe_ib MIME-Version: 1.0 Message-Id: <20250106-dpu-perf-rework-v4-9-00b248349476@linaro.org> References: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> In-Reply-To: <20250106-dpu-perf-rework-v4-0-00b248349476@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Stephen Boyd , Simona Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov , Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4335; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=oxkaR0JZPrIZxqN448X3RF02D4PAZKi9Fntcg0zH3oQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBne0j6o/3hLawn8SE5xGF3Cxo+0quVgwdVB4hEV r7+b303Z0+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3tI+gAKCRCLPIo+Aiko 1WOHB/sGxZ3bsc5J6lsIkxoTOJ/FYTMoXYRfiGeMAzqx2U+QcRjiElnxMixlkbd0BY3RC+swG9g sHNZnMOM4mPJ22MwFJscMYiTp+z65LT1DAzUegjYwGjmTCmUW2CsgiMlZyrGnF0FSOJb3N/x7Iu NpV6luraN/VtA9x57AAWzWkwmg7QfWV97KjQnFUqz2BkIs1MH8G7pltviJB845n6kdUy+0B6oRE 7VxOvJk8poM/0jND349kMAxh2XxarpjXmiwTzQeKvC10punUFxH/IOUNn2govwpFpH6PVmoxwH9 d4yKa0oqrNq5emyCw0YWEXHzQ8Wo1Fym2DwAVYvqlptEyTPD X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The max_per_pipe_ib is a constant across all CRTCs and is read from the catalog. The override value is also applied at the _dpu_core_perf_crtc_update_bus() time. Drop corresponding calculations and read the value directly at icc_set_bw() time. Suggested-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 16 ++++------------ drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 -- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 913eb4c01abe10c1ed84215fbbee50abd69e9317..62dab5883513dc570076da5a64e32e502dd4320b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -105,12 +105,10 @@ static void _dpu_core_perf_calc_crtc(const struct dpu_core_perf *core_perf, } perf->bw_ctl = _dpu_core_perf_calc_bw(perf_cfg, crtc); - perf->max_per_pipe_ib = perf_cfg->min_dram_ib; perf->core_clk_rate = _dpu_core_perf_calc_clk(perf_cfg, crtc, state); DRM_DEBUG_ATOMIC( - "crtc=%d clk_rate=%llu core_ib=%u core_ab=%u\n", + "crtc=%d clk_rate=%llu core_ab=%u\n", crtc->base.id, perf->core_clk_rate, - perf->max_per_pipe_ib, (u32)DIV_ROUND_UP_ULL(perf->bw_ctl, 1000)); } @@ -126,9 +124,6 @@ static void dpu_core_perf_aggregate(struct drm_device *ddev, curr_client_type == dpu_crtc_get_client_type(tmp_crtc)) { dpu_cstate = to_dpu_crtc_state(tmp_crtc->state); - perf->max_per_pipe_ib = max(perf->max_per_pipe_ib, - dpu_cstate->new_perf.max_per_pipe_ib); - perf->bw_ctl += dpu_cstate->new_perf.bw_ctl; DRM_DEBUG_ATOMIC("crtc=%d bw=%llu\n", @@ -204,7 +199,7 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); avg_bw = div_u64(perf.bw_ctl, 1000); /*Bps_to_icc*/ - peak_bw = perf.max_per_pipe_ib; + peak_bw = kms->catalog->perf->min_dram_ib; if (kms->perf.fix_core_ab_vote) avg_bw = kms->perf.fix_core_ab_vote; @@ -315,15 +310,12 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, * 2. new bandwidth vote - "ab or ib vote" is lower * than current vote at end of commit or stop. */ - if ((params_changed && ((new->bw_ctl > old->bw_ctl) || - (new->max_per_pipe_ib > old->max_per_pipe_ib))) || - (!params_changed && ((new->bw_ctl < old->bw_ctl) || - (new->max_per_pipe_ib < old->max_per_pipe_ib)))) { + if ((params_changed && new->bw_ctl > old->bw_ctl) || + (!params_changed && new->bw_ctl < old->bw_ctl)) { DRM_DEBUG_ATOMIC("crtc=%d p=%d new_bw=%llu,old_bw=%llu\n", crtc->base.id, params_changed, new->bw_ctl, old->bw_ctl); old->bw_ctl = new->bw_ctl; - old->max_per_pipe_ib = new->max_per_pipe_ib; update_bus = true; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h index 9d8516ca32d162b1e277ec88067e5c21abeb2017..863a6fc1f30c21cf2030a30be5fe62b024b3b820 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h @@ -14,12 +14,10 @@ /** * struct dpu_core_perf_params - definition of performance parameters - * @max_per_pipe_ib: maximum instantaneous bandwidth request * @bw_ctl: arbitrated bandwidth request * @core_clk_rate: core clock rate request */ struct dpu_core_perf_params { - u32 max_per_pipe_ib; u64 bw_ctl; u64 core_clk_rate; }; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index ac3c6c5ad1cec3856f0eff2ed71153d3c2dc279e..cc240d3c7faa89254a575237634d0d0fa8f04f73 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1488,8 +1488,6 @@ static int dpu_crtc_debugfs_state_show(struct seq_file *s, void *v) dpu_crtc->cur_perf.core_clk_rate); seq_printf(s, "bw_ctl: %uk\n", (u32)DIV_ROUND_UP_ULL(dpu_crtc->cur_perf.bw_ctl, 1000)); - seq_printf(s, "max_per_pipe_ib: %u\n", - dpu_crtc->cur_perf.max_per_pipe_ib); return 0; }