Skip to contentSkip to conversation

media: venus: handle peak bitrate set property

PATCH Superseded Malathi Gottam 2 participants 3 messages Oct 9, 2018 – Oct 22, 2018

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: venus: handle peak bitrate set property

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

---
 drivers/media/platform/qcom/venus/venc.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/media/platform/qcom/venus/venc.c +12 -10
index ef11495..3f50cd0 100644
@@ -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,
Signature · 1 line
1.9.1
#1 lore raw

Hi Malathi,

Thanks for the patch!

Quoted 2 lines · Malathi Gottam

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.

Quoted 42 lines
---
 drivers/media/platform/qcom/venus/venc.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/media/platform/qcom/venus/venc.c +12 -10
index ef11495..3f50cd0 100644
@@ -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,
Signature · 2 lines
regards,
Stan
#2 lore raw
Quoted 52 lines · Stanimir Varbanov

Hi Malathi,

Thanks for the patch!

Quoted 2 lines · Malathi Gottam

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.

Quoted 40 lines
---
 drivers/media/platform/qcom/venus/venc.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/media/platform/qcom/venus/venc.c +12 -10
index ef11495..3f50cd0 100644
@@ -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;
+	}
 
Quoted 3 lines
Quoted 3 lines
drivers/media/platform/qcom/venus/venc.c +0 -0
 	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.