Commit c0b8892e authored by Hsin-Yi Wang's avatar Hsin-Yi Wang Committed by Chun-Kuang Hu

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.

Fixes: 119f5173 ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: default avatarHsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
parent c79484f6
...@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, ...@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
true, true); 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, static void mtk_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state) struct drm_plane_state *old_state)
{ {
...@@ -178,6 +188,11 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, ...@@ -178,6 +188,11 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
if (!crtc || WARN_ON(!fb)) if (!crtc || WARN_ON(!fb))
return; return;
if (!plane->state->visible) {
mtk_plane_atomic_disable(plane, old_state);
return;
}
gem = fb->obj[0]; gem = fb->obj[0];
mtk_gem = to_mtk_gem_obj(gem); mtk_gem = to_mtk_gem_obj(gem);
addr = mtk_gem->dma_addr; addr = mtk_gem->dma_addr;
...@@ -200,16 +215,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, ...@@ -200,16 +215,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
state->pending.dirty = true; 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 = { static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
.prepare_fb = drm_gem_fb_prepare_fb, .prepare_fb = drm_gem_fb_prepare_fb,
.atomic_check = mtk_plane_atomic_check, .atomic_check = mtk_plane_atomic_check,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment