From patchwork Mon Jul 20 13:23:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 237043 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1978504ilg; Mon, 20 Jul 2020 06:24:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMzD2eS9sRw5ZVQv/rJ+FXWEbEeY+EBNzHhvg3UXAkUbTvwkkS98GuZNO+sBphrJKkp8tf X-Received: by 2002:a17:906:8316:: with SMTP id j22mr20084912ejx.97.1595251442237; Mon, 20 Jul 2020 06:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595251442; cv=none; d=google.com; s=arc-20160816; b=TnDr0gwdKRLfvXTa9c3ZDAhLikLs+KWB0VC2FyPCKc8ZsLf/E0Sjhr6FAVek2zTGXf IhBbZR2RElMDtlL7xzGSkGKzomuBGt95CRGhXDg2MYlqh5DQjcx7p46S1af1vgVAonMX z1i2cRkN5rMMp6fM7mzgw5gXJUrYzoWxwRdU97nihZbSHeLPAqwKRrJwxj1H0iseNCYV 7MKLlhMknSuK/RjmgtrktJWOFf0uhtlzi2mijHmZcZnkGPdUT2txIY+kqG+bvleasw3F ZJAnMYbafkRhssKz4KluN+C+qu/9ahJEBRc/UfWHIquwkaCp2C6dmrPxcIn9DMRHqxth bcaw== 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=UY1nsdPNSUSAf+7YLs436phqwdMpy28An6352a8KdMA=; b=KhwlbZFmnbJ32LfmQrGjfEiiitz0mHbjLNHbFn/Y8K1s6GiRtFYqyIwnNmeb8ffFht JQxi516T8h8SxJXkA8gindj6moJdkKjfhs2kF1R14/zfR+wrQ/x1eVazS6lvF3T2qSmc Ut4yPluICtqSwQbV87ie/RXqpNrE+97BMt7j1R3JZgdhyhkKCBJVIEjt3kYyUxwcXxB/ t18bIuiqHdhVhUOVOyZOGaKyJnD/9JjOoFjMom8rcnpDSCJRJosC/ijZrt/jQumRbqSs dhCIpdMohhawhLMZBVfo9xnqZRtdAEKeF1K9nat/2KOW8iVePnLjFRVn3mA1McuvGq2m Q4sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WHDkbIXS; 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 cw22si9976530ejb.61.2020.07.20.06.24.02; Mon, 20 Jul 2020 06:24:02 -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=WHDkbIXS; 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 S1728091AbgGTNYB (ORCPT + 15 others); Mon, 20 Jul 2020 09:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727062AbgGTNYB (ORCPT ); Mon, 20 Jul 2020 09:24:01 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2533C0619D2 for ; Mon, 20 Jul 2020 06:24:00 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id h22so20211045lji.9 for ; Mon, 20 Jul 2020 06:24:00 -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=UY1nsdPNSUSAf+7YLs436phqwdMpy28An6352a8KdMA=; b=WHDkbIXS1LKiXXQSdcPiZnulaypwcekKf5KQa61fI5WKRKDz+n7syHUpQsA9D1s1Rb Dl/jcNCpUoRiXIAuIPVtiv+bJNO0FLthaQIlhRVZtWebTtxRTcdNXmITs5tgDm4NpEQ3 9Ehui6uPqOsqkqEigy5DPXOd2lclWimRV5uMUTYMIku2+01GvrXZU5E27p/O56Mo+GJN WgY66eKB7fOv3pgHfKPnr7hd0HmcF7aQ75is2+3g/gM3H8KMnnZaw2TJ/Ym/aUXO8xtm +WYyQZ5EYw2Uf9Ue0sJC2mtkq5IYNZ80PYDqygrBN+YzlqQehFxss+a0GofJFuWKLgOo MyVg== 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=UY1nsdPNSUSAf+7YLs436phqwdMpy28An6352a8KdMA=; b=dJ19h9WXsPBSl9sdAdBYTlM+kflrlftKbDKZs8HPRFjE7x7uQlfPHYRo36zWFh3OBG qExoxWfmhi37A4XzXbjPyKWPIfpbck42rM/yFDvmJkWswLMAQ2Cjcm7/s6UMguLZ3uwT CY7l8rrmPQPdu829+I7efaWKI190r48nddgXvvk51h4BWzxMHo5vR6t2ze82uB1EPpV+ gw/PulFwailk58OVEKAnVZ95tyrNP3T9ZXh1L4WcGfoVnHkJ3FmjZuLsUDTet2t8Vabg iiOSH9d/HEZ4ruiP0vPVFGFh3vmDwacQ99ezkNrjRSyxBCp3yij9Kqayjen2OGQc/2e4 4ejg== X-Gm-Message-State: AOAM531WyKCojpvDaEDaIXwqCyQLfyF7oKkLLos35bGLSXEwsnovCpr6 qA1bVKwF8/Sbj1AvJQ6d7LeGgg== X-Received: by 2002:a2e:7a03:: with SMTP id v3mr11175750ljc.141.1595251439058; Mon, 20 Jul 2020 06:23:59 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id h6sm867829lfc.84.2020.07.20.06.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 06:23:58 -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 2/6] venus: venc: Add support for constant quality control Date: Mon, 20 Jul 2020 16:23:09 +0300 Message-Id: <20200720132313.4810-3-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 Adds implementation of V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY v4l control when the bitrate mode is CQ. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/hfi_cmds.c | 37 ++++++++++++++++++- .../media/platform/qcom/venus/hfi_helper.h | 10 ++++- drivers/media/platform/qcom/venus/venc.c | 14 ++++++- .../media/platform/qcom/venus/venc_ctrls.c | 8 +++- 5 files changed, 66 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 7118612673c9..1bac30d4cf50 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -201,6 +201,7 @@ struct venc_controls { u32 bitrate; u32 bitrate_peak; u32 rc_enable; + u32 const_quality; u32 h264_i_period; u32 h264_entropy_mode; diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index c67e412f8201..7022368c1e63 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -640,6 +640,7 @@ static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt, case HFI_RATE_CONTROL_CBR_VFR: case HFI_RATE_CONTROL_VBR_CFR: case HFI_RATE_CONTROL_VBR_VFR: + case HFI_RATE_CONTROL_CQ: break; default: ret = -EINVAL; @@ -1218,6 +1219,37 @@ pkt_session_set_property_4xx(struct hfi_session_set_property_pkt *pkt, return 0; } +static int +pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt, + void *cookie, u32 ptype, void *pdata) +{ + void *prop_data; + + if (!pkt || !cookie || !pdata) + return -EINVAL; + + prop_data = &pkt->data[1]; + + pkt->shdr.hdr.size = sizeof(*pkt); + pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY; + pkt->shdr.session_id = hash32_ptr(cookie); + pkt->num_properties = 1; + pkt->data[0] = ptype; + + switch (ptype) { + case HFI_PROPERTY_CONFIG_HEIC_FRAME_QUALITY: { + struct hfi_heic_frame_quality *in = pdata, *cq = prop_data; + + cq->frame_quality = in->frame_quality; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cq); + break; + } default: + return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata); + } + + return 0; +} + int pkt_session_get_property(struct hfi_session_get_property_pkt *pkt, void *cookie, u32 ptype) { @@ -1236,7 +1268,10 @@ int pkt_session_set_property(struct hfi_session_set_property_pkt *pkt, if (hfi_ver == HFI_VERSION_3XX) return pkt_session_set_property_3xx(pkt, cookie, ptype, pdata); - return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata); + if (hfi_ver == HFI_VERSION_4XX) + return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata); + + return pkt_session_set_property_6xx(pkt, cookie, ptype, pdata); } void pkt_set_version(enum hfi_version version) diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index f6613df1d16b..758c70ac26fd 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -231,6 +231,7 @@ #define HFI_RATE_CONTROL_VBR_CFR 0x1000003 #define HFI_RATE_CONTROL_CBR_VFR 0x1000004 #define HFI_RATE_CONTROL_CBR_CFR 0x1000005 +#define HFI_RATE_CONTROL_CQ 0x1000008 #define HFI_VIDEO_CODEC_H264 0x00000002 #define HFI_VIDEO_CODEC_H263 0x00000004 @@ -504,6 +505,7 @@ #define HFI_PROPERTY_CONFIG_VENC_HIER_P_ENH_LAYER 0x200600b #define HFI_PROPERTY_CONFIG_VENC_LTRPERIOD 0x200600c #define HFI_PROPERTY_CONFIG_VENC_PERF_MODE 0x200600e +#define HFI_PROPERTY_CONFIG_HEIC_FRAME_QUALITY 0x2006014 /* * HFI_PROPERTY_PARAM_VPE_COMMON_START @@ -520,7 +522,8 @@ enum hfi_version { HFI_VERSION_1XX, HFI_VERSION_3XX, - HFI_VERSION_4XX + HFI_VERSION_4XX, + HFI_VERSION_6XX, }; struct hfi_buffer_info { @@ -725,6 +728,11 @@ struct hfi_quality_vs_speed { u32 quality_vs_speed; }; +struct hfi_heic_frame_quality { + u32 frame_quality; + u32 reserved[3]; +}; + struct hfi_quantization { u32 qp_i; u32 qp_p; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 513bbc07f7bc..4c30c3f3369e 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -740,14 +740,26 @@ static int venc_set_properties(struct venus_inst *inst) rate_control = HFI_RATE_CONTROL_OFF; else if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) rate_control = HFI_RATE_CONTROL_VBR_CFR; - else + else if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) rate_control = HFI_RATE_CONTROL_CBR_CFR; + else if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CQ) + rate_control = HFI_RATE_CONTROL_CQ; ptype = HFI_PROPERTY_PARAM_VENC_RATE_CONTROL; ret = hfi_session_set_property(inst, ptype, &rate_control); if (ret) return ret; + if (rate_control == HFI_RATE_CONTROL_CQ && ctr->const_quality) { + struct hfi_heic_frame_quality quality = {}; + + ptype = HFI_PROPERTY_CONFIG_HEIC_FRAME_QUALITY; + quality.frame_quality = ctr->const_quality; + ret = hfi_session_set_property(inst, ptype, &quality); + if (ret) + return ret; + } + if (!ctr->bitrate) bitrate = 64000; else diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 8362dde7949e..97a1e821c07e 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -202,6 +202,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: ctr->rc_enable = ctrl->val; break; + case V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY: + ctr->const_quality = ctrl->val; + break; default: return -EINVAL; } @@ -217,7 +220,7 @@ int venc_ctrl_init(struct venus_inst *inst) { int ret; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 31); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 32); if (ret) return ret; @@ -357,6 +360,9 @@ int venc_ctrl_init(struct venus_inst *inst) v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE, 0, 1, 1, 1); + v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, + V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY, 0, 100, 1, 0); + ret = inst->ctrl_handler.error; if (ret) goto err; From patchwork Mon Jul 20 13:23:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 237044 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1978576ilg; Mon, 20 Jul 2020 06:24:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0yOuFZvcla0q2zVnAKCY8SMJl8YdHhvSqzWvyJN5CSb4dn9qCI7VgtM7SuGjC2tEK6YVf X-Received: by 2002:a17:906:a0c8:: with SMTP id bh8mr21653216ejb.190.1595251447781; Mon, 20 Jul 2020 06:24:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595251447; cv=none; d=google.com; s=arc-20160816; b=0RaaWiOUE5KR+qc3d/Md2LAe3WZe6FMhlJfYAy/D4MQxJql9s9vGxBJtRNwa5VqLpe ni1yXl0vp2BMoPnzJG02fXfItsmuMOOaWiMYXSdxqqj0sHxuq5punt9l9jAMYDhIspVX O824pknTx+CGV2gPNAB6NZnOal2+7oDO/hO9smaeJy+gloZQmc3ivvU+6l12Cb+MtrG+ 3Qs34+2k68NulWfQKCHpN65zsuKylCiDMi+NfjGjYkxwZfVeINn3PU1ElnRhEc3B1DsM JFPfSomHfIn0KP+/EiHVvZ60w/AiY3tLg6SJWY4CISd/Dc/WutFMIChu9pgq3Ca9p67A dDzg== 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=MqUU4NwcPoS5ZN35RvVZCwFe9U5tn/4+nbmkAYnncfM=; b=cd94REVI8q+1STuG46hrVtu7OyXFCSd/F7MIP/zm0o03NHecD97mPoZBsx7zcXmqvG 0clhu5zF+fPC+4hxqWxurJR25LIJzoxSkSJiTDw02flMR9lZcenmS5hLUcz0EuTn4JwN H0jzKZx+RQiU7rRZ6Af/tno8Q9c4qjKJlbyN1FEM6PuYAj/2BvpF3JLZKSUjB2fWVyti MWMPKxhzE32HP/rA9ISBolwbIBXzPmvaCXwCo+CjxofNZwOQ12AcIBQJ8KI9ZyvYgKlD ZjQPK5ChlHtbQG1v/qtWhdbY1EJw9yoNLNkG8bqqQJslS5vLxak5zci3u2l82Yqq+WZ2 lO3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PX9OEKkp; 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 co20si10320024edb.131.2020.07.20.06.24.07; Mon, 20 Jul 2020 06:24:07 -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=PX9OEKkp; 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 S1728151AbgGTNYH (ORCPT + 15 others); Mon, 20 Jul 2020 09:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgGTNYG (ORCPT ); Mon, 20 Jul 2020 09:24:06 -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 05010C061794 for ; Mon, 20 Jul 2020 06:24:06 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id f5so20200071ljj.10 for ; Mon, 20 Jul 2020 06:24:05 -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=MqUU4NwcPoS5ZN35RvVZCwFe9U5tn/4+nbmkAYnncfM=; b=PX9OEKkpI/jtSn3vID9ulI98KVskkSEehSSFoiChH9W5domW5LwSB3O8SlIYSY8G2W urdoQAOyCy4Fe5al/Ra+s6SR9G6P7B0NqKstWvfIUbilRDNaTb+lQlHtfwCb37av9a2Y 8BhB17PzbPlxgRLv7YZ7g9odrv5W3O08vy/vLNmRM4Jgv2pyDewwFL2zkF/7gxtvBo/P BANErjpf/Ah1Hk4QG0q2RjEblvaVCspAI4Do6eKzNllNQdyvL1Diw8dYk1G9PoAPrQM2 AxpIYtRde2mZ53hBPzygFN27BJWAqCpoh/e6V8eFLIU7a4BmilWhCdfMqVLSE+TCF2h3 fsCQ== 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=MqUU4NwcPoS5ZN35RvVZCwFe9U5tn/4+nbmkAYnncfM=; b=U4qV3NOnmpDbd5mFsFYCX7VAJkDLFLBNvLwVHOqonwgPaLddVAO8yaKvMsiPMEUMGr KPl4aYml0W8nd1KoDHZIzBvlOYuhF9WZQdTKhZymgGRwIkyS6uto6LGwiZIq4cy7d/ab 7WkOhqyfJHXr+KZwwU+VG/NIQPRN1jC/uU0hSiDv/Oew96BvD2NGAdRRRJs71n4Vxgv4 TKbpaI7iWzPjcxrXgcmTrv50cgjaL0psLlOXZiDC9zg8MhgRqcDpTAu1HbyDVn7wei0+ VO/If4FBBuFDuMGrVSBeCozTAu8IcrJzJo2XyYH3KzvDPD5y3pa6g0Jdqhf4b+I9efjW 77gQ== X-Gm-Message-State: AOAM530DbcoYfOuc4Zl3GKx4tkn5OyTv+di0QO8XIsQE+QDH0rkWDtOn nQXueyZvCJ+q/6TchiBZPKc0JA== X-Received: by 2002:a2e:7804:: with SMTP id t4mr10479933ljc.8.1595251444480; Mon, 20 Jul 2020 06:24:04 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id h6sm867829lfc.84.2020.07.20.06.23.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 06:24:03 -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 3/6] media: v4l2-ctrl: Add frame-skip std encoder control Date: Mon, 20 Jul 2020 16:23:10 +0300 Message-Id: <20200720132313.4810-4-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 Adds encoders standard v4l2 control for frame-skip. The control is a copy of a custom encoder control so that other v4l2 encoder drivers can use it. Signed-off-by: Stanimir Varbanov Reviewed-by: Hans Verkuil --- .../media/v4l/ext-ctrls-codec.rst | 33 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 10 ++++++ include/uapi/linux/v4l2-controls.h | 6 ++++ 3 files changed, 49 insertions(+) -- 2.17.1 diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index b9d3f7ae6486..3e6b5d61500b 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -602,6 +602,39 @@ enum v4l2_mpeg_video_bitrate_mode - Encoder will decide the appropriate quantization parameter and bitrate to produce requested frame quality. + +``V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE (enum)`` + +enum v4l2_mpeg_video_frame_skip_mode - + Indicates in what conditions the encoder should skip frames. If + encoding a frame would cause the encoded stream to be larger then a + chosen data limit then the frame will be skipped. Possible values + are: + + +.. tabularcolumns:: |p{9.2cm}|p{8.3cm}| + +.. raw:: latex + + \small + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - ``V4L2_MPEG_FRAME_SKIP_MODE_DISABLED`` + - Frame skip mode is disabled. + * - ``V4L2_MPEG_FRAME_SKIP_MODE_LEVEL_LIMIT`` + - Frame skip mode enabled and buffer limit is set by the chosen + level and is defined by the standard. + * - ``V4L2_MPEG_FRAME_SKIP_MODE_BUF_LIMIT`` + - Frame skip mode enabled and buffer limit is set by the VBV + (MPEG1/2/4) or CPB (H264) buffer size control. + +.. raw:: latex + + \normalsize + ``V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (integer)`` For every captured frame, skip this many subsequent frames (default 0). diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index bc00d02e411f..eb403858d325 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -591,6 +591,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "External", NULL, }; + static const char * const mpeg_video_frame_skip[] = { + "Disabled", + "Level Limit", + "VBV/CPB Limit", + NULL, + }; switch (id) { case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: @@ -652,6 +658,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return flash_strobe_source; case V4L2_CID_MPEG_VIDEO_HEADER_MODE: return header_mode; + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: + return mpeg_video_frame_skip; case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: return multi_slice; case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: @@ -846,6 +854,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: return "H264 MB Level Rate Control"; case V4L2_CID_MPEG_VIDEO_HEADER_MODE: return "Sequence Header Mode"; case V4L2_CID_MPEG_VIDEO_MAX_REF_PIC: return "Max Number of Reference Pics"; + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: return "Frame Skip Mode"; case V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP: return "H263 I-Frame QP Value"; case V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP: return "H263 P-Frame QP Value"; case V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP: return "H263 B-Frame QP Value"; @@ -1267,6 +1276,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_FLASH_LED_MODE: case V4L2_CID_FLASH_STROBE_SOURCE: case V4L2_CID_MPEG_VIDEO_HEADER_MODE: + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: case V4L2_CID_MPEG_VIDEO_H264_LEVEL: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0f7e4388dcce..053827cda8e6 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -744,6 +744,12 @@ enum v4l2_cid_mpeg_video_hevc_size_of_length_field { #define V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES (V4L2_CID_MPEG_BASE + 643) #define V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR (V4L2_CID_MPEG_BASE + 644) #define V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY (V4L2_CID_MPEG_BASE + 645) +#define V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_BASE + 646) +enum v4l2_mpeg_video_frame_skip_mode { + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED = 0, + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1, + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2, +}; /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) 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; From patchwork Mon Jul 20 13:23:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 237046 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1978764ilg; Mon, 20 Jul 2020 06:24:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKGpoj0OkC0cfI7EBJbr/F8d4QSCpPrS8Mx807hyGYsdQOmpnR2RPtPSfP8mQXbWB9fgEK X-Received: by 2002:a17:906:ecb6:: with SMTP id qh22mr19345767ejb.230.1595251461384; Mon, 20 Jul 2020 06:24:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595251461; cv=none; d=google.com; s=arc-20160816; b=02DOZUUOyhv8ihESdLLut+l11opWkq1weLqtZzlwqjQYqccD6W3zU2rTOsoW8DaHmY HtaTCV3aIYITasaCWZr/McpUGHEeyfCN9BH60EBkr8CCv1hzNZQsw9dasMVv9DWkBH9J olEOes+ZF4x/IOlCpdUyK0fAnvf2PlcF/q7ZNbXBgwqngtrk6Hianzmlv2YVUx+lsncO /YOEixSGGD1+aQavYTSbHjiu8Vl4WICxayQU5TkANZbxopMCU/foP49Kepm+KvMtUXlH DeiacAvaig+zlcNA2IKde3IKIkGnq+vyt/zLj1+vYYOhF6hbsI1eat/6+To3fN+v68Bx 6nRw== 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=PCNLmGR8sMtBYV74iVoiny++gKyFU6QKve9J6ft8KaU=; b=Vi/xSH2nvwoOs49AHorzdvgzkpWCyhqfCRu9J1kYm2OqnOzXPZ9d20mIOj7k50NEDr mFsdsf4ShbstMBqOy2OISzyJRTX4hv8Dc8/Xnhza4HaKvGZwHnaeRcNyJSWqTxaa6lX6 sUmuv3GvBKYnJrH5S3AWMDzVo6XvavbN1d589K67Q5/binlGxJrcpfNmn2bTwESQUiZh paK1m1KMYttQvEx85U9JKKyfxFUApkj20EePZhN8zjpr4irvAv54HFnbPDT3JXR/30sJ Fc4AnlnFpu+mix14cUax04G2CW2kDS/dU2/dUSFLByywo04mC2Mc5Kw5XJu3UZp/6nnz GO/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YLYbNeJb; 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.20; Mon, 20 Jul 2020 06:24:21 -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=YLYbNeJb; 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 S1728232AbgGTNYT (ORCPT + 15 others); Mon, 20 Jul 2020 09:24:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726705AbgGTNYS (ORCPT ); Mon, 20 Jul 2020 09:24:18 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95D1FC0619D2 for ; Mon, 20 Jul 2020 06:24:18 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id i80so9682956lfi.13 for ; Mon, 20 Jul 2020 06:24:18 -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=PCNLmGR8sMtBYV74iVoiny++gKyFU6QKve9J6ft8KaU=; b=YLYbNeJbyBIaAQ8rb/3znbvrfWAkG4bvqP1j/gNRpW2GRjAqCS3c57lHyprI9vcUVy CFYb6/y0MWLSE9CSw6JnkGdtlKiGuenOa6djBdXOcXB5EZe4wJ/G7oXvQ7cCPaNamTef cnXYLGAHpAjq/bOaUfi4sP9VWdQu3vzn/aG6Fjt2+/ybVS/Cf4NRtH/7inpbltWwLXvx 9M9lYOOvRcrBJ++S/+qt8xMlSOTOCTGXb83x40QVyzfzokshHKrV6DUZODmIrA9GXWim bMophe4N3uJwQBu0Sr/9uv2THyxTHEDF5bsZ6Dd3yM9YBKQwikBqCqYtNwc9pWARjKHq vGdw== 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=PCNLmGR8sMtBYV74iVoiny++gKyFU6QKve9J6ft8KaU=; b=igf5giGgSV+RGWYqJom3e9g0OjYMX0QNoSOUCRd7iDsf1FAHARB2BZHf4WVRWctb/+ eQsX7pQtub9D9BE/YK9WES/X8pgRbLiSZn0pbU5NHMhouVFd7Cqgp8rbZ4fxUN6oDlzO Ttdn/3VYKE+bkW7ErN77fqrlI81QNQN7ziMA6AvjDUwaqPWwNY8d3OdYP56bLTPyEmVo 9axbpDOcJnHIaVDly3ql9jzIlDPc/iQ33Q3/94qSRluySt1V8upKjxe6Sn9C/TJTDLhX DHpq2pr8AF7r9iL9/SESpsBUtZPdmri8wl7DqY88DN4S4lONt6sSi5JJrlH4huZBFp+D iBCA== X-Gm-Message-State: AOAM531Wm4F+JZUSJQsgnN9SiEUSnr18RGW04Qlg16gVchBpcY4M8ffM UifFiLgF6Ruon9mVK5XQlxBhBQ== X-Received: by 2002:a19:f80e:: with SMTP id a14mr811645lff.49.1595251457123; Mon, 20 Jul 2020 06:24:17 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id h6sm867829lfc.84.2020.07.20.06.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 06:24:16 -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 5/6] media: s5p-mfc: Use standard frame skip mode control Date: Mon, 20 Jul 2020 16:23:12 +0300 Message-Id: <20200720132313.4810-6-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 Use the standard menu control for frame skip mode in the MFC driver. The legacy private menu control is kept for backward compatibility. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.1 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 912fe0c5ab18..3092eb6777a5 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -261,6 +261,11 @@ static struct mfc_control controls[] = { .menu_skip_mask = 0, .default_value = V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED, }, + { + .id = V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE, + .maximum = V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT, + .default_value = V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED, + }, { .id = V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -1849,6 +1854,7 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) p->seq_hdr_mode = ctrl->val; break; case V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE: + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: p->frame_skip_mode = ctrl->val; break; case V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT: From patchwork Mon Jul 20 13:23:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 237047 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1978802ilg; Mon, 20 Jul 2020 06:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaxg5eypMt6zddEsEc/Xcp6jhOfTdB7sKjKu9WoBIY3WXGQioncClse14QpYDCuKwMz5qT X-Received: by 2002:a17:906:2e4b:: with SMTP id r11mr20220949eji.227.1595251465618; Mon, 20 Jul 2020 06:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595251465; cv=none; d=google.com; s=arc-20160816; b=fIayh3mJ11Lg1Z7bLAMxG4MFkDTIiwn8VNLL4fHgQ75+0LhnmXhX/6HtGr8RljX02Z HCvDciWamdLTh15GMHqLzv5XH44/ZrqMOigPBCeUJOGc7dFLPkOTgn7HL/UUG94WJzmm URxyUg5s3BApu3faX3MaOwuuKUtyjZRJzTSt8uav6vh2nGyLoyUVw5+x06QUlLtKEGpB 6KLLpFOSyGWLVZPVI146tgi6SX+FIK3H7dzY5/O+VfIUuwGOCdFL63IbzhtJR5lvhtOL XffzatOmB4tI0E3gkAswtf2avjpgeI0RoZRbY7De34rd6DCoPodsuD7DdrD4zBtmF065 0PAg== 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=b2rYd9nm3SPkJnxD1ULMt+9UUxBnRy5tHP+SV4VkRQo=; b=rWxmEU5jaOZKnYeAqH3onBWNx/mjPhTCrvLTghrnjiogMhsYBjfA3eBH6F4NhubGXB +2YmLD6w8k+KncqDB6/O5dF8meB3yUqB4zZ2wmPLcUwmbxYLbQjtJQmKvCqnYOdWgpYP 0TTgSTMlhB+nkXkoBxcs6LbdwaCbcTPGUXI4N95Telhk+ypeyH3Bs9La504TSK8ql62D HorFZ7+KNf27fxtVKsHaxJMtdzP6Le/WxmI/VEGhEgK5FeeWeqW9k8xf4rXnBTpz5xk1 7vhplJgDy4If7iaxWoqcfdp6JnYdtpq0v9kgGEuID0FnHXNuc3rn27JYBeAsQcNZf3vN FcIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eNLxZATC; 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.25; Mon, 20 Jul 2020 06:24:25 -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=eNLxZATC; 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 S1728291AbgGTNYY (ORCPT + 15 others); Mon, 20 Jul 2020 09:24:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728261AbgGTNYY (ORCPT ); Mon, 20 Jul 2020 09:24:24 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A3E5C061794 for ; Mon, 20 Jul 2020 06:24:23 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id s9so20197274ljm.11 for ; Mon, 20 Jul 2020 06:24:23 -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=b2rYd9nm3SPkJnxD1ULMt+9UUxBnRy5tHP+SV4VkRQo=; b=eNLxZATCSdcSJ52R9lxPtdWl3+8VydtB0TO4J8z7BDb8HN92Pe6AaHHdp0c1Y5KFnD e1OayGHlgNk3Wtps9EiuilM0+OQTpGTkNosnVoeW15aTGu5D6+oNsWWtNtxBceo7A/E9 1ey+E6yhxnN/dRVA7YuPQhHIpv3haqeN7RDwHU4dEjLMWS6tJGBAPK1NNOXhikY4aRrW TTiIVqOppHt6CI3SRJGbMgEWegQAW2COI3Z3I1p8uraJLc8U/+HDLUS1sRmQxHnFL2rs x3fo3RwaOZorYwx0685XNtaZbGPsc7sGjOAUnzIaNb6uWW4I7Hq+D/FOgnZAkjgPfk4+ hSnA== 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=b2rYd9nm3SPkJnxD1ULMt+9UUxBnRy5tHP+SV4VkRQo=; b=FfEGZsHtKg5ZAFWR3yLZoU/w834CDQYBs2t2Qh4tItut0pr0jaZWKyF7WZVE4uws5c HBaNuNw3ztI8q4dDcEettnTb8TbXGzbTTHFf4l4RZtDvRR8YZaxRdYslUbuf08drHv+G 5EPjbfHHYKTULfuoP7sYG6rmVRm62cCCPzReSO8kAwYlWTR6Kr+IwAsVKIwi3kfiFI3L I6bGrJ4XKweNMsIRLwpVeP5Kjwn65+5CakcQCnG5K/1LwA9mluCqPZMYrNrkbsDFTQYJ WIZer759Q2nBDzKFc7eW2mMmCayZCFlycA49aDcBX/1I4vBzu8QLR8KJQFuid6VpcJnq FRlw== X-Gm-Message-State: AOAM530qhSWEMBAU90nmVy9L4FUfriQkR68bXUzekAZnljJXrsjtMTF0 aybrHpFVTQCoC/X5eRUd1euuzA== X-Received: by 2002:a2e:7601:: with SMTP id r1mr11283577ljc.111.1595251462129; Mon, 20 Jul 2020 06:24:22 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id h6sm867829lfc.84.2020.07.20.06.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 06:24:21 -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 6/6] media: docs: Deprecate mfc frame skip control Date: Mon, 20 Jul 2020 16:23:13 +0300 Message-Id: <20200720132313.4810-7-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 Deprecate mfc private frame skip mode control for new clients and use the standard one instead. Signed-off-by: Stanimir Varbanov --- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 3e6b5d61500b..30899d84f178 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -2816,6 +2816,11 @@ MFC 5.1 Control IDs ``V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE`` (enum) + .. note:: + + This control is deprecated. Use the standard + ``V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE`` control instead. + enum v4l2_mpeg_mfc51_video_frame_skip_mode - Indicates in what conditions the encoder should skip frames. If encoding a frame would cause the encoded stream to be larger then a