From patchwork Tue Aug 6 11:57:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakarsh Jain X-Patchwork-Id: 13754802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46361C49EA1 for ; Tue, 6 Aug 2024 12:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:Content-Type: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=QEtNHtSIRpFLQ01HmiZiDyTT4HWV/qbWxmK/lhObWlk=; b=fAuAZ/VuAvBttW MOjuuj/jy6D9/mlhjexDu13jkxdb8ev/mSY1oQEc+PpOdI3NnpQhXEKhWuY8Rqtpl2DdVn9MPWNqL 737OJkDRKI9kfLgpTk+2B+Ul9ZHy3DeOUTy5rSLSlSHnl6sFrttAk2gyB0ajqAnKRCex/+HNJnsvt mSyz4Pqhxln/+LPQCwuwA9XNhQcbulworNMinJqGZ4m77gHkLJ3vqT5C7UBJo0M2YBovWXLOU2PLI SSrU75hUOHTT1lW6b8KuzPnf0zv1te5OBHO2xw2+nN2AQEc+8lVwDLsnROXEgCxuC8fHF26LaVSUo rrNcl+2k4Qo5t8o8i1EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbJcQ-00000001YfA-2ouc; Tue, 06 Aug 2024 12:48:50 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbJbq-00000001YOH-2ywn for linux-arm-kernel@lists.infradead.org; Tue, 06 Aug 2024 12:48:18 +0000 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20240806124806epoutp0407507118a0a76b07cd7473708d84b063~pJIUA3OSX1121111211epoutp04R for ; Tue, 6 Aug 2024 12:48:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20240806124806epoutp0407507118a0a76b07cd7473708d84b063~pJIUA3OSX1121111211epoutp04R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1722948486; bh=QEtNHtSIRpFLQ01HmiZiDyTT4HWV/qbWxmK/lhObWlk=; h=From:To:Cc:Subject:Date:References:From; b=sGfssVKcBnEYKetXdCIFBGoQdZ6RrWlYwzrk2zfk8wek5bS9PK+EVkSxgibzEUWjU sqTOan5J2NOGOJlwF/U5/zeR1lLJcg7b4hFtxgP7XPd70Q03MZ3hmP3jXh72ueadLy syIAx13ZmyrNAnCSr+RFQJdmNsH98L0VtA0N51Z4= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20240806124805epcas5p2d53b355c44898279dde28938c1bdb6c5~pJITmwos-1377113771epcas5p29; Tue, 6 Aug 2024 12:48:05 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.181]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4WdY4h0hJsz4x9Pp; Tue, 6 Aug 2024 12:48:04 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 63.03.09640.38B12B66; Tue, 6 Aug 2024 21:48:03 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20240806120911epcas5p1b0defc027a7f03ee9bf5f21036d3ae5e~pImVVCbEx2322623226epcas5p1B; Tue, 6 Aug 2024 12:09:10 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240806120910epsmtrp282af1e81e0f56b730bc118d524d22f05~pImVNyaKs0294202942epsmtrp2K; Tue, 6 Aug 2024 12:09:10 +0000 (GMT) X-AuditID: b6c32a49-aabb8700000025a8-e9-66b21b83dae5 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id C6.E8.08456.66212B66; Tue, 6 Aug 2024 21:09:10 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240806120909epsmtip2899fc7b950568b76927de86a555ad74d~pImTaRr0G1162811628epsmtip2M; Tue, 6 Aug 2024 12:09:08 +0000 (GMT) From: Aakarsh Jain To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: m.szyprowski@samsung.com, andrzej.hajda@intel.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, krzysztof.kozlowski+dt@linaro.org, linux-samsung-soc@vger.kernel.org, gost.dev@samsung.com, aswani.reddy@samsung.com, pankaj.dubey@samsung.com, Aakarsh Jain Subject: [PATCH] media: s5p-mfc: Corrected NV12M/NV21M plane-sizes Date: Tue, 6 Aug 2024 17:27:14 +0530 Message-Id: <20240806115714.29828-1-aakarsh.jain@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFKsWRmVeSWpSXmKPExsWy7bCmhm6z9KY0g60/zS2e7pjJanF/8WcW i0Obt7Jb3D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j0VCLuag4EQAk pH9wtwIAAA== X-CMS-MailID: 20240806120911epcas5p1b0defc027a7f03ee9bf5f21036d3ae5e X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240806120911epcas5p1b0defc027a7f03ee9bf5f21036d3ae5e References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_054815_408143_135E9F8D X-CRM114-Status: GOOD ( 15.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There is a possibility of getting page fault if the overall buffer size is not aligned to 256bytes. Since MFC does read operation only and it won't corrupt the data values even if it reads the extra bytes. Corrected luma and chroma plane sizes for V4L2_PIX_FMT_NV12M and V4L2_PIX_FMT_NV21M pixel format. Signed-off-by: Aakarsh Jain --- .../media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c index 73f7af674c01..03c957221fc4 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c @@ -498,8 +498,8 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct s5p_mfc_ctx *ctx) case V4L2_PIX_FMT_NV21M: ctx->stride[0] = ALIGN(ctx->img_width, S5P_FIMV_NV12MT_HALIGN_V6); ctx->stride[1] = ALIGN(ctx->img_width, S5P_FIMV_NV12MT_HALIGN_V6); - ctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height); - ctx->chroma_size = calc_plane(ctx->stride[1], (ctx->img_height / 2)); + ctx->luma_size = calc_plane(ctx->img_width, ctx->img_height); + ctx->chroma_size = calc_plane(ctx->img_width, (ctx->img_height >> 1)); break; case V4L2_PIX_FMT_YUV420M: case V4L2_PIX_FMT_YVU420M: @@ -539,9 +539,11 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct s5p_mfc_ctx *ctx) static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx) { unsigned int mb_width, mb_height; + unsigned int default_size; mb_width = MB_WIDTH(ctx->img_width); mb_height = MB_HEIGHT(ctx->img_height); + default_size = (mb_width * mb_height) * 256; if (IS_MFCV12(ctx->dev)) { switch (ctx->src_fmt->fourcc) { @@ -549,8 +551,8 @@ static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx) case V4L2_PIX_FMT_NV21M: ctx->stride[0] = ALIGN(ctx->img_width, S5P_FIMV_NV12M_HALIGN_V6); ctx->stride[1] = ALIGN(ctx->img_width, S5P_FIMV_NV12M_HALIGN_V6); - ctx->luma_size = ctx->stride[0] * ALIGN(ctx->img_height, 16); - ctx->chroma_size = ctx->stride[0] * ALIGN(ctx->img_height / 2, 16); + ctx->luma_size = ALIGN(default_size, 256); + ctx->chroma_size = ALIGN(default_size / 2, 256); break; case V4L2_PIX_FMT_YUV420M: case V4L2_PIX_FMT_YVU420M: