[Freedreno] [PATCH 7/7] drm/msm/dpu: pull connector from dpu_encoder_phys to dpu_encoder_virt

Abhinav Kumar quic_abhinavk at quicinc.com
Sat Feb 12 01:01:57 UTC 2022



On 2/3/2022 12:26 AM, Dmitry Baryshkov wrote:
> 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.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk at quicinc.com>
> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c      | 11 ++++++-----
>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |  2 --
>   2 files changed, 6 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 1462c426c14c..afafdaf48aea 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -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;
> @@ -993,6 +995,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++) {
>   		int num_blk;
>   		struct dpu_hw_blk *hw_blk[MAX_CHANNELS_PER_ENC];
> @@ -1030,7 +1034,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);
> @@ -1064,7 +1067,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc)
>   
>   	if (dpu_enc->disp_info.intf_type == INTF_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;
> @@ -1168,9 +1171,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");
>   
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
> index 6e80321b13c5..5093810f6663 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
> @@ -174,7 +174,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
> @@ -203,7 +202,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;


More information about the Freedreno mailing list