Re: [PATCH v6 06/14] drm/msm/dpu: Fail atomic_check if multiple outputs request CDM block

From: Dmitry Baryshkov
Date: Sat Feb 15 2025 - 10:26:34 EST


On Fri, Feb 14, 2025 at 04:14:29PM -0800, Jessica Zhang wrote:
> Currently, our hardware only supports a single output using CDM block at
> most. Because of this, we cannot support cases where both writeback and DP
> output request CDM simultaneously
>
> To avoid this happening when CWB is enabled, change
> msm_display_topoloy.needs_cdm into a num_cdm counter to track how many
> outputs are requesting CDM block. Return EINVAL if multiple outputs are
> trying to reserve CDM.
>
> Signed-off-by: Jessica Zhang <quic_jesszhan@xxxxxxxxxxx>
> ---
> Changes in v6:
> - cdm_requested -> num_cdm
>
> Changes in v5:
> - Changed check to fail only if multiple outputs are requesting CDM
> simultaneously
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 ++--
> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 12 +++++++++---
> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 5 +++--
> 3 files changed, 14 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 ad969a5b9434..0e4f27da9534 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -692,10 +692,10 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,
> fb = conn_state->writeback_job->fb;
>
> if (fb && MSM_FORMAT_IS_YUV(msm_framebuffer_format(fb)))
> - topology->needs_cdm = true;
> + topology->num_cdm++;
> } else if (disp_info->intf_type == INTF_DP) {
> if (msm_dp_is_yuv_420_enabled(priv->dp[disp_info->h_tile_instance[0]], adj_mode))
> - topology->needs_cdm = true;
> + topology->num_cdm++;
> }
> }
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> index 0fbb92021b18..4da2e47265d4 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> @@ -585,7 +585,8 @@ static int _dpu_rm_reserve_dsc(struct dpu_rm *rm,
>
> static int _dpu_rm_reserve_cdm(struct dpu_rm *rm,
> struct dpu_global_state *global_state,
> - uint32_t crtc_id)
> + uint32_t crtc_id,
> + int num_cdm)
> {
> /* try allocating only one CDM block */
> if (!rm->cdm_blk) {
> @@ -593,6 +594,11 @@ static int _dpu_rm_reserve_cdm(struct dpu_rm *rm,
> return -EIO;
> }
>
> + if (num_cdm > 1) {
> + DPU_ERROR("More than 1 INTF requesting CDM\n");

I think we should downgrade those to DPU_DEBUG or something like that,
but that can go separately, or when picking the patch up.

Nevertheless:

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>


> + return -EINVAL;
> + }
> +
> if (global_state->cdm_to_crtc_id) {
> DPU_ERROR("CDM_0 is already allocated\n");
> return -EIO;
--
With best wishes
Dmitry