Linux Samsung SOC development
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: fimd: fix buffer size calculation
@ 2015-04-13  7:28 Marek Szyprowski
  2015-04-13  7:48 ` Inki Dae
  2015-04-13 14:58 ` Daniel Stone
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Szyprowski @ 2015-04-13  7:28 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: dri-devel, Marek Szyprowski, Andrzej Hajda, Inki Dae,
	Joonyoung Shim, Daniel Stone, stable

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 <m.szyprowski@samsung.com>
CC: stable@vger.kernel.org  # v4.0+
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 0e93ed792224..f29a13e0524c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -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));
 
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/exynos: fimd: fix buffer size calculation
  2015-04-13  7:28 [PATCH] drm/exynos: fimd: fix buffer size calculation Marek Szyprowski
@ 2015-04-13  7:48 ` Inki Dae
  2015-04-13 14:58 ` Daniel Stone
  1 sibling, 0 replies; 3+ messages in thread
From: Inki Dae @ 2015-04-13  7:48 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-samsung-soc, stable, Andrzej Hajda, dri-devel, Daniel Stone

On 2015년 04월 13일 16:28, Marek Szyprowski wrote:
> 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.

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

> 
> Signed-off by: Marek Szyprowski <m.szyprowski@samsung.com>
> CC: stable@vger.kernel.org  # v4.0+
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 0e93ed792224..f29a13e0524c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -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
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/exynos: fimd: fix buffer size calculation
  2015-04-13  7:28 [PATCH] drm/exynos: fimd: fix buffer size calculation Marek Szyprowski
  2015-04-13  7:48 ` Inki Dae
@ 2015-04-13 14:58 ` Daniel Stone
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Stone @ 2015-04-13 14:58 UTC (permalink / raw)
  To: Marek Szyprowski; +Cc: linux-samsung-soc, stable, Andrzej Hajda, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1826 bytes --]

Hi Marek,

On Mon, 13 Apr, 2015 at 8:28 AM, Marek Szyprowski 
<m.szyprowski@samsung.com> wrote:
> 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.

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.

Reviewed-by: Daniel Stone <daniels@collabora.com>

Cheers,
Daniel

> Signed-off by: Marek Szyprowski <m.szyprowski@samsung.com>
> CC: stable@vger.kernel.org  # v4.0+
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 0e93ed792224..f29a13e0524c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -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));
> 
> --
> 1.9.2
> 

[-- Attachment #1.2: Type: text/html, Size: 2219 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-13 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-13  7:28 [PATCH] drm/exynos: fimd: fix buffer size calculation Marek Szyprowski
2015-04-13  7:48 ` Inki Dae
2015-04-13 14:58 ` Daniel Stone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox