Skip to content

Commit 7f82d9c

Browse files
Yongqiang NiuChun-Kuang Hu
authored andcommitted
drm/mediatek: Clear pending flag when cmdq packet is done
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 <[email protected]> Signed-off-by: jason-jh.lin <[email protected]> Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 593b655 commit 7f82d9c

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

drivers/gpu/drm/mediatek/mtk_drm_crtc.c

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,42 @@ struct mtk_ddp_comp *mtk_drm_ddp_comp_for_plane(struct drm_crtc *crtc,
276276
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
277277
static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
278278
{
279+
struct cmdq_cb_data *data = mssg;
279280
struct cmdq_client *cmdq_cl = container_of(cl, struct cmdq_client, client);
280281
struct mtk_drm_crtc *mtk_crtc = container_of(cmdq_cl, struct mtk_drm_crtc, cmdq_client);
282+
struct mtk_crtc_state *state;
283+
unsigned int i;
284+
285+
if (data->sta < 0)
286+
return;
287+
288+
state = to_mtk_crtc_state(mtk_crtc->base.state);
289+
290+
state->pending_config = false;
291+
292+
if (mtk_crtc->pending_planes) {
293+
for (i = 0; i < mtk_crtc->layer_nr; i++) {
294+
struct drm_plane *plane = &mtk_crtc->planes[i];
295+
struct mtk_plane_state *plane_state;
296+
297+
plane_state = to_mtk_plane_state(plane->state);
298+
299+
plane_state->pending.config = false;
300+
}
301+
mtk_crtc->pending_planes = false;
302+
}
303+
304+
if (mtk_crtc->pending_async_planes) {
305+
for (i = 0; i < mtk_crtc->layer_nr; i++) {
306+
struct drm_plane *plane = &mtk_crtc->planes[i];
307+
struct mtk_plane_state *plane_state;
308+
309+
plane_state = to_mtk_plane_state(plane->state);
310+
311+
plane_state->pending.async_config = false;
312+
}
313+
mtk_crtc->pending_async_planes = false;
314+
}
281315

282316
mtk_crtc->cmdq_vblank_cnt = 0;
283317
}
@@ -433,7 +467,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
433467
state->pending_vrefresh, 0,
434468
cmdq_handle);
435469

436-
state->pending_config = false;
470+
if (!cmdq_handle)
471+
state->pending_config = false;
437472
}
438473

439474
if (mtk_crtc->pending_planes) {
@@ -453,9 +488,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
453488
mtk_ddp_comp_layer_config(comp, local_layer,
454489
plane_state,
455490
cmdq_handle);
456-
plane_state->pending.config = false;
491+
if (!cmdq_handle)
492+
plane_state->pending.config = false;
457493
}
458-
mtk_crtc->pending_planes = false;
494+
495+
if (!cmdq_handle)
496+
mtk_crtc->pending_planes = false;
459497
}
460498

461499
if (mtk_crtc->pending_async_planes) {
@@ -475,9 +513,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
475513
mtk_ddp_comp_layer_config(comp, local_layer,
476514
plane_state,
477515
cmdq_handle);
478-
plane_state->pending.async_config = false;
516+
if (!cmdq_handle)
517+
plane_state->pending.async_config = false;
479518
}
480-
mtk_crtc->pending_async_planes = false;
519+
520+
if (!cmdq_handle)
521+
mtk_crtc->pending_async_planes = false;
481522
}
482523
}
483524

0 commit comments

Comments
 (0)