From patchwork Tue Jul 21 07:45:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 245425 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2688587ilg; Tue, 21 Jul 2020 00:49:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLAQ8n8QmX+8+b58ZkasCm3JXyMUQWOdlv/rv6pvF6EiyPuHfthMcz6fucB54cEORaKgLf X-Received: by 2002:a17:906:8157:: with SMTP id z23mr25408260ejw.349.1595317758580; Tue, 21 Jul 2020 00:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595317758; cv=none; d=google.com; s=arc-20160816; b=EZEsBRZ1OHpoSR+D0n7jeS1gEMlvK1BSfmfUtOl8MWIg+FTp0FYMT3ODHaW8OukUSw rr4BlDj6hZbiPgO7SpFQo/NoOHPLoYNPaYrT0i/FhfmWTOeZktoe5DY4B7TecFHBXRia Scv7PDBI8bnbN51RvkUsofNZ2Ai7J1/A5b32zcXI5ImwlWcBe8yF6qmThMLHTZuG6hjT qLCjtyNobCfvACbzgDycq45ryzDBEinszW3CnVp1S9DRMgpouuiN/VBQbzSkH76iMgXY aeRy6uWLGCeSFHXkJav8Wmt8bQeMFkXMFlrLp07bOWmprd54jrp6hzRgU13sZ3OoVEhW a30A== 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=Jtpjis3KIOZCdi3KvFSAjM++J5bi1QesG6WNE5dmK3OZY0ROLu/h5Tl+OR8SJa7Zxo C4uKJic38rw+2K29JuXXscRQ+efmKXIpXYY6St2s2FRAfdaJMUFur85emje+lxIYK2+h nOXt6bBZkmnd3RQFnkTLEfkno/ygr8lIC0d/DuUk4dI8OkvXIpw9pmVikfMtc+23iDpR hy7Gu+yutevb96q5ltETtgfVPeTASjU1K0QSdM2XiUpcDVfRWsuvsG7Xttvy6nW8L4rj nNU97JeYLkC7Q8sVABsp9mf1p+Hz7DOAa8xzqPxutzWkwzfNL9s/T3LMGZE6auKN4DV7 sWlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xO/qrEaz"; 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 d4si11272674ejb.349.2020.07.21.00.49.18; Tue, 21 Jul 2020 00:49:18 -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="xO/qrEaz"; 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 S1728036AbgGUHtR (ORCPT + 15 others); Tue, 21 Jul 2020 03:49:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725984AbgGUHtQ (ORCPT ); Tue, 21 Jul 2020 03:49:16 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA8CC061794 for ; Tue, 21 Jul 2020 00:49:16 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id b11so8729302lfe.10 for ; Tue, 21 Jul 2020 00:49:16 -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=xO/qrEazEurCKMVx/z8pZNoA4cSkvoSezcPLfk7wG1+eXesSMkQ2ER0gWslYpa4DsV 6byH1lsaaeDBHyJ7BBzxnobi6QUsDFGYp5s4o5dHQNp5V9l+pseaorlHVQ+GRhakKHsY 1TKiJb8pbyZUtZshd4JoRD4wuL65HNqPL3PqgzXfD3rpU8lkh9l5P2axbnWkaPCs5Qlo cRIPRAEmzfw4MyXkIqUhM7D8ajhYSZIrDciAq8QqjcXBkbG/6Rma4zX0da1nK11FF3Pw jRmGw1cYmHcMYv62VoPWaRbNwnMstM3b6+V3eeit6MVCwkV9IbqxlXESmw+ZnWk0FRjJ V9bw== 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=PcKbL2e4Zad+cgr6TIKBh8JybjwWg+ewE4ER2hShEWktbHySBAhX9mz4PmKHGvfu2l 7N50tFXoLU2HipCn5Y2RA69uMS7qn3MeCqLMfj6NUKUGASswXWRjU863X0TSIqXu9Pc6 QAKmfMIJe7qQnM2a5iraL9aTkZEbaYjBjf2314KRobHMfxUQV8X3HQHhbNh9zWXZzWUO ipyNTr8XIuPtAE6ZtjHhVXOx6NfJ7pTYomuABcuRq9/trO9BCsfno9yH3Are8tS/jv1y Oymn2wHphwx4NHKSFykRzh5Bkh5EY+KU8tQHFoIqveU0oquvC4dXSshuuuLWJnQ13aJb 3KOw== X-Gm-Message-State: AOAM533/hHjLCZcM7N19PjapsrFAh9szLr0MFJh9wJ0Qt/0iIr1riAPS zhjXwWaYuhG1anhockOfr+2Y2g== X-Received: by 2002:a19:be87:: with SMTP id o129mr270351lff.180.1595317754868; Tue, 21 Jul 2020 00:49:14 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id d2sm4045334ljg.6.2020.07.21.00.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 00:49:14 -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 2/6] venus: venc: Add support for constant quality control Date: Tue, 21 Jul 2020 10:45:34 +0300 Message-Id: <20200721074538.505-3-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 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 Tue Jul 21 07:45:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 245433 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2689854ilg; Tue, 21 Jul 2020 00:52:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1ZgBzpqn51S0wGtEU3Xg7tGjbeaATMnKXFxsWzD3ogIGvFVXw2VFMsq6bvC+idQvgy+sa X-Received: by 2002:a17:906:1697:: with SMTP id s23mr25504792ejd.166.1595317922537; Tue, 21 Jul 2020 00:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595317922; cv=none; d=google.com; s=arc-20160816; b=DIZEUv7z+Ov1BxsAi7is1I8ziW8GFdNsy4fgNeyNf65uuXDwFgKTN43KJVuM4qG7uF o8jz01PBJieyOkJWaGbFbHPkUh983XQe37P1t1C9d1jUXqhrDwgrhOXvxOwYDmm5J6h7 VZAy5OEWRmhY8zQt6R3AanKC4aZ/GQV/REhql2VnMGHGbl8EPrJIEjhxgeeAFWdlH3EY OrMlKCIfxM7fe33WqVoX3DY2eC2lCrQVabf6kPtrWt2RQFy/hVH+4W5mhJyhaf9dgXge PFaZeACmSLC69+IBMefH+XZ4/Pu3OfTjYMsN/o9iszne1ml+lSjXuzP5iSSwlNuNfgE5 ajPg== 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=j9CTrGuuoHUlZAGWfnV64jcGILUKrabUBS1No8VUp1I=; b=QHDXwfB238LfP8XHuSPYHlKvWPXAfyIRzFoQAN+deWss1OnR47eYGS6abs1pc+hgEi rNOjGzefYE2Ng3AJIsvS/d9+WWdpqXOVT9+r2dtMUtvKNDRShaSxCeXFJbC2ftMDr8dU fVA7kKrRVMSKwRhZIYm+cU7KK1TeB8CuFPT1KT23G8VRfLcVuBszNZzAD1U+TKuRZRHB O3zp1TyJPkiHZAMh+oh3wHT6mCRQS4+muNCafEVcVDO6jIfDu0OH1uw/r0W4YrPIAEEl TtcHmk/qDyu2gijE71hQjY5q8iQHrnR80oQr7CUYCWNobuqQ84GzgluRBoTsLAdm20zu B++Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pqv9oNkm; 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 g13si11865826edy.128.2020.07.21.00.52.02; Tue, 21 Jul 2020 00:52: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=Pqv9oNkm; 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 S1728106AbgGUHwB (ORCPT + 15 others); Tue, 21 Jul 2020 03:52:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727837AbgGUHwA (ORCPT ); Tue, 21 Jul 2020 03:52:00 -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 DC63EC061794 for ; Tue, 21 Jul 2020 00:51:59 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id o4so11161439lfi.7 for ; Tue, 21 Jul 2020 00:51:59 -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=j9CTrGuuoHUlZAGWfnV64jcGILUKrabUBS1No8VUp1I=; b=Pqv9oNkm+9Pyllwjqpce/RwRsaSGWGr+5lDHn44Yg8zbs2uz60bhclQNYbB+p1Hcjc VQ1IgVfV0bRdqmrENvzzsrYv6a1kEqITdKiiCdBY91izlprm+tK/KiHxn/Kp9XJh+iUG Vos3S2owafkRuZZTsRqGs0RjMXKcaUkZ2pCPEPdmnnWU4uzQzTk/NYhU00OO/yiCa+tL Njtzj2G/F5xm0WX+Y7IJM3DvrfNYC4qfQjXMOj0lO/likqKukAyy7/WL126HeEUEX997 9Nx96Zu/Hlny6SS8VgLvOxQI2oyJRrUNpWyIus56AnoP+rYLNYanke4lrOnFZBAr/l4e S8Tw== 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=j9CTrGuuoHUlZAGWfnV64jcGILUKrabUBS1No8VUp1I=; b=cMp0IdDTBKtLUHEIs9lR2WtiAhUjIo7DUyJTjq54YDZ6oBBCbg3KL/Du5A9HZpxJIO URHGCnjouzyDEkHnrwnQwNx5Nxv37tf3gE4//FX4bSf/ujCdYHv8I7VPRooHhX/FIsk6 V2pojTEfhghvuJsDzGqVnV5sFLItBY94p1CYFbwgnryCi64i+yUl90q4UIpmkKMcASvp V70EnsO28W5hBzLLnW5s2RY0Xt0BToTUZOxAoomuFsPOmzIitTycP72o9OKU2IF019Am 2/QfgzKM4n7yJ0b+nrDl5mOvtqxzx7uwY84z92TEF2DFb9CqGu0yEeMMPAjKYn+GVLQy dABA== X-Gm-Message-State: AOAM530zNB1KtOAbblrNIFKI2CbWGK2abGZz9lGF8G5rp7h2DkgYbaU4 aUptdb51sJX4B2LPoNIuWXDFCA== X-Received: by 2002:a19:e204:: with SMTP id z4mr3654835lfg.121.1595317918217; Tue, 21 Jul 2020 00:51:58 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id d2sm4045334ljg.6.2020.07.21.00.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 00:51:57 -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 3/6] media: v4l2-ctrl: Add frame-skip std encoder control Date: Tue, 21 Jul 2020 10:45:35 +0300 Message-Id: <20200721074538.505-4-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 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 | 38 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 10 +++++ include/uapi/linux/v4l2-controls.h | 6 +++ 3 files changed, 54 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..985e4c2d29bf 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -602,6 +602,40 @@ 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 + :ref:`VBV (MPEG1/2/4) ` or + :ref:`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). @@ -1173,6 +1207,8 @@ enum v4l2_mpeg_video_h264_entropy_mode - Quantization parameter for an B frame for MPEG4. Valid range: from 1 to 31. +.. _v4l2-mpeg-video-vbv-size: + ``V4L2_CID_MPEG_VIDEO_VBV_SIZE (integer)`` The Video Buffer Verifier size in kilobytes, it is used as a limitation of frame skip. The VBV is defined in the standard as a @@ -1210,6 +1246,8 @@ enum v4l2_mpeg_video_h264_entropy_mode - Force a key frame for the next queued buffer. Applicable to encoders. This is a general, codec-agnostic keyframe control. +.. _v4l2-mpeg-video-h264-cpb-size: + ``V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (integer)`` The Coded Picture Buffer size in kilobytes, it is used as a limitation of frame skip. The CPB is defined in the H264 standard as 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 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; From patchwork Tue Jul 21 07:45:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 245435 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2689923ilg; Tue, 21 Jul 2020 00:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw99QFWG8Kc9Yjg/hLe+6rcLIAIg6dobr93s5jeGvtvpQ6SC3ZXhYyST/5GzbjOkdP5x1n+ X-Received: by 2002:a17:906:abd6:: with SMTP id kq22mr25304519ejb.458.1595317930584; Tue, 21 Jul 2020 00:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595317930; cv=none; d=google.com; s=arc-20160816; b=FrBnSYtWt05UBZXxg98f2W2KUsWEMTbnTvAcx4PR2br5l2WDP8zUgcsWwpa2D7nCs6 EgO60sOIWLe9PHNcuzz+ADoREd+9w8QWzO+JGjJrUz0HY/fA2DeEkaYDfAnUzIlAnhLc FHqXhH3jjMzrvN/dAYLi6ZZOgpMyepa/F5r9L4bjoe+HPTnHyVnWnaxsasnawmGPGlqR n8i9jq4RlZum+h+Yr7oWxJW0iTojDEkaJmw1i802jlPdbXyKLdKprYPomuwx39itNPi+ kqodxUTEVUGZgZYjAyJIx8Ec31vEnWl1teJLNV0Oq4Esa0n+DVAbTN1YYvFtKybgvSOh mBEg== 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=AZBTJhswKDsQGiPTDKQxMrAkA3g3Y3/zRSnGC6et00TJpdLm6DpK3O/av8UCZy1Acq vXx16MO10uabGTTLr+x5917DAphEDGe/cTSkxlmH2SRzRV8MAu2z3kSsafUoca6cxQV3 4tou17qAx96qfdfWKxEG9qIh/Oz1qQMf1XmLxQBSmCgVOjbAi+OdzvURbqSNWY+JnhRD /BIfUSxTG7gux9vNo5PHBCpGQA82kK5D6FVLOPxm76YJDS1HcdgqrbmsXA8OMBTWS4I6 MTqrAcwF4j+JzDIaf/6i4IYWOgBR+eZq2Dy6ix2G6kOES8aMMw15DtUmqPLgN1lrhf2w g6Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ajU56Grs; 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 y18si11571831eds.226.2020.07.21.00.52.10; Tue, 21 Jul 2020 00:52:10 -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=ajU56Grs; 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 S1728513AbgGUHwI (ORCPT + 15 others); Tue, 21 Jul 2020 03:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728476AbgGUHwG (ORCPT ); Tue, 21 Jul 2020 03:52:06 -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 74EADC061794 for ; Tue, 21 Jul 2020 00:52:06 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id b30so8858136lfj.12 for ; Tue, 21 Jul 2020 00:52:06 -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=ajU56GrsuzhVrOlNfLRWp8gS9xgN5nLCwulEk19YM/GaWszzUOzXZsUttzaFR+kYBd a3WblZS8HsXjcOC+06HIMV/LfkYXcZpbGarrKZegHGsFyAEj/801vqo3iMBEB/GbSAfu 5G8PlNSKeeoRAyWoCTQUtqRvvOpPsdyur+CMiLPDYZyvMhtv9uWYiDmN756EBkuZADpN 2Kyo38Mvtv/2H8ivHQdBv83rtP1KNSTNZwjTHa0dNZqyXHixtKsGNiZc7WycJks8M/Xe Kng05ZGPmPIK/PAuxYzSmLffC8oh+0kR8WmHRM6j5HJg+pSXYsO/xDEvgGfhr+4Xf1tC 09tg== 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=TpY0uLMtI+34/luruSZgq2ZTsuu/Pum4yTNQX/uICBQtMjPmt2rOy0hkOsxIsRUuSj ZPF1I7XvAzUWiIR/ru6xv0zzf0Jp+rGW+e6utPxxmZ2ieNqyZRfn0YLOyBzOLdoGocRX oww/jXicVo80ZOjzh9Yo49B27R8WLCBp9SxLWI2vpdjexlq/aAd003t2rZgo+tVQeUN7 At/FjQEC7tavessVq8RGmOZsHUvUTNgMItuyZxLFMqf+FjjDdNxRuiE7fQbyBzmbDzsz caaJZCP9l/JDiQVCq53dTgTnJHneNMUDNxJnZZRGefayJppe4IkWu0P0jjX4z5VZ+7Vb q1DA== X-Gm-Message-State: AOAM530cIUP23TKvJTdhrl2LDe6/GANSQkBMIKTYl3HsM+5XVn4Rmsf9 rE57vkBMSQFPgTb7hHR+YxCgGw== X-Received: by 2002:a19:e45:: with SMTP id 66mr9554217lfo.82.1595317924966; Tue, 21 Jul 2020 00:52:04 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id d2sm4045334ljg.6.2020.07.21.00.52.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 00:52:04 -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 5/6] media: s5p-mfc: Use standard frame skip mode control Date: Tue, 21 Jul 2020 10:45:37 +0300 Message-Id: <20200721074538.505-6-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 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 Tue Jul 21 07:45:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 245437 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2689950ilg; Tue, 21 Jul 2020 00:52:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUU+pq2/z9FM5SSDvLY0PI/Pa71vWKgzEPCeoa8WjbKzn8gW30tlQJQgOBFYZ2C8LCcNCw X-Received: by 2002:a50:fb06:: with SMTP id d6mr7655939edq.165.1595317933887; Tue, 21 Jul 2020 00:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595317933; cv=none; d=google.com; s=arc-20160816; b=JufrVRodg+zLt5d6tM/bsnbegn3HlvjecxwadTBJdQ9t0zsmtSzb1gjC5a0/5AlUG1 nLs/LHttRsw+8l1ZDngU8YrFOSV+SXDATj8vrHqwwY39yuownSCKItkld6dJMhPRA0l7 mZqJStdHpX6Y+/ICdZNAMxX0hf26PTxm969T/muZJIvg5z7XmFdswvbMJct6NOXQmdMn dfDF+LHtl/JuTOT/YgdTndj4o98SMAnjk1LsDhJYd1VLh+ADBuiGBlEzG/ddwJ4ZzGkU h7Jx4rVuIF0ph9vse5Tzfx8PcgJLv0EQ7+Tp+qDHzArnnWeqylf9f/TOckvcPAHlhDBA 23qw== 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=+Wsh5lsQJS5Oj2N0tWY17u1sLYFEy9iokkNEGsNaFVc=; b=mBwDEXBvGyRVG3sGu44JgvOwbpA52lRiPBDZ7fJDl5xSkskepcrWX8UEMqMGjmid0y O4gPXnuMl1u4G+MTURwPe73W//ecK1gTcXsSbNu+jbHpLtVEiRRpNaOHmaeG6xdqKJdB CWUn6omDfPR4Q4xLwJEv8swmx5wZ2LWs6qo5TsB13/EVwhC9SbNC0Xz6RmnSt4N3cjYs yPLY7HsAMmLGTpds+uRmpjUU8TiuO+QIPtdM//4QZaxi+ZkSGn9/+xXRNtnjkQoVMoPv ZSMFUJI9L3OeGjacVo2kTeiAXkKVohe1pAE+FUbiuM2/rHW1ECxq5Q9dOjTbwtSlZpMR DyCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OaaqOgLW; 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 92si11828194edj.9.2020.07.21.00.52.13; Tue, 21 Jul 2020 00:52:13 -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=OaaqOgLW; 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 S1728208AbgGUHwL (ORCPT + 15 others); Tue, 21 Jul 2020 03:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728532AbgGUHwJ (ORCPT ); Tue, 21 Jul 2020 03:52:09 -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 48DAAC0619D7 for ; Tue, 21 Jul 2020 00:52:09 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id q6so2018201ljp.4 for ; Tue, 21 Jul 2020 00:52:09 -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=+Wsh5lsQJS5Oj2N0tWY17u1sLYFEy9iokkNEGsNaFVc=; b=OaaqOgLWbDq6dMMW9Qd714qnIPqwNeJycdVqOHjHvtSPWLsGIigkGw3oYMdwp9gy4J 88BotViSV5y55ZHLLXr8sWbl+PPKCk9tXV+bTSFWoP3wNxz7xA30hFbaLABgg0NpGMod uDE0TkuRkq58eaFQFqS+oH2AtsKYdu8HhKnLuZbl20b4DKXdf7SXkHyZiw4H5Rj19ktz u9JPRKOqXwdSgzsBEgXe474H+oLNjrbIfD0CTbStqhC18SSsUtnX1Kih5O9eSmUm9G3q LeZQzR6KTwjZYtd+Mz5s6/lnFAn7MHBqU8dsogvhX9kxc+XXAVSRxGaCMyP7kH6prdMJ 7uhQ== 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=+Wsh5lsQJS5Oj2N0tWY17u1sLYFEy9iokkNEGsNaFVc=; b=QEhTGTPcgEwlobT5ocRnqW7kiQUfdgVRryZJB2qeyZI9pVqLKWXCX6wIuzPe1+yacG 1YvJhNwRvBPxCwof8SBC26fl9As3cnkz3LQnZIfB+aKpxW2ZLrTrkYKLd1XNDs5vGZfr c+S+oGw85rPfJsswZqkYemEoiiKT9rMbIzXMY4Em45s/VAcYIo3W8G2dDdbcg5NxSufP iGkXZnrk/lZhs/Trc5L5rrdPp6YyTttDjiES7bAo11aAeK0nO62SOl9+gGwYbjoEG3Vu GI3nLXXFcSvQhAEuEOrS0C7Fw5d0RXNjYIquxMqAPjPVftkkyn+p1hL4Y0HmIZ6XJBvU U+eQ== X-Gm-Message-State: AOAM531as2tomZZ2kyyi7dxNixGeful8G+iThFpfntS3FewE/GC9y4fS 9KGecdnAtnEycnrDJft79QBjeJm8LQM= X-Received: by 2002:a05:651c:1105:: with SMTP id d5mr12887062ljo.62.1595317927776; Tue, 21 Jul 2020 00:52:07 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id d2sm4045334ljg.6.2020.07.21.00.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 00:52:07 -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 6/6] media: docs: Deprecate mfc frame skip control Date: Tue, 21 Jul 2020 10:45:38 +0300 Message-Id: <20200721074538.505-7-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 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 Reviewed-by: Hans Verkuil diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 985e4c2d29bf..31d77d1cdcc9 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -2821,6 +2821,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