Skip to content

Commit c0b8892

Browse files
hsinyi527Chun-Kuang Hu
authored andcommitted
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: 119f517 ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.") Signed-off-by: Hsin-Yi Wang <[email protected]> Reviewed-by: Tomasz Figa <[email protected]> Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent c79484f commit c0b8892

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

drivers/gpu/drm/mediatek/mtk_drm_plane.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
164164
true, true);
165165
}
166166

167+
static void mtk_plane_atomic_disable(struct drm_plane *plane,
168+
struct drm_plane_state *old_state)
169+
{
170+
struct mtk_plane_state *state = to_mtk_plane_state(plane->state);
171+
172+
state->pending.enable = false;
173+
wmb(); /* Make sure the above parameter is set before update */
174+
state->pending.dirty = true;
175+
}
176+
167177
static void mtk_plane_atomic_update(struct drm_plane *plane,
168178
struct drm_plane_state *old_state)
169179
{
@@ -178,6 +188,11 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
178188
if (!crtc || WARN_ON(!fb))
179189
return;
180190

191+
if (!plane->state->visible) {
192+
mtk_plane_atomic_disable(plane, old_state);
193+
return;
194+
}
195+
181196
gem = fb->obj[0];
182197
mtk_gem = to_mtk_gem_obj(gem);
183198
addr = mtk_gem->dma_addr;
@@ -200,16 +215,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
200215
state->pending.dirty = true;
201216
}
202217

203-
static void mtk_plane_atomic_disable(struct drm_plane *plane,
204-
struct drm_plane_state *old_state)
205-
{
206-
struct mtk_plane_state *state = to_mtk_plane_state(plane->state);
207-
208-
state->pending.enable = false;
209-
wmb(); /* Make sure the above parameter is set before update */
210-
state->pending.dirty = true;
211-
}
212-
213218
static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
214219
.prepare_fb = drm_gem_fb_prepare_fb,
215220
.atomic_check = mtk_plane_atomic_check,

0 commit comments

Comments
 (0)