<html><body><p>
<pre>
Hi CK,

> > --- a/drivers/gpu/drm/mediatek/mtk_crtc.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c
> > @@ -314,30 +314,32 @@ static void ddp_cmdq_cb(struct mbox_client
> *cl, void *mssg)
> >
> > state = to_mtk_crtc_state(mtk_crtc->base.state);
> >
> > - state->pending_config = false;
> > + if (!mtk_crtc->config_updating) {
> > + state->pending_config = false;
>
> I think if mtk_crtc->config_updating == true, the whole clear job
> could be skipped.
> And use spin_lock to protect the clear job in irq.
>
> /*
> spin_lock():
> if (mtk_crtc->config_updating) {
> spin_unlock();
> goto out;
> }
>
> /* clear job */
>
> spin_unlock();
> */
> out:
>
> In mtk_crtc_config_update(), use spin_lock to protect mtk_crtc-
> >config_updating:
>
> spin_lock();
> mtk_crtc->config_updating = true;
> spin_unlock();
> ...
> spin_lock();
> mtk_crtc->config_updating = false;
> spin_unlock();
>

Thanks for the reviews.

I think that's more solid to protect the updating config of cmd buffer.

I will also add spin_lock for the whole statement in
mtk_drm_finish_page_flip() because config_updating flag is covered the
pending_need_vblank flag.

Regards,
Jason-JH.Lin

> Regards,
> Chun-Kuang.
>
>
> >
> > - if (mtk_crtc->pending_planes) {
> > - for (i = 0; i < mtk_crtc->layer_nr; i++) {
> > - struct drm_plane *plane = &mtk_crtc-
> >planes[i];
> > - struct mtk_plane_state *plane_state;
> > + if (mtk_crtc->pending_planes) {
> > + for (i = 0; i < mtk_crtc->layer_nr; i++) {
> > + struct drm_plane *plane =
> &mtk_crtc->planes[i];
> > + struct mtk_plane_state
> *plane_state;
> >
> > - plane_state = to_mtk_plane_state(plane-
> >state);
> > + plane_state =
> to_mtk_plane_state(plane->state);
> >
> > - plane_state->pending.config = false;
> > + plane_state->pending.config =
> false;
> > + }
> > + mtk_crtc->pending_planes = false;
> > }
> > - mtk_crtc->pending_planes = false;
> > - }
> >
> > - if (mtk_crtc->pending_async_planes) {
> > - for (i = 0; i < mtk_crtc->layer_nr; i++) {
> > - struct drm_plane *plane = &mtk_crtc-
> >planes[i];
> > - struct mtk_plane_state *plane_state;
> > + if (mtk_crtc->pending_async_planes) {
> > + for (i = 0; i < mtk_crtc->layer_nr; i++) {
> > + struct drm_plane *plane =
> &mtk_crtc->planes[i];
> > + struct mtk_plane_state
> *plane_state;
> >
> > - plane_state = to_mtk_plane_state(plane-
> >state);
> > + plane_state =
> to_mtk_plane_state(plane->state);
> >
> > - plane_state->pending.async_config = false;
> > + plane_state->pending.async_config =
> false;
> > + }
> > + mtk_crtc->pending_async_planes = false;
> > }
> > - mtk_crtc->pending_async_planes = false;
> > }
> >
> > mtk_crtc->cmdq_vblank_cnt = 0;
> > --
> > 2.18.0
> >

</pre>
</p></body></html><!--type:text--><!--{--><pre>************* MEDIATEK Confidentiality Notice ********************
The information contained in this e-mail message (including any 
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be 
conveyed only to the designated recipient(s). Any use, dissemination, 
distribution, printing, retaining or copying of this e-mail (including its 
attachments) by unintended recipient(s) is strictly prohibited and may 
be unlawful. If you are not an intended recipient of this e-mail, or believe 
that you have received this e-mail in error, please notify the sender 
immediately (by replying to this e-mail), delete any and all copies of 
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!
</pre><!--}-->