From patchwork Sun Jul 5 12:11:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 234829 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp3932769ilg; Sun, 5 Jul 2020 05:12:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztSC0foxjWtJjYxoaOTilvdUD02SX5rrS+Wyu3VjL4ApZPyv9aUlmMyRDXLJFZhhjFBtsi X-Received: by 2002:a17:906:3446:: with SMTP id d6mr34397393ejb.323.1593951141607; Sun, 05 Jul 2020 05:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593951141; cv=none; d=google.com; s=arc-20160816; b=akKGmqaOVxplS/qm7wqVrtl7z4vd3mlWytXSNZt7vJin74msfN/RNpdljmKfvWJWe3 XjUBOn2jv2VrTGzBUoTdBwDx8Y4G7jTk8ZET/cpRxstHWCy3szREEb+fSHAx5McnhE24 8YdYmihBRTiN+fJ2nU7eHHEEB6i5Oo0LbCeNTW8I+iBzTMeDk1Y4mYsxFg4o4Bzy7Ju1 vfQVSb0XGgW/P3j6fqrjNC+K5OHsymc8rmxPCUuwVvH6445cY52uwiKChAUYut9CwV2X aHUBwmEIA1XqXni8iiUs9Psck4Oafr+fJvfP0Ulxw6UBA/9JN1/vWeAm5EAv/9zK2IRJ g6uw== 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=zK4YihAvQTXrBMYtDYkEeB1Blv4/x0/6zo1B3RKHst+YE27z0fBHTi0jFzv1oGrDlm sXQ06MYR+N6K8yS31a3X3YOCphmFoY+rwRz2QDJjPdGL01Zeq26S4AGxLx06c7KRUqO7 zKHaJzglNbuP7NGwldY9Ry6n040KPIjlTjNjLoi7RzHCSxlAf3rLSz++qDF+avZoqdnn 9YZaOQOVOR32Z1+9DOsXyz6q6zOnrNv1He9Sqsap2P7alA5Ek8eCN46nME9+skqX4Od7 JmZ2BMXg9b4FbBjIanFaOs8eOekJE3dhCzf3NuDQynvTHQWTsG4wZmbGJPV57bad70qA OEzg== 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-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 f1si10612706eje.610.2020.07.05.05.12.21; Sun, 05 Jul 2020 05:12:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-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-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 S1727043AbgGEMMI (ORCPT + 4 others); Sun, 5 Jul 2020 08:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727028AbgGEMMH (ORCPT ); Sun, 5 Jul 2020 08:12:07 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E50BC08C5DF for ; Sun, 5 Jul 2020 05:12:06 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id w16so39537058ejj.5 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=hL/mpkAbzozWSO7IDXapkgPwOUVjQV7tfg+GLnVVl8LTyfDAxQoUWfVI7yGjn3E4KT q+E6K4y/HRjjhJchC3jOEFXLGHND+lNdsSbX7623KYHYnfidr9CHJqz9gvMCjSQO/Wed 5l5K50MU9IJ1jkonALnmBw89MOD4eLtJFAm7Q3cISr76Qvi2MjLoa6PaMS6PkzT3UMHc PI5s/NwxXFI5CPBqO4sHHHxyNkovcfiyJcUfb5lz1tdGm+kSHsHTN3NQN6yCAVL70tHf QWRerMxGm2LJOPucIjCy72S6zPF1kcysiHC9a1XSmOWTxoxHED8GBnkR9F6ed2BA6FGE mjpQ== X-Gm-Message-State: AOAM532E7F91ONiBAFndbyaOpXWLeGwRRp7N+FhltPdslr9sUgutParV 8Cyyr7jUuVnchajdRFTlaCFRnPAfWSGR/Q== 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 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;