Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp952780imd; Thu, 1 Nov 2018 08:05:59 -0700 (PDT) X-Google-Smtp-Source: AJdET5fOzlp/3D4NNGlkOrfnQ4vssaPjkdeW507QiWrsJIKFxHSpDOEMulqsgcYRJ7hymTnaSUR1 X-Received: by 2002:a62:5a47:: with SMTP id o68-v6mr8105362pfb.31.1541084759020; Thu, 01 Nov 2018 08:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541084758; cv=none; d=google.com; s=arc-20160816; b=NZi8yu1Ry86Wc7cT9kkbQYjdrod0XtzGq3iY1w3UbMvZg5exYmUaXto4No6YoH+NFF E8OQn5ewcGU6h4qA/I0p/4AhFIyDT28yUXQRqQp9Sb3/OzdNuskaWRMSFJI1kQKSwaqp Dr8cNg1TatWciLFkzU9J8y0XF8/QzD1iWJagi3IKsmZ6XFL4DMDaGekawMuRblMPPDUl V9Io+4UK1JWqsbu7ZMZW63jw00LY6xOirNvCP8Gl8gOVrxGir+CKpiQ0tuf59rHDzL3j qQS9pJStdphPH/wkKZ2XH7hcrzbj4yDXmWgOe315n51LsE8zd6spo8dMZe6Rf5D6Ozrj UbXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=e0iYSht8hSFv2C0qPTuUkTgt8vgA/0rOFTt/hulLcZI=; b=Wl/TLNbkOWFyglLa2dt5e7X6NiVv0UY5B/5kGiJ2aT9bWXARgJYCErwKkj+dyKdRcp 60pYWohLUbBo5sy4EA834sDb/VoKLWJ8cL25mq8XtWqt5GeJjUZuNHkULrUyvYcrTfhM CHZ1rNGJiS9jj6dXZLvPv1AcjyLEFuLLqVINbCwRSqopMcifxfgcA/LEkoT1XpS73Ual GypcsIOBNchwUP+qy8wHXSxKlLykueT8MfaveNL/N2Ar5W/lnAwG6jwtQpXK1oK/Sj3G OFjpH5d+98f7ArZADYtrMLr/e9PAM/BC5OpQuqCXRdE8CO/r8JdEm97e5A5gzJWIbDai tPMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k2wN0dg6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si31432116pll.238.2018.11.01.08.05.43; Thu, 01 Nov 2018 08:05:58 -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=@linaro.org header.s=google header.b=k2wN0dg6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729014AbeKBAGi (ORCPT + 99 others); Thu, 1 Nov 2018 20:06:38 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53309 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728646AbeKBAGh (ORCPT ); Thu, 1 Nov 2018 20:06:37 -0400 Received: by mail-wm1-f65.google.com with SMTP id v24-v6so1674637wmh.3 for ; Thu, 01 Nov 2018 08:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=e0iYSht8hSFv2C0qPTuUkTgt8vgA/0rOFTt/hulLcZI=; b=k2wN0dg6nq7yCE9KmnjO6B3KOt4rAIRaBb7Fc6BmwL5kbTWC6x/SbFR56LJogcC4id Q7FKn/Tr5O9shHA2IxUo6Li3W/wlXHTaVhf3ZbgVpqFN4B3QY17saifq8SH5yARG6q4n e7oes+AYxLIGf6DUBNEcG3ksKO2iFdrb8098o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=e0iYSht8hSFv2C0qPTuUkTgt8vgA/0rOFTt/hulLcZI=; b=tAhtvfVwXj70/AK1WkyYq0JQ4cFkO+rQPvlX0PqFEIFrR2NHVgoWZwKkc6Fa2dcR/s 7yKl10SJcxTiOGK9L896vWkY/EDsxSiLDoB5FibHPong/RzDpsifBlZkmYetxwb3fy0X vs7eBajCRDPSwFPNUGd3gllZb7ddVGkLEmTT3KS7LIFCKHfxjmAlqQEAj5AtxG0CRv0y uOXBcpCLFDPxIqwQSkPso1RbSE6tuwIZVd5HuQqAjE4jnEAnxkBCV1Zo96vT1zpf+JLV zf1HQE043dFKWrGi48sNAiHHPFvgtmra6u5SOgNTTCnni9MFeM+EhaQhmVSsXGH7Qi2l OtTQ== X-Gm-Message-State: AGRZ1gKhL9aWAe6vjH3PPnkGSi+VfJxQATTfK9vPTAcLBONNI8ME9Y6W gRTVsUMOPtWKVP/DiQjMH/fHCQ== X-Received: by 2002:a1c:3403:: with SMTP id b3-v6mr5849291wma.108.1541084596023; Thu, 01 Nov 2018 08:03:16 -0700 (PDT) Received: from [192.168.27.209] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id r1sm7181535wrx.15.2018.11.01.08.03.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 08:03:15 -0700 (PDT) Subject: Re: [PATCH] media: venus: dynamic handling of bitrate To: Tomasz Figa , vgarodia@codeaurora.org Cc: mgottam@codeaurora.org, Stanimir Varbanov , Hans Verkuil , Mauro Carvalho Chehab , Linux Media Mailing List , Linux Kernel Mailing List , linux-arm-msm , Alexandre Courbot , linux-media-owner@vger.kernel.org References: <1540971728-26789-1-git-send-email-mgottam@codeaurora.org> <3ff2c3dd-434d-960b-6806-f4bb8ec0d954@linaro.org> <3364115421e89c7710725c06b820f8c6@codeaurora.org> From: Stanimir Varbanov Message-ID: <19a08bd3-4e4c-56d2-6df2-54c3d91af4f3@linaro.org> Date: Thu, 1 Nov 2018 17:03:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/1/18 4:31 PM, Tomasz Figa wrote: > On Thu, Nov 1, 2018 at 11:23 PM Vikash Garodia wrote: >> >> On 2018-11-01 19:23, Tomasz Figa wrote: >>> On Thu, Nov 1, 2018 at 10:01 PM wrote: >>>> >>>> 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. >>> >>> Where does this requirement come from? It should be possible to set >>> the control at any time and it should apply to any encoding happening >>> after the control is set. >>> >> With the patch, now video driver will set the control whenever client >> sets >> and will apply to encoder. > > That's good, thanks for clarifying. I guess I misunderstood Malathi's comment. OK, just wonder about locking when we check streamon_out/cap flags? -- regards, Stan