Skip to content

Commit 3ec71e0

Browse files
Jason-JH.LinChun-Kuang Hu
authored andcommitted
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: 1a64a7a ("drm/mediatek: Fix cursor plane no update") Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: CK Hu <ck.hu@mediatek.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20230809125722.24112-2-jason-jh.lin@mediatek.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent 26fdd23 commit 3ec71e0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/mediatek/mtk_drm_plane.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ static void mtk_plane_atomic_async_update(struct drm_plane *plane,
227227
plane->state->src_y = new_state->src_y;
228228
plane->state->src_h = new_state->src_h;
229229
plane->state->src_w = new_state->src_w;
230-
swap(plane->state->fb, new_state->fb);
231230

232231
mtk_plane_update_new_state(new_state, new_plane_state);
232+
swap(plane->state->fb, new_state->fb);
233233
wmb(); /* Make sure the above parameters are set before update */
234234
new_plane_state->pending.async_dirty = true;
235235
mtk_drm_crtc_async_update(new_state->crtc, plane, state);

0 commit comments

Comments
 (0)