linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: venus: handle peak bitrate set property
@ 2018-10-09  7:51 Malathi Gottam
  2018-10-09 14:59 ` Stanimir Varbanov
  0 siblings, 1 reply; 3+ messages in thread
From: Malathi Gottam @ 2018-10-09  7:51 UTC (permalink / raw)
  To: stanimir.varbanov, hverkuil, mchehab
  Cc: linux-media, linux-kernel, linux-arm-msm, acourbot, vgarodia, mgottam

Max bitrate property is not supported for venus version 4xx.
Add a version check for the same.

Signed-off-by: Malathi Gottam <mgottam@codeaurora.org>
---
 drivers/media/platform/qcom/venus/venc.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index ef11495..3f50cd0 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -757,18 +757,20 @@ static int venc_set_properties(struct venus_inst *inst)
 	if (ret)
 		return ret;
 
-	if (!ctr->bitrate_peak)
-		bitrate *= 2;
-	else
-		bitrate = ctr->bitrate_peak;
+	if (!IS_V4(inst->core)) {
+		if (!ctr->bitrate_peak)
+			bitrate *= 2;
+		else
+			bitrate = ctr->bitrate_peak;
 
-	ptype = HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE;
-	brate.bitrate = bitrate;
-	brate.layer_id = 0;
+		ptype = HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE;
+		brate.bitrate = bitrate;
+		brate.layer_id = 0;
 
-	ret = hfi_session_set_property(inst, ptype, &brate);
-	if (ret)
-		return ret;
+		ret = hfi_session_set_property(inst, ptype, &brate);
+		if (ret)
+			return ret;
+	}
 
 	if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264) {
 		profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_H264_PROFILE,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: venus: handle peak bitrate set property
  2018-10-09  7:51 [PATCH] media: venus: handle peak bitrate set property Malathi Gottam
@ 2018-10-09 14:59 ` Stanimir Varbanov
  2018-10-22 12:04   ` mgottam
  0 siblings, 1 reply; 3+ messages in thread
From: Stanimir Varbanov @ 2018-10-09 14:59 UTC (permalink / raw)
  To: Malathi Gottam, stanimir.varbanov, hverkuil, mchehab
  Cc: linux-media, linux-kernel, linux-arm-msm, acourbot, vgarodia

Hi Malathi,

Thanks for the patch!

On 10/09/2018 10:51 AM, Malathi Gottam wrote:
> Max bitrate property is not supported for venus version 4xx.
> Add a version check for the same.

I'd like to avoid version checks in this layer of the driver. Could just
black-list this property in pkt_session_set_property_4xx? Hint, see
HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE in the same function.

> 
> Signed-off-by: Malathi Gottam <mgottam@codeaurora.org>
> ---
>  drivers/media/platform/qcom/venus/venc.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
> index ef11495..3f50cd0 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -757,18 +757,20 @@ static int venc_set_properties(struct venus_inst *inst)
>  	if (ret)
>  		return ret;
>  
> -	if (!ctr->bitrate_peak)
> -		bitrate *= 2;
> -	else
> -		bitrate = ctr->bitrate_peak;
> +	if (!IS_V4(inst->core)) {
> +		if (!ctr->bitrate_peak)
> +			bitrate *= 2;
> +		else
> +			bitrate = ctr->bitrate_peak;
>  
> -	ptype = HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE;
> -	brate.bitrate = bitrate;
> -	brate.layer_id = 0;
> +		ptype = HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE;
> +		brate.bitrate = bitrate;
> +		brate.layer_id = 0;
>  
> -	ret = hfi_session_set_property(inst, ptype, &brate);
> -	if (ret)
> -		return ret;
> +		ret = hfi_session_set_property(inst, ptype, &brate);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264) {
>  		profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_H264_PROFILE,
> 

-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: venus: handle peak bitrate set property
  2018-10-09 14:59 ` Stanimir Varbanov
@ 2018-10-22 12:04   ` mgottam
  0 siblings, 0 replies; 3+ messages in thread
From: mgottam @ 2018-10-22 12:04 UTC (permalink / raw)
  To: Stanimir Varbanov
  Cc: hverkuil, mchehab, linux-media, linux-kernel, linux-arm-msm,
	acourbot, vgarodia

On 2018-10-09 20:29, Stanimir Varbanov wrote:
> Hi Malathi,
> 
> Thanks for the patch!
> 
> On 10/09/2018 10:51 AM, Malathi Gottam wrote:
>> Max bitrate property is not supported for venus version 4xx.
>> Add a version check for the same.
> 
> I'd like to avoid version checks in this layer of the driver. Could 
> just
> black-list this property in pkt_session_set_property_4xx? Hint, see
> HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE in the same function.
> 
>> 
>> Signed-off-by: Malathi Gottam <mgottam@codeaurora.org>
>> ---
>>  drivers/media/platform/qcom/venus/venc.c | 22 ++++++++++++----------
>>  1 file changed, 12 insertions(+), 10 deletions(-)
>> 
>> diff --git a/drivers/media/platform/qcom/venus/venc.c 
>> b/drivers/media/platform/qcom/venus/venc.c
>> index ef11495..3f50cd0 100644
>> --- a/drivers/media/platform/qcom/venus/venc.c
>> +++ b/drivers/media/platform/qcom/venus/venc.c
>> @@ -757,18 +757,20 @@ static int venc_set_properties(struct venus_inst 
>> *inst)
>>  	if (ret)
>>  		return ret;
>> 
>> -	if (!ctr->bitrate_peak)
>> -		bitrate *= 2;
>> -	else
>> -		bitrate = ctr->bitrate_peak;
>> +	if (!IS_V4(inst->core)) {
>> +		if (!ctr->bitrate_peak)
>> +			bitrate *= 2;
>> +		else
>> +			bitrate = ctr->bitrate_peak;
>> 
>> -	ptype = HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE;
>> -	brate.bitrate = bitrate;
>> -	brate.layer_id = 0;
>> +		ptype = HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE;
>> +		brate.bitrate = bitrate;
>> +		brate.layer_id = 0;
>> 
>> -	ret = hfi_session_set_property(inst, ptype, &brate);
>> -	if (ret)
>> -		return ret;
>> +		ret = hfi_session_set_property(inst, ptype, &brate);
>> +		if (ret)
>> +			return ret;
>> +	}
>> 
>>  	if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264) {
>>  		profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_H264_PROFILE,
>> 
Hi Stan,

Though this property is bypassed in the function 
"pkt_session_set_property_4xx", it is set to firmware in hfi_venus 
layer.

So we can return -ENOTSUPP from packet layer. If hfi_venus layer 
receives error as ENOTSUPP, treat it as normal and return 0 to venc 
layer.

I will post the updated patch, with this implementation.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-22 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09  7:51 [PATCH] media: venus: handle peak bitrate set property Malathi Gottam
2018-10-09 14:59 ` Stanimir Varbanov
2018-10-22 12:04   ` mgottam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).