From patchwork Fri Jul 7 19:39:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 700118 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAB40EB64DA for ; Fri, 7 Jul 2023 19:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233087AbjGGTme (ORCPT ); Fri, 7 Jul 2023 15:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233056AbjGGTlR (ORCPT ); Fri, 7 Jul 2023 15:41:17 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE3CF2D55 for ; Fri, 7 Jul 2023 12:39:46 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4fba1288bbdso3375378e87.1 for ; Fri, 07 Jul 2023 12:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688758785; x=1691350785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NjoI3Dx1Y7JEO/QjjX2Gq34JkRG4tKXD0+CPY31Fy3E=; b=TotxLp9WEbEa1H0ui4tZtY7EzhGfQ3fBWZC5iUtDBnbwg0MTlgsGk1A3H9rzvZQh0x VurNoqfvegRbAAw+d1xNGyniWPDdLER8VAVoUOBdSuGV/BIyDEJEwfSci02GHpCfaeLl ILhnVBkMtfvfQuld9mw9cgMzSNJVwvlIulPYELfS3fmefr3zPOeTDURxyw4Fz9hrLR6X QdmuNbI0yE3gnlNoy68rWkgkAgdMj0RQdZtX9Zb8OpruTWxkabvv97Sn+6EB9IiTu3CA 2Dmm8G3QJubAyrP7MOptZafM1OU7SeSI27Cgd2MFFSW+P3ryciIDpqa5CKqhqQ2WoFZD D5TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688758785; x=1691350785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NjoI3Dx1Y7JEO/QjjX2Gq34JkRG4tKXD0+CPY31Fy3E=; b=jUWd6r74RrUjqgxloz9oYCniwJ629NpDIN0R4fgYxYEWRpq/Vddo9MzYdfAqd5Vxr+ 4qmQqOIsZZKK65V2nf6m2O/GE1txghXbWegIvFylmeQG+BwsZMjwMB0wyQqSkaQx7+yM RQ+CRPKrkHq7Em5VnTI796gtYq/em4ZD/K6lipQV3RKx1ent5nHk3R4g4MwcRHLctkn3 zgzLR/HEB0/dOFSjdyllVb5dSw2unXfGTPiZYK8vNeh5LqDLH4+eCv+vymdjsh0KbrYt 7IlzWBQ/7nv+y/eXGAQiQXWpqZAbs7ys7gpdOYJYEJ0CG9L/f+3Rzq3EDMRxA8bU1OTM B1Ng== X-Gm-Message-State: ABy/qLZZvrjVFJYqd/1UFgIDtn8KYZy1U+HUmnOgHW3BrKxmwSG+nNrT kpTSW0+izdO7dGoLo/d37BVPxA== X-Google-Smtp-Source: APBJJlFdYPw4GxOROVzMAnYhE6vEelZplJXJjnXlGWENi3d9i5ezSHyTJHzQS0wP8tC7Ahq3f0VVZA== X-Received: by 2002:a05:6512:36c5:b0:4fb:8f79:631 with SMTP id e5-20020a05651236c500b004fb8f790631mr4796453lfs.46.1688758784667; Fri, 07 Jul 2023 12:39:44 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id q16-20020a19a410000000b004fba759bf44sm778995lfc.277.2023.07.07.12.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 12:39:44 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v3 02/11] drm/msm/dpu: core_perf: extract bandwidth aggregation function Date: Fri, 7 Jul 2023 22:39:33 +0300 Message-Id: <20230707193942.3806526-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230707193942.3806526-1-dmitry.baryshkov@linaro.org> References: <20230707193942.3806526-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation to refactoring the dpu_core_perf debugfs interface, extract the bandwidth aggregation function from _dpu_core_perf_crtc_update_bus(). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 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 1d9d83d7b99e..333dcfe57800 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -206,33 +206,38 @@ 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; + 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; + + dpu_core_perf_aggregate(crtc->dev, dpu_crtc_get_client_type(crtc), &perf); if (!kms->num_paths) return 0;