Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3733705ybt; Sun, 5 Jul 2020 05:13:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya1Z2kU2mOlZ8FiROvVWSIyBa9qsLaojwj8dJaKVxLdy10QHRKu6ys1lhboBQT+m+oMmH4 X-Received: by 2002:a17:906:d92e:: with SMTP id rn14mr41771386ejb.314.1593951208701; Sun, 05 Jul 2020 05:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593951208; cv=none; d=google.com; s=arc-20160816; b=kAzXxumm5m+qGn3iT1dEleU3f7IwZDitcuJD7Sm4eDRDQMdjHmzTZptg9FTK4gBnSJ iMsXH6Wx5cQJfWu/I1bZZghk4WlYoCC2v6ieQ/xC4maArVHq3EtcjEJFeqLi7PLhhLPG i3v1F+jPxhXJDEinlNrYug0/QDLQzP6C+d5ERL1yrZm71NF3jAKujIGGQfmV7aA+SUl3 hJ6/xuD0Lgx0caVKuYr9SHliM+OGr9AwuiaP4uAgLJyXv/5/vPxYCH5L+KNL1lCl7v7b mnsu4/QKoWmGW+vHGyqiLPL+Nqz/BqYJrNzOXwTUPJCION+UJ6YKzyM6Czs5Bk+Iu8rk JU2g== 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=PVmLU+hVnh8Nuu06hzfy+sP04k3OApAgFHgahioSu+I=; b=mt1Q+nbNNwqpoOLYS9qgGg/IpggpYHbY9YN2et2nNFAonKUyy8rKJp53vR28zZ3m4A ezNMBMIuYFmEiGOC6T8BPXm6blx4j9ORIm52w37IhKGE2O31dq2zOoNrfHD9KlqxUg9H It/VZ7/ANWnKMxOQMno/kVpKJfrfFsJhFg+sr5mF6wbI3WXt6f1c+Uwge6cy8z5Nsbs4 ueBQWmH7lfW+fEpE2lL+Wao8sbbSrAXqxKeIzeOCNFQlFGxqiZK+pwaqjihr7au04gnR y+6qE37/s7Q5odxJt6Naqk0qB1mj/ttm8e1JDqXX0oF01NUUtltWZZknfMvHEarmF548 DRxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HdJZqMAC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 be11si9173215edb.482.2020.07.05.05.13.06; Sun, 05 Jul 2020 05:13:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=HdJZqMAC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727045AbgGEMMI (ORCPT + 99 others); Sun, 5 Jul 2020 08:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727017AbgGEMMG (ORCPT ); Sun, 5 Jul 2020 08:12:06 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55A09C08C5DE for ; Sun, 5 Jul 2020 05:12:06 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id dp18so39528087ejc.8 for ; Sun, 05 Jul 2020 05:12: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=PVmLU+hVnh8Nuu06hzfy+sP04k3OApAgFHgahioSu+I=; b=HdJZqMAC9vwDwq/2+iB7h9yJXCGAIGf8xNMQ9liFjhLi/fvb1XZzTeWNBYjSiMHKOa 98mdSBS50YvGC0BDVIhjIAFTKcDlIyz92ScwSNbaxLdwW6nf7N6Cj/zKQIe4jq7t2GvX wi+NVJRogKGWybka9wuVMlNXfLtjuhLHL0rZlVSNg//AcGoqJU1V43CPFBxjCSoK6zrB 71KTZXPIyrDe+8RGyBhMaNUxMYCKdwbTc1Ghw6QNClu8AH4nbo72658WQJefPVrbG/51 wDZsc7GMLht95gL3fkIsHaXRHdSFYj3mdO7pfHCvFX2yjFo0NPMC+JiMfVWs7wEH1dte i9+Q== 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=PVmLU+hVnh8Nuu06hzfy+sP04k3OApAgFHgahioSu+I=; b=AyNpBsr5LWlnzob19sg6L0Q9n11tBgxFKthFedxZvuaB5ghEQDYvqoHNg5OQDoOTnp k2tKMpjEKZLjCCb7saDIUNEw7b11aF4dMou3RfbCRUdryxomYF/Cv2ncoFXYr17U6tPt wPCxnj5Uw51/9AVfYxqeoMvj2gjcnQ+1LBmh8Z3C1JVEtqi51d7RvdI9BZ9qd5MfdNLN qG0tjy83ETyE48lCSki1ar1n2cvM4jJBirb6T/+8QElp+lUyp8ttkbhbKznt4uHRtYa7 CVGJwlXm1XOZP+LV35P+Z+nf7Ikz323vDIKpx0nMJXdS+8FdUGEU6r0SvPduyk6j+Onj geoQ== X-Gm-Message-State: AOAM533M40eS+BPNM4bNIyu2BQnDOCQRInn5crkx79jQ3/dp+bRtIo6f KKix97W3Oijrl0mXgirK4hqorg== X-Received: by 2002:a17:906:1a59:: with SMTP id j25mr37496895ejf.398.1593951125047; Sun, 05 Jul 2020 05:12:05 -0700 (PDT) Received: from localhost.localdomain (212-5-158-133.ip.btc-net.bg. [212.5.158.133]) by smtp.gmail.com with ESMTPSA id j64sm1517458edd.61.2020.07.05.05.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2020 05:12: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: Kyungmin Park , Kamil Debski , Jeongtae Park , Andrzej Hajda , Hans Verkuil , Maheshwar Ajja , Stanimir Varbanov Subject: [PATCH 2/4] venus: venc: Add support for frame-skip mode v4l2 control Date: Sun, 5 Jul 2020 15:11:26 +0300 Message-Id: <20200705121128.5250-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200705121128.5250-1-stanimir.varbanov@linaro.org> References: <20200705121128.5250-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 7118612673c9..5e74d0441592 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 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 513bbc07f7bc..2279596d4d60 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 - rate_control = HFI_RATE_CONTROL_CBR_CFR; + rate_control = ctr->frame_skip_mode ? HFI_RATE_CONTROL_CBR_VFR : + HFI_RATE_CONTROL_CBR_CFR; ptype = HFI_PROPERTY_PARAM_VENC_RATE_CONTROL; ret = hfi_session_set_property(inst, ptype, &rate_control); diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 8362dde7949e..a418d7d6db0c 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_FRAME_SKIP_MODE: + ctr->frame_skip_mode = 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,13 @@ 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_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; -- 2.17.1