drm/exynos: fimd: fix buffer size calculation
Subsystems (3)
PATCH 1/1 drm/exynos: fimd: fix buffer size calculation
Commit adacb228d72b9529f8de0769cc33414c3012054d ("drm: Exynos: Respect framebuffer pitch for FIMD/Mixer") changed the way of buffer size
calcularion: it replaced fb_width by fb_pitch entry. fb_pitch however already contains '(win_data->bpp >> 3)' factor, so it should be removed from final buffer size calculation formula. This patch fixes this issue, solving possible IOMMU page fault caused by FIMD module accessing memory outside of the given display buffer.
Signed-off by: Marek Szyprowski <[email protected]>
CC: [email protected] # v4.0+
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -1
@@ -689,7 +689,7 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)writel (val, ctx->regs +VIDWx_BUF_START (win,0 ));/* buffer end address */ - size = plane->pitch * plane->crtc_height * (plane->bpp >>3 ); + size = plane->pitch * plane->crtc_height; val = (unsigned long )(dma_addr + size);writel (val, ctx->regs +VIDWx_BUF_END (win,0 ));
Signature · 1 line
1.9.2
Inki Dae
maintainerQuoted 7 lines · Marek Szyprowski
Commit
adacb228d72b9529f8de0769cc33414c3012054d("drm: Exynos: Respect framebuffer pitch for FIMD/Mixer") changed the way of buffer size
calcularion: it replacedfb_widthbyfb_pitchentry.fb_pitchhowever already contains '(win_data->bpp>> 3)' factor, so it should be removed from final buffer size calculation formula. This patch fixes this issue, solving possible IOMMU page fault caused by FIMD module accessing memory outside of the given display buffer.
This fixup had already been posted by Daniel Stone,
https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/commit/?h=exynos-drm-next
Thanks,
Inki Dae
Quoted 13 lines
Signed-off by: Marek Szyprowski <[email protected]>
CC: [email protected] # v4.0+--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) · line 695
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-1@@ -689,7 +689,7 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)writel (val, ctx->regs +VIDWx_BUF_START (win,0 ));/* buffer end address */ - size = plane->pitch * plane->crtc_height * (plane->bpp >>3 ); + size = plane->pitch * plane->crtc_height; val = (unsigned long )(dma_addr + size);writel (val, ctx->regs +VIDWx_BUF_END (win,0 ));
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Marek,
Quoted 7 lines · Marek Szyprowski
Commit
adacb228d72b9529f8de0769cc33414c3012054d("drm: Exynos: Respect framebuffer pitch for FIMD/Mixer") changed the way of buffer size
calcularion: it replacedfb_widthbyfb_pitchentry.fb_pitchhowever already contains '(win_data->bpp>> 3)' factor, so it should be removed from final buffer size calculation formula. This patch fixes this issue, solving possible IOMMU page fault caused by FIMD module accessing memory outside of the given display buffer.
Yes, you're right; sorry about this. It slipped in during a rebase and I definitely should've caught it. This has already been fixed for -next in the commit Inki pointed out, but in the meantime it should definitely be applied to stable as a more minimal fix.
Thanks for catching this and providing the fix.
Cheers,
Daniel
Quoted 21 lines
Signed-off by: Marek Szyprowski <[email protected]>
CC: [email protected] # v4.0+--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-2@@ -689,7 +689,7 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) writel(val, ctx->regs + VIDWx_BUF_START(win, 0));/* buffer end address */ - size = plane->pitch * plane->crtc_height * (plane->bpp >>3 ); + size = plane->pitch * plane->crtc_height; val = (unsigned long )(dma_addr + size);writel (val, ctx->regs +VIDWx_BUF_END (win,0 )); --
Quoted 2 lines
1.9.2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel