aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason-JH.Lin <[email protected]>2023-08-09 20:57:21 +0800
committerChun-Kuang Hu <[email protected]>2023-10-08 01:28:31 +0000
commit3ec71e05ae6e7f46512e568ed81c92be589003dd (patch)
tree40038fef0649b6fe8637d571017e9e2d829db7c5
parent26fdd23ff861d5436f70f67a09161b06d2c306e2 (diff)
drm/mediatek: Fix iommu fault by swapping FBs after updating plane state
According to the comment in drm_atomic_helper_async_commit(), we should make sure FBs have been swapped, so that cleanups in the new_state performs a cleanup in the old FB. So we should move swapping FBs after calling mtk_plane_update_new_state(), to avoid using the old FB which could be freed. Fixes: 1a64a7aff8da ("drm/mediatek: Fix cursor plane no update") Signed-off-by: Jason-JH.Lin <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: CK Hu <[email protected]> Reviewed-by: Alexandre Mergnat <[email protected]> Link: https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
-rw-r--r--drivers/gpu/drm/mediatek/mtk_drm_plane.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
index 5acb03b7c6fe..ddc9355b06d5 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
@@ -227,9 +227,9 @@ static void mtk_plane_atomic_async_update(struct drm_plane *plane,
plane->state->src_y = new_state->src_y;
plane->state->src_h = new_state->src_h;
plane->state->src_w = new_state->src_w;
- swap(plane->state->fb, new_state->fb);
mtk_plane_update_new_state(new_state, new_plane_state);
+ swap(plane->state->fb, new_state->fb);
wmb(); /* Make sure the above parameters are set before update */
new_plane_state->pending.async_dirty = true;
mtk_drm_crtc_async_update(new_state->crtc, plane, state);