From patchwork Wed Jul 13 08:05:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "tiffany.lin" X-Patchwork-Id: 9227047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E7256075D for ; Wed, 13 Jul 2016 08:05:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FCA6223B3 for ; Wed, 13 Jul 2016 08:05:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 838E527D5D; Wed, 13 Jul 2016 08:05:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07ACA223B3 for ; Wed, 13 Jul 2016 08:05:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bNFB7-00078y-Fm; Wed, 13 Jul 2016 08:05:57 +0000 Received: from [210.61.82.184] (helo=mailgw02.mediatek.com) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bNFB5-0006jl-68 for linux-mediatek@lists.infradead.org; Wed, 13 Jul 2016 08:05:56 +0000 Received: from mtkhts07.mediatek.inc [(172.21.101.69)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 964931746; Wed, 13 Jul 2016 16:05:31 +0800 Received: from localhost.localdomain (10.21.14.115) by mtkhts07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Wed, 13 Jul 2016 16:05:29 +0800 From: Tiffany Lin To: Hans Verkuil , Mauro Carvalho Chehab , Matthias Brugger , Daniel Kurtz , Pawel Osciak Subject: [PATCH] [media] mtk-vcodec: fix default OUTPUT buffer size Date: Wed, 13 Jul 2016 16:05:23 +0800 Message-ID: <1468397123-9808-1-git-send-email-tiffany.lin@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160713_010555_411283_DD531FD1 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tiffany Lin , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Yingjoe Chen , Eddie Huang , linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When calculate OUTPUT buffer size in vidioc_try_fmt, it will add more size hw need in each plane. But in mtk_vcodec_enc_set_default_params, it do not add same size in each plane. This makes v4l2-compliance test fail. This patch fix the issue. Signed-off-by: Tiffany Lin --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 907a6d1..3ed3f2d 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -328,10 +328,11 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct mtk_video_fmt *fmt) pix_fmt_mp->height += 32; mtk_v4l2_debug(0, - "before resize width=%d, height=%d, after resize width=%d, height=%d, sizeimage=%d", + "before resize width=%d, height=%d, after resize width=%d, height=%d, sizeimage=%d %d", tmp_w, tmp_h, pix_fmt_mp->width, pix_fmt_mp->height, - pix_fmt_mp->width * pix_fmt_mp->height); + pix_fmt_mp->plane_fmt[0].sizeimage, + pix_fmt_mp->plane_fmt[1].sizeimage); pix_fmt_mp->num_planes = fmt->num_planes; pix_fmt_mp->plane_fmt[0].sizeimage = @@ -1166,9 +1167,13 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx) (q_data->coded_height + 32) <= MTK_VENC_MAX_H) q_data->coded_height += 32; - q_data->sizeimage[0] = q_data->coded_width * q_data->coded_height; + q_data->sizeimage[0] = + q_data->coded_width * q_data->coded_height+ + ((ALIGN(q_data->coded_width, 16) * 2) * 16); q_data->bytesperline[0] = q_data->coded_width; - q_data->sizeimage[1] = q_data->sizeimage[0] / 2; + q_data->sizeimage[1] = + (q_data->coded_width * q_data->coded_height) / 2 + + (ALIGN(q_data->coded_width, 16) * 16); q_data->bytesperline[1] = q_data->coded_width; q_data = &ctx->q_data[MTK_Q_DATA_DST];