drm/msm: convert kms->complete_commit() to crtc_mask
authorRob Clark <robdclark@chromium.org>
Thu, 29 Aug 2019 16:45:13 +0000 (09:45 -0700)
committerRob Clark <robdclark@chromium.org>
Tue, 3 Sep 2019 23:17:01 +0000 (16:17 -0700)
Prep work for async commits, in which case this will be called after we
no longer have the atomic state object.

This drops some wait_for_vblanks(), but those should be unnecessary, as
we call this after waiting for flush to complete.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Sean Paul <sean@poorly.run>
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
drivers/gpu/drm/msm/msm_atomic.c
drivers/gpu/drm/msm/msm_kms.h

index 4b777492b729d3208f78ce2b77a5f949b8c995d0..55f7fa2000af231ac8cbec963d82ab27576f1ac4 100644 (file)
@@ -391,13 +391,8 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event)
        kthread_queue_work(&priv->event_thread[crtc_id].worker, &fevent->work);
 }
 
-void dpu_crtc_complete_commit(struct drm_crtc *crtc,
-               struct drm_crtc_state *old_state)
+void dpu_crtc_complete_commit(struct drm_crtc *crtc)
 {
-       if (!crtc || !crtc->state) {
-               DPU_ERROR("invalid crtc\n");
-               return;
-       }
        trace_dpu_crtc_complete_commit(DRMID(crtc));
 }
 
index 10f78459f6c206fdc0071730fb7eebb1b64fe869..5174e86124cc4df70c343c8d2de763f6a9f422c1 100644 (file)
@@ -244,10 +244,8 @@ void dpu_crtc_commit_kickoff(struct drm_crtc *crtc);
 /**
  * dpu_crtc_complete_commit - callback signalling completion of current commit
  * @crtc: Pointer to drm crtc object
- * @old_state: Pointer to drm crtc old state object
  */
-void dpu_crtc_complete_commit(struct drm_crtc *crtc,
-               struct drm_crtc_state *old_state);
+void dpu_crtc_complete_commit(struct drm_crtc *crtc);
 
 /**
  * dpu_crtc_init - create a new crtc object
index 49c9c8cf2991fe633033e9a306e8a25e28e55a61..23566b1aac87106d6efbcfddec35117f045945d7 100644 (file)
@@ -322,27 +322,15 @@ static void dpu_kms_commit(struct msm_kms *kms, struct drm_atomic_state *state)
        }
 }
 
-static void dpu_kms_complete_commit(struct msm_kms *kms,
-               struct drm_atomic_state *old_state)
+static void dpu_kms_complete_commit(struct msm_kms *kms, unsigned crtc_mask)
 {
-       struct dpu_kms *dpu_kms;
-       struct msm_drm_private *priv;
+       struct dpu_kms *dpu_kms = to_dpu_kms(kms);
        struct drm_crtc *crtc;
-       struct drm_crtc_state *old_crtc_state;
-       int i;
-
-       if (!kms || !old_state)
-               return;
-       dpu_kms = to_dpu_kms(kms);
-
-       if (!dpu_kms->dev || !dpu_kms->dev->dev_private)
-               return;
-       priv = dpu_kms->dev->dev_private;
 
        DPU_ATRACE_BEGIN("kms_complete_commit");
 
-       for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i)
-               dpu_crtc_complete_commit(crtc, old_crtc_state);
+       for_each_crtc_mask(dpu_kms->dev, crtc, crtc_mask)
+               dpu_crtc_complete_commit(crtc);
 
        pm_runtime_put_sync(&dpu_kms->pdev->dev);
 
index 83e49fdf0816384f6219d0d409c833bafa8e9ee9..8c6622fb373b124c92af8fc094aa0294265cd3b4 100644 (file)
@@ -119,17 +119,13 @@ static void mdp4_wait_flush(struct msm_kms *kms, unsigned crtc_mask)
                mdp4_crtc_wait_for_commit_done(crtc);
 }
 
-static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *state)
+static void mdp4_complete_commit(struct msm_kms *kms, unsigned crtc_mask)
 {
        struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
-       int i;
        struct drm_crtc *crtc;
-       struct drm_crtc_state *crtc_state;
-
-       drm_atomic_helper_wait_for_vblanks(mdp4_kms->dev, state);
 
        /* see 119ecb7fd */
-       for_each_new_crtc_in_state(state, crtc, crtc_state, i)
+       for_each_crtc_mask(mdp4_kms->dev, crtc, crtc_mask)
                drm_crtc_vblank_put(crtc);
 
        mdp4_disable(mdp4_kms);
index eec220f2244579fcd87a3a628f3a6469c16f6577..7be28f14f93b1239ec6f3eccfdd04fb208a96194 100644 (file)
@@ -169,14 +169,12 @@ static void mdp5_wait_flush(struct msm_kms *kms, unsigned crtc_mask)
                mdp5_crtc_wait_for_commit_done(crtc);
 }
 
-static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *state)
+static void mdp5_complete_commit(struct msm_kms *kms, unsigned crtc_mask)
 {
        struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
        struct device *dev = &mdp5_kms->pdev->dev;
        struct mdp5_global_state *global_state;
 
-       drm_atomic_helper_wait_for_vblanks(mdp5_kms->dev, state);
-
        global_state = mdp5_get_existing_global_state(mdp5_kms);
 
        if (mdp5_kms->smp)
index 4c349c9d98a8b7a32dbb23496d0f90cf082a3fc3..1717f430bfb498d2fe16c4616fa4bcff7222a78e 100644 (file)
@@ -63,7 +63,7 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
        }
 
        kms->funcs->wait_flush(kms, crtc_mask);
-       kms->funcs->complete_commit(kms, state);
+       kms->funcs->complete_commit(kms, crtc_mask);
 
        drm_atomic_helper_commit_hw_done(state);
 
index a112dfb36301bc03d9ef2b73e15d1ffa3af79cd0..10dd171b43f87dc1514c4fad6f910485bd764dee 100644 (file)
@@ -33,7 +33,7 @@ struct msm_kms_funcs {
        /* modeset, bracketing atomic_commit(): */
        void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
        void (*commit)(struct msm_kms *kms, struct drm_atomic_state *state);
-       void (*complete_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
+       void (*complete_commit)(struct msm_kms *kms, unsigned crtc_mask);
        void (*wait_flush)(struct msm_kms *kms, unsigned crtc_mask);
 
        /* get msm_format w/ optional format modifiers from drm_mode_fb_cmd2 */