From patchwork Mon Jul 14 11:18:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: panpan liu X-Patchwork-Id: 4544721 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 881DFC0514 for ; Mon, 14 Jul 2014 11:21:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF3E12010F for ; Mon, 14 Jul 2014 11:21:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89B9F200FF for ; Mon, 14 Jul 2014 11:21:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X6eHe-0006iX-F2; Mon, 14 Jul 2014 11:19:02 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X6eHa-0006Vd-Vy for linux-arm-kernel@lists.infradead.org; Mon, 14 Jul 2014 11:18:59 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8P00ES18QZX950@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 14 Jul 2014 20:18:35 +0900 (KST) X-AuditID: cbfee61a-f79e46d00000134f-cc-53c3bc8b79fd Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 08.1B.04943.B8CB3C35; Mon, 14 Jul 2014 20:18:35 +0900 (KST) Received: from localhost ([109.123.105.139]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8P00B8Q8QIIV80@mmp2.samsung.com>; Mon, 14 Jul 2014 20:18:35 +0900 (KST) From: panpan liu To: kyungmin.park@samsung.com, k.debski@samsung.com, jtp.park@samsung.com, mchehab@redhat.com Subject: [PATCH] s5p-mfc: limit the size of the CPB Date: Mon, 14 Jul 2014 19:18:18 +0800 Message-id: <1405336698-3873-1-git-send-email-panpan1.liu@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAJMWRmVeSWpSXmKPExsVy+t9jQd3uPYeDDaadkLE4svYqk8WP1xfY LM42vWG32PT4GqtFz4atrBZ7jh5md2Dz2Lyk3uP9vqtsHn1bVjF6fN4kF8ASxWWTkpqTWZZa pG+XwJVx/flqpoIm3orlZyaxNzD+4+pi5OSQEDCRuNlwkx3CFpO4cG89WxcjF4eQwHRGiTc3 +6GcP4wS02c8ZgapYhPQkug5948FxBYRiJfY8f4ZE4jNLOAqsXY9xCRhAWOJrY37GUFsFgFV iY4TvWA1vAJuEk/2nAMaygG0TUFiziSbCYzcCxgZVjGKphYkFxQnpeca6hUn5haX5qXrJefn bmIEh8MzqR2MKxssDjEKcDAq8fBmcBwOFmJNLCuuzD3EKMHBrCTCK7UOKMSbklhZlVqUH19U mpNafIhRmoNFSZz3QKt1oJBAemJJanZqakFqEUyWiYNTqoGR+Rwv5+ZlxvzvTAPLK3Vrl0c/ rzrmE9PAKTThhPgLDRbpzPcM7jL8i3/1HeU89+XTknXzvGpkF92Ounj4clB2zZIkHaao81vs Lt80ML4qtv9p789/VgLdSz3+M9dXnY3Tb7n7kl/2p76PPeeFsOdT7JkvRkbsP7XLoT/q1dlr xpw784vj1k5QYinOSDTUYi4qTgQAVn4lhgMCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140714_041859_198993_63193D19 X-CRM114-Status: GOOD ( 10.30 ) X-Spam-Score: -5.0 (-----) Cc: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 The register of the CPB limits the size. The max size is 4M, so it is more reasonable. Signed-off-by: panpan liu --- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) mode change 100644 => 100755 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c -- 1.7.9.5 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c old mode 100644 new mode 100755 index 0bae907..70b9458 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -413,7 +413,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) int ret = 0; struct s5p_mfc_fmt *fmt; struct v4l2_pix_format_mplane *pix_mp; - + struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size; + mfc_debug_enter(); ret = vidioc_try_fmt(file, priv, f); pix_mp = &f->fmt.pix_mp; @@ -466,11 +467,13 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); pix_mp->height = 0; pix_mp->width = 0; - if (pix_mp->plane_fmt[0].sizeimage) - ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; - else + if (pix_mp->plane_fmt[0].sizeimage == 0) pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = DEF_CPB_SIZE; + else if(pix_mp->plane_fmt[0].sizeimage > buf_size->cpb) + ctx->dec_src_buf_size = buf_size->cpb; + else + ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; pix_mp->plane_fmt[0].bytesperline = 0; ctx->state = MFCINST_INIT; out: