diff mbox series

[1/1] venus : Enabling sufficient sequence change support for VP9 on sc7180-venus

Message ID 20220905084227.24028-2-quic_vboma@quicinc.com (mailing list archive)
State Not Applicable
Headers show
Series Enabling sufficient sequence change support for VP9 | expand

Commit Message

Viswanath Boma Sept. 5, 2022, 8:42 a.m. UTC
From: Viswanath Boma <quic_vboma@quicinc.com>

For sc7180 VP9 requires enabling of sufficient sequence change support.

Signed-off-by: Vikash Garodia <vgarodia@qti.qualcomm.com>
Signed-off-by: Viswanath Boma <quic_vboma@quicinc.com>
---
 drivers/media/platform/qcom/venus/core.h       |  2 ++
 drivers/media/platform/qcom/venus/hfi_cmds.c   |  1 +
 drivers/media/platform/qcom/venus/hfi_helper.h |  2 ++
 drivers/media/platform/qcom/venus/hfi_msgs.c   | 13 ++++++-------
 drivers/media/platform/qcom/venus/vdec.c       | 16 +++++++++++++++-
 5 files changed, 26 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
index 60fcded03b872..007494a4fcfcf 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -25,6 +25,7 @@ 
 #define VIDC_CLKS_NUM_MAX		4
 #define VIDC_VCODEC_CLKS_NUM_MAX	2
 #define VIDC_PMDOMAINS_NUM_MAX		3
+#define VER_STR_SZ              128
 
 struct freq_tbl {
 	unsigned int load;
@@ -162,6 +163,7 @@  struct venus_core {
 	unsigned int core0_usage_count;
 	unsigned int core1_usage_count;
 	struct dentry *root;
+	char venus_img_ver[VER_STR_SZ];
 };
 
 struct vdec_controls {
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
index 7ed19050fab49..c296b0d343532 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
@@ -511,6 +511,7 @@  static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt,
 		pkt->shdr.hdr.size += sizeof(u32) + sizeof(*en);
 		break;
 	}
+	case HFI_PROPERTY_PARAM_VDEC_ENABLE_SUFFICIENT_SEQCHANGE_EVENT:
 	case HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER: {
 		struct hfi_enable *in = pdata;
 		struct hfi_enable *en = prop_data;
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index 507ff8c5a9b38..52517aafde214 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -463,6 +463,8 @@ 
 #define HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH			0x1003007
 #define HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT			0x1003009
 #define HFI_PROPERTY_PARAM_VDEC_COLOUR_SPACE			0x100300a
+#define HFI_PROPERTY_PARAM_VDEC_ENABLE_SUFFICIENT_SEQCHANGE_EVENT \
+								0x0100300b
 
 /*
  * HFI_PROPERTY_CONFIG_VDEC_COMMON_START
diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c
index e8776ac45b020..4ef5d6b6e7ec0 100644
--- a/drivers/media/platform/qcom/venus/hfi_msgs.c
+++ b/drivers/media/platform/qcom/venus/hfi_msgs.c
@@ -16,7 +16,6 @@ 
 #include "hfi_parser.h"
 
 #define SMEM_IMG_VER_TBL	469
-#define VER_STR_SZ		128
 #define SMEM_IMG_OFFSET_VENUS	(14 * 128)
 
 static void event_seq_changed(struct venus_core *core, struct venus_inst *inst,
@@ -241,11 +240,11 @@  static void hfi_sys_init_done(struct venus_core *core, struct venus_inst *inst,
 }
 
 static void
-sys_get_prop_image_version(struct device *dev,
+sys_get_prop_image_version(struct venus_core *core,
 			   struct hfi_msg_sys_property_info_pkt *pkt)
 {
+	struct device *dev = core->dev;
 	u8 *smem_tbl_ptr;
-	u8 *img_ver;
 	int req_bytes;
 	size_t smem_blk_sz;
 
@@ -255,15 +254,15 @@  sys_get_prop_image_version(struct device *dev,
 		/* bad packet */
 		return;
 
-	img_ver = (u8 *)&pkt->data[1];
+	strncpy(core->venus_img_ver, (u8 *)&pkt->data[1], VER_STR_SZ);
 
-	dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver);
+	dev_dbg(dev, VDBGL "F/W version: %s\n", core->venus_img_ver);
 
 	smem_tbl_ptr = qcom_smem_get(QCOM_SMEM_HOST_ANY,
 		SMEM_IMG_VER_TBL, &smem_blk_sz);
 	if (!IS_ERR(smem_tbl_ptr) && smem_blk_sz >= SMEM_IMG_OFFSET_VENUS + VER_STR_SZ)
 		memcpy(smem_tbl_ptr + SMEM_IMG_OFFSET_VENUS,
-		       img_ver, VER_STR_SZ);
+		       core->venus_img_ver, VER_STR_SZ);
 }
 
 static void hfi_sys_property_info(struct venus_core *core,
@@ -279,7 +278,7 @@  static void hfi_sys_property_info(struct venus_core *core,
 
 	switch (pkt->data[0]) {
 	case HFI_PROPERTY_SYS_IMAGE_VERSION:
-		sys_get_prop_image_version(dev, pkt);
+		sys_get_prop_image_version(core, pkt);
 		break;
 	default:
 		dev_dbg(dev, VDBGL "unknown property data\n");
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 0525fd0d3ef2c..409705b2b1c88 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -627,7 +627,7 @@  static int vdec_set_properties(struct venus_inst *inst)
 {
 	struct vdec_controls *ctr = &inst->controls.dec;
 	struct hfi_enable en = { .enable = 1 };
-	u32 ptype;
+	u32 ptype, major, minor, rev;
 	int ret;
 
 	if (ctr->post_loop_deb_mode) {
@@ -637,6 +637,20 @@  static int vdec_set_properties(struct venus_inst *inst)
 			return ret;
 	}
 
+
+	/* Enabling sufficient sequence change support for VP9 */
+	ret = sscanf(inst->core->venus_img_ver, "14:VIDEO.VE.%u.%u-%u-PROD",
+			 &major, &minor, &rev);
+	if (ret != 3)
+		return -EINVAL;
+
+	if (major == 5 && minor == 4 && rev >= 51) {
+		ptype = HFI_PROPERTY_PARAM_VDEC_ENABLE_SUFFICIENT_SEQCHANGE_EVENT;
+		ret = hfi_session_set_property(inst, ptype, &en);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }