Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/msm/dp: msm_dp_mst_select_bpp() ignores active link
  payloads
--

commit fe27a53f609d8ebc504e0261bf692547244b1158
Author: Yongxing Mou <[email protected]>

drm/msm/dp: select MST stream bpp during atomic check

This commit selects the MST stream bpp during atomic check by trying 30,
24, and 18 bpp against the port PBN and link time slots, storing the chosen
bpp in a custom connector state subclass for commit.

> diff --git a/drivers/gpu/drm/msm/dp/dp_mst_drm.c 
> b/drivers/gpu/drm/msm/dp/dp_mst_drm.c
> index 2b96e003225d5..a452b3d2ba228 100644
> --- a/drivers/gpu/drm/msm/dp/dp_mst_drm.c
> +++ b/drivers/gpu/drm/msm/dp/dp_mst_drm.c

[ ... ]

> @@ -142,6 +189,42 @@ static int msm_dp_mst_connector_atomic_check(struct 
> drm_connector *connector,
>       return drm_dp_atomic_release_time_slots(state, &mst->mst_mgr, 
> mst_conn->mst_port);
>  }
>  
> +static int msm_dp_mst_select_bpp(struct drm_atomic_commit *state,
> +                              struct msm_dp_mst *mst,
> +                              const struct drm_dp_mst_topology_state 
> *mst_state,
> +                              struct drm_dp_mst_port *port,
> +                              const struct drm_display_mode *mode,
> +                              u32 max_bpp, u32 *bpp)
> +{
> +     static const u32 bpps[] = { 30, 24, 18 };
> +     unsigned int i;
> +
> +     for (i = 0; i < ARRAY_SIZE(bpps); i++) {
> +             int pbn, slots;
> +
> +             if (bpps[i] > max_bpp)
> +                     continue;
> +
> +             pbn = drm_dp_calc_pbn_mode(mode->clock, bpps[i] << 4);
> +             if (pbn > port->full_pbn)
> +                     continue;
> +
> +             slots = drm_dp_atomic_find_time_slots(state, &mst->mst_mgr, 
> port, pbn);
> +             if (slots < 0)
> +                     return slots;
> +
> +             if (slots <= mst_state->total_avail_slots) {
> +                     drm_dbg_kms(mst->msm_dp->drm_dev,
> +                                 "[MST] bpp=%u pbn=%d slots=%d\n",
> +                                 bpps[i], pbn, slots);
> +                     *bpp = bpps[i];
> +                     return 0;
> +             }
> +     }
> +
> +     return -ENOSPC;
> +}

[Severity: Medium]
Does comparing slots against mst_state->total_avail_slots ignore time slots
already consumed by other active streams on the link?

drm_dp_atomic_find_time_slots() returns only the slots required for this
port, while mst_state->total_avail_slots holds the full link capacity (63)
and is never decremented as payloads are added to mst_state->payloads.
When another stream is already active on the link and a new stream fits
within total_avail_slots on its own at 30 or 24 bpp,
msm_dp_mst_select_bpp() accepts that bpp without stepping down to 24 or 18
bpp, and drm_dp_mst_atomic_check() ->
drm_dp_mst_atomic_check_payload_alloc_limits() then rejects the modeset
with -ENOSPC when summing payload->time_slots across mst_state->payloads.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=28

Reply via email to