* Re: [PATCH v6 3/6] drm/mediatek: Detect CMDQ execution timeout
[not found] ` <20211028101912.4624-4-jason-jh.lin@mediatek.com>
@ 2021-10-29 5:32 ` Fei Shao
0 siblings, 0 replies; 2+ messages in thread
From: Fei Shao @ 2021-10-29 5:32 UTC (permalink / raw)
To: jason-jh.lin
Cc: Chun-Kuang Hu, Philipp Zabel, Matthias Brugger, Jassi Brar,
Yongqiang Niu, David Airlie, Daniel Vetter, dri-devel,
linux-mediatek, linux-arm-kernel, linux-kernel, hsinyi,
nancy.lin, singo.chang
On Thu, Oct 28, 2021 at 6:19 PM jason-jh.lin <jason-jh.lin@mediatek.com> wrote:
>
> From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
>
> CMDQ is used to update display register in vblank period, so
> it should be execute in next 2 vblank. One vblank interrupt
> before send message (occasionally) and one vblank interrupt
> after cmdq done. If it fail to execute in next 3 vblank,
> tiemout happen.
>
> Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> Signed-off-by: jason-jh.lin <jason-jh.lin@mediatek.com>
Reviewed-by: Fei Shao <fshao@chromium.org>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index e23e3224ac67..a368cbc18923 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -54,6 +54,7 @@ struct mtk_drm_crtc {
> #if IS_REACHABLE(CONFIG_MTK_CMDQ)
> struct cmdq_client cmdq_client;
> u32 cmdq_event;
> + u32 cmdq_vblank_cnt;
> #endif
>
> struct device *mmsys_dev;
> @@ -227,7 +228,10 @@ struct mtk_ddp_comp *mtk_drm_ddp_comp_for_plane(struct drm_crtc *crtc,
> static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
> {
> struct cmdq_cb_data *data = mssg;
> + struct cmdq_client *cmdq_cl = container_of(cl, struct cmdq_client, client);
> + struct mtk_drm_crtc *mtk_crtc = container_of(cmdq_cl, struct mtk_drm_crtc, cmdq_client);
>
> + mtk_crtc->cmdq_vblank_cnt = 0;
> cmdq_pkt_destroy(data->pkt);
> }
> #endif
> @@ -483,6 +487,15 @@ static void mtk_drm_crtc_update_config(struct mtk_drm_crtc *mtk_crtc,
> cmdq_handle->pa_base,
> cmdq_handle->cmd_buf_size,
> DMA_TO_DEVICE);
> + /*
> + * CMDQ command should execute in next 3 vblank.
> + * One vblank interrupt before send message (occasionally)
> + * and one vblank interrupt after cmdq done,
> + * so it's timeout after 3 vblank interrupt.
> + * If it fail to execute in next 3 vblank, timeout happen.
> + */
> + mtk_crtc->cmdq_vblank_cnt = 3;
> +
> mbox_send_message(mtk_crtc->cmdq_client.chan, cmdq_handle);
> mbox_client_txdone(mtk_crtc->cmdq_client.chan, 0);
> }
> @@ -499,11 +512,14 @@ static void mtk_crtc_ddp_irq(void *data)
>
> #if IS_REACHABLE(CONFIG_MTK_CMDQ)
> if (!priv->data->shadow_register && !mtk_crtc->cmdq_client.chan)
> + mtk_crtc_ddp_config(crtc, NULL);
> + else if (--mtk_crtc->cmdq_vblank_cnt == 0)
> + DRM_ERROR("mtk_crtc %d CMDQ execute command timeout!\n",
> + drm_crtc_index(&mtk_crtc->base));
> #else
> if (!priv->data->shadow_register)
> -#endif
> mtk_crtc_ddp_config(crtc, NULL);
> -
> +#endif
> mtk_drm_finish_page_flip(mtk_crtc);
> }
>
> --
> 2.18.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v6 0/5] CMDQ refinement of Mediatek DRM driver
[not found] <20211028101912.4624-1-jason-jh.lin@mediatek.com>
[not found] ` <20211028101912.4624-4-jason-jh.lin@mediatek.com>
@ 2021-11-17 23:54 ` Chun-Kuang Hu
1 sibling, 0 replies; 2+ messages in thread
From: Chun-Kuang Hu @ 2021-11-17 23:54 UTC (permalink / raw)
To: jason-jh.lin
Cc: Chun-Kuang Hu, Philipp Zabel, Matthias Brugger, Jassi Brar,
Yongqiang Niu, Fei Shao, David Airlie, Daniel Vetter,
DRI Development, moderated list:ARM/Mediatek SoC support,
Linux ARM, linux-kernel, Hsin-Yi Wang, Nancy Lin, singo.chang
Hi, Jason:
For this series except [v6,3/6] drm/mediatek: Detect CMDQ execution
timeout (I pick v5), applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
jason-jh.lin <jason-jh.lin@mediatek.com> 於 2021年10月28日 週四 下午6:19寫道:
>
> Change in v6:
> 1. Drop the redundant checking of cmdq_vblank_cnt .
> 2. fix the indent.
>
> Change in v5:
> 1. Move mbox_free_channel to a independent patch.
>
> Change in v4:
> 1. Add cmdq_vblank_cnt initial value to 3.
> 2. Move mtk_drm_cmdq_pkt_create to the same define scope with
> mtk_drm_cmdq_pkt_destroy.
>
> Change in v3:
> 1. Revert "drm/mediatek: clear pending flag when cmdq packet is done"
> and add it after the CMDQ refinement patches.
> 2. Change the remove of struct cmdq_client to remove the pointer of
> struct cmdq_client.
> 3. Fix pkt buf alloc once but free many times.
>
> Changes in v2:
> 1. Define mtk_drm_cmdq_pkt_create() and mtk_drm_cmdq_pkt_destroy()
> when CONFIG_MTK_CMDQ is reachable.
>
> Chun-Kuang Hu (4):
> drm/mediatek: Use mailbox rx_callback instead of cmdq_task_cb
> drm/mediatek: Remove the pointer of struct cmdq_client
> drm/mediatek: Detect CMDQ execution timeout
> drm/mediatek: Add cmdq_handle in mtk_crtc
>
> Yongqiang Niu (1):
> drm/mediatek: Clear pending flag when cmdq packet is done
>
> jason-jh.lin (1):
> drm/mediatek: Add mbox_free_channel in mtk_drm_crtc_destroy
>
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 175 ++++++++++++++++++++----
> 1 file changed, 151 insertions(+), 24 deletions(-)
>
> --
> 2.18.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-17 23:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20211028101912.4624-1-jason-jh.lin@mediatek.com>
[not found] ` <20211028101912.4624-4-jason-jh.lin@mediatek.com>
2021-10-29 5:32 ` [PATCH v6 3/6] drm/mediatek: Detect CMDQ execution timeout Fei Shao
2021-11-17 23:54 ` [PATCH v6 0/5] CMDQ refinement of Mediatek DRM driver Chun-Kuang Hu
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).