Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp808461imd; Thu, 1 Nov 2018 06:02:45 -0700 (PDT) X-Google-Smtp-Source: AJdET5fttR8ATPuHS/iJs0nFpdgKHYi6MXbq3OY+VN0oeIFjeom2BUK95QIut5KKXdW3zxPijHNy X-Received: by 2002:a63:e248:: with SMTP id y8mr4624206pgj.84.1541077365441; Thu, 01 Nov 2018 06:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541077365; cv=none; d=google.com; s=arc-20160816; b=NZ/lq3FsNOSf2+naOjBfsQRvASJvarlblquhYhsFk2NaFXKDhkv8SJGgMPGkz2YJI9 yInmXsbA9PSRoNMQXIIZ7r+FW599vsqhERiap0e9XZYw9vZAC8M4CEy9D1ndBXzscY9y DdHrjkKALyjEkLX0TEOJELeIj70aYYD1cxTh/P5uKIxiSxPzbgfobtu5ewOeMTh0/BAx NvCzA13VBbFhfhb14KzmXAvqp/braAPEbb/7ix8zcpLtegsfP4D26uA2Z0ty1gNoOXNQ XEDVnGC5sXuzmf2cu9LgbgryyAxRF7sMWb9cmwdfyDm98kDaqoM8W26ObgHIsui976r5 Yv0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=k8ePxd5AIya9GOCxw2exeehP5ZjAY2luSYAPcpAd0vI=; b=z3+D7aKyfz5pmBhoGoIXFe8M15s8tlQqTEChJdtZAeCMT5eYqZe/ojzv2i+jRVFGzp cZMGpb9Fr1KLkLVv0ngUbIi4GnNtH3FDQX8KVWJhS+qMuQvLNAXBwb4/NzBUUQqjSEV8 TcwYnQF3YyQjXf6tB+4zrYfA6ruizYlhZHSYPvcql8n7YmJSDqx3W9DymM/vT8iGhBeH FdmqhTBy2Aw9++v1LbhL1XaeoOrr4OMY51VOyALMKY+/Jmpy0/ZEuQStxykvsKYv4B7s bmyC//tDqh3OwAvUm0xEFxgKtGT88VzgrmH/om5a2WnNYgChAp8+ujHgx2znvDWMR34c FP6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=iL2fpXWH; dkim=pass header.i=@codeaurora.org header.s=default header.b=NvLlUdPw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z16-v6si30281768pga.177.2018.11.01.06.02.21; Thu, 01 Nov 2018 06:02:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=iL2fpXWH; dkim=pass header.i=@codeaurora.org header.s=default header.b=NvLlUdPw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728375AbeKAWEn (ORCPT + 99 others); Thu, 1 Nov 2018 18:04:43 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:36078 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727644AbeKAWEm (ORCPT ); Thu, 1 Nov 2018 18:04:42 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7A742607E2; Thu, 1 Nov 2018 13:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541077309; bh=loOFQ5+Rv8J/8Th+I4HGto0cMxZP2smDduUMYaxJPlk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iL2fpXWHivJYq+z9ihHS5BmlUe+Yma/Sk5tScH6pNMEKpCQuRBTVXG1XsU0eGLjHa YNpdQmnC0GZxWK2BBDrL3Ka4mtHXpGXp3otFtqUhD8Py8hpZyY/DFlhnHBUHUMgF88 8BI0FzZSskcJsyGSZ7+PMxqEHLYBOSSmv2PI6v+Q= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id B0AEB607E2; Thu, 1 Nov 2018 13:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541077308; bh=loOFQ5+Rv8J/8Th+I4HGto0cMxZP2smDduUMYaxJPlk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NvLlUdPw56FUH1d4PrVAXuKQSWCeAr0rGUTS4dDxAUQpCwcg6MTZadyrAquE2vdvs NlOqfdvEemirHXjFpgj7QWTvLzCfiDYM0TWWv6U+oNlt28mEhxEG11gq7b+d1I4Sn5 xX2xX9LQb95fRg2pomDgJ8Wkb1lxGU4gWI00XGvQ= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 01 Nov 2018 18:31:48 +0530 From: mgottam@codeaurora.org To: Stanimir Varbanov Cc: hverkuil@xs4all.nl, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, acourbot@chromium.org, vgarodia@codeaurora.org Subject: Re: [PATCH] media: venus: dynamic handling of bitrate In-Reply-To: <3ff2c3dd-434d-960b-6806-f4bb8ec0d954@linaro.org> References: <1540971728-26789-1-git-send-email-mgottam@codeaurora.org> <3ff2c3dd-434d-960b-6806-f4bb8ec0d954@linaro.org> Message-ID: <3364115421e89c7710725c06b820f8c6@codeaurora.org> X-Sender: mgottam@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-11-01 17:48, Stanimir Varbanov wrote: > Hi Malathi, > > Thanks for the patch! > > On 10/31/18 9:42 AM, Malathi Gottam wrote: >> 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 >> --- >> drivers/media/platform/qcom/venus/venc_ctrls.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c >> b/drivers/media/platform/qcom/venus/venc_ctrls.c >> index 45910172..54f310c 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,15 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) >> break; >> case V4L2_CID_MPEG_VIDEO_BITRATE: >> ctr->bitrate = ctrl->val; >> + if (inst->streamon_out && inst->streamon_cap) { > > Hmm, hfi_session_set_property already checks the instance state so I > don't think those checks are needed. Another thing is that we need to > take the instance mutex to check the instance state. Yes Stan, "hfi_session_set_property" this property check the instance state, but returns EINVAL if this is set at UNINIT instance state. Controls initialization happens much earlier than session init and instance init. So the instance is still in UNINIT state which causes failure while setting. Through this patch we try to meet the client request of changing bitrate only when both planes are streamed on. We have two ways to handle it 1. The way in this patch checks the planes state which will definitely ensure instance is in START state. 2. Have a check to ensure that instance is atleast Initialized. I hope the first proposal is good enough for meeting requirement. > >> + 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) >> + return ret; >> + } >> break; >> case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: >> ctr->bitrate_peak = ctrl->val; >>