Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1740587pxb; Mon, 12 Apr 2021 05:47:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAK3UpzbsVzjk4J0VnAGe1jPitAtAQgMGZuAM/96D6hnTr/kAb1BgUMl4kadYx90Z14LLy X-Received: by 2002:aa7:d2da:: with SMTP id k26mr16114469edr.156.1618231654209; Mon, 12 Apr 2021 05:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618231654; cv=none; d=google.com; s=arc-20160816; b=bQrG2/nLoUxjuQ+Ln3/q9cS5Q5W2qnsdcEGYHF4lBoJ3S6gLWIBGUVNHqsOWjt+x0r ZKveumK+e82/x5LkP7jmySFjJqPY6FnzdVT0n3QGzspQXZTGo4HThs8wMWac7xNretsA 7HsTUgBCuS6/OOy3raGbjUI7ra5Kns9eQq6Edgk/P1yoKWW5k3iQ/991K+2dBWZUNlNO p9vZ6CsXM5NPSy4vxKXtGaZ5lKOzyCmuk0vc5ucQjIwGiZ4nUPefeMv00On9QTadHIWe bP28OFxIFUjVaaCLu9U3cbdmBvjp+Niki+2f1QnF+ioUAf9xhJcspPv8J39Xy6JeIn7P LAAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=9/2Swut7uY4nbrWHJoKWLSy2plqYMvikKxNTHvFU/Nw=; b=fHbnoDf5r7mlrNgZtMof8d2ROzBUeI4ed9W8h3lU09xjnzI79MoUv6lF1HC0JphH4q Z07pWP9Z3icGfB4402GZyjbOaCkdgOZ8TWo7ZrzY+DkaI7ZtuWJDP/FaRsULjmPOHUZo Q8hsDMPwAi0+P7xvOMR2rwtACTRwRFIPmf6H5MXxZydqgEy32OPTNq+/EvlMGqyAlumM AzOJEd2rzWO1Kada7GQ4e5wF8h+6MSGXcWx/1B0nYL7HvsfoZTAFfTSZgvII7zOgy5Tl UzFH7AcGwQHKBg/4HXa1PeRMzP3zbiiQtnlk/3U9jU69M8AHeBQBwW6IyB2pQpPCVeFw g1Sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz11si8021031ejc.745.2021.04.12.05.47.11; Mon, 12 Apr 2021 05:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241270AbhDLMq0 (ORCPT + 99 others); Mon, 12 Apr 2021 08:46:26 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:33814 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S237283AbhDLMq0 (ORCPT ); Mon, 12 Apr 2021 08:46:26 -0400 X-UUID: 085ae5c250dd4cd09bb22d5615847105-20210412 X-UUID: 085ae5c250dd4cd09bb22d5615847105-20210412 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 873425032; Mon, 12 Apr 2021 20:46:05 +0800 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 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; -- 2.25.1