Re: [PATCH v3 36/38] drm/msm/dpu: use msm_dp_get_mst_intf_id() to get the intf id

From: Dmitry Baryshkov

Date: Thu Apr 09 2026 - 10:54:15 EST


On Tue, Apr 07, 2026 at 10:32:22AM +0800, Yongxing Mou wrote:
>
>
> On 8/27/2025 7:42 AM, Dmitry Baryshkov wrote:
> > On Mon, Aug 25, 2025 at 10:16:22PM +0800, Yongxing Mou wrote:
> > > From: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
> > >
> > > Use msm_dp_get_mst_intf_id() to get the interface ID for the DP MST
> > > controller as the intf_id is unique for each MST stream of each
> > > DP controller.
> >
> > I think we have one sensible exception: SC8180X, where we have several
> > DP controllers and one shared DP interface, but let's forget about it
> > for now...
> >
> Sure.
> > >
> > > Signed-off-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
> > > Signed-off-by: Yongxing Mou <yongxing.mou@xxxxxxxxxxxxxxxx>
> > > ---
> > > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 51 +++++++++++++++++++++++++----
> > > 1 file changed, 44 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > > index 05e5f3463e30c9a6bd5b740580720ae2bf6b3246..2eb5397d15732b224372c68d0b2b7167da9f2896 100644
> > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > > @@ -1429,17 +1429,52 @@ static void dpu_encoder_virt_atomic_disable(struct drm_encoder *drm_enc,
> > > 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)
> > > + enum dpu_intf_type type, int enc_type, u32 id)
> > > {
> > > - int i = 0;
> > > + int i = 0, cnt = 0;
> > > + int controller_id = id >> 16;
> > > + int stream_id = id & 0x0F;
> > > if (type == INTF_WB)
> > > return NULL;
> > > - for (i = 0; i < catalog->intf_count; i++) {
> > > - if (catalog->intf[i].type == type
> > > - && catalog->intf[i].controller_id == controller_id) {
> > > - return dpu_rm_get_intf(dpu_rm, catalog->intf[i].id);
> > > + if (enc_type == DRM_MODE_ENCODER_DPMST) {
> > > + /* The intf order in dpu_intf_cfg matches the mapping in the DP HPG.
> > > + * example:
> > > + * DPU_8_4_0 - DP Controller intf to stream Mapping
> > > + *
> > > + * +-------------+----------+----------+----------+----------+
> > > + * | stream_id |    0     |    1     |    2     |    3     |
> > > + * +-------------+----------+----------+----------+----------+
> > > + * | DP0         | INTF_0   | INTF_3   | INTF_6   | INTF_7   |
> > > + * | DP1         | INTF_4   | INTF_8   |          |          |
> > > + * +-------------+----------+----------+----------+----------+
> > > + *
> > > + * DPU_9_2_0 - DP Controller intf to stream Mapping
> > > + *
> > > + * +-------------+----------+----------+
> > > + * | Controller  |    0     |    1     |
> > > + * +-------------+----------+----------+
> > > + * | DP0         | INTF_0   | INTF_3   |
> > > + * | DP1         | INTF_4   | INTF_8   |
> > > + * | DP2         | INTF_6   | INTF_7   |
> > > + * +-------------+----------+----------+
> > > + */

Drop the comment, please.

> > > + DPU_DEBUG("controller_id %d for stream_id = %d\n", controller_id, stream_id);
> > > + for (i = 0; i < catalog->intf_count; i++) {
> > > + if (catalog->intf[i].type == INTF_DP
> > > + && controller_id == catalog->intf[i].controller_id) {
> >
> > && should be on the previous line
> >
> > > + if (cnt == stream_id)
> >
> > if (cnt++ == stream_id) return;
> >
> > > + return dpu_rm_get_intf(dpu_rm, catalog->intf[i].id);
> > > + cnt++;
> > > + }
> > > + }
> >
> > return NULL, drop else{}
> >
> Hi,Got it.. Does this code looks fine?
> ......
> for (i = 0; i < catalog->intf_count; i++) {
> if (catalog->intf[i].type == disp_info->intf_type &&
> controller_id == catalog->intf[i].controller_id)
> if (cnt++ == stream_id)
> return dpu_rm_get_intf(dpu_rm, catalog->intf[i].id);
> }

LGTM.

> ...
> > > + } else {
> > > + for (i = 0; i < catalog->intf_count; i++) {
> > > + if (catalog->intf[i].type == type
> > > + && catalog->intf[i].controller_id == controller_id) {
> > > + return dpu_rm_get_intf(dpu_rm, catalog->intf[i].id);
> > > + }
> > > }
> > > }

--
With best wishes
Dmitry