LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
To: Yongqiang Niu <yongqiang.niu@mediatek.com>
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Fabien Parent <fparent@baylibre.com>,
	Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com>,
	DTML <devicetree@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Project_Global_Chrome_Upstream_Group@mediatek.com,
	Hsin-Yi Wang <hsinyi@chromium.org>
Subject: Re: [PATCH v3] drm/mediatek: clear pending flag when cmdq packet is done.
Date: Tue, 3 Aug 2021 07:16:23 +0800	[thread overview]
Message-ID: <CAAOTY_-7MNrO5my3_9EAeSVxtsVC-dGTZH31tph9TpY3faAdwQ@mail.gmail.com> (raw)
In-Reply-To: <1627888227-5757-2-git-send-email-yongqiang.niu@mediatek.com>

Hi, Yongqiang:

Yongqiang Niu <yongqiang.niu@mediatek.com> 於 2021年8月2日 週一 下午3:11寫道:
>
> In cmdq mode, packet may be flushed before it is executed, so
> the pending flag should be cleared after cmdq packet is done.
>
> Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 51 +++++++++++++++++++++++++++++----
>  1 file changed, 46 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 4c25e33..2a2d43e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -267,6 +267,40 @@ static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
>  {
>         struct mtk_drm_crtc *mtk_crtc = container_of(cl, struct mtk_drm_crtc, cmdq_cl);
>         struct cmdq_cb_data *data = mssg;
> +       struct mtk_crtc_state *state;
> +       unsigned int i;
> +
> +       state = to_mtk_crtc_state(mtk_crtc->base.state);
> +
> +       if (state->pending_config) {

No matter pending_config is true or not, it would be false after this.
So we could simply drop this checking.

> +               state->pending_config = false;
> +       }
> +
> +       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);
> +
> +                       if (plane_state->pending.config)

Ditto.

> +                               plane_state->pending.config = 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;
> +
> +                       plane_state = to_mtk_plane_state(plane->state);
> +
> +                       if (plane_state->pending.async_config)

Ditto.

Regards,
Chun-Kuang.

> +                               plane_state->pending.async_config = false;
> +               }
> +               mtk_crtc->pending_async_planes = false;
> +       }
>
>         mtk_crtc->cmdq_vblank_cnt = 0;
>         mtk_drm_cmdq_pkt_destroy(mtk_crtc->cmdq_chan, data->pkt);
> @@ -423,7 +457,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
>                                     state->pending_vrefresh, 0,
>                                     cmdq_handle);
>
> -               state->pending_config = false;
> +               if (!cmdq_handle)
> +                       state->pending_config = false;
>         }
>
>         if (mtk_crtc->pending_planes) {
> @@ -443,9 +478,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
>                                 mtk_ddp_comp_layer_config(comp, local_layer,
>                                                           plane_state,
>                                                           cmdq_handle);
> -                       plane_state->pending.config = false;
> +                       if (!cmdq_handle)
> +                               plane_state->pending.config = false;
>                 }
> -               mtk_crtc->pending_planes = false;
> +
> +               if (!cmdq_handle)
> +                       mtk_crtc->pending_planes = false;
>         }
>
>         if (mtk_crtc->pending_async_planes) {
> @@ -465,9 +503,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
>                                 mtk_ddp_comp_layer_config(comp, local_layer,
>                                                           plane_state,
>                                                           cmdq_handle);
> -                       plane_state->pending.async_config = false;
> +                       if (!cmdq_handle)
> +                               plane_state->pending.async_config = false;
>                 }
> -               mtk_crtc->pending_async_planes = false;
> +
> +               if (!cmdq_handle)
> +                       mtk_crtc->pending_async_planes = false;
>         }
>  }
>
> --
> 1.8.1.1.dirty
>

      reply	other threads:[~2021-08-02 23:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02  7:10 Yongqiang Niu
2021-08-02  7:10 ` Yongqiang Niu
2021-08-02 23:16   ` Chun-Kuang Hu [this message]

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=CAAOTY_-7MNrO5my3_9EAeSVxtsVC-dGTZH31tph9TpY3faAdwQ@mail.gmail.com \
    --to=chunkuang.hu@kernel.org \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dennis-yc.hsieh@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fparent@baylibre.com \
    --cc=hsinyi@chromium.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=yongqiang.niu@mediatek.com \
    --subject='Re: [PATCH v3] drm/mediatek: clear pending flag when cmdq packet is done.' \
    /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

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).