Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Marijn Suijten <marijn.suijten@somainline.org>
Cc: Stephen Boyd <swboyd@chromium.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Bjorn Andersson <andersson@kernel.org>,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org
Subject: [PATCH 5/7] drm/msm/dpu: inline dpu_encoder_get_wb()
Date: Mon,  1 May 2023 02:57:30 +0300	[thread overview]
Message-ID: <20230430235732.3341119-6-dmitry.baryshkov@linaro.org> (raw)
In-Reply-To: <20230430235732.3341119-1-dmitry.baryshkov@linaro.org>

The function dpu_encoder_get_wb() returns controller_id if the
corresponding WB is present in the catalog. We can inline this function
and rely on dpu_rm_get_wb() returning NULL for indices for which the
WB is not present on the device.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 24 ++-------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 4c85cbb030e4..507ff3f88c67 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -1277,22 +1277,6 @@ static enum dpu_intf dpu_encoder_get_intf(const struct dpu_mdss_cfg *catalog,
 	return INTF_MAX;
 }
 
-static enum dpu_wb dpu_encoder_get_wb(const struct dpu_mdss_cfg *catalog,
-		enum dpu_intf_type type, u32 controller_id)
-{
-	int i = 0;
-
-	if (type != INTF_WB)
-		return WB_MAX;
-
-	for (i = 0; i < catalog->wb_count; i++) {
-		if (catalog->wb[i].id == controller_id)
-			return catalog->wb[i].id;
-	}
-
-	return WB_MAX;
-}
-
 void dpu_encoder_vblank_callback(struct drm_encoder *drm_enc,
 		struct dpu_encoder_phys *phy_enc)
 {
@@ -2261,7 +2245,6 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 		 */
 		u32 controller_id = disp_info->h_tile_instance[i];
 		enum dpu_intf intf_idx;
-		enum dpu_wb wb_idx;
 
 		if (disp_info->num_of_h_tiles > 1) {
 			if (i == 0)
@@ -2279,14 +2262,11 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 							    disp_info->intf_type,
 							    controller_id);
 
-		wb_idx = dpu_encoder_get_wb(dpu_kms->catalog,
-				disp_info->intf_type, controller_id);
-
 		if (intf_idx >= INTF_0 && intf_idx < INTF_MAX)
 			phys_params.hw_intf = dpu_rm_get_intf(&dpu_kms->rm, intf_idx);
 
-		if (wb_idx >= WB_0 && wb_idx < WB_MAX)
-			phys_params.hw_wb = dpu_rm_get_wb(&dpu_kms->rm, wb_idx);
+		if (disp_info->intf_type == INTF_WB && controller_id < WB_MAX)
+			phys_params.hw_wb = dpu_rm_get_wb(&dpu_kms->rm, controller_id);
 
 		if (!phys_params.hw_intf && !phys_params.hw_wb) {
 			DPU_ERROR_ENC(dpu_enc, "no intf or wb block assigned at idx: %d\n", i);
-- 
2.39.2


  parent reply	other threads:[~2023-05-01  0:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-30 23:57 [PATCH 0/7] drm/msm/dpu: simplify DPU encoder init Dmitry Baryshkov
2023-04-30 23:57 ` [PATCH 1/7] drm/msm/dpu: merge dpu_encoder_init() and dpu_encoder_setup() Dmitry Baryshkov
2023-05-01 19:58   ` Abhinav Kumar
2023-05-01 20:45     ` Dmitry Baryshkov
2023-05-01 21:22       ` Abhinav Kumar
2023-05-01 21:27         ` Dmitry Baryshkov
2023-05-02 20:27           ` Abhinav Kumar
2023-04-30 23:57 ` [PATCH 2/7] drm/msm/dpu: drop dpu_encoder_early_unregister Dmitry Baryshkov
2023-05-02 20:45   ` Abhinav Kumar
2023-05-02 20:54     ` Dmitry Baryshkov
2023-05-02 20:59       ` Abhinav Kumar
2023-05-02 21:04         ` Dmitry Baryshkov
2023-04-30 23:57 ` [PATCH 3/7] drm/msm/dpu: separate common function to init physical encoder Dmitry Baryshkov
2023-05-02 21:33   ` Abhinav Kumar
2023-05-02 21:36     ` Dmitry Baryshkov
2023-04-30 23:57 ` [PATCH 4/7] drm/msm/dpu: drop duplicated intf/wb indices from encoder structs Dmitry Baryshkov
2023-05-02 23:04   ` Abhinav Kumar
2023-05-02 23:15     ` Dmitry Baryshkov
2023-05-02 23:19       ` Abhinav Kumar
2023-05-02 23:53         ` Dmitry Baryshkov
2023-04-30 23:57 ` Dmitry Baryshkov [this message]
2023-05-02 23:51   ` [PATCH 5/7] drm/msm/dpu: inline dpu_encoder_get_wb() Abhinav Kumar
2023-05-02 23:54     ` Dmitry Baryshkov
2023-05-02 23:58       ` Abhinav Kumar
2023-05-02 23:59         ` Dmitry Baryshkov
2023-04-30 23:57 ` [PATCH 6/7] drm/msm/dpu: call dpu_rm_get_intf() from dpu_encoder_get_intf() Dmitry Baryshkov
2023-05-02 23:57   ` Abhinav Kumar
2023-05-02 23:58     ` Dmitry Baryshkov
2023-05-03  0:04       ` [Freedreno] " Abhinav Kumar
2023-04-30 23:57 ` [PATCH 7/7] drm/msm/dpu: drop dpu_encoder_phys_ops.atomic_mode_set Dmitry Baryshkov
2023-05-03  0:01   ` Dmitry Baryshkov
2023-05-03 22:42 ` [PATCH 0/7] drm/msm/dpu: simplify DPU encoder init Abhinav Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230430235732.3341119-6-dmitry.baryshkov@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=airlied@gmail.com \
    --cc=andersson@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox