From: Jeykumar Sankaran <jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Abhinav Kumar <abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 11/12] drm/msm: dpu: Add ->enabled to dpu_encoder_virt
Date: Mon, 12 Nov 2018 17:43:17 -0800 [thread overview]
Message-ID: <848efa69c74b25ee0845e02dc4d19d61@codeaurora.org> (raw)
In-Reply-To: <20181112194222.193546-12-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
On 2018-11-12 11:42, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
>
> Add a bool to dpu_encoder_virt to track whether the encoder is enabled
> or not. Repurpose the enc_lock mutex to ensure that it is consistent
> with the hw state.
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 27 +++++++++++++++++----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 10a0676d1dcf..3daa86220d47 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -132,6 +132,7 @@ enum dpu_enc_rc_states {
> * @base: drm_encoder base class for registration with DRM
> * @enc_spinlock: Virtual-Encoder-Wide Spin Lock for IRQ purposes
> * @bus_scaling_client: Client handle to the bus scaling interface
> + * @enabled: True if the encoder is active, protected by
> enc_lock
> * @num_phys_encs: Actual number of physical encoders contained.
> * @phys_encs: Container of physical encoders managed.
> * @cur_master: Pointer to the current master in this
> mode. Optimization
> @@ -148,8 +149,8 @@ enum dpu_enc_rc_states {
> * all CTL paths
> * @crtc_kickoff_cb_data: Opaque user data given to crtc_kickoff_cb
> * @debugfs_root: Debug file system root file node
> - * @enc_lock: Lock around physical encoder
> create/destroy and
> - access.
> + * @enc_lock: Lock around physical encoder
> + * create/destroy/enable/disable
> * @frame_busy_mask: Bitmask tracking which phys_enc we are
> still
> * busy processing current command.
> * Bit0 = phys_encs[0] etc.
> @@ -175,6 +176,8 @@ struct dpu_encoder_virt {
> spinlock_t enc_spinlock;
> uint32_t bus_scaling_client;
>
> + bool enabled;
> +
> unsigned int num_phys_encs;
> struct dpu_encoder_phys *phys_encs[MAX_PHYS_ENCODERS_PER_VIRTUAL];
> struct dpu_encoder_phys *cur_master;
> @@ -1121,6 +1124,8 @@ static void dpu_encoder_virt_enable(struct
> drm_encoder *drm_enc)
> return;
> }
> dpu_enc = to_dpu_encoder_virt(drm_enc);
> +
> + mutex_lock(&dpu_enc->enc_lock);
> cur_mode = &dpu_enc->base.crtc->state->adjusted_mode;
>
> trace_dpu_enc_enable(DRMID(drm_enc), cur_mode->hdisplay,
> @@ -1137,10 +1142,15 @@ static void dpu_encoder_virt_enable(struct
> drm_encoder *drm_enc)
> if (ret) {
> DPU_ERROR_ENC(dpu_enc, "dpu resource control failed:
> %d\n",
> ret);
> - return;
> + goto out;
> }
>
> _dpu_encoder_virt_enable_helper(drm_enc);
> +
> + dpu_enc->enabled = true;
> +
> +out:
> + mutex_unlock(&dpu_enc->enc_lock);
> }
>
> static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
> @@ -1162,11 +1172,14 @@ static void dpu_encoder_virt_disable(struct
> drm_encoder *drm_enc)
> return;
> }
>
> - mode = &drm_enc->crtc->state->adjusted_mode;
> -
> dpu_enc = to_dpu_encoder_virt(drm_enc);
> DPU_DEBUG_ENC(dpu_enc, "\n");
>
> + mutex_lock(&dpu_enc->enc_lock);
Where do you expect it to go wrong if enable/disable
is not protected using enc_lock?
Thanks and Regards,
Jeykumar S.
> + dpu_enc->enabled = false;
> +
> + mode = &drm_enc->crtc->state->adjusted_mode;
> +
> priv = drm_enc->dev->dev_private;
> dpu_kms = to_dpu_kms(priv->kms);
>
> @@ -1200,6 +1213,8 @@ static void dpu_encoder_virt_disable(struct
> drm_encoder *drm_enc)
> DPU_DEBUG_ENC(dpu_enc, "encoder disabled\n");
>
> dpu_rm_release(&dpu_kms->rm, drm_enc);
> +
> + mutex_unlock(&dpu_enc->enc_lock);
> }
>
> static enum dpu_intf dpu_encoder_get_intf(struct dpu_mdss_cfg
> *catalog,
> @@ -2233,6 +2248,8 @@ struct drm_encoder *dpu_encoder_init(struct
> drm_device *dev,
>
> drm_encoder_helper_add(&dpu_enc->base, &dpu_encoder_helper_funcs);
>
> + dpu_enc->enabled = false;
> +
> return &dpu_enc->base;
> }
--
Jeykumar S
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
next prev parent reply other threads:[~2018-11-13 1:43 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 19:42 [PATCH 00/12] drm/msm: dpu: Clean up runtime power handling Sean Paul
2018-11-12 19:42 ` [PATCH 02/12] drm/msm: dpu: Remove unused trace_dpu_perf_update_bus() Sean Paul
[not found] ` <20181112194222.193546-3-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 0:48 ` Jeykumar Sankaran
[not found] ` <20181112194222.193546-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-12 19:42 ` [PATCH 01/12] drm/msm: dpu: Remove dpu_power_handle_get_dbus_name() Sean Paul
[not found] ` <20181112194222.193546-2-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 0:37 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 03/12] drm/msm: dpu: Remove dpu_power_client Sean Paul
[not found] ` <20181112194222.193546-4-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 0:57 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 07/12] drm/msm: dpu: Include dpu_io_util.h directly in dpu_kms.h Sean Paul
[not found] ` <20181112194222.193546-8-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:26 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 10/12] drm/msm: dpu: Fix typo in dpu_encoder Sean Paul
[not found] ` <20181112194222.193546-11-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:32 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 12/12] drm/msm: dpu: Move crtc runtime resume to encoder Sean Paul
[not found] ` <20181112194222.193546-13-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:47 ` Jeykumar Sankaran
[not found] ` <883389e20cc26db9071884be7b0802e7-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:22 ` Sean Paul
2018-11-13 15:55 ` [PATCH v2 13/12] drm/msm: dpu: Don't drop locks in crtc_vblank_enable Sean Paul
2018-11-12 19:42 ` [PATCH 04/12] drm/msm: dpu: Don't use power_event for vbif_init_memtypes Sean Paul
[not found] ` <20181112194222.193546-5-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:01 ` Jeykumar Sankaran
[not found] ` <488b7be307ca7f5db3b7c22c62a79e89-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:24 ` [PATCH v2 " Sean Paul
2018-11-13 1:06 ` [PATCH " Jeykumar Sankaran
2018-11-13 1:31 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 05/12] drm/msm: dpu: Handle crtc pm_runtime_resume() directly Sean Paul
2018-11-13 1:20 ` Jeykumar Sankaran
[not found] ` <9d648caa250f75a9870e77de283b2927-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:16 ` Sean Paul
2018-11-12 19:42 ` [PATCH 06/12] drm/msm: dpu: Remove power_handle from core_perf Sean Paul
[not found] ` <20181112194222.193546-7-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:25 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 08/12] drm/msm: dpu: Move DPU_POWER_HANDLE_DBUS_ID to core_perf Sean Paul
2018-11-13 1:27 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 09/12] drm/msm: dpu: Remove dpu_power_handle Sean Paul
[not found] ` <20181112194222.193546-10-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:30 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 11/12] drm/msm: dpu: Add ->enabled to dpu_encoder_virt Sean Paul
[not found] ` <20181112194222.193546-12-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:43 ` Jeykumar Sankaran [this message]
[not found] ` <848efa69c74b25ee0845e02dc4d19d61-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:19 ` 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=848efa69c74b25ee0845e02dc4d19d61@codeaurora.org \
--to=jsanka-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
--cc=abhinavk-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