From patchwork Fri Nov 2 12:41:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malathi Gottam X-Patchwork-Id: 10665453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1959A15E9 for ; Fri, 2 Nov 2018 12:43:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0180E2B41E for ; Fri, 2 Nov 2018 12:43:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E754B2B437; Fri, 2 Nov 2018 12:43:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88C692B41E for ; Fri, 2 Nov 2018 12:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726125AbeKBVuZ (ORCPT ); Fri, 2 Nov 2018 17:50:25 -0400 Received: from alexa-out-blr-02.qualcomm.com ([103.229.18.198]:17695 "EHLO alexa-out-blr.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726104AbeKBVuZ (ORCPT ); Fri, 2 Nov 2018 17:50:25 -0400 X-IronPort-AV: E=Sophos;i="5.54,455,1534789800"; d="scan'208";a="227395" Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by alexa-out-blr.qualcomm.com with ESMTP/TLS/AES256-SHA; 02 Nov 2018 18:11:19 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,9064"; a="5622275" Received: from mgottam-linux.qualcomm.com ([10.204.65.20]) by ironmsg01-blr.qualcomm.com with ESMTP; 02 Nov 2018 18:11:18 +0530 Received: by mgottam-linux.qualcomm.com (Postfix, from userid 2305155) id 6BCFB1D4A; Fri, 2 Nov 2018 18:11:18 +0530 (IST) From: Malathi Gottam To: stanimir.varbanov@linaro.org, hverkuil@xs4all.nl, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, acourbot@chromium.org, vgarodia@codeaurora.org, mgottam@codeaurora.org Subject: [PATCH v2] media: venus: dynamic handling of bitrate Date: Fri, 2 Nov 2018 18:11:16 +0530 Message-Id: <1541162476-20770-1-git-send-email-mgottam@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Any request for a change in bitrate after both planes are streamed on is handled by setting the target bitrate property to hardware. Signed-off-by: Malathi Gottam Acked-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/venc_ctrls.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 45910172..f90a34e 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -79,7 +79,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) { struct venus_inst *inst = ctrl_to_inst(ctrl); struct venc_controls *ctr = &inst->controls.enc; + struct hfi_bitrate brate; u32 bframes; + u32 ptype; int ret; switch (ctrl->id) { @@ -88,6 +90,19 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) break; case V4L2_CID_MPEG_VIDEO_BITRATE: ctr->bitrate = ctrl->val; + mutex_lock(&inst->lock); + if (inst->streamon_out && inst->streamon_cap) { + ptype = HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE; + brate.bitrate = ctr->bitrate; + brate.layer_id = 0; + + ret = hfi_session_set_property(inst, ptype, &brate); + if (ret) { + mutex_unlock(&inst->lock); + return ret; + } + } + mutex_unlock(&inst->lock); break; case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: ctr->bitrate_peak = ctrl->val;