From patchwork Tue Dec 8 14:39:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 7798361 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BF7FBBEEE1 for ; Tue, 8 Dec 2015 14:39:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB52120524 for ; Tue, 8 Dec 2015 14:39:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78AA3204FB for ; Tue, 8 Dec 2015 14:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756802AbbLHOjZ (ORCPT ); Tue, 8 Dec 2015 09:39:25 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:19710 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756617AbbLHOjX (ORCPT ); Tue, 8 Dec 2015 09:39:23 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NZ100DW5NDK3IB0@mailout1.w1.samsung.com>; Tue, 08 Dec 2015 14:39:20 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-12-5666eb988f1f Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id FF.87.21385.89BE6665; Tue, 8 Dec 2015 14:39:20 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NZ100CISNDFL460@eusync1.samsung.com>; Tue, 08 Dec 2015 14:39:20 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Andrzej Pietrasiewicz Subject: [PATCH] media: s5p-jpeg: Adjust buffer size for Exynos 4412 Date: Tue, 08 Dec 2015 15:39:08 +0100 Message-id: <1449585548-17113-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDJMWRmVeSWpSXmKPExsVy+t/xy7ozXqeFGXzdym0x62U7i0XPhq2s FjPO72OyWHvkLrsDi0ffllWMHp83yQUwRXHZpKTmZJalFunbJXBlPF+lUDCDp+LJvqNsDYyd XF2MnBwSAiYSX79MZIKwxSQu3FvPBmILCSxllFg7PbGLkQvIbmKS2PvqK1iCTcBQouttF5gt IuAksXDWX3YQm1kgQeLokymsILawgIvEmVuNYENZBFQlbv7uA7N5BTwkWjofs0Ask5P4/3IF 0wRG7gWMDKsYRVNLkwuKk9JzjfSKE3OLS/PS9ZLzczcxQvz8dQfj0mNWhxgFOBiVeHgVTqaG CbEmlhVX5h5ilOBgVhLhbX2eFibEm5JYWZValB9fVJqTWnyIUZqDRUmcd+au9yFCAumJJanZ qakFqUUwWSYOTqkGxtCbDyPiGhSO+p7eGypR/y75q9/Wudk6F4zbLp0wvFm3+M9ilVuvt94+ nbUzeX2jpMfF4iMf09rK+bfdXWe8IE3AOCvDzfvVk+Int+6HGKSE/jkiK3s1s1Nzg0FszvQf Wi5aP99Nbsxb9EPY0vpdWhgzW8vp1UFZzu+EFJrjVh6+qfWTt+PUMSWW4oxEQy3mouJEAG1+ v9zvAQAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andrzej Pietrasiewicz Eliminate iommu fault during encoding by adjusting image size used for buffer size computation and ensuring that the buffer is not overrun. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 4a608cb..49556e2 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1548,8 +1548,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 || @@ -1564,7 +1566,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,