linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeykumar Sankaran <jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
Cc: Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH v2 19/24] drm/msm: dpu: Remove vblank_callback from encoder
Date: Mon, 19 Nov 2018 12:11:11 -0800	[thread overview]
Message-ID: <49433c0b23f20ad585631f65f2eefde9@codeaurora.org> (raw)
In-Reply-To: <20181116184238.170034-20-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>

On 2018-11-16 10:42, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> The indirection of registering a callback and opaque pointer isn't 
> reall
> useful when there's only one callsite. So instead of having the
> vblank_cb registration, just give encoder a crtc and let it directly
> call the vblank handler.
> 
> In a later patch, we'll make use of this further.
> 
> Changes in v2:
> - None
> 
> Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>

> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c    |  8 +++----
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h    |  6 +++++
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 25 +++++++++++----------
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 10 ++++-----
>  4 files changed, 26 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 141ed1b0e90a..4d7f9ff1e9f4 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -293,9 +293,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct
> drm_crtc *crtc)
>  	return INTF_MODE_NONE;
>  }
> 
> -static void dpu_crtc_vblank_cb(void *data)
> +void dpu_crtc_vblank_callback(struct drm_crtc *crtc)
>  {
> -	struct drm_crtc *crtc = (struct drm_crtc *)data;
>  	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
> 
>  	/* keep statistics on vblank callback - with auto reset via
> debugfs */
> @@ -771,8 +770,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
>  						     DRMID(enc), enable,
>  						     dpu_crtc);
> 
> -			dpu_encoder_register_vblank_callback(enc,
> -					dpu_crtc_vblank_cb, (void *)crtc);
> +			dpu_encoder_assign_crtc(enc, crtc);
>  		}
>  	} else {
>  		list_for_each_entry(enc, &dev->mode_config.encoder_list,
> head) {
> @@ -783,7 +781,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
>  						     DRMID(enc), enable,
>  						     dpu_crtc);
> 
> -			dpu_encoder_register_vblank_callback(enc, NULL,
> NULL);
> +			dpu_encoder_assign_crtc(enc, NULL);
>  		}
>  	}
>  }
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> index 93d21a61a040..54595cc29be5 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> @@ -270,6 +270,12 @@ static inline int dpu_crtc_frame_pending(struct
> drm_crtc *crtc)
>   */
>  int dpu_crtc_vblank(struct drm_crtc *crtc, bool en);
> 
> +/**
> + * dpu_crtc_vblank_callback - called on vblank irq, issues completion
> events
> + * @crtc: Pointer to drm crtc object
> + */
> +void dpu_crtc_vblank_callback(struct drm_crtc *crtc);
> +
>  /**
>   * dpu_crtc_commit_kickoff - trigger kickoff of the commit for this 
> crtc
>   * @crtc: Pointer to drm crtc object
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index d89ac520f7e6..fd6514f681ae 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -142,9 +142,11 @@ enum dpu_enc_rc_states {
>   * @intfs_swapped	Whether or not the phys_enc interfaces have been
> swapped
>   *			for partial update right-only cases, such as
> pingpong
>   *			split where virtual pingpong does not generate
> IRQs
> - * @crtc_vblank_cb:	Callback into the upper layer / CRTC for
> - *			notification of the VBLANK
> - * @crtc_vblank_cb_data:	Data from upper layer for VBLANK
> notification
> + * @crtc:		Pointer to the currently assigned crtc. Normally
> you
> + *			would use crtc->state->encoder_mask to determine
> the
> + *			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.
>   * @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
> @@ -186,8 +188,7 @@ struct dpu_encoder_virt {
> 
>  	bool intfs_swapped;
> 
> -	void (*crtc_vblank_cb)(void *);
> -	void *crtc_vblank_cb_data;
> +	struct drm_crtc *crtc;
> 
>  	struct dentry *debugfs_root;
>  	struct mutex enc_lock;
> @@ -1241,8 +1242,8 @@ static void dpu_encoder_vblank_callback(struct
> drm_encoder *drm_enc,
>  	dpu_enc = to_dpu_encoder_virt(drm_enc);
> 
>  	spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags);
> -	if (dpu_enc->crtc_vblank_cb)
> -		dpu_enc->crtc_vblank_cb(dpu_enc->crtc_vblank_cb_data);
> +	if (dpu_enc->crtc)
> +		dpu_crtc_vblank_callback(dpu_enc->crtc);
>  	spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags);
> 
>  	atomic_inc(&phy_enc->vsync_cnt);
> @@ -1262,15 +1263,14 @@ static void 
> dpu_encoder_underrun_callback(struct
> drm_encoder *drm_enc,
>  	DPU_ATRACE_END("encoder_underrun_callback");
>  }
> 
> -void dpu_encoder_register_vblank_callback(struct drm_encoder *drm_enc,
> -		void (*vbl_cb)(void *), void *vbl_data)
> +void dpu_encoder_assign_crtc(struct drm_encoder *drm_enc, struct 
> drm_crtc
> *crtc)
>  {
>  	struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
>  	unsigned long lock_flags;
>  	bool enable;
>  	int i;
> 
> -	enable = vbl_cb ? true : false;
> +	enable = crtc ? true : false;
> 
>  	if (!drm_enc) {
>  		DPU_ERROR("invalid encoder\n");
> @@ -1279,8 +1279,9 @@ void dpu_encoder_register_vblank_callback(struct
> drm_encoder *drm_enc,
>  	trace_dpu_enc_vblank_cb(DRMID(drm_enc), enable);
> 
>  	spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags);
> -	dpu_enc->crtc_vblank_cb = vbl_cb;
> -	dpu_enc->crtc_vblank_cb_data = vbl_data;
> +	/* crtc should always be cleared before re-assigning */
> +	WARN_ON(crtc && dpu_enc->crtc);
> +	dpu_enc->crtc = crtc;
>  	spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags);
> 
>  	for (i = 0; i < dpu_enc->num_phys_encs; i++) {
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> index aa4f135218fa..be1d80867834 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> @@ -55,14 +55,12 @@ void dpu_encoder_get_hw_resources(struct 
> drm_encoder
> *encoder,
>  				  struct dpu_encoder_hw_resources
> *hw_res);
> 
>  /**
> - * dpu_encoder_register_vblank_callback - provide callback to encoder
> that
> - *	will be called on the next vblank.
> + * dpu_encoder_assign_crtc - Link the encoder to the crtc it's 
> assigned
> to
>   * @encoder:	encoder pointer
> - * @cb:		callback pointer, provide NULL to deregister and
> disable IRQs
> - * @data:	user data provided to callback
> + * @crtc:	crtc pointer
>   */
> -void dpu_encoder_register_vblank_callback(struct drm_encoder *encoder,
> -		void (*cb)(void *), void *data);
> +void dpu_encoder_assign_crtc(struct drm_encoder *encoder,
> +			     struct drm_crtc *crtc);
> 
>  /**
>   * dpu_encoder_register_frame_event_callback - provide callback to
> encoder that

-- 
Jeykumar S
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

  parent reply	other threads:[~2018-11-19 20:11 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16 18:42 [PATCH v2 00/24] drm/msm: Various dpu locking and legacy cleanups Sean Paul
2018-11-16 18:42 ` [PATCH v2 01/24] drm/msm: dpu: Remove dpu_power_handle_get_dbus_name() Sean Paul
2018-11-16 18:42 ` [PATCH v2 03/24] drm/msm: dpu: Remove dpu_power_client Sean Paul
2018-11-16 18:42 ` [PATCH v2 04/24] drm/msm: dpu: Don't use power_event for vbif_init_memtypes Sean Paul
     [not found]   ` <20181116184238.170034-5-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-12-03 19:49     ` Jeykumar Sankaran
2018-11-16 18:42 ` [PATCH v2 09/24] drm/msm: dpu: Remove dpu_power_handle Sean Paul
2018-11-16 18:42 ` [PATCH v2 11/24] drm/msm: dpu: Add ->enabled to dpu_encoder_virt Sean Paul
2018-12-03 19:51   ` Jeykumar Sankaran
     [not found] ` <20181116184238.170034-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-16 18:42   ` [PATCH v2 02/24] drm/msm: dpu: Remove unused trace_dpu_perf_update_bus() Sean Paul
2018-11-16 18:42   ` [PATCH v2 05/24] drm/msm: dpu: Handle crtc pm_runtime_resume() directly Sean Paul
     [not found]     ` <20181116184238.170034-6-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 19:41       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 06/24] drm/msm: dpu: Remove power_handle from core_perf Sean Paul
2018-11-16 18:42   ` [PATCH v2 07/24] drm/msm: dpu: Include dpu_io_util.h directly in dpu_kms.h Sean Paul
2018-11-16 18:42   ` [PATCH v2 08/24] drm/msm: dpu: Move DPU_POWER_HANDLE_DBUS_ID to core_perf Sean Paul
2018-11-16 18:42   ` [PATCH v2 10/24] drm/msm: dpu: Fix typo in dpu_encoder Sean Paul
2018-11-16 18:42   ` [PATCH v2 12/24] drm/msm: dpu: Move crtc runtime resume to encoder Sean Paul
     [not found]     ` <20181116184238.170034-13-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-12-03 19:52       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 13/24] drm/msm: dpu: Don't drop locks in crtc_vblank_enable Sean Paul
2018-11-19 19:43     ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 14/24] drm/msm: dpu: Grab the modeset locks in frame_event Sean Paul
2018-11-16 20:02     ` Jeykumar Sankaran
     [not found]       ` <0405e429330ba1de19d96a6918a6daae-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-16 21:18         ` Sean Paul
     [not found]     ` <20181116184238.170034-15-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-30 22:00       ` [PATCH v3 " Sean Paul
2018-12-03 19:53         ` Jeykumar Sankaran
     [not found]         ` <20181130220011.39644-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-12-03 21:45           ` Daniel Vetter
2018-11-16 18:42   ` [PATCH v2 15/24] drm/msm: dpu: Stop using encoder->crtc pointer Sean Paul
     [not found]     ` <20181116184238.170034-16-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-16 20:05       ` Jeykumar Sankaran
     [not found]         ` <580ced340265a3c45b31836291bfbb4c-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-16 21:14           ` Sean Paul
2018-11-19 20:03             ` Jeykumar Sankaran
2018-11-26 21:53               ` Sean Paul
2018-12-03 19:43                 ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 16/24] drm/msm: dpu: Add modeset lock checks where applicable Sean Paul
2018-11-16 20:05     ` Jeykumar Sankaran
2019-10-09 22:20     ` Daniel Vetter
2019-10-10 13:13       ` Sean Paul
2018-11-16 18:42   ` [PATCH v2 17/24] drm/msm: dpu: Move pm_runtime_(get|put) from vblank_enable Sean Paul
2018-11-19 20:09     ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 18/24] drm/msm: dpu: Remove crtc_lock from setup_mixers Sean Paul
     [not found]     ` <20181116184238.170034-19-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:09       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 20/24] drm/msm: dpu: Use atomic_disable for dpu_crtc_disable Sean Paul
     [not found]     ` <20181116184238.170034-21-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:12       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 21/24] drm/msm: dpu: Don't bother checking ->enabled in dpu_crtc_vblank Sean Paul
     [not found]     ` <20181116184238.170034-22-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:13       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 23/24] drm/msm: dpu: Remove vblank_requested flag from dpu_crtc Sean Paul
     [not found]     ` <20181116184238.170034-24-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:14       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 24/24] drm/msm: dpu: Remove crtc_lock Sean Paul
     [not found]     ` <20181116184238.170034-25-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:14       ` Jeykumar Sankaran
2018-11-16 18:42 ` [PATCH v2 19/24] drm/msm: dpu: Remove vblank_callback from encoder Sean Paul
     [not found]   ` <20181116184238.170034-20-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:11     ` Jeykumar Sankaran [this message]
2018-11-16 18:42 ` [PATCH v2 22/24] drm/msm: dpu: Separate crtc assignment from vblank enable Sean Paul
     [not found]   ` <20181116184238.170034-23-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:13     ` Jeykumar Sankaran
2018-12-04 15:15 ` [PATCH v2 00/24] drm/msm: Various dpu locking and legacy cleanups Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49433c0b23f20ad585631f65f2eefde9@codeaurora.org \
    --to=jsanka-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).