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: 245434 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2689880ilg; Tue, 21 Jul 2020 00:52:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyg8Ec5x4Fk5+ncT+WSBV6/Kd4X4VgS7TXLUDCMGLKrQhwopfyyuDPQV6DFmyy7XkY8BxzU X-Received: by 2002:a05:6402:2064:: with SMTP id bd4mr24319278edb.180.1595317926800; Tue, 21 Jul 2020 00:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595317926; cv=none; d=google.com; s=arc-20160816; b=AfCZpQglMrXlhpgGRwF6E+BnvBt/iG5PzJeidX9hftW1Syj18kJMiplQyTiEuF4vuH N9wQhuNrzfVS6YOuXWnBx1Ng/kpkxfL7+3TV9Yfts7bl39lT3DVrEUWDwcHDg55Cm0YL McT7LsVdjm8D3QFndvBFEBbAm7OEro76TMmjYaAXw4KFp4L63AbQLF5DQB3NNCgkfWJa IlaLK3Ad1LeLXBhtXFsptm2T9f86ETtfn5DzIQB3AAE2tGKFpIJvHuNqjtXGZiaWo6G7 a0Ls82WOvEAHtVd0C325zOPRkYuy+oZGf1x2Q2RaaHEJBklm7jrUGWwYrnYxgQAZe5a4 Xy1Q== 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=d9a11gSXF5aVoEa1FEdqJhsu8ltL0Y4i64DGKwbk0NU=; b=geks6fRCeoD+oVQWF9NxmkF/Qd3364erLuggfPn8MOC5N0uM2iJXUUT8W+iOwIU1vs MOgvpPJ4yBvgVj7yjibALclQBWelPdtjL3PdcMOBZ/wI5mA/4AH8R6o/M0YQ2c+Z7ycw zPKO3cSSjH9a640IadmL80GsCCajsTJo3zISPnri8D5GqP2TjM8rKqAocMYNV91J1d9w aVKCGDMFttTBTanZMXGVd0+LLeiGyUok8w6EAbYGx1TI0AB8azrzWQCmsTEeFLbv/3/y tTMzugpyMMgNJ5s0qeN36N1znjcwRHI2yvpVANhA8Ld0ltYW7g1NtubVcuPF8oI1hSrS +FUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eropNhXc; 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 s23si12357030eji.327.2020.07.21.00.52.06; Tue, 21 Jul 2020 00:52:06 -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=eropNhXc; 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 S1728322AbgGUHwF (ORCPT + 15 others); Tue, 21 Jul 2020 03:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728259AbgGUHwD (ORCPT ); Tue, 21 Jul 2020 03:52:03 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B323C0619D7 for ; Tue, 21 Jul 2020 00:52:03 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id q6so2017962ljp.4 for ; Tue, 21 Jul 2020 00:52:03 -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=QtW2mEza1YvuEv+9giJZkVDWhdRjEIO1BCP6NYsjIE0AhiV55KkEjwO/FdQIKsjn9o zXz25WVi79E3xR2TixDIz+8HKxPwMrQMqmGOEZG8OWdqbziy8mtxUk/TZNmGV2GtKDTU v+P08dZ13DtKKp1/ZM5yvZQ5DnA//Xo1+0fbFEckgSeyk3PF4rTYAN8oAGL1ERO3jQJ8 ye6sqx+0tERXQhFljaCjSkDATZGHVKAj28W8MXEPN3Q3uXIW/Ykjp/8H5mfsprXWbmnG 8zQY1ZoLCA4sZ/ySKvJ+x4LDl0SCu1N+ibNSSfaZs9AhDeshAh69JgV5qUO4XSDrixkT WjNg== X-Gm-Message-State: AOAM531v3vKfawSDMF1hwJlgy6cSH5coS8fofpip9MskBxkVvRfqWl/0 z4lP8u1TEOhuy+KyeQ5s0zbU/w== 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 Cc: Mauro Carvalho Chehab , Kyungmin Park , Kamil Debski , Jeongtae Park , Andrzej Hajda , Ezequiel Garcia , Maheshwar Ajja , Nicolas Dufresne , Stanimir Varbanov 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> 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 | 12 +++++++++++- 3 files changed, 16 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..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;