From patchwork Tue Jul 21 07:45:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11675171 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21B8E138A for ; Tue, 21 Jul 2020 07:54:24 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 EEA0A208E4 for ; Tue, 21 Jul 2020 07:54:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="byck98cZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eropNhXc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEA0A208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qscxhRxbbj/nNUc1rSYuYdvKF4N4eVxMmqblO4h1Qx4=; b=byck98cZJwgDGvPJos8Uo9trwT ZVbd65G6JlRWEjn8q8uCToBxKeY1SEFIoTf9Rxk22TOU9AwHUAKzuYleG3lbBz2sMZheOJraukj9b pYeo/SWblTP6URSKQUv0q8Hr2P6rd7yiFTP1B1qQCPfv/hru8On4Su9xflwdYA2GPQs3/rHq4+nFM 07gYSFaHVTcItWuIuOO2rRAwDG8HmHbz1KYvVQLWYlYCM72YsNOKFax93IGhrmgCI86PXZKj4cEXv 32hDvk/09s6V1o3qvI6HbXJgN8t4e+oKVMnfrU2ufGK8nFzV1j6Jtte34Illv6DJ4EJKyTnZBazpE c2aEf0fQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxn4w-0004OZ-Rs; Tue, 21 Jul 2020 07:52:47 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxn4F-00046e-Hr for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2020 07:52:12 +0000 Received: by mail-lj1-x241.google.com with SMTP id q4so23098753lji.2 for ; Tue, 21 Jul 2020 00:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=d9a11gSXF5aVoEa1FEdqJhsu8ltL0Y4i64DGKwbk0NU=; b=eropNhXcr1qmSYp6MQSQH8SCCY9dO21OxwiQ1/J5Y5LeR7u3hA5MH8oE+cYQPI6DVx TYPSiUAy6Ut8hNsBEK92cXQWOa7Qq2i3XhtWkmNnbPHJ5EELeGDeQo8oR5J32k7XsHzH Zuk7Ak/5185SPlLvApm6s7jqjR1S90ixhxS8ZWZP4zfwFB2/iNcJAlSgvd+wldPaTFrh xv7PLeMbdMhmTrMAhxApSs7SXeRNq1tqkXlqExCp0HynF1VYnWCfP1FvDk1YMTmbt9Fv Y1f5fN/aGalPdqnJbP60drYGsFWFUP8z19AohHcccJu7jCHmo7sTX87wqN4qh4z7jsyD GU5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d9a11gSXF5aVoEa1FEdqJhsu8ltL0Y4i64DGKwbk0NU=; b=ZgwDB3iYL4H2B4YjqeyOtJ65Tmm4nq2nsjpU2QMhiO9t/3v0n2ZHfJyozYJGOCMHvO dpk0hZqFlMlwgv2pWGQqDOamDom0V0QvlC+uDFCalfy6G/S9k0C4x9z2au9yQFw3xp7l phcCW/7jCY9m8uNxFSD2i5ErYyl74w343IwQJomB9HXSjUwtlywWQjLaGwfP+hVHhAOF NJ6v+CUFeW5HiVITsFu/5V0X60y1gsT9qB6fjBZbof/DON3WL9+Rj1w6CxDZpW5vORSw Xw0mCdIUGIXlMtfhWf9GGcAqYFlcXsVDBoEQAqqfuZLyeuNzxpGIMRdiKixmuH0mShn1 3byw== X-Gm-Message-State: AOAM532XmfVCkR8CoH2dSkrxUHvWE13TZ2ir1yspbqH8P8mpq9Qse5Rr RbDAl+4at/Pj68VTBM3ExAovOw== X-Google-Smtp-Source: ABdhPJwf++3Kb/qsnwkDB7Vlea/x6zdJgR3gAfbfKNoqAwCOXuARDIJT4I0s9DJZnJNfkqzUYlUbEw== X-Received: by 2002:a2e:9397:: with SMTP id g23mr13075463ljh.185.1595317921844; Tue, 21 Jul 2020 00:52:01 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id d2sm4045334ljg.6.2020.07.21.00.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 00:52:01 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/6] venus: venc: Add support for frame-skip mode v4l2 control Date: Tue, 21 Jul 2020 10:45:36 +0300 Message-Id: <20200721074538.505-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200721074538.505-1-stanimir.varbanov@linaro.org> References: <20200721074538.505-1-stanimir.varbanov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_035203_775961_CD164DE4 X-CRM114-Status: GOOD ( 14.49 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:241 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maheshwar Ajja , Andrzej Hajda , Kamil Debski , Nicolas Dufresne , Jeongtae Park , Kyungmin Park , Stanimir Varbanov , Mauro Carvalho Chehab , Ezequiel Garcia MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This adds support for frame-skip-mode standard v4l2 control in encoder driver. The control is implemented based on the combination of client selected bitrate-mode and frame-skip-mode. Once The client selected bitrate-mode (constant or variable) and the frame-skip-mode is not disabled we set variable framerate for rate controller. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/venc.c | 6 ++++-- drivers/media/platform/qcom/venus/venc_ctrls.c | 12 +++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 1bac30d4cf50..72e171ee05a8 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -202,6 +202,7 @@ struct venc_controls { u32 bitrate_peak; u32 rc_enable; u32 const_quality; + u32 frame_skip_mode; u32 h264_i_period; u32 h264_entropy_mode; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 4c30c3f3369e..e4bbaae9975a 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -739,9 +739,11 @@ static int venc_set_properties(struct venus_inst *inst) if (!ctr->rc_enable) rate_control = HFI_RATE_CONTROL_OFF; else if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) - rate_control = HFI_RATE_CONTROL_VBR_CFR; + rate_control = ctr->frame_skip_mode ? HFI_RATE_CONTROL_VBR_VFR : + HFI_RATE_CONTROL_VBR_CFR; else if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) - rate_control = HFI_RATE_CONTROL_CBR_CFR; + rate_control = ctr->frame_skip_mode ? HFI_RATE_CONTROL_CBR_VFR : + HFI_RATE_CONTROL_CBR_CFR; else if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CQ) rate_control = HFI_RATE_CONTROL_CQ; diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 97a1e821c07e..440878928ab1 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -205,6 +205,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY: ctr->const_quality = ctrl->val; break; + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: + ctr->frame_skip_mode = ctrl->val; + break; default: return -EINVAL; } @@ -220,7 +223,7 @@ int venc_ctrl_init(struct venus_inst *inst) { int ret; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 32); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 33); if (ret) return ret; @@ -363,6 +366,13 @@ int venc_ctrl_init(struct venus_inst *inst) v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY, 0, 100, 1, 0); + v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops, + V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE, + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT, + ~((1 << V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED) | + (1 << V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT)), + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED); + ret = inst->ctrl_handler.error; if (ret) goto err;