From patchwork Mon Apr 12 12:45:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 12197963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9B6FC43603 for ; Mon, 12 Apr 2021 12:46:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A4F361350 for ; Mon, 12 Apr 2021 12:46:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A4F361350 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HQw2KKfx7mQkABTBCelOYuDWwjUmq1ZTJt5Xc7M3eIM=; b=KMk955Jcu+BrEWdMfeiUWBbb9 rmDS/YLFwbZ+Gu81Hrt3l7B4vqFnzgu1kIFPOcIFoVhPugK45mVtEpDRn3gDmfGnoVWRnqbE96pd7 0mctaQu3KVIg82p5DVXPPOB7QypVstPw3npMF4zaE/Q6XNkKCfN1b8CYkvmNX3zUiABLZZ7Jp4Jh+ SYRA/R+RcH+TklEr4vSwJOyjERlHCFJTBqdBI/4tN7Fkl1qGxyndlTdI9004FjGfNXqi4IcZWiUHd 5mQ9yX2EEMcI2ozYv79PbFYp+J54DKRf2ugOPogMgj7qNE3uGuaI/UTGcBeT5bAfQrA3TCGrqvy/x zvd3ww3Kw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxF-006jVj-J0; Mon, 12 Apr 2021 12:46:13 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxD-006jUt-C9; Mon, 12 Apr 2021 12:46:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Sa9Q96t18yBT/AJIm+DoU/yHlnH+BC5fArmV0BzNcZw=; b=IWgoDPMpRiQziyyDBeO0dMncC7 ATyR1AOKTs0AiIv2lIFanzBjkCGb3T1obv1lzrkjtYpZHWwCBJ1O5ZWmW7MDrqgktWpM4gbAd1Emh pGQejqhOqB9/LaAzPRsy9xGcse7hQZESM9HFt36w6dLyoYGd+78Bit/l7I9Ik509uOGiE/LwoL3oR UFLptxv+2DfS8WyhNEe8rKe1vh6sYNYG+OILcDKxBz2uf2mJ3sa/RqnQK3ZDUithgmGZoYWGDaLkc uFRPrTRdJ6nAhSxQfZ5GfYvSgNeySwZB3V+5GYISv4QiUNDn3xl3TfvT6JK0u3eUZdY5gJnOjNnp4 pkvIggvA==; Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVvxA-006EOV-SQ; Mon, 12 Apr 2021 12:46:10 +0000 X-UUID: 2f0dcd809797422eb5405ae5a7778246-20210412 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Sa9Q96t18yBT/AJIm+DoU/yHlnH+BC5fArmV0BzNcZw=; b=b2Oa7xR/5V8WnIhjd9JyWqOz4PBtZC/W46nKATJGqJuiOOo6YbQLwiu0vHJ3wh9vSClOZnaoIHXZ8pyxMS7A3tqIzY+fBaIHQa2sz+Ui/G/SxHp7pacBgR+yTeiIz/LRMOw+9w54pPTIxOp/84z/xObTjLOz1P5XaZK41UiWuNo=; X-UUID: 2f0dcd809797422eb5405ae5a7778246-20210412 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1842161867; Mon, 12 Apr 2021 05:46:08 -0700 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 05:46:05 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 20:46:04 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 20:46:02 +0800 From: Irui Wang To: Alexandre Courbot , Hans Verkuil , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger CC: Tiffany Lin , Fritz Koenig , Tzung-Bi Shih , Maoguang Meng , Longfei Wang , Yunfei Dong , Irui Wang , , , , , , , Subject: [PATCH v3,1/6] media: mtk-vcodec: venc: remove redundant code Date: Mon, 12 Apr 2021 20:45:50 +0800 Message-ID: <20210412124555.26897-2-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210412124555.26897-1-irui.wang@mediatek.com> References: <20210412124555.26897-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_054608_946108_AD474C4D X-CRM114-Status: GOOD ( 13.03 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Alexandre Courbot vidioc_try_fmt() does clamp height and width when called on the OUTPUT queue, so clamping them prior to calling this function is redundant. Set the queue's parameters after calling vidioc_try_fmt() so we can use the values it computed. Signed-off-by: Alexandre Courbot --- .../media/platform/mtk-vcodec/mtk_vcodec_enc.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 4831052f475d..42ff13867940 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -443,7 +443,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, struct mtk_q_data *q_data; int ret, i; const struct mtk_video_fmt *fmt; - struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) { @@ -468,20 +467,13 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, f->fmt.pix.pixelformat = fmt->fourcc; } - pix_fmt_mp->height = clamp(pix_fmt_mp->height, - MTK_VENC_MIN_H, - MTK_VENC_MAX_H); - pix_fmt_mp->width = clamp(pix_fmt_mp->width, - MTK_VENC_MIN_W, - MTK_VENC_MAX_W); - - q_data->visible_width = f->fmt.pix_mp.width; - q_data->visible_height = f->fmt.pix_mp.height; - q_data->fmt = fmt; - ret = vidioc_try_fmt(f, q_data->fmt); + ret = vidioc_try_fmt(f, fmt); if (ret) return ret; + q_data->fmt = fmt; + q_data->visible_width = f->fmt.pix_mp.width; + q_data->visible_height = f->fmt.pix_mp.height; q_data->coded_width = f->fmt.pix_mp.width; q_data->coded_height = f->fmt.pix_mp.height;