public inbox for linux-arm-msm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
To: Bruce Wang <bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 3/4] drm/msm/dpu: Remove suspend state tracking from crtc
Date: Fri, 5 Oct 2018 14:04:17 -0400	[thread overview]
Message-ID: <20181005180417.GN72545@art_vandelay> (raw)
In-Reply-To: <20181005154843.172326-4-bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

On Fri, Oct 05, 2018 at 11:48:42AM -0400, Bruce Wang wrote:
> dpu_crtc_enable/disable/reset are only being called upon
> initialization/destruction of the device and as part of the PM
> suspend/resume handling.

*and dpms/enable on/off


> Since core suspend and resume calls
> are guarenteed to not overlap with one another we don't need to

*guaranteed

It also might be more clear to just state "Since drm core's modeset locks
serialize atomic commits we don't need to..."


> track whether or not we're in a suspended state from inside the crtc.
> This patch removes the suspend logic from the crtc, and removes the relevant
> tracing from dpu_trace.
> 
> Signed-off-by: Bruce Wang <bzwang@chromium.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  | 61 ++---------------------
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h  |  2 -
>  drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 15 +-----
>  3 files changed, 7 insertions(+), 71 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index d4530d60767b..31e372554e0c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -815,35 +815,6 @@ static void _dpu_crtc_vblank_enable_no_lock(
>  	}
>  }
>  
> -/**
> - * _dpu_crtc_set_suspend - notify crtc of suspend enable/disable
> - * @crtc: Pointer to drm crtc object
> - * @enable: true to enable suspend, false to indicate resume
> - */
> -static void _dpu_crtc_set_suspend(struct drm_crtc *crtc, bool enable)
> -{
> -	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
> -
> -	DRM_DEBUG_KMS("crtc%d suspend = %d\n", crtc->base.id, enable);
> -
> -	mutex_lock(&dpu_crtc->crtc_lock);
> -
> -	/*
> -	 * If the vblank is enabled, release a power reference on suspend
> -	 * and take it back during resume (if it is still enabled).
> -	 */
> -	trace_dpu_crtc_set_suspend(DRMID(&dpu_crtc->base), enable, dpu_crtc);
> -	if (dpu_crtc->suspend == enable)
> -		DPU_DEBUG("crtc%d suspend already set to %d, ignoring update\n",
> -				crtc->base.id, enable);
> -	else if (dpu_crtc->enabled && dpu_crtc->vblank_requested) {
> -		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, !enable);
> -	}
> -
> -	dpu_crtc->suspend = enable;
> -	mutex_unlock(&dpu_crtc->crtc_lock);
> -}
> -
>  /**
>   * dpu_crtc_duplicate_state - state duplicate hook
>   * @crtc: Pointer to drm crtc structure
> @@ -881,25 +852,14 @@ static struct drm_crtc_state *dpu_crtc_duplicate_state(struct drm_crtc *crtc)
>   */
>  static void dpu_crtc_reset(struct drm_crtc *crtc)
>  {

Can you add a patch to the series to delete this function entirely and use
drm_atomic_helper_crtc_reset in dpu_crtc_funcs instead?

> -	struct dpu_crtc *dpu_crtc;
>  	struct dpu_crtc_state *cstate;
>  
> -	if (!crtc) {
> -		DPU_ERROR("invalid crtc\n");
> -		return;
> -	}
> -

Since we're going to delete this function entirely, please also rollback the
cleanups in it so the diff is a bit more easy to read.

> -	/* revert suspend actions, if necessary */
> -	if (dpu_kms_is_suspend_state(crtc->dev))
> -		_dpu_crtc_set_suspend(crtc, false);
> -
>  	/* remove previous state, if present */
>  	if (crtc->state) {
>  		dpu_crtc_destroy_state(crtc, crtc->state);
> -		crtc->state = 0;
> +		crtc->state = NULL;
>  	}
>  
> -	dpu_crtc = to_dpu_crtc(crtc);
>  	cstate = kzalloc(sizeof(*cstate), GFP_KERNEL);
>  	if (!cstate) {
>  		DPU_ERROR("failed to allocate state\n");
> @@ -951,9 +911,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
>  
>  	DRM_DEBUG_KMS("crtc%d\n", crtc->base.id);
>  
> -	if (dpu_kms_is_suspend_state(crtc->dev))
> -		_dpu_crtc_set_suspend(crtc, true);
> -
>  	/* Disable/save vblank irq handling */
>  	drm_crtc_vblank_off(crtc);
>  
> @@ -966,8 +923,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
>  				atomic_read(&dpu_crtc->frame_pending));
>  
>  	trace_dpu_crtc_disable(DRMID(crtc), false, dpu_crtc);
> -	if (dpu_crtc->enabled && !dpu_crtc->suspend &&
> -			dpu_crtc->vblank_requested) {
> +	if (dpu_crtc->enabled && dpu_crtc->vblank_requested) {
>  		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, false);
>  	}
>  	dpu_crtc->enabled = false;
> @@ -1033,8 +989,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
>  
>  	mutex_lock(&dpu_crtc->crtc_lock);
>  	trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
> -	if (!dpu_crtc->enabled && !dpu_crtc->suspend &&
> -			dpu_crtc->vblank_requested) {
> +	if (!dpu_crtc->enabled && dpu_crtc->vblank_requested) {
>  		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, true);
>  	}
>  	dpu_crtc->enabled = true;
> @@ -1289,17 +1244,11 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>  
>  int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
>  {
> -	struct dpu_crtc *dpu_crtc;
> -
> -	if (!crtc) {
> -		DPU_ERROR("invalid crtc\n");
> -		return -EINVAL;
> -	}
> -	dpu_crtc = to_dpu_crtc(crtc);
> +	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
>  
>  	mutex_lock(&dpu_crtc->crtc_lock);
>  	trace_dpu_crtc_vblank(DRMID(&dpu_crtc->base), en, dpu_crtc);
> -	if (dpu_crtc->enabled && !dpu_crtc->suspend) {
> +	if (dpu_crtc->enabled) {
>  		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, en);
>  	}
>  	dpu_crtc->vblank_requested = en;
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> index 3723b4830335..7dc181aabb4d 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> @@ -133,7 +133,6 @@ struct dpu_crtc_frame_event {
>   * @play_count    : frame count between crtc enable and disable
>   * @vblank_cb_time  : ktime at vblank count reset
>   * @vblank_requested : whether the user has requested vblank events
> - * @suspend         : whether or not a suspend operation is in progress
>   * @enabled       : whether the DPU CRTC is currently enabled. updated in the
>   *                  commit-thread, not state-swap time which is earlier, so
>   *                  safe to make decisions on during VBLANK on/off work
> @@ -169,7 +168,6 @@ struct dpu_crtc {
>  	u64 play_count;
>  	ktime_t vblank_cb_time;
>  	bool vblank_requested;
> -	bool suspend;
>  	bool enabled;
>  
>  	struct list_head feature_list;
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
> index 636b31b0d311..0c122e173892 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
> @@ -749,7 +749,6 @@ TRACE_EVENT(dpu_crtc_vblank_enable,
>  		__field(	uint32_t,		enc_id	)
>  		__field(	bool,			enable	)
>  		__field(	bool,			enabled )
> -		__field(	bool,			suspend )
>  		__field(	bool,			vblank_requested )
>  	),
>  	TP_fast_assign(
> @@ -757,15 +756,12 @@ TRACE_EVENT(dpu_crtc_vblank_enable,
>  		__entry->enc_id = enc_id;
>  		__entry->enable = enable;
>  		__entry->enabled = crtc->enabled;
> -		__entry->suspend = crtc->suspend;
>  		__entry->vblank_requested = crtc->vblank_requested;
>  	),
> -	TP_printk("id:%u encoder:%u enable:%s state{enabled:%s suspend:%s "
> -		  "vblank_req:%s}",
> +	TP_printk("id:%u encoder:%u enable:%s state{enabled:%s vblank_req:%s}",
>  		  __entry->drm_id, __entry->enc_id,
>  		  __entry->enable ? "true" : "false",
>  		  __entry->enabled ? "true" : "false",
> -		  __entry->suspend ? "true" : "false",
>  		  __entry->vblank_requested ? "true" : "false")
>  );
>  
> @@ -776,26 +772,19 @@ DECLARE_EVENT_CLASS(dpu_crtc_enable_template,
>  		__field(	uint32_t,		drm_id	)
>  		__field(	bool,			enable	)
>  		__field(	bool,			enabled )
> -		__field(	bool,			suspend )
>  		__field(	bool,			vblank_requested )
>  	),
>  	TP_fast_assign(
>  		__entry->drm_id = drm_id;
>  		__entry->enable = enable;
>  		__entry->enabled = crtc->enabled;
> -		__entry->suspend = crtc->suspend;
>  		__entry->vblank_requested = crtc->vblank_requested;
>  	),
> -	TP_printk("id:%u enable:%s state{enabled:%s suspend:%s vblank_req:%s}",
> +	TP_printk("id:%u enable:%s state{enabled:%s vblank_req:%s}",
>  		  __entry->drm_id, __entry->enable ? "true" : "false",
>  		  __entry->enabled ? "true" : "false",
> -		  __entry->suspend ? "true" : "false",
>  		  __entry->vblank_requested ? "true" : "false")
>  );
> -DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_set_suspend,
> -	TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc),
> -	TP_ARGS(drm_id, enable, crtc)
> -);
>  DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_enable,
>  	TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc),
>  	TP_ARGS(drm_id, enable, crtc)
> -- 
> 2.19.0.605.g01d371f741-goog
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

  parent reply	other threads:[~2018-10-05 18:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05 15:48 [PATCH 0/4] drm/msm: Use atomic helpers for PM suspend/resume Bruce Wang
     [not found] ` <20181005154843.172326-1-bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-10-05 15:48   ` [PATCH 1/4] drm/msm/dpu: Remove dpu_kms_pm_suspend/resume Bruce Wang
     [not found]     ` <20181005154843.172326-2-bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-10-05 17:27       ` Sean Paul
2018-10-05 17:35         ` Sean Paul
2018-10-05 15:48   ` [PATCH 2/4] drm/msm: Cut dpu_kms hooks from msm_pm_suspend/resume Bruce Wang
     [not found]     ` <20181005154843.172326-3-bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-10-05 17:34       ` Sean Paul
2018-10-05 15:48   ` [PATCH 3/4] drm/msm/dpu: Remove suspend state tracking from crtc Bruce Wang
     [not found]     ` <20181005154843.172326-4-bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-10-05 18:04       ` Sean Paul [this message]
2018-10-05 15:48   ` [PATCH 4/4] drm/msm/dpu: Remove suspend_state from dpu_kms Bruce Wang
     [not found]     ` <20181005154843.172326-5-bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-10-05 18:05       ` 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=20181005180417.GN72545@art_vandelay \
    --to=sean-p7ytbzm4h96eqtr555yldq@public.gmane.org \
    --cc=abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@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