Skip to content

Commit 9efb16c

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: Chun-Kuang Hu <[email protected]>
1 parent bc9241b commit 9efb16c

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

drivers/gpu/drm/mediatek/mtk_drm_crtc.c

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,36 @@ static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
267267
{
268268
struct mtk_drm_crtc *mtk_crtc = container_of(cl, struct mtk_drm_crtc, cmdq_cl);
269269
struct cmdq_cb_data *data = mssg;
270+
struct mtk_crtc_state *state;
271+
unsigned int i;
272+
273+
state = to_mtk_crtc_state(mtk_crtc->base.state);
274+
275+
state->pending_config = false;
276+
277+
if (mtk_crtc->pending_planes) {
278+
for (i = 0; i < mtk_crtc->layer_nr; i++) {
279+
struct drm_plane *plane = &mtk_crtc->planes[i];
280+
struct mtk_plane_state *plane_state;
281+
282+
plane_state = to_mtk_plane_state(plane->state);
283+
284+
plane_state->pending.config = false;
285+
}
286+
mtk_crtc->pending_planes = false;
287+
}
288+
289+
if (mtk_crtc->pending_async_planes) {
290+
for (i = 0; i < mtk_crtc->layer_nr; i++) {
291+
struct drm_plane *plane = &mtk_crtc->planes[i];
292+
struct mtk_plane_state *plane_state;
293+
294+
plane_state = to_mtk_plane_state(plane->state);
295+
296+
plane_state->pending.async_config = false;
297+
}
298+
mtk_crtc->pending_async_planes = false;
299+
}
270300

271301
mtk_crtc->cmdq_vblank_cnt = 0;
272302
mtk_drm_cmdq_pkt_destroy(mtk_crtc->cmdq_chan, data->pkt);
@@ -423,7 +453,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
423453
state->pending_vrefresh, 0,
424454
cmdq_handle);
425455

426-
state->pending_config = false;
456+
if (!cmdq_handle)
457+
state->pending_config = false;
427458
}
428459

429460
if (mtk_crtc->pending_planes) {
@@ -443,9 +474,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
443474
mtk_ddp_comp_layer_config(comp, local_layer,
444475
plane_state,
445476
cmdq_handle);
446-
plane_state->pending.config = false;
477+
if (!cmdq_handle)
478+
plane_state->pending.config = false;
447479
}
448-
mtk_crtc->pending_planes = false;
480+
481+
if (!cmdq_handle)
482+
mtk_crtc->pending_planes = false;
449483
}
450484

451485
if (mtk_crtc->pending_async_planes) {
@@ -465,9 +499,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
465499
mtk_ddp_comp_layer_config(comp, local_layer,
466500
plane_state,
467501
cmdq_handle);
468-
plane_state->pending.async_config = false;
502+
if (!cmdq_handle)
503+
plane_state->pending.async_config = false;
469504
}
470-
mtk_crtc->pending_async_planes = false;
505+
506+
if (!cmdq_handle)
507+
mtk_crtc->pending_async_planes = false;
471508
}
472509
}
473510

0 commit comments

Comments
 (0)