diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2015-05-18 12:14:01 +0200 |
---|---|---|
committer | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2015-05-18 12:14:56 +0200 |
commit | 002a740af38610cf26ebe167cd76c283509714cb (patch) | |
tree | e51abdac77a94344d42eb8908c03327c76ac7ca7 | |
parent | c7b095b0e3ced802829b2a88085f126762b9cef1 (diff) | |
download | linux-exynos-002a740af38610cf26ebe167cd76c283509714cb.tar.gz linux-exynos-002a740af38610cf26ebe167cd76c283509714cb.tar.bz2 linux-exynos-002a740af38610cf26ebe167cd76c283509714cb.zip |
media: s5p-jpeg: Adjust buffer size for Exynos 4412
Eliminate iommu fault during encoding by adjusting image size
used for buffer size computation and ensuring that the buffer is not
overrun.
Change-Id: I4837ef4cd518732af8110725b50e8f4e1bd313a9
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
-rw-r--r-- | drivers/media/platform/s5p-jpeg/jpeg-core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index a1fb7e6a97c3..ce27620f76d3 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1294,8 +1294,10 @@ static int exynos4_jpeg_get_output_buffer_size(struct s5p_jpeg_ctx *ctx, struct v4l2_pix_format *pix = &f->fmt.pix; u32 pix_fmt = f->fmt.pix.pixelformat; int w = pix->width, h = pix->height, wh_align; + int padding = 0; if (pix_fmt == V4L2_PIX_FMT_RGB32 || + pix_fmt == V4L2_PIX_FMT_RGB565 || pix_fmt == V4L2_PIX_FMT_NV24 || pix_fmt == V4L2_PIX_FMT_NV42 || pix_fmt == V4L2_PIX_FMT_NV12 || @@ -1311,7 +1313,10 @@ static int exynos4_jpeg_get_output_buffer_size(struct s5p_jpeg_ctx *ctx, &h, S5P_JPEG_MIN_HEIGHT, S5P_JPEG_MAX_HEIGHT, wh_align); - return w * h * fmt_depth >> 3; + if (ctx->jpeg->variant->version == SJPEG_EXYNOS4) + padding = PAGE_SIZE; + + return (w * h * fmt_depth >> 3) + padding; } static int exynos3250_jpeg_try_downscale(struct s5p_jpeg_ctx *ctx, |