Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1578079pxj; Fri, 4 Jun 2021 19:31:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzEeHW0E94RTNIaP5mfpTw0gtyEWjWquqviAVc+vyvjJM+dLxFyMsdnL/U5dlY5SlyFW3w X-Received: by 2002:a17:906:2419:: with SMTP id z25mr7252325eja.343.1622860307627; Fri, 04 Jun 2021 19:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622860307; cv=none; d=google.com; s=arc-20160816; b=g0Hhk0cvaeDrttsSjxdTgJgavDvsJVLuhDQnkOo8Hy0EYiS+1TXBru1WC0ms4ZbusW ClPX+kw/tS9JahjlWpIdwR9kExjoZBxAzmR6jbZvrpHhCDtIs95xq4GhFs7+GdK9SI0T +zxKUR4OWtOqrMu7CtgK64533/Y8NAvVxxUcHBMflxjCfMTGvNzzVAxdlm7oHVB8kB67 cZ75SdLPJZewEIsCbEZ26slZyTNK1JADOfNj39zkG8uMou5MJ6Z7nXSbgc/PId2Gr9gr Ld8+q16sjZWRaXDYu3u6bVThwp5mP2JiCmfhVLgfGj7hqkoU9v/Y+j2ZFqjTNmHZjg9N dVxA== 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=Pwtn/HJXjRBbTjzM3yC1/4zYGE5a02JWMBCioANy/B0=; b=ObbSvEbVI/hcQgUwpnaximUyfnXfnM2FZ/nCgXdSIemX6vh7OqWlqbs2EvgudAn7Ga llCHbd7ezjHxyGvX6UlmJMlvZYuIjExY4Q1gzgKnr6IUwJUkE4oRsKkns8ivbYnQsz+f EbZPxYe1N8IM0Suub/Mt3k/6Mb7naC5+C7eiO8iRb/8gCccn33VZws11dEU+dVKlX9jv bthbHG7uKVr0w3cBjECr1tZTKMIv/QkWS8+Ge+EgkW/9OlcwACK08GBvIbJ9SiXB5eNx Mhq7ES2VRZbFwJMsM2KtAIZhX0uewLecEG937QsfB43l8oaLnqA5O7Fvttu/sOGUUKIE umzg== 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 c16si6527979edw.128.2021.06.04.19.31.25; Fri, 04 Jun 2021 19:31:47 -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 S231530AbhFECbS (ORCPT + 99 others); Fri, 4 Jun 2021 22:31:18 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:37538 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230169AbhFECbR (ORCPT ); Fri, 4 Jun 2021 22:31:17 -0400 X-UUID: f9d9df33227547b2806ad0992ecebcd4-20210605 X-UUID: f9d9df33227547b2806ad0992ecebcd4-20210605 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 750112557; Sat, 05 Jun 2021 10:29:26 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 5 Jun 2021 10:29:25 +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; Sat, 5 Jun 2021 10:29:24 +0800 From: Irui Wang To: Alexandre Courbot , Hans Verkuil , Tzung-Bi Shih , Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tomasz Figa , Yong Wu CC: Hsin-Yi Wang , Maoguang Meng , Longfei Wang , Yunfei Dong , Fritz Koenig , Irui Wang , , , , , , , Subject: [PATCH v5,1/6] media: mtk-vcodec: venc: remove redundant code Date: Sat, 5 Jun 2021 10:29:13 +0800 Message-ID: <20210605022918.4213-2-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210605022918.4213-1-irui.wang@mediatek.com> References: <20210605022918.4213-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 Signed-off-by: Irui Wang --- .../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.18.0