Fail atomic check if any color feature is requested with no
dspps allocated in the datapath so that composer can offload those
features.

Signed-off-by: Kalyan Thota <quic_kaly...@quicinc.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 4170fbe..de8d799 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1147,6 +1147,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
        int left_zpos_cnt = 0, right_zpos_cnt = 0;
        struct drm_rect crtc_rect = { 0 };
        bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
+       struct dpu_crtc_mixer *mixer = cstate->mixers;
 
        pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL);
 
@@ -1173,6 +1174,16 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
                _dpu_crtc_setup_lm_bounds(crtc, crtc_state);
        }
 
+       if (crtc_state->color_mgmt_changed) {
+               for (i = 0; i < cstate->num_mixers; i++) {
+                       if (!mixer[i].hw_dspp) {
+                               DPU_DEBUG("%s: failed to get dspp for crtc%d 
state\n",
+                                               dpu_crtc->name, crtc->base.id);
+                               return -EINVAL;
+                       }
+               }
+       }
+
        crtc_rect.x2 = mode->hdisplay;
        crtc_rect.y2 = mode->vdisplay;
 
-- 
2.7.4

Reply via email to