drm/mediatek: check plane visibility in atomic_update
Subsystems (3)
PATCH v2 1/1 drm/mediatek: check plane visibility in atomic_update
Disable the plane if it's not visible. Otherwise mtk_ovl_layer_config() would proceed with invalid plane and we may see vblank timeout.
---
v2: Add fixes tag
--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_plane.c +13 -10
@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, true, true); } +static void mtk_plane_atomic_disable (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct mtk_plane_state *state =to_mtk_plane_state (plane->state); + + state->pending.enable = false; +wmb ();/* Make sure the above parameter is set before update */ + state->pending.dirty = true; +} +static void mtk_plane_atomic_update (struct drm_plane *plane,struct drm_plane_state *old_state) {
@@ -178,6 +188,9 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,if (!crtc ||WARN_ON (!fb))return ; +if (!plane->state->visible) +return mtk_plane_atomic_disable (plane, old_state); + gem = fb->obj[0 ]; mtk_gem =to_mtk_gem_obj (gem); addr = mtk_gem->dma_addr;
@@ -200,16 +213,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, state->pending.dirty = true; } -static void mtk_plane_atomic_disable (struct drm_plane *plane, -struct drm_plane_state *old_state) -{ -struct mtk_plane_state *state =to_mtk_plane_state (plane->state); - - state->pending.enable = false; -wmb ();/* Make sure the above parameter is set before update */ - state->pending.dirty = true; -} -static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = { .prepare_fb = drm_gem_fb_prepare_fb, .atomic_check = mtk_plane_atomic_check,
Signature · 1 line
2.27.0.111.gc72c7da667-goog
Hi Hsin-Yi,
Quoted 12 lines · Hsin-Yi Wang
Disable the plane if it's not visible. Otherwise
mtk_ovl_layer_config()would proceed with invalid plane and we may see vblank timeout.Fixes 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")Signed-off-by Hsin-Yi Wang <[email protected]>Reviewed-by Chun-Kuang Hu <[email protected]>---
v2: Add fixes tag--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
Thank you for the patch. Please see my comments inline.
Quoted 22 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +10
-0@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, true, true); } +static void mtk_plane_atomic_disable (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct mtk_plane_state *state =to_mtk_plane_state (plane->state); + + state->pending.enable = false; +wmb ();/* Make sure the above parameter is set before update */ + state->pending.dirty = true; +} +static void mtk_plane_atomic_update (struct drm_plane *plane,struct drm_plane_state *old_state) {
drivers/gpu/drm/mediatek/mtk_drm_plane.c static void mtk_plane_atomic_update(struct drm_plane *plane, · line 192
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +2
-0@@ -178,6 +188,9 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,if (!crtc ||WARN_ON (!fb))return ; +if (!plane->state->visible) +return mtk_plane_atomic_disable (plane, old_state);
nit: Both this function and mtk_plane_atomic_disable() have the void return type. Perhaps we should rather move the return, without a value, to a separate statement?
Best regards,
Tomasz
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 44 lines · Tomasz Figa
Hi Hsin-Yi,
Quoted 12 lines · Hsin-Yi Wang
Disable the plane if it's not visible. Otherwise
mtk_ovl_layer_config()would proceed with invalid plane and we may see vblank timeout.Fixes 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")Signed-off-by Hsin-Yi Wang <[email protected]>Reviewed-by Chun-Kuang Hu <[email protected]>---
v2: Add fixes tag--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)Thank you for the patch. Please see my comments inline.
Quoted 25 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +10
-0@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, true, true); } +static void mtk_plane_atomic_disable (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct mtk_plane_state *state =to_mtk_plane_state (plane->state); + + state->pending.enable = false; +wmb ();/* Make sure the above parameter is set before update */ + state->pending.dirty = true; +} +static void mtk_plane_atomic_update (struct drm_plane *plane,struct drm_plane_state *old_state) {@@ -178,6 +188,9 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,if (!crtc ||WARN_ON (!fb))return ;
Quoted 6 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c static void mtk_plane_atomic_update(struct drm_plane *plane, · line 192
Quoted 2 lines
drivers/gpu/drm/mediatek/mtk_drm_plane.c +2
-0+if (!plane->state->visible) +return mtk_plane_atomic_disable (plane, old_state);nit: Both this function and
mtk_plane_atomic_disable()have the void return type. Perhaps we should rather move the return, without a value, to a separate statement?
Updated in v3, thanks.
Quoted 3 lines
Best regards,
Tomasz