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 6/7] drm/msm/dpu: call dpu_rm_get_intf() from dpu_encoder_get_intf()
Date: Mon,  1 May 2023 02:57:31 +0300	[thread overview]
Message-ID: <20230430235732.3341119-7-dmitry.baryshkov@linaro.org> (raw)
In-Reply-To: <20230430235732.3341119-1-dmitry.baryshkov@linaro.org>

There is little sense to get intf index just to call dpu_rm_get_intf()
on it. Move dpu_rm_get_intf() call to dpu_encoder_get_intf() function.

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

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 507ff3f88c67..b35e92c658ad 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -1259,22 +1259,23 @@ static void dpu_encoder_virt_atomic_disable(struct drm_encoder *drm_enc,
 	mutex_unlock(&dpu_enc->enc_lock);
 }
 
-static enum dpu_intf dpu_encoder_get_intf(const struct dpu_mdss_cfg *catalog,
+static struct dpu_hw_intf *dpu_encoder_get_intf(const struct dpu_mdss_cfg *catalog,
+		struct dpu_rm *dpu_rm,
 		enum dpu_intf_type type, u32 controller_id)
 {
 	int i = 0;
 
 	if (type == INTF_WB)
-		return INTF_MAX;
+		return NULL;
 
 	for (i = 0; i < catalog->intf_count; i++) {
 		if (catalog->intf[i].type == type
 		    && catalog->intf[i].controller_id == controller_id) {
-			return catalog->intf[i].id;
+			return dpu_rm_get_intf(dpu_rm, catalog->intf[i].id);
 		}
 	}
 
-	return INTF_MAX;
+	return NULL;
 }
 
 void dpu_encoder_vblank_callback(struct drm_encoder *drm_enc,
@@ -2244,7 +2245,6 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 		 * h_tile_instance_ids[2] = {1, 0}; DSI1 = left, DSI0 = right
 		 */
 		u32 controller_id = disp_info->h_tile_instance[i];
-		enum dpu_intf intf_idx;
 
 		if (disp_info->num_of_h_tiles > 1) {
 			if (i == 0)
@@ -2258,12 +2258,9 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 		DPU_DEBUG("h_tile_instance %d = %d, split_role %d\n",
 				i, controller_id, phys_params.split_role);
 
-		intf_idx = dpu_encoder_get_intf(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);
+		phys_params.hw_intf = dpu_encoder_get_intf(dpu_kms->catalog, &dpu_kms->rm,
+							   disp_info->intf_type,
+							   controller_id);
 
 		if (disp_info->intf_type == INTF_WB && controller_id < WB_MAX)
 			phys_params.hw_wb = dpu_rm_get_wb(&dpu_kms->rm, controller_id);
@@ -2287,7 +2284,6 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 			DPU_ERROR_ENC(dpu_enc, "failed to add phys encs\n");
 			break;
 		}
-
 	}
 
 	mutex_unlock(&dpu_enc->enc_lock);
-- 
2.39.2


  parent reply	other threads:[~2023-04-30 23:59 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 ` [PATCH 5/7] drm/msm/dpu: inline dpu_encoder_get_wb() Dmitry Baryshkov
2023-05-02 23:51   ` 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 ` Dmitry Baryshkov [this message]
2023-05-02 23:57   ` [PATCH 6/7] drm/msm/dpu: call dpu_rm_get_intf() from dpu_encoder_get_intf() 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-7-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