From patchwork Mon Jul 20 13:23:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 237045 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1978676ilg; Mon, 20 Jul 2020 06:24:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxo/em8azwBIeFx8EWXvie2VlO1IdG4qSQnDfS1lgkXPlgx9T4PhRyvSwtiMJBDpGbnnxP X-Received: by 2002:a17:906:26d6:: with SMTP id u22mr21690699ejc.271.1595251454809; Mon, 20 Jul 2020 06:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595251454; cv=none; d=google.com; s=arc-20160816; b=RtqJPVm2YbLCPPy9anhR3m0fUenCr+AH8hDjhd0P7rN5+LT83kB41L2yIY7Wf+M46c aBhx2DOTUW+FC9JpUU2Z2k+AX7fwinl3HpcBq62M3Rs1Idlu70cik+BFlb7btLmGKn/f Z9a34xfE86UojNNEiKXmBGsYwZ050u7x8GRxNzc9/tsRq6WRrfe9sbrG6VNecabcrjSp 9413gnqr6VBN6x8m5tgwQSLWnAimoGexJkaSjtercUV9Ok3gLU04MIYeRAWieLOz4ntv v1tYe+TeZPyAUDe+/mOEvaz2odPNT8oinxAtBrbey463IWK8n8vmB+3UBaTleyhYftFL GYFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=BEn8b19KNXeg8BFW/3OCgXOCsWUTohzxaH9qqztvhnA=; b=MDXF9w9RGobdiLEttcLGoLPOyPE82MECdiGMKaVGF01E3z2PmbyclrEUrqAhd2Hs+A Haw6XYGvPH8BXIGmROXmxRbUPInFKijAoXMfPw9QBBXdr0hv51hzP5MkRv74PQsL93Ae FLX9Dxe9e3qjkg1ner4dZfyHOjuQsfr0LGgK4ZwfNSHxls9KAG4xbzimwRo5J6zgDWkO i6BJoI5Z82ucBzhAWhQU9B924ebwqw4nHQIcx+NhlMHfMx76LeWijyqutIMs3AFYAL1h Libt3AKzpj4kC077gicvZGn+XYL8kjj9k136spREkCGgmjk+iZ0a4TXC/ltXdpTJFGFS r7XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CIw7Kr4J; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si10668219eji.501.2020.07.20.06.24.14; Mon, 20 Jul 2020 06:24:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CIw7Kr4J; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728182AbgGTNYO (ORCPT + 15 others); Mon, 20 Jul 2020 09:24:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726782AbgGTNYN (ORCPT ); Mon, 20 Jul 2020 09:24:13 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E31E6C0619D2 for ; Mon, 20 Jul 2020 06:24:12 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id k13so725306lfo.0 for ; Mon, 20 Jul 2020 06:24:12 -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=BEn8b19KNXeg8BFW/3OCgXOCsWUTohzxaH9qqztvhnA=; b=CIw7Kr4JtLkyvV0dl204XhbNYAfTMVrKzFJl3Lw2jjNU8u+uwKAPhn1po8GrGaeaog 1l1O7/OOF7433cWd/EdEBHRzVqbJNwG+lYd41oXrhduywn/HpYL6OaCiknpw1DGxsTNg VC0pRGaaptJbwDUfJ5gwl9AM2XmAYFEDtGIEKHYHQtKVvsjQlxmAEWMHXbA6wpduqfBm NroLGPjfFqRhO4VoHiVtVEccBIIdfH4L2VCZiGcgdNXmuI/GWBqqW2xTc+U1OT4K/tc5 7bNNEocdH8YWUJum2f5ARusglDb7ujbM3rBaDQbtvezoJfwr3WeDoQ1LX7VQT/GlM6BQ Q2Pg== 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=BEn8b19KNXeg8BFW/3OCgXOCsWUTohzxaH9qqztvhnA=; b=MVAu3jl0pAOCc7ObH8WDL5LZK7K/Ph6Zb6JSifao873H3xOyZCYh4Oq3/oTGbHKkbk 9BKsWBmvyES3JV/ibVY+DgWXOfPD46spnkhKhI88Em0A9CW94ekFQqpETy3YyDvOX8th oYFRND0Ucm02VVZemIvxNhU/tTql9LNZytHgHcHKYJUuF6FgiWJ9TVjGqZq80FX8AbOg YXOCCsqYB7/TQKNp/Q0jiQJuZA0Q/S4A8b3pqGXF97ds307mXW0fQBXAn3zsuJWywos7 w/z5dyYoK0AEtQnp2ghX/pJLpQWh2Mes+HKRzn7yT3utusERyR08/NiM84k4P0sSxNq/ P5YQ== X-Gm-Message-State: AOAM5305XynR40dPlXHmwsUoqcOWkatCdfqcAzqS5cir26FfO0GfUEnT WGAfZKSuBct2vAcG1ZD4rQs5Uw== X-Received: by 2002:ac2:4550:: with SMTP id j16mr10846655lfm.37.1595251451216; Mon, 20 Jul 2020 06:24:11 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id h6sm867829lfc.84.2020.07.20.06.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 06:24:10 -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 Cc: Mauro Carvalho Chehab , Hans Verkuil , Kyungmin Park , Kamil Debski , Jeongtae Park , Andrzej Hajda , Ezequiel Garcia , Philipp Zabel , Maheshwar Ajja , Stanimir Varbanov Subject: [PATCH 4/6] venus: venc: Add support for frame-skip mode v4l2 control Date: Mon, 20 Jul 2020 16:23:11 +0300 Message-Id: <20200720132313.4810-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200720132313.4810-1-stanimir.varbanov@linaro.org> References: <20200720132313.4810-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.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 | 11 ++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) -- 2.17.1 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..4ac8da2ad061 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -204,6 +204,8 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) break; case V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY: ctr->const_quality = ctrl->val; + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: + ctr->frame_skip_mode = ctrl->val; break; default: return -EINVAL; @@ -220,7 +222,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 +365,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;