drm/msm/dpu: pull connector from dpu_encoder_phys to dpu_encoder_virt
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Thu, 17 Feb 2022 03:53:58 +0000 (06:53 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 18 Feb 2022 17:15:12 +0000 (20:15 +0300)
All physical encoders used by virtual encoder share the same connector,
so pull the connector field from dpu_encoder_phys into dpu_encoder_virt
structure. Otherwise code suggests that different phys_encs
can have different connectors.

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220217035358.465904-8-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h

index df6b1de3edf7bb76698a6b7acc3f5246b4e0d3ca..3940b9c6323bee57e3acd59651e4d3e9402db680 100644 (file)
@@ -143,6 +143,7 @@ enum dpu_enc_rc_states {
  *                     link between encoder/crtc. However in this case we need
  *                     to track crtc in the disable() hook which is called
  *                     _after_ encoder_mask is cleared.
+ * @connector:         If a mode is set, cached pointer to the active connector
  * @crtc_kickoff_cb:           Callback into CRTC that will flush & start
  *                             all CTL paths
  * @crtc_kickoff_cb_data:      Opaque user data given to crtc_kickoff_cb
@@ -183,6 +184,7 @@ struct dpu_encoder_virt {
        bool intfs_swapped;
 
        struct drm_crtc *crtc;
+       struct drm_connector *connector;
 
        struct dentry *debugfs_root;
        struct mutex enc_lock;
@@ -990,6 +992,8 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc,
 
        cstate->num_mixers = num_lm;
 
+       dpu_enc->connector = conn_state->connector;
+
        for (i = 0; i < dpu_enc->num_phys_encs; i++) {
                struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i];
 
@@ -1017,7 +1021,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc,
                        return;
                }
 
-               phys->connector = conn_state->connector;
                phys->cached_mode = crtc_state->adjusted_mode;
                if (phys->ops.atomic_mode_set)
                        phys->ops.atomic_mode_set(phys, crtc_state, conn_state);
@@ -1051,7 +1054,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc)
 
        if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_DSI &&
                        !WARN_ON(dpu_enc->num_phys_encs == 0)) {
-               unsigned bpc = dpu_enc->phys_encs[0]->connector->display_info.bpc;
+               unsigned bpc = dpu_enc->connector->display_info.bpc;
                for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) {
                        if (!dpu_enc->hw_pp[i])
                                continue;
@@ -1150,9 +1153,7 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
 
        dpu_encoder_resource_control(drm_enc, DPU_ENC_RC_EVENT_STOP);
 
-       for (i = 0; i < dpu_enc->num_phys_encs; i++) {
-               dpu_enc->phys_encs[i]->connector = NULL;
-       }
+       dpu_enc->connector = NULL;
 
        DPU_DEBUG_ENC(dpu_enc, "encoder disabled\n");
 
index 918989bc91b74978bc9a870f9dfff9a373f96a1f..fa8493ac0340a012697e71476414be3e8ec6c78a 100644 (file)
@@ -173,7 +173,6 @@ struct dpu_encoder_irq {
  *     tied to a specific panel / sub-panel. Abstract type, sub-classed by
  *     phys_vid or phys_cmd for video mode or command mode encs respectively.
  * @parent:            Pointer to the containing virtual encoder
- * @connector:         If a mode is set, cached pointer to the active connector
  * @ops:               Operations exposed to the virtual encoder
  * @parent_ops:                Callbacks exposed by the parent to the phys_enc
  * @hw_mdptop:         Hardware interface to the top registers
@@ -202,7 +201,6 @@ struct dpu_encoder_irq {
  */
 struct dpu_encoder_phys {
        struct drm_encoder *parent;
-       struct drm_connector *connector;
        struct dpu_encoder_phys_ops ops;
        const struct dpu_encoder_virt_ops *parent_ops;
        struct dpu_hw_mdp *hw_mdptop;