From 2139b617bf469971c31a8a86eaabe864d7837465 Mon Sep 17 00:00:00 2001 From: Veera Sundaram Sankaran Date: Wed, 14 Sep 2022 14:07:53 -0700 Subject: [PATCH] disp: msm: sde: fix crtc count based on layer mixer Fix the max crtc count based on the number of real layer mixers available. Usermode can use the crtc count to derive the number of layer mixers. This will be used in usermode to check if a new DP/IWE/WB session can be supported by the HW, based on the existing displays at that point. This will avoid atomic_check validation failures in driver. Change-Id: I63b033604ac549fc01bccef2a9320e0befab5926 Signed-off-by: Veera Sundaram Sankaran --- msm/sde/sde_kms.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index cab71ff257..01e47d9ee1 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -2132,7 +2132,7 @@ static int _sde_kms_drm_obj_init(struct sde_kms *sde_kms) u32 sspp_id[MAX_PLANES]; u32 master_plane_id[MAX_PLANES]; - u32 num_virt_planes = 0; + u32 num_virt_planes = 0, dummy_mixer_count = 0; if (!sde_kms || !sde_kms->dev || !sde_kms->dev->dev) { SDE_ERROR("invalid sde_kms\n"); @@ -2153,7 +2153,11 @@ static int _sde_kms_drm_obj_init(struct sde_kms *sde_kms) if (!_sde_kms_get_displays(sde_kms)) (void)_sde_kms_setup_displays(dev, priv, sde_kms); - max_crtc_count = min(catalog->mixer_count, priv->num_encoders); + for (i = 0; i < catalog->mixer_count; i++) + if (catalog->mixer[i].dummy_mixer) + dummy_mixer_count++; + + max_crtc_count = catalog->mixer_count - dummy_mixer_count; /* Create the planes */ for (i = 0; i < catalog->sspp_count; i++) {