Skip to contentSkip to conversation

media: venus: Add QCM2290 support with AR50_LITE core

PATCH Superseded Jorge Ramirez-Ortiz 7 participants 42 messages Jun 26, 2025 – Jul 14, 2025

Subsystems (6)

v5 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v5 cover media: venus: Add QCM2290 support with AR50_LITE core

Changes since v4:
- patch 1/5:
- added reviewed by: Krzysztof Kozlowski
- updated example section
- patch 2/5:
- added reviewed by: Bryan O'Donoghue
- Fixed Co-developed-by order
- patch 3/5:
- patch 4/5:
- removed encode-node (userspace exposure)
- fixed Co-developed-by order
- patch 5/5:
- fixed venus register region
- power-domain-names: one per line
- clock-names: one per line
- fixed interconnect tags
- empty line before subnode
- enable the venus node

Changes since v3:
- Fixed schema commit subject.

Changes since v2:
- Removed IS_HFI/IS_VPU macros
- checkpatch.pl --strict fixes:
- convert macro to static inline to avoid argument reuse side effect

Changes since v1:
- Added IS_HFI macro usage
- Moved schema patch to top
- Fixed commit messages

This patch series adds support for the Venus video decoder/encoder block present on the Qualcomm QCM2290.

Only video decoding is supported in this set - video encoding should follow up in the coming weeks.

The QCM2290 integrates an AR50_LITE core, a low-power implementation of Venus supporting H.264, HEVC (H.265), and VP9 decoding.

The series includes:
- DT binding schema for qcom,qcm2290-venus
- SoC integration via qcm2290.dtsi
- Resource table definitions and frequency scaling
- Platform capability registration for the AR50_LITE core decoding block.

Decoding was verified on the QCOM RB1 platform using GStreamer with V4L2-based decode plugins. The following pipelines were used for playback 1280x720 and 1920x1080 H.264, HEVC and VP9 videos from https://www.elecard.com/videos.

[H.264]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h264parse ! v4l2h264dec \
! videoconvert ! autovideosink

[H.265]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h265parse ! v4l2h265dec \
! videoconvert ! autovideosink

[VP9]
gst-launch-1.0 filesrc location=videos/xxxxx.webm \
! matroskademux ! queue ! v4l2vp9dec \
! videoconvert ! autovideosink

[Fluster]
The H.264 decoder was also tested using the Fluster test suite (version: v0.4.0-12-g33566abd0964).
Target: GStreamer-H.264-V4L2-Gst1.0, Test Suite: JVT-AVC_V1
Result: 126/135 tests passed
Failures:
FM1_BT_B, FM1_FT_E, FM2_SVA_C, BA3_SVA_C, SP1_BT_A, SP2_BT_B, MR6_BT_B, MR7_BT_B, MR8_BT_B

---

Jorge Ramirez-Ortiz (5):
media: dt-bindings: venus: Add qcm2290 dt schema
media: venus: vdec: AR50_LITE video core support
media: venus: hfi_plat_v6_lite: Populate decode capabilities
media: venus: core: Add qcm2290 DT compatible and resource data
arm64: dts: qcom: qcm2290: Add venus video node

 .../bindings/media/qcom,qcm2290-venus.yaml    | 127 +++++++++++++++
 arch/arm64/boot/dts/qcom/qcm2290.dtsi         |  57 +++++++
 drivers/media/platform/qcom/venus/Makefile    |   2 +-
 drivers/media/platform/qcom/venus/core.c      |  50 +++++-
 drivers/media/platform/qcom/venus/core.h      |  11 +-
 drivers/media/platform/qcom/venus/firmware.c  |   8 +-
 drivers/media/platform/qcom/venus/helpers.c   |  80 ++++++++++
 drivers/media/platform/qcom/venus/helpers.h   |   2 +
 .../media/platform/qcom/venus/hfi_helper.h    |  10 +-
 .../media/platform/qcom/venus/hfi_platform.c  |   2 +
 .../media/platform/qcom/venus/hfi_platform.h  |   1 +
 .../qcom/venus/hfi_platform_v6_lite.c         | 148 ++++++++++++++++++
 drivers/media/platform/qcom/venus/hfi_venus.c |  14 +-
 .../media/platform/qcom/venus/pm_helpers.c    |   1 +
 drivers/media/platform/qcom/venus/vdec.c      |  15 +-
 15 files changed, 503 insertions(+), 25 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
 create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH v5 1/5 media: dt-bindings: venus: Add qcm2290 dt schema

Add a schema for the venus video encoder/decoder on the qcm2290.

---
 .../bindings/media/qcom,qcm2290-venus.yaml    | 127 ++++++++++++++++++
 1 file changed, 127 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +127 -0
new file mode 100644
index 000000000000..a9f89b545334
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/qcom,qcm2290-venus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm QCM2290 Venus video encode and decode accelerators
+
+maintainers:
+  - Vikash Garodia <[email protected]>
+
+description:
+  The Venus AR50_LITE IP is a video encode and decode accelerator present
+  on Qualcomm platforms
+
+allOf:
+  - $ref: qcom,venus-common.yaml#
+
+properties:
+  compatible:
+    const: qcom,qcm2290-venus
+
+  power-domains:
+    maxItems: 3
+
+  power-domain-names:
+    items:
+      - const: venus
+      - const: vcodec0
+      - const: cx
+
+  clocks:
+    maxItems: 6
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+      - const: bus
+      - const: throttle
+      - const: vcodec0_core
+      - const: vcodec0_bus
+
+  iommus:
+    minItems: 1
+    maxItems: 5
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  operating-points-v2: true
+  opp-table:
+    type: object
+
+required:
+  - compatible
+  - power-domain-names
+  - iommus
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/qcom,gcc-qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,rpm-icc.h>
+    #include <dt-bindings/power/qcom-rpmpd.h>
+
+    venus: video-codec@5a00000 {
+        compatible = "qcom,qcm2290-venus";
+        reg = <0x5a00000 0xf0000>;
+        interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+        power-domains = <&gcc GCC_VENUS_GDSC>,
+                        <&gcc GCC_VCODEC0_GDSC>,
+                        <&rpmpd QCM2290_VDDCX>;
+        power-domain-names = "venus",
+                             "vcodec0",
+                             "cx";
+        operating-points-v2 = <&venus_opp_table>;
+
+        clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+                 <&gcc GCC_VIDEO_AHB_CLK>,
+                 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+                 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+                 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+                 <&gcc GCC_VCODEC0_AXI_CLK>;
+        clock-names = "core",
+                       "iface",
+                       "bus",
+                       "throttle",
+                       "vcodec0_core",
+                       "vcodec0_bus";
+
+        memory-region = <&pil_video_mem>;
+        iommus = <&apps_smmu 0x860 0x0>,
+                 <&apps_smmu 0x880 0x0>,
+                 <&apps_smmu 0x861 0x04>,
+                 <&apps_smmu 0x863 0x0>,
+                 <&apps_smmu 0x804 0xE0>;
+
+        interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+                         &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+                        <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+                         &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+        interconnect-names = "video-mem",
+                             "cpu-cfg";
+
+        venus_opp_table: opp-table {
+            compatible = "operating-points-v2";
+
+            opp-133000000 {
+                opp-hz = /bits/ 64 <133000000>;
+                required-opps = <&rpmpd_opp_low_svs>;
+            };
+            opp-240000000 {
+                opp-hz = /bits/ 64 <240000000>;
+                required-opps = <&rpmpd_opp_svs>;
+            };
+        };
+    };
Signature · 1 line
2.34.1
#9 lore raw

PATCH v5 2/5 media: venus: vdec: AR50_LITE video core support

In reply to Jorge Ramirez-Ortiz

The AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.

---
 drivers/media/platform/qcom/venus/core.c      | 11 ++-
 drivers/media/platform/qcom/venus/core.h      | 11 ++-
 drivers/media/platform/qcom/venus/firmware.c  |  8 +-
 drivers/media/platform/qcom/venus/helpers.c   | 80 +++++++++++++++++++
 drivers/media/platform/qcom/venus/helpers.h   |  2 +
 .../media/platform/qcom/venus/hfi_helper.h    | 10 ++-
 drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++--
 .../media/platform/qcom/venus/pm_helpers.c    |  1 +
 drivers/media/platform/qcom/venus/vdec.c      | 15 ++--
 9 files changed, 128 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
index d305d74bb152..736ef53d988d 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
 static void venus_assign_register_offsets(struct venus_core *core)
 {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		core->cpu_base = core->base + CPU_BASE_V6;
 		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
 		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
 		core->wrapper_base = core->base + WRAPPER_BASE_V6;
 		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
 	} else {
 		core->vbif_base = core->base + VBIF_BASE;
 		core->cpu_base = core->base + CPU_BASE;
drivers/media/platform/qcom/venus/core.h +10 -1
index b412e0c5515a..e755a28e919b 100644
@@ -382,6 +382,7 @@ enum venus_inst_modes {
  * @lock:	instance lock
  * @core:	a reference to the core struct
  * @clk_data:	clock data per core ID
+ * @eosbufs:	a lit of EOS buffers
  * @dpbbufs:	a list of decoded picture buffers
  * @internalbufs:	a list of internal bufferes
  * @registeredbufs:	a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {
 	struct mutex lock;
 	struct venus_core *core;
 	struct clock_data clk_data;
+	struct list_head eosbufs;
 	struct list_head dpbbufs;
 	struct list_head internalbufs;
 	struct list_head registeredbufs;
@@ -520,7 +522,14 @@ struct venus_inst {
 #define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
 #define IS_V3(core)	((core)->res->hfi_version == HFI_VERSION_3XX)
 #define IS_V4(core)	((core)->res->hfi_version == HFI_VERSION_4XX)
-#define IS_V6(core)	((core)->res->hfi_version == HFI_VERSION_6XX)
+static inline bool IS_V6(struct venus_core *core)
+{
+	if (WARN_ON_ONCE(!core))
+		return false;
+
+	return core->res->hfi_version == HFI_VERSION_6XX ||
+	       core->res->hfi_version == HFI_VERSION_6XX_LITE;
+}
 
 #define IS_AR50(core)		((core)->res->vpu_version == VPU_VERSION_AR50)
 #define IS_AR50_LITE(core)	((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +4 -4
index 66a18830e66d..f8dcef0426ac 100644
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	u32 fw_size = core->fw.mapped_mem_size;
 	void __iomem *wrapper_base;
 
-	if (IS_IRIS2_1(core))
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 		wrapper_base = core->wrapper_tz_base;
 	else
 		wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR);
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR);
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Bring XTSS out of reset */
 		writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET);
 	} else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)
 	if (resume) {
 		venus_reset_cpu(core);
 	} else {
-		if (IS_IRIS2_1(core))
+		if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 			writel(WRAPPER_XTSS_SW_RESET_BIT,
 			       core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
 		else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)
 	void __iomem *wrapper_base = core->wrapper_base;
 	void __iomem *wrapper_tz_base = core->wrapper_tz_base;
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Assert the reset to XTSS */
 		reg = readl(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
 		reg |= WRAPPER_XTSS_SW_RESET_BIT;
drivers/media/platform/qcom/venus/helpers.c +80 -0

92 lines not on this page · raw message

drivers/media/platform/qcom/venus/helpers.h +2 -0
index 358e4f39c9c0..bf55fe3b8747 100644
@@ -58,6 +58,8 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt,
 bool venus_helper_check_format(struct venus_inst *inst, u32 v4l2_pixfmt);
 int venus_helper_alloc_dpb_bufs(struct venus_inst *inst);
 int venus_helper_free_dpb_bufs(struct venus_inst *inst);
+int venus_helper_alloc_eos_buf(struct venus_inst *inst, struct hfi_frame_data *data);
+int venus_helper_free_eos_bufs(struct venus_inst *inst);
 int venus_helper_intbufs_alloc(struct venus_inst *inst);
 int venus_helper_intbufs_free(struct venus_inst *inst);
 int venus_helper_intbufs_realloc(struct venus_inst *inst);
drivers/media/platform/qcom/venus/hfi_helper.h +7 -3
index f44059f19505..128ddf8e3cd5 100644
@@ -397,13 +397,16 @@
 #define HFI_BUFFER_INTERNAL_PERSIST_1		0x5
 #define HFI_BUFFER_INTERNAL_SCRATCH(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x6 : 0x1000001)
 #define HFI_BUFFER_INTERNAL_SCRATCH_1(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x7 : 0x1000005)
 #define HFI_BUFFER_INTERNAL_SCRATCH_2(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x8 : 0x1000006)
 #define HFI_BUFFER_EXTRADATA_INPUT(ver)		\
 	(((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)
 #define HFI_BUFFER_EXTRADATA_OUTPUT(ver)	\
@@ -561,6 +564,7 @@ enum hfi_version {
 	HFI_VERSION_3XX,
 	HFI_VERSION_4XX,
 	HFI_VERSION_6XX,
+	HFI_VERSION_6XX_LITE,
 };
 
 struct hfi_buffer_info {
drivers/media/platform/qcom/venus/hfi_venus.c +9 -5
index b5f2ea879950..302776bf8fe6 100644
@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)
 	if (count >= max_tries)
 		ret = -ETIMEDOUT;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core)) {
 		writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6);
 		writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);
 	}
@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)
 	u32 mask_val;
 	int ret;
 
+	if (IS_AR50_LITE(hdev->core))
+		return 0;
+
 	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
 		writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6);
 
@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core)
 	wrapper_base = hdev->core->wrapper_base;
 
 	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
+
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
 		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||
 		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
 			hdev->irq_status = status;
 	}
 	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
-	if (!(IS_IRIS2(core) || IS_IRIS2_1(core)))
+	if (!(IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)))
 		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
 
 	return IRQ_WAKE_THREAD;
@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
drivers/media/platform/qcom/venus/pm_helpers.c +1 -0
index 409aa9bd0b5d..5d9dfe3fd043 100644
@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)
 		return &pm_ops_v3;
 	case HFI_VERSION_4XX:
 	case HFI_VERSION_6XX:
+	case HFI_VERSION_6XX_LITE:
 		return &pm_ops_v4;
 	}
 
drivers/media/platform/qcom/venus/vdec.c +7 -8
index 99ce5fd41577..87c7901b280e 100644
@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 {
 	struct venus_inst *inst = to_inst(file);
 	struct vb2_queue *dst_vq;
-	struct hfi_frame_data fdata = {0};
+	struct hfi_frame_data fdata;
 	int ret;
 
 	ret = v4l2_m2m_ioctl_try_decoder_cmd(file, fh, cmd);
@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 
 	if (cmd->cmd == V4L2_DEC_CMD_STOP) {
 		/*
-		 * Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on
+		 * Implement V4L2_DEC_CMD_STOP by enqueue a buffer on
 		 * decoder input to signal EOS.
 		 */
 		if (!(inst->streamon_out && inst->streamon_cap))
 			goto unlock;
 
-		fdata.buffer_type = HFI_BUFFER_INPUT;
-		fdata.flags |= HFI_BUFFERFLAG_EOS;
-		if (IS_V6(inst->core) && is_fw_rev_or_older(inst->core, 1, 0, 87))
-			fdata.device_addr = 0;
-		else
-			fdata.device_addr = 0xdeadb000;
+		ret = venus_helper_alloc_eos_buf(inst, &fdata);
+		if (ret)
+			goto unlock;
 
 		ret = hfi_session_process_buf(inst, &fdata);
 
@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)
 		hfi_session_abort(inst);
 
 	venus_helper_free_dpb_bufs(inst);
+	venus_helper_free_eos_bufs(inst);
 	venus_pm_load_scale(inst);
 	INIT_LIST_HEAD(&inst->registeredbufs);
 	mutex_unlock(&inst->lock);
@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)
 	if (!inst)
 		return -ENOMEM;
 
+	INIT_LIST_HEAD(&inst->eosbufs);
 	INIT_LIST_HEAD(&inst->dpbbufs);
 	INIT_LIST_HEAD(&inst->registeredbufs);
 	INIT_LIST_HEAD(&inst->internalbufs);
Signature · 1 line
2.34.1
#16 lore raw

PATCH v5 3/5 media: venus: hfi_plat_v6_lite: Populate decode capabilities

In reply to Jorge Ramirez-Ortiz

Add hfi platform file with decoding capabilities for hfi v6_lite.

---
 drivers/media/platform/qcom/venus/Makefile    |   2 +-
 .../media/platform/qcom/venus/hfi_platform.c  |   2 +
 .../media/platform/qcom/venus/hfi_platform.h  |   1 +
 .../qcom/venus/hfi_platform_v6_lite.c         | 148 ++++++++++++++++++
 4 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
drivers/media/platform/qcom/venus/Makefile +1 -1
index 91ee6be10292..4a6a942db58b 100644
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \
 		   hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \
 		   hfi_parser.o pm_helpers.o dbgfs.o \
 		   hfi_platform.o hfi_platform_v4.o \
-		   hfi_platform_v6.o hfi_plat_bufs_v6.o \
+		   hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \
 
 venus-dec-objs += vdec.o vdec_ctrls.o
 venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
index 643e5aa138f5..f56b8f9946d7 100644
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
 		return &hfi_plat_v4;
 	case HFI_VERSION_6XX:
 		return &hfi_plat_v6;
+	case HFI_VERSION_6XX_LITE:
+		return &hfi_plat_v6_lite;
 	default:
 		break;
 	}
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
index ec89a90a8129..6356e4bd0de2 100644
@@ -58,6 +58,7 @@ struct hfi_platform {
 
 extern const struct hfi_platform hfi_plat_v4;
 extern const struct hfi_platform hfi_plat_v6;
+extern const struct hfi_platform hfi_plat_v6_lite;
 
 const struct hfi_platform *hfi_platform_get(enum hfi_version version);
 unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +148 -0

148 lines not on this page · raw message

Signature · 1 line
2.34.1
#22 lore raw

PATCH v5 4/5 media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the venus core.

Video encoding support is not exposed until the relevant hardware capabilities are enabled.

---
 drivers/media/platform/qcom/venus/core.c | 39 ++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/media/platform/qcom/venus/core.c +39 -0
index 736ef53d988d..f1f211ca1ce2 100644
@@ -1062,6 +1062,44 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct freq_tbl qcm2290_freq_table[] = {
+	{ 352800, 240000000 },	/* 1920x1088 @ 30 + 1280x720 @ 30 */
+	{ 244800, 133000000 },	/* 1920x1088 @ 30 */
+};
+
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 244800, 2128000, 0, 2128000, 0}, /* 1920x1088 @ 30 */
+};
+
+static const struct venus_resources qcm2290_res = {
+	.freq_tbl = qcm2290_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(qcm2290_freq_table),
+	.bw_tbl_dec = qcm2290_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(qcm2290_bw_table_dec),
+	.clks = { "core", "iface", "bus", "throttle" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
+	.vcodec_clks_num = 2,
+	.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx" },
+	.vcodec_num = 1,
+	.hfi_version = HFI_VERSION_6XX_LITE,
+	.vpu_version = VPU_VERSION_AR50_LITE,
+	.max_load = 352800,
+	.num_vpp_pipes = 1,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x70800000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x24800000,
+	.dma_mask = 0xe0000000 - 1,
+	.fwname = "qcom/venus-6.0/venus.mbn",
+	.dec_nodename = "video-decoder",
+};
+
 static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
 	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
@@ -1072,6 +1110,7 @@ static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
 	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
 	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
+	{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, venus_dt_match);
Signature · 1 line
2.34.1
#28 lore raw

PATCH v5 5/5 arm64: dts: qcom: qcm2290: Add venus video node

In reply to Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +57 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			status = "okay";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};
+
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
 		mdss: display-subsystem@5e00000 {
 			compatible = "qcom,qcm2290-mdss";
 			reg = <0x0 0x05e00000 0x0 0x1000>;
Signature · 1 line
2.34.1
#29 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1671

Quoted 9 lines · Jorge Ramirez-Ortiz
arch/arm64/boot/dts/qcom/qcm2290.dtsi +9 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			status = "okay";

Drop, unless you override existing node, but then this should follow standard override-label/phandle syntax.

Best regards,
Krzysztof

#30 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

Quoted 14 lines · Krzysztof Kozlowski

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1671

Quoted 9 lines · Jorge Ramirez-Ortiz
arch/arm64/boot/dts/qcom/qcm2290.dtsi +9 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			status = "okay";

Drop, unless you override existing node, but then this should follow standard override-label/phandle syntax.

yep

Reviewed-by on v5 4/5
#23 lore raw

Re: [PATCH v5 4/5] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Jorge Ramirez-Ortiz
Quoted 62 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the venus core.

Video encoding support is not exposed until the relevant hardware capabilities are enabled.

---
  drivers/media/platform/qcom/venus/core.c | 39 ++++++++++++++++++++++++
  1 file changed, 39 insertions(+)
drivers/media/platform/qcom/venus/core.c +38 -0
index 736ef53d988d..f1f211ca1ce2 100644
@@ -1062,6 +1062,44 @@ static const struct venus_resources sc7280_res = {
  	.enc_nodename = "video-encoder",
  };
 
+static const struct freq_tbl qcm2290_freq_table[] = {
+	{ 352800, 240000000 },	/* 1920x1088 @ 30 + 1280x720 @ 30 */
+	{ 244800, 133000000 },	/* 1920x1088 @ 30 */
+};
+
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 244800, 2128000, 0, 2128000, 0}, /* 1920x1088 @ 30 */
+};
+
+static const struct venus_resources qcm2290_res = {
+	.freq_tbl = qcm2290_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(qcm2290_freq_table),
+	.bw_tbl_dec = qcm2290_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(qcm2290_bw_table_dec),
+	.clks = { "core", "iface", "bus", "throttle" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
+	.vcodec_clks_num = 2,
+	.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx" },
+	.vcodec_num = 1,
+	.hfi_version = HFI_VERSION_6XX_LITE,
+	.vpu_version = VPU_VERSION_AR50_LITE,
+	.max_load = 352800,
+	.num_vpp_pipes = 1,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x70800000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x24800000,
+	.dma_mask = 0xe0000000 - 1,
+	.fwname = "qcom/venus-6.0/venus.mbn",
+	.dec_nodename = "video-decoder",
+};
+
  static const struct of_device_id venus_dt_match[] = {
  	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
  	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },

drivers/media/platform/qcom/venus/core.c static const struct of_device_id venus_dt_match[] = { · line 1116

Quoted 7 lines
drivers/media/platform/qcom/venus/core.c +1 -0
@@ -1072,6 +1110,7 @@ static const struct of_device_id venus_dt_match[] = {
  	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
  	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
  	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
+	{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },
  	{ }
  };
  MODULE_DEVICE_TABLE(of, venus_dt_match);
Reviewed-by on v5 1/5
#2 lore raw

Re: [PATCH v5 1/5] media: dt-bindings: venus: Add qcm2290 dt schema

In reply to Jorge Ramirez-Ortiz
Quoted 132 lines · Jorge Ramirez-Ortiz

Add a schema for the venus video encoder/decoder on the qcm2290.

---
  .../bindings/media/qcom,qcm2290-venus.yaml    | 127 ++++++++++++++++++
  1 file changed, 127 insertions(+)

create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +117 -0
new file mode 100644
index 000000000000..a9f89b545334
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/qcom,qcm2290-venus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm QCM2290 Venus video encode and decode accelerators
+
+maintainers:
+  - Vikash Garodia <[email protected]>
+
+description:
+  The Venus AR50_LITE IP is a video encode and decode accelerator present
+  on Qualcomm platforms
+
+allOf:
+  - $ref: qcom,venus-common.yaml#
+
+properties:
+  compatible:
+    const: qcom,qcm2290-venus
+
+  power-domains:
+    maxItems: 3
+
+  power-domain-names:
+    items:
+      - const: venus
+      - const: vcodec0
+      - const: cx
+
+  clocks:
+    maxItems: 6
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+      - const: bus
+      - const: throttle
+      - const: vcodec0_core
+      - const: vcodec0_bus
+
+  iommus:
+    minItems: 1
+    maxItems: 5
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  operating-points-v2: true
+  opp-table:
+    type: object
+
+required:
+  - compatible
+  - power-domain-names
+  - iommus
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/qcom,gcc-qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,rpm-icc.h>
+    #include <dt-bindings/power/qcom-rpmpd.h>
+
+    venus: video-codec@5a00000 {
+        compatible = "qcom,qcm2290-venus";
+        reg = <0x5a00000 0xf0000>;
+        interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+        power-domains = <&gcc GCC_VENUS_GDSC>,
+                        <&gcc GCC_VCODEC0_GDSC>,
+                        <&rpmpd QCM2290_VDDCX>;
+        power-domain-names = "venus",
+                             "vcodec0",
+                             "cx";
+        operating-points-v2 = <&venus_opp_table>;
+
+        clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+                 <&gcc GCC_VIDEO_AHB_CLK>,
+                 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+                 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+                 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+                 <&gcc GCC_VCODEC0_AXI_CLK>;
+        clock-names = "core",
+                       "iface",
+                       "bus",
+                       "throttle",
+                       "vcodec0_core",
+                       "vcodec0_bus";
+
+        memory-region = <&pil_video_mem>;
+        iommus = <&apps_smmu 0x860 0x0>,
+                 <&apps_smmu 0x880 0x0>,
+                 <&apps_smmu 0x861 0x04>,
+                 <&apps_smmu 0x863 0x0>,
+                 <&apps_smmu 0x804 0xE0>;
+
+        interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+                         &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+                        <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+                         &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+        interconnect-names = "video-mem",
+                             "cpu-cfg";
+
+        venus_opp_table: opp-table {
+            compatible = "operating-points-v2";
+

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 127

Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10 -0
+            opp-133000000 {
+                opp-hz = /bits/ 64 <133000000>;
+                required-opps = <&rpmpd_opp_low_svs>;
+            };
+            opp-240000000 {
+                opp-hz = /bits/ 64 <240000000>;
+                required-opps = <&rpmpd_opp_svs>;
+            };
+        };
+    };
Reviewed-by on v5 3/5
#17 lore raw

Re: [PATCH v5 3/5] media: venus: hfi_plat_v6_lite: Populate decode capabilities

In reply to Jorge Ramirez-Ortiz
Quoted 193 lines · Jorge Ramirez-Ortiz

Add hfi platform file with decoding capabilities for hfi v6_lite.

---
  drivers/media/platform/qcom/venus/Makefile    |   2 +-
  .../media/platform/qcom/venus/hfi_platform.c  |   2 +
  .../media/platform/qcom/venus/hfi_platform.h  |   1 +
  .../qcom/venus/hfi_platform_v6_lite.c         | 148 ++++++++++++++++++
  4 files changed, 152 insertions(+), 1 deletion(-)

create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c

drivers/media/platform/qcom/venus/Makefile +1 -1
index 91ee6be10292..4a6a942db58b 100644
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \
  		   hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \
  		   hfi_parser.o pm_helpers.o dbgfs.o \
  		   hfi_platform.o hfi_platform_v4.o \
-		   hfi_platform_v6.o hfi_plat_bufs_v6.o \
+		   hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \
 
  venus-dec-objs += vdec.o vdec_ctrls.o
  venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
index 643e5aa138f5..f56b8f9946d7 100644
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
  		return &hfi_plat_v4;
  	case HFI_VERSION_6XX:
  		return &hfi_plat_v6;
+	case HFI_VERSION_6XX_LITE:
+		return &hfi_plat_v6_lite;
  	default:
  		break;
  	}
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
index ec89a90a8129..6356e4bd0de2 100644
@@ -58,6 +58,7 @@ struct hfi_platform {
 
  extern const struct hfi_platform hfi_plat_v4;
  extern const struct hfi_platform hfi_plat_v6;
+extern const struct hfi_platform hfi_plat_v6_lite;
 
  const struct hfi_platform *hfi_platform_get(enum hfi_version version);
  unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +138 -0
new file mode 100644
index 000000000000..41958a3e353b
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2025, The Linux Foundation. All rights reserved.
+ */
+#include "hfi_platform.h"
+
+static const struct hfi_plat_caps caps[] = {
+{
+	.codec = HFI_VIDEO_CODEC_H264,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_1},
+	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_41},
+	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_5},
+	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_41},
+	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_41},
+	.num_pl = 5,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_HEVC,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_HEVC_PROFILE_MAIN, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_MAIN},
+	.pl[1] = {HFI_HEVC_PROFILE_MAIN10, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_MAIN},
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_VP9,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_VP9_PROFILE_P0, 200},
+	.pl[1] = {HFI_VP9_PROFILE_P2_10B, 200},
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+} };
+
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+{
+	*entries = ARRAY_SIZE(caps);
+	return caps;
+}
+
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+{
+	*enc_codecs = 0x0;
+	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
+		      HFI_VIDEO_CODEC_VP9;
+	*count = 3;
+}
+
+static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
+	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+};
+
+static const struct hfi_platform_codec_freq_data *
+get_codec_freq_data(u32 session_type, u32 pixfmt)
+{
+	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
+	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
+	const struct hfi_platform_codec_freq_data *found = NULL;
+
+	for (i = 0; i < data_size; i++) {
+		if (data[i].pixfmt == pixfmt &&
+		    data[i].session_type == session_type) {
+			found = &data[i];
+			break;
+		}
+	}
+
+	return found;
+}
+
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->vpp_freq;
+
+	return 0;
+}
+
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->vsp_freq;
+
+	return 0;
+}
+
+static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->low_power_freq;
+
+	return 0;

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 148

Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +10 -0
+}
+
+const struct hfi_platform hfi_plat_v6_lite = {
+	.codec_vpp_freq = codec_vpp_freq,
+	.codec_vsp_freq = codec_vsp_freq,
+	.codec_lp_freq = codec_lp_freq,
+	.codecs = get_codecs,
+	.capabilities = get_capabilities,
+	.bufreq = hfi_plat_bufreq_v6,
+};

@Dikshita @Vikash happy enough with this ?

Reviewed-by
#31 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

In reply to Jorge Ramirez
Quoted 16 lines · Jorge Ramirez
Quoted 14 lines · Krzysztof Kozlowski

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1671

Quoted 9 lines · Jorge Ramirez-Ortiz
arch/arm64/boot/dts/qcom/qcm2290.dtsi +9 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			status = "okay";

Drop, unless you override existing node, but then this should follow standard override-label/phandle syntax.

Quoted 1 line

yep

With that taken care of:

Konrad

#3 lore raw

Re: [PATCH v5 1/5] media: dt-bindings: venus: Add qcm2290 dt schema

In reply to Jorge Ramirez-Ortiz
Quoted 51 lines · Jorge Ramirez-Ortiz

Add a schema for the venus video encoder/decoder on the qcm2290.

---
 .../bindings/media/qcom,qcm2290-venus.yaml    | 127 ++++++++++++++++++
 1 file changed, 127 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +36 -0
new file mode 100644
index 000000000000..a9f89b545334
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/qcom,qcm2290-venus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm QCM2290 Venus video encode and decode accelerators
+
+maintainers:
+  - Vikash Garodia <[email protected]>
+
+description:
+  The Venus AR50_LITE IP is a video encode and decode accelerator present
+  on Qualcomm platforms
+
+allOf:
+  - $ref: qcom,venus-common.yaml#
+
+properties:
+  compatible:
+    const: qcom,qcm2290-venus
+
+  power-domains:
+    maxItems: 3
+
+  power-domain-names:
+    items:
+      - const: venus
+      - const: vcodec0
+      - const: cx
+
+  clocks:
+    maxItems: 6
+
+  clock-names:
+    items:

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10 -0
+      - const: core
+      - const: iface
+      - const: bus
+      - const: throttle
+      - const: vcodec0_core
+      - const: vcodec0_bus
+
+  iommus:
+    minItems: 1
+    maxItems: 5

2 should be good to support non secure usecases. 5 not needed.

Quoted 50 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +50 -0
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  operating-points-v2: true
+  opp-table:
+    type: object
+
+required:
+  - compatible
+  - power-domain-names
+  - iommus
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/qcom,gcc-qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,rpm-icc.h>
+    #include <dt-bindings/power/qcom-rpmpd.h>
+
+    venus: video-codec@5a00000 {
+        compatible = "qcom,qcm2290-venus";
+        reg = <0x5a00000 0xf0000>;
+        interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+        power-domains = <&gcc GCC_VENUS_GDSC>,
+                        <&gcc GCC_VCODEC0_GDSC>,
+                        <&rpmpd QCM2290_VDDCX>;
+        power-domain-names = "venus",
+                             "vcodec0",
+                             "cx";
+        operating-points-v2 = <&venus_opp_table>;
+
+        clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+                 <&gcc GCC_VIDEO_AHB_CLK>,
+                 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+                 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+                 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+                 <&gcc GCC_VCODEC0_AXI_CLK>;
+        clock-names = "core",
+                       "iface",
+                       "bus",

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10 -0
+                       "throttle",
+                       "vcodec0_core",
+                       "vcodec0_bus";
+
+        memory-region = <&pil_video_mem>;
+        iommus = <&apps_smmu 0x860 0x0>,
+                 <&apps_smmu 0x880 0x0>,
+                 <&apps_smmu 0x861 0x04>,
+                 <&apps_smmu 0x863 0x0>,
+                 <&apps_smmu 0x804 0xE0>;

update this accordingly.

Quoted 5 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +5 -0
+
+        interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+                         &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+                        <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+                         &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 121

Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10 -0
+        interconnect-names = "video-mem",
+                             "cpu-cfg";
+
+        venus_opp_table: opp-table {
+            compatible = "operating-points-v2";
+
+            opp-133000000 {
+                opp-hz = /bits/ 64 <133000000>;
+                required-opps = <&rpmpd_opp_low_svs>;
+            };

This value is incorrect, fix it to 133330000.

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 124

Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +3 -0
+            opp-240000000 {
+                opp-hz = /bits/ 64 <240000000>;
+                required-opps = <&rpmpd_opp_svs>;

Do you see other corners in the reference catalog as well, not just the downstream code ? OR did you limit this as the usecase do not demand higher corner ?

Regards,
Vikash

Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +3 -0
+            };
+        };
+    };
#32 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

In reply to Jorge Ramirez-Ortiz
Quoted 39 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +22 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			status = "okay";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

Regards,
Vikash

Quoted 11 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +8 -0
+
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
 		mdss: display-subsystem@5e00000 {
 			compatible = "qcom,qcm2290-mdss";
 			reg = <0x0 0x05e00000 0x0 0x1000>;
#33 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 10 lines
Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			status = "okay";
+
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Quoted 14 lines

Regards,
Vikash

Quoted 11 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +8 -0
+
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
 		mdss: display-subsystem@5e00000 {
 			compatible = "qcom,qcm2290-mdss";
 			reg = <0x0 0x05e00000 0x0 0x1000>;
#10 lore raw

Re: [PATCH v5 2/5] media: venus: vdec: AR50_LITE video core support

In reply to Jorge Ramirez-Ortiz
Quoted 72 lines · Jorge Ramirez-Ortiz

The AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.

---
 drivers/media/platform/qcom/venus/core.c      | 11 ++-
 drivers/media/platform/qcom/venus/core.h      | 11 ++-
 drivers/media/platform/qcom/venus/firmware.c  |  8 +-
 drivers/media/platform/qcom/venus/helpers.c   | 80 +++++++++++++++++++
 drivers/media/platform/qcom/venus/helpers.h   |  2 +
 .../media/platform/qcom/venus/hfi_helper.h    | 10 ++-
 drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++--
 .../media/platform/qcom/venus/pm_helpers.c    |  1 +
 drivers/media/platform/qcom/venus/vdec.c      | 15 ++--
 9 files changed, 128 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
index d305d74bb152..736ef53d988d 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
 static void venus_assign_register_offsets(struct venus_core *core)
 {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		core->cpu_base = core->base + CPU_BASE_V6;
 		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
 		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
 		core->wrapper_base = core->base + WRAPPER_BASE_V6;
 		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
 	} else {
 		core->vbif_base = core->base + VBIF_BASE;
 		core->cpu_base = core->base + CPU_BASE;
drivers/media/platform/qcom/venus/core.h +2 -0
index b412e0c5515a..e755a28e919b 100644
@@ -382,6 +382,7 @@ enum venus_inst_modes {
  * @lock:	instance lock
  * @core:	a reference to the core struct
  * @clk_data:	clock data per core ID
+ * @eosbufs:	a lit of EOS buffers
  * @dpbbufs:	a list of decoded picture buffers
  * @internalbufs:	a list of internal bufferes
  * @registeredbufs:	a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {
 	struct mutex lock;
 	struct venus_core *core;
 	struct clock_data clk_data;
+	struct list_head eosbufs;
 	struct list_head dpbbufs;
 	struct list_head internalbufs;
 	struct list_head registeredbufs;
@@ -520,7 +522,14 @@ struct venus_inst {
 #define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
 #define IS_V3(core)	((core)->res->hfi_version == HFI_VERSION_3XX)

drivers/media/platform/qcom/venus/core.h struct venus_inst { · line 532

Quoted 10 lines
drivers/media/platform/qcom/venus/core.h +8 -1
 #define IS_V4(core)	((core)->res->hfi_version == HFI_VERSION_4XX)
-#define IS_V6(core)	((core)->res->hfi_version == HFI_VERSION_6XX)
+static inline bool IS_V6(struct venus_core *core)
+{
+	if (WARN_ON_ONCE(!core))
+		return false;
+
+	return core->res->hfi_version == HFI_VERSION_6XX ||
+	       core->res->hfi_version == HFI_VERSION_6XX_LITE;
+}

It should be HFI_VERSION_4XX_LITE for AR50_LITE. 4XX represents SC7280 and SDM845 which are AR50.

Quoted 35 lines
drivers/media/platform/qcom/venus/core.h +0 -0
 #define IS_AR50(core)		((core)->res->vpu_version == VPU_VERSION_AR50)
 #define IS_AR50_LITE(core)	((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +3 -3
index 66a18830e66d..f8dcef0426ac 100644
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	u32 fw_size = core->fw.mapped_mem_size;
 	void __iomem *wrapper_base;
 
-	if (IS_IRIS2_1(core))
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 		wrapper_base = core->wrapper_tz_base;
 	else
 		wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR);
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR);
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Bring XTSS out of reset */
 		writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET);
 	} else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)
 	if (resume) {
 		venus_reset_cpu(core);
 	} else {
-		if (IS_IRIS2_1(core))
+		if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 			writel(WRAPPER_XTSS_SW_RESET_BIT,
 			       core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
 		else

drivers/media/platform/qcom/venus/firmware.c static int venus_shutdown_no_tz(struct venus_core *core) · line 186

Quoted 7 lines
drivers/media/platform/qcom/venus/firmware.c +1 -1
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)
 	void __iomem *wrapper_base = core->wrapper_base;
 	void __iomem *wrapper_tz_base = core->wrapper_tz_base;
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Assert the reset to XTSS */
 		reg = readl(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);

No need to handle no-tz case. Pls drop.

Quoted 58 lines
drivers/media/platform/qcom/venus/firmware.c +0 -0
 		reg |= WRAPPER_XTSS_SW_RESET_BIT;
drivers/media/platform/qcom/venus/helpers.c +49 -0
index 8295542e1a7c..812bec9a05be 100644
@@ -230,6 +230,79 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
 }
 EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs);
 
+static void free_eos_buf(struct venus_inst *inst, struct intbuf *buf)
+{
+	list_del_init(&buf->list);
+	dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da,
+		       buf->attrs);
+	kfree(buf);
+}
+
+int venus_helper_free_eos_bufs(struct venus_inst *inst)
+{
+	struct intbuf *buf, *n;
+
+	list_for_each_entry_safe(buf, n, &inst->eosbufs, list) {
+		free_eos_buf(inst, buf);
+	}
+
+	if (list_empty(&inst->eosbufs))
+		INIT_LIST_HEAD(&inst->eosbufs);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(venus_helper_free_eos_bufs);
+
+int venus_helper_alloc_eos_buf(struct venus_inst *inst,
+			       struct hfi_frame_data *data)
+{
+	struct venus_core *core = inst->core;
+	struct device *dev = core->dev;
+	struct intbuf *buf;
+	int ret = 0;
+
+	memset(data, 0, sizeof(*data));
+
+	data->buffer_type = HFI_BUFFER_INPUT;
+	data->flags = HFI_BUFFERFLAG_EOS;
+
+	if (IS_AR50_LITE(inst->core)) {
+		/* We must send valid sizes and addresses */
+		buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+		if (!buf) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		buf->type = HFI_BUFFER_INPUT;
+		buf->size = SZ_4K;
+		buf->attrs = DMA_ATTR_NO_KERNEL_MAPPING;
+		buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL,
+					  buf->attrs);

drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 291

Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10 -0
+		if (!buf->va) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		list_add_tail(&buf->list, &inst->eosbufs);
+
+		data->alloc_len = buf->size;
+		data->device_addr = buf->da;
+

why this special handling for eos buffer is needed for AR50_LITE?

Quoted 18 lines
drivers/media/platform/qcom/venus/helpers.c +14 -0
+	} else if (IS_V6(inst->core) &&
+		   is_fw_rev_or_older(inst->core, 1, 0, 87)) {
+		data->device_addr = 0;
+	} else {
+		data->device_addr = 0xdeadb000;
+	}
+
+	return 0;
+fail:
+	kfree(buf);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(venus_helper_alloc_eos_buf);
+
 static int intbufs_set_buffer(struct venus_inst *inst, u32 type)
 {
 	struct venus_core *core = inst->core;

drivers/media/platform/qcom/venus/helpers.c static int platform_get_bufreq(struct venus_inst *inst, u32 buftype, · line 712

Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +7 -0
@@ -630,6 +703,13 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,
 	if (!hfi_plat || !hfi_plat->bufreq)
 		return -EINVAL;
 
+	/* Firmware buffer requirements for internal buffers only */
+	if (IS_AR50_LITE(inst->core))
+		if (buftype != HFI_BUFFER_INPUT &&
+		    buftype != HFI_BUFFER_OUTPUT &&
+		    buftype != HFI_BUFFER_OUTPUT2)
+			return -EINVAL;
+

why this check is needed here? Buffer requirements for all buffer types should come from firmware for all V4 based targets.

Quoted 41 lines
drivers/media/platform/qcom/venus/helpers.c +0 -0
 	params.version = version;
 	params.num_vpp_pipes = inst->core->res->num_vpp_pipes;
 
drivers/media/platform/qcom/venus/helpers.h +2 -0
index 358e4f39c9c0..bf55fe3b8747 100644
@@ -58,6 +58,8 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt,
 bool venus_helper_check_format(struct venus_inst *inst, u32 v4l2_pixfmt);
 int venus_helper_alloc_dpb_bufs(struct venus_inst *inst);
 int venus_helper_free_dpb_bufs(struct venus_inst *inst);
+int venus_helper_alloc_eos_buf(struct venus_inst *inst, struct hfi_frame_data *data);
+int venus_helper_free_eos_bufs(struct venus_inst *inst);
 int venus_helper_intbufs_alloc(struct venus_inst *inst);
 int venus_helper_intbufs_free(struct venus_inst *inst);
 int venus_helper_intbufs_realloc(struct venus_inst *inst);
drivers/media/platform/qcom/venus/hfi_helper.h +6 -3
index f44059f19505..128ddf8e3cd5 100644
@@ -397,13 +397,16 @@
 #define HFI_BUFFER_INTERNAL_PERSIST_1		0x5
 #define HFI_BUFFER_INTERNAL_SCRATCH(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x6 : 0x1000001)
 #define HFI_BUFFER_INTERNAL_SCRATCH_1(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x7 : 0x1000005)
 #define HFI_BUFFER_INTERNAL_SCRATCH_2(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x8 : 0x1000006)
 #define HFI_BUFFER_EXTRADATA_INPUT(ver)		\
 	(((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)
 #define HFI_BUFFER_EXTRADATA_OUTPUT(ver)	\

drivers/media/platform/qcom/venus/hfi_helper.h enum hfi_version { · line 567

Quoted 4 lines
drivers/media/platform/qcom/venus/hfi_helper.h +1 -0
@@ -561,6 +564,7 @@ enum hfi_version {
 	HFI_VERSION_3XX,
 	HFI_VERSION_4XX,
 	HFI_VERSION_6XX,
+	HFI_VERSION_6XX_LITE,

s/HFI_VERSION_6XX_LITE/HFI_VERSION_4XX_LITE.
update all applicable places.

Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_helper.h +0 -0
 };
 
 struct hfi_buffer_info {
drivers/media/platform/qcom/venus/hfi_venus.c +0 -0
index b5f2ea879950..302776bf8fe6 100644

drivers/media/platform/qcom/venus/hfi_venus.c static int venus_boot_core(struct venus_hfi_device *hdev) · line 502

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_venus.c +1 -1
@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)
 	if (count >= max_tries)
 		ret = -ETIMEDOUT;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core)) {
 		writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6);
 		writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);

CPU_CS_X2RPMH_V6 is not needed for AR50_LITE, pls drop.

Quoted 12 lines
drivers/media/platform/qcom/venus/hfi_venus.c +3 -0
 	}
@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)
 	u32 mask_val;
 	int ret;
 
+	if (IS_AR50_LITE(hdev->core))
+		return 0;
+
 	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
 		writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6);
 

drivers/media/platform/qcom/venus/hfi_venus.c static irqreturn_t venus_isr(struct venus_core *core) · line 1143

Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_venus.c +2 -1
@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core)
 	wrapper_base = hdev->core->wrapper_base;
 
 	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
+
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
 		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||

WD mask is incorrect, pls fix.

Quoted 33 lines
drivers/media/platform/qcom/venus/hfi_venus.c +3 -3
 		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
 			hdev->irq_status = status;
 	}
 	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
-	if (!(IS_IRIS2(core) || IS_IRIS2_1(core)))
+	if (!(IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)))
 		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
 
 	return IRQ_WAKE_THREAD;
@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
drivers/media/platform/qcom/venus/pm_helpers.c +0 -0
index 409aa9bd0b5d..5d9dfe3fd043 100644

drivers/media/platform/qcom/venus/pm_helpers.c const struct venus_pm_ops *venus_pm_get(enum hfi_version version) · line 1171

Quoted 4 lines
drivers/media/platform/qcom/venus/pm_helpers.c +1 -0
@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)
 		return &pm_ops_v3;
 	case HFI_VERSION_4XX:
 	case HFI_VERSION_6XX:
+	case HFI_VERSION_6XX_LITE:

s/HFI_VERSION_6XX_LITE/HFI_VERSION_4XX_LITE

Thanks,
Dikshita

Quoted 55 lines
drivers/media/platform/qcom/venus/pm_helpers.c +0 -0
 		return &pm_ops_v4;
 	}
 
drivers/media/platform/qcom/venus/vdec.c +7 -8
index 99ce5fd41577..87c7901b280e 100644
@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 {
 	struct venus_inst *inst = to_inst(file);
 	struct vb2_queue *dst_vq;
-	struct hfi_frame_data fdata = {0};
+	struct hfi_frame_data fdata;
 	int ret;
 
 	ret = v4l2_m2m_ioctl_try_decoder_cmd(file, fh, cmd);
@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 
 	if (cmd->cmd == V4L2_DEC_CMD_STOP) {
 		/*
-		 * Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on
+		 * Implement V4L2_DEC_CMD_STOP by enqueue a buffer on
 		 * decoder input to signal EOS.
 		 */
 		if (!(inst->streamon_out && inst->streamon_cap))
 			goto unlock;
 
-		fdata.buffer_type = HFI_BUFFER_INPUT;
-		fdata.flags |= HFI_BUFFERFLAG_EOS;
-		if (IS_V6(inst->core) && is_fw_rev_or_older(inst->core, 1, 0, 87))
-			fdata.device_addr = 0;
-		else
-			fdata.device_addr = 0xdeadb000;
+		ret = venus_helper_alloc_eos_buf(inst, &fdata);
+		if (ret)
+			goto unlock;
 
 		ret = hfi_session_process_buf(inst, &fdata);
 
@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)
 		hfi_session_abort(inst);
 
 	venus_helper_free_dpb_bufs(inst);
+	venus_helper_free_eos_bufs(inst);
 	venus_pm_load_scale(inst);
 	INIT_LIST_HEAD(&inst->registeredbufs);
 	mutex_unlock(&inst->lock);
@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)
 	if (!inst)
 		return -ENOMEM;
 
+	INIT_LIST_HEAD(&inst->eosbufs);
 	INIT_LIST_HEAD(&inst->dpbbufs);
 	INIT_LIST_HEAD(&inst->registeredbufs);
 	INIT_LIST_HEAD(&inst->internalbufs);
#24 lore raw

Re: [PATCH v5 4/5] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Jorge Ramirez-Ortiz
Quoted 17 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the venus core.

Video encoding support is not exposed until the relevant hardware capabilities are enabled.

---
 drivers/media/platform/qcom/venus/core.c | 39 ++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/media/platform/qcom/venus/core.c +0 -0
index 736ef53d988d..f1f211ca1ce2 100644

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1069

Quoted 8 lines
drivers/media/platform/qcom/venus/core.c +5 -0
@@ -1062,6 +1062,44 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct freq_tbl qcm2290_freq_table[] = {
+	{ 352800, 240000000 },	/* 1920x1088 @ 30 + 1280x720 @ 30 */
+	{ 244800, 133000000 },	/* 1920x1088 @ 30 */
+};
+

fix this corner.

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1073

Quoted 4 lines
drivers/media/platform/qcom/venus/core.c +4 -0
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 244800, 2128000, 0, 2128000, 0}, /* 1920x1088 @ 30 */
+};
+

what is the reference for this?

Quoted 4 lines
drivers/media/platform/qcom/venus/core.c +4 -0
+static const struct venus_resources qcm2290_res = {
+	.freq_tbl = qcm2290_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(qcm2290_freq_table),
+	.bw_tbl_dec = qcm2290_bw_table_dec,

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1087

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +10 -0
+	.bw_tbl_dec_size = ARRAY_SIZE(qcm2290_bw_table_dec),
+	.clks = { "core", "iface", "bus", "throttle" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
+	.vcodec_clks_num = 2,
+	.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx" },
+	.vcodec_num = 1,
+	.hfi_version = HFI_VERSION_6XX_LITE,

s/HFI_VERSION_6XX_LITE/HFI_VERSION_4XX_LITE

Thanks,
Dikshita

Quoted 26 lines
drivers/media/platform/qcom/venus/core.c +16 -0
+	.vpu_version = VPU_VERSION_AR50_LITE,
+	.max_load = 352800,
+	.num_vpp_pipes = 1,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x70800000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x24800000,
+	.dma_mask = 0xe0000000 - 1,
+	.fwname = "qcom/venus-6.0/venus.mbn",
+	.dec_nodename = "video-decoder",
+};
+
 static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
 	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
@@ -1072,6 +1110,7 @@ static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
 	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
 	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
+	{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, venus_dt_match);
#18 lore raw

Re: [PATCH v5 3/5] media: venus: hfi_plat_v6_lite: Populate decode capabilities

In reply to Jorge Ramirez-Ortiz
Quoted 16 lines · Jorge Ramirez-Ortiz

Add hfi platform file with decoding capabilities for hfi v6_lite.

---
 drivers/media/platform/qcom/venus/Makefile    |   2 +-
 .../media/platform/qcom/venus/hfi_platform.c  |   2 +
 .../media/platform/qcom/venus/hfi_platform.h  |   1 +
 .../qcom/venus/hfi_platform_v6_lite.c         | 148 ++++++++++++++++++
 4 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
drivers/media/platform/qcom/venus/Makefile +0 -0
index 91ee6be10292..4a6a942db58b 100644

drivers/media/platform/qcom/venus/Makefile venus-core-objs += core.o helpers.o firmware.o \ · line 8

Quoted 5 lines
drivers/media/platform/qcom/venus/Makefile +1 -1
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \
 		   hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \
 		   hfi_parser.o pm_helpers.o dbgfs.o \
 		   hfi_platform.o hfi_platform_v4.o \
-		   hfi_platform_v6.o hfi_plat_bufs_v6.o \
+		   hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \

s/hfi_platform_v6_lite/hfi_platform_v4_lite

drivers/media/platform/qcom/venus/hfi_platform.c const struct hfi_platform *hfi_platform_get(enum hfi_version version) · line 17

Quoted 13 lines
drivers/media/platform/qcom/venus/Makefile +0 -0
 venus-dec-objs += vdec.o vdec_ctrls.o
 venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
index 643e5aa138f5..f56b8f9946d7 100644
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
 		return &hfi_plat_v4;
 	case HFI_VERSION_6XX:
 		return &hfi_plat_v6;
+	case HFI_VERSION_6XX_LITE:
+		return &hfi_plat_v6_lite;

update here as well.

drivers/media/platform/qcom/venus/hfi_platform.h struct hfi_platform { · line 61

Quoted 12 lines
drivers/media/platform/qcom/venus/hfi_platform.c +0 -0
 	default:
 		break;
 	}
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
index ec89a90a8129..6356e4bd0de2 100644
@@ -58,6 +58,7 @@ struct hfi_platform {
 
 extern const struct hfi_platform hfi_plat_v4;
 extern const struct hfi_platform hfi_plat_v6;
+extern const struct hfi_platform hfi_plat_v6_lite;

ditto

Quoted 22 lines
drivers/media/platform/qcom/venus/hfi_platform.h +0 -0
 const struct hfi_platform *hfi_platform_get(enum hfi_version version);
 unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +13 -0
new file mode 100644
index 000000000000..41958a3e353b
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2025, The Linux Foundation. All rights reserved.
+ */
+#include "hfi_platform.h"
+
+static const struct hfi_plat_caps caps[] = {
+{
+	.codec = HFI_VIDEO_CODEC_H264,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 23

Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +10 -0
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_1},
+	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_41},
+	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_5},
+	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_41},
+	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_41},

what is the reference for these values?

Quoted 9 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +9 -0
+	.num_pl = 5,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_HEVC,
+	.domain = VIDC_SESSION_TYPE_DEC,

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 42

Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +10 -0
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_HEVC_PROFILE_MAIN, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_MAIN},
+	.pl[1] = {HFI_HEVC_PROFILE_MAIN10, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_MAIN},

what is the reference for these values?

Quoted 95 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +95 -0
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_VP9,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_VP9_PROFILE_P0, 200},
+	.pl[1] = {HFI_VP9_PROFILE_P2_10B, 200},
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+} };
+
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+{
+	*entries = ARRAY_SIZE(caps);
+	return caps;
+}
+
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+{
+	*enc_codecs = 0x0;
+	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
+		      HFI_VIDEO_CODEC_VP9;
+	*count = 3;
+}
+
+static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
+	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+};
+
+static const struct hfi_platform_codec_freq_data *
+get_codec_freq_data(u32 session_type, u32 pixfmt)
+{
+	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
+	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
+	const struct hfi_platform_codec_freq_data *found = NULL;
+
+	for (i = 0; i < data_size; i++) {
+		if (data[i].pixfmt == pixfmt &&
+		    data[i].session_type == session_type) {
+			found = &data[i];
+			break;
+		}
+	}
+
+	return found;
+}
+
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->vpp_freq;
+
+	return 0;
+}
+
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->vsp_freq;
+
+	return 0;
+}
+
+static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->low_power_freq;
+

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 147

Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +10 -0
+	return 0;
+}
+
+const struct hfi_platform hfi_plat_v6_lite = {
+	.codec_vpp_freq = codec_vpp_freq,
+	.codec_vsp_freq = codec_vsp_freq,
+	.codec_lp_freq = codec_lp_freq,
+	.codecs = get_codecs,
+	.capabilities = get_capabilities,
+	.bufreq = hfi_plat_bufreq_v6,

buffer requirement should come from firmware, pls drop.

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 148

Quoted 1 line
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +1 -0
+};

lot of code duplication here, pls see the possibility to commonize the code.

Thanks,
Dikshita

#34 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

In reply to Jorge Ramirez
Quoted 75 lines · Jorge Ramirez
Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 10 lines
Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			status = "okay";
+
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

Quoted 5 lines

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Most likely you have referred incorrect downstream file. Refer scuba-vidc.dtsi. Again, good reference for such cases would IP catalogues and if not, gcc driver in this case which have structures defining different corners for video.

Quoted 16 lines
Quoted 16 lines

Regards,
Vikash

Quoted 11 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +8 -0
+
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
 		mdss: display-subsystem@5e00000 {
 			compatible = "qcom,qcm2290-mdss";
 			reg = <0x0 0x05e00000 0x0 0x1000>;
#35 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

Quoted 77 lines · Vikash Garodia
Quoted 75 lines · Jorge Ramirez
Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 18 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			status = "okay";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

Quoted 6 lines
Quoted 5 lines

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Most likely you have referred incorrect downstream file. Refer scuba-vidc.dtsi.

I took them from actual documents (which might or might not be obsolete, hard to say but they were the latest version and as such, they contradict the downstream dtsi).

So I'd rather not use downstream - could you point me to the reference you used please - I wonder if the fix is required downstream instead of here?

Quoted 3 lines

Again, good reference for such cases would IP catalogues and if not, gcc driver in this case which have structures defining different corners for video.

The PM document for this chip only confirms two values - the other 4 ones claim they are not supported on 50_LT

but we can discuss offline.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

Regards,
Vikash

Quoted 11 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +8 -0
+
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
 		mdss: display-subsystem@5e00000 {
 			compatible = "qcom,qcm2290-mdss";
 			reg = <0x0 0x05e00000 0x0 0x1000>;
#36 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

Quoted 83 lines · Jorge Ramirez
Quoted 82 lines · Vikash Garodia
Quoted 80 lines · Jorge Ramirez
Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 10 lines
Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			status = "okay";
+
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Quoted 8 lines
Quoted 1 line

Most likely you have referred incorrect downstream file. Refer scuba-vidc.dtsi.

I took them from actual documents (which might or might not be obsolete, hard to say but they were the latest version and as such, they contradict the downstream dtsi).

So I'd rather not use downstream - could you point me to the reference you used please - I wonder if the fix is required downstream instead of here?

You can look for this file gcc-scuba.c and refer gcc_video_venus_clk_src which is the src for different venus clocks.

Quoted 26 lines
Quoted 4 lines

Again, good reference for such cases would IP catalogues and if not, gcc driver in this case which have structures defining different corners for video.

The PM document for this chip only confirms two values - the other 4 ones claim they are not supported on 50_LT

but we can discuss offline.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

Regards,
Vikash

Quoted 11 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +8 -0
+
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
 		mdss: display-subsystem@5e00000 {
 			compatible = "qcom,qcm2290-mdss";
 			reg = <0x0 0x05e00000 0x0 0x1000>;
#11 lore raw

Re: [PATCH v5 2/5] media: venus: vdec: AR50_LITE video core support

In reply to Dikshita Agarwal
Quoted 79 lines · Dikshita Agarwal
Quoted 76 lines · Jorge Ramirez-Ortiz

The AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.

---
 drivers/media/platform/qcom/venus/core.c      | 11 ++-
 drivers/media/platform/qcom/venus/core.h      | 11 ++-
 drivers/media/platform/qcom/venus/firmware.c  |  8 +-
 drivers/media/platform/qcom/venus/helpers.c   | 80 +++++++++++++++++++
 drivers/media/platform/qcom/venus/helpers.h   |  2 +
 .../media/platform/qcom/venus/hfi_helper.h    | 10 ++-
 drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++--
 .../media/platform/qcom/venus/pm_helpers.c    |  1 +
 drivers/media/platform/qcom/venus/vdec.c      | 15 ++--
 9 files changed, 128 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
index d305d74bb152..736ef53d988d 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
 static void venus_assign_register_offsets(struct venus_core *core)
 {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		core->cpu_base = core->base + CPU_BASE_V6;
 		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
 		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
 		core->wrapper_base = core->base + WRAPPER_BASE_V6;
 		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
 	} else {
 		core->vbif_base = core->base + VBIF_BASE;
 		core->cpu_base = core->base + CPU_BASE;
drivers/media/platform/qcom/venus/core.h +4 -1
index b412e0c5515a..e755a28e919b 100644
@@ -382,6 +382,7 @@ enum venus_inst_modes {
  * @lock:	instance lock
  * @core:	a reference to the core struct
  * @clk_data:	clock data per core ID
+ * @eosbufs:	a lit of EOS buffers
  * @dpbbufs:	a list of decoded picture buffers
  * @internalbufs:	a list of internal bufferes
  * @registeredbufs:	a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {
 	struct mutex lock;
 	struct venus_core *core;
 	struct clock_data clk_data;
+	struct list_head eosbufs;
 	struct list_head dpbbufs;
 	struct list_head internalbufs;
 	struct list_head registeredbufs;
@@ -520,7 +522,14 @@ struct venus_inst {
 #define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
 #define IS_V3(core)	((core)->res->hfi_version == HFI_VERSION_3XX)
 #define IS_V4(core)	((core)->res->hfi_version == HFI_VERSION_4XX)
-#define IS_V6(core)	((core)->res->hfi_version == HFI_VERSION_6XX)
+static inline bool IS_V6(struct venus_core *core)
+{
Quoted 8 lines

drivers/media/platform/qcom/venus/core.h struct venus_inst { · line 532

Quoted 6 lines
drivers/media/platform/qcom/venus/core.h +6 -0
+	if (WARN_ON_ONCE(!core))
+		return false;
+
+	return core->res->hfi_version == HFI_VERSION_6XX ||
+	       core->res->hfi_version == HFI_VERSION_6XX_LITE;
+}

It should be HFI_VERSION_4XX_LITE for AR50_LITE. 4XX represents SC7280 and SDM845 which are AR50.

ah good information - where is this documented? I never found this information... I'd appreciate if you could confirm with some document for future reference.

Quoted 38 lines
Quoted 38 lines
drivers/media/platform/qcom/venus/core.h +0 -0
 #define IS_AR50(core)		((core)->res->vpu_version == VPU_VERSION_AR50)
 #define IS_AR50_LITE(core)	((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +3 -3
index 66a18830e66d..f8dcef0426ac 100644
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	u32 fw_size = core->fw.mapped_mem_size;
 	void __iomem *wrapper_base;
 
-	if (IS_IRIS2_1(core))
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 		wrapper_base = core->wrapper_tz_base;
 	else
 		wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR);
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR);
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Bring XTSS out of reset */
 		writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET);
 	} else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)
 	if (resume) {
 		venus_reset_cpu(core);
 	} else {
-		if (IS_IRIS2_1(core))
+		if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 			writel(WRAPPER_XTSS_SW_RESET_BIT,
 			       core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
 		else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)
 	void __iomem *wrapper_base = core->wrapper_base;
 	void __iomem *wrapper_tz_base = core->wrapper_tz_base;
 
Quoted 5 lines

drivers/media/platform/qcom/venus/firmware.c static int venus_shutdown_no_tz(struct venus_core *core) · line 186

Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.c +1 -1
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Assert the reset to XTSS */
 		reg = readl(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);

No need to handle no-tz case. Pls drop.

ok

Quoted 61 lines
Quoted 61 lines
drivers/media/platform/qcom/venus/firmware.c +0 -0
 		reg |= WRAPPER_XTSS_SW_RESET_BIT;
drivers/media/platform/qcom/venus/helpers.c +52 -0
index 8295542e1a7c..812bec9a05be 100644
@@ -230,6 +230,79 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
 }
 EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs);
 
+static void free_eos_buf(struct venus_inst *inst, struct intbuf *buf)
+{
+	list_del_init(&buf->list);
+	dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da,
+		       buf->attrs);
+	kfree(buf);
+}
+
+int venus_helper_free_eos_bufs(struct venus_inst *inst)
+{
+	struct intbuf *buf, *n;
+
+	list_for_each_entry_safe(buf, n, &inst->eosbufs, list) {
+		free_eos_buf(inst, buf);
+	}
+
+	if (list_empty(&inst->eosbufs))
+		INIT_LIST_HEAD(&inst->eosbufs);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(venus_helper_free_eos_bufs);
+
+int venus_helper_alloc_eos_buf(struct venus_inst *inst,
+			       struct hfi_frame_data *data)
+{
+	struct venus_core *core = inst->core;
+	struct device *dev = core->dev;
+	struct intbuf *buf;
+	int ret = 0;
+
+	memset(data, 0, sizeof(*data));
+
+	data->buffer_type = HFI_BUFFER_INPUT;
+	data->flags = HFI_BUFFERFLAG_EOS;
+
+	if (IS_AR50_LITE(inst->core)) {
+		/* We must send valid sizes and addresses */
+		buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+		if (!buf) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		buf->type = HFI_BUFFER_INPUT;
+		buf->size = SZ_4K;
+		buf->attrs = DMA_ATTR_NO_KERNEL_MAPPING;
+		buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL,
+					  buf->attrs);
+		if (!buf->va) {
+			ret = -ENOMEM;
+			goto fail;
Quoted 8 lines

drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 291

Quoted 7 lines
drivers/media/platform/qcom/venus/helpers.c +7 -0
+		}
+
+		list_add_tail(&buf->list, &inst->eosbufs);
+
+		data->alloc_len = buf->size;
+		data->device_addr = buf->da;
+

why this special handling for eos buffer is needed for AR50_LITE?

this _fix_ was develope through testing: without it there is no EOS and errors are reporting upon killing the player

Quoted 21 lines
Quoted 21 lines
drivers/media/platform/qcom/venus/helpers.c +14 -0
+	} else if (IS_V6(inst->core) &&
+		   is_fw_rev_or_older(inst->core, 1, 0, 87)) {
+		data->device_addr = 0;
+	} else {
+		data->device_addr = 0xdeadb000;
+	}
+
+	return 0;
+fail:
+	kfree(buf);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(venus_helper_alloc_eos_buf);
+
 static int intbufs_set_buffer(struct venus_inst *inst, u32 type)
 {
 	struct venus_core *core = inst->core;
@@ -630,6 +703,13 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,
 	if (!hfi_plat || !hfi_plat->bufreq)
 		return -EINVAL;
 
Quoted 9 lines

drivers/media/platform/qcom/venus/helpers.c static int platform_get_bufreq(struct venus_inst *inst, u32 buftype, · line 712

Quoted 7 lines
drivers/media/platform/qcom/venus/helpers.c +7 -0
+	/* Firmware buffer requirements for internal buffers only */
+	if (IS_AR50_LITE(inst->core))
+		if (buftype != HFI_BUFFER_INPUT &&
+		    buftype != HFI_BUFFER_OUTPUT &&
+		    buftype != HFI_BUFFER_OUTPUT2)
+			return -EINVAL;
+

why this check is needed here? Buffer requirements for all buffer types should come from firmware for all V4 based targets.

because I used V6 as you saw earlier.

Quoted 39 lines
Quoted 39 lines
drivers/media/platform/qcom/venus/helpers.c +0 -0
 	params.version = version;
 	params.num_vpp_pipes = inst->core->res->num_vpp_pipes;
 
drivers/media/platform/qcom/venus/helpers.h +2 -0
index 358e4f39c9c0..bf55fe3b8747 100644
@@ -58,6 +58,8 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt,
 bool venus_helper_check_format(struct venus_inst *inst, u32 v4l2_pixfmt);
 int venus_helper_alloc_dpb_bufs(struct venus_inst *inst);
 int venus_helper_free_dpb_bufs(struct venus_inst *inst);
+int venus_helper_alloc_eos_buf(struct venus_inst *inst, struct hfi_frame_data *data);
+int venus_helper_free_eos_bufs(struct venus_inst *inst);
 int venus_helper_intbufs_alloc(struct venus_inst *inst);
 int venus_helper_intbufs_free(struct venus_inst *inst);
 int venus_helper_intbufs_realloc(struct venus_inst *inst);
drivers/media/platform/qcom/venus/hfi_helper.h +6 -3
index f44059f19505..128ddf8e3cd5 100644
@@ -397,13 +397,16 @@
 #define HFI_BUFFER_INTERNAL_PERSIST_1		0x5
 #define HFI_BUFFER_INTERNAL_SCRATCH(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x6 : 0x1000001)
 #define HFI_BUFFER_INTERNAL_SCRATCH_1(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x7 : 0x1000005)
 #define HFI_BUFFER_INTERNAL_SCRATCH_2(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x8 : 0x1000006)
 #define HFI_BUFFER_EXTRADATA_INPUT(ver)		\
 	(((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_helper.h enum hfi_version { · line 567

Quoted 6 lines
drivers/media/platform/qcom/venus/hfi_helper.h +1 -0
 #define HFI_BUFFER_EXTRADATA_OUTPUT(ver)	\
@@ -561,6 +564,7 @@ enum hfi_version {
 	HFI_VERSION_3XX,
 	HFI_VERSION_4XX,
 	HFI_VERSION_6XX,
+	HFI_VERSION_6XX_LITE,

s/HFI_VERSION_6XX_LITE/HFI_VERSION_4XX_LITE.
update all applicable places.

sure, I'll validate that - I remember starting with V4 but it didnt work so switched to 6xx. I'll try again.

Quoted 60 lines
Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_helper.h +0 -0
 };
 
 struct hfi_buffer_info {
drivers/media/platform/qcom/venus/hfi_venus.c +0 -0
index b5f2ea879950..302776bf8fe6 100644

drivers/media/platform/qcom/venus/hfi_venus.c static int venus_boot_core(struct venus_hfi_device *hdev) · line 502

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_venus.c +1 -1
@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)
 	if (count >= max_tries)
 		ret = -ETIMEDOUT;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core)) {
 		writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6);
 		writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);

CPU_CS_X2RPMH_V6 is not needed for AR50_LITE, pls drop.

Quoted 12 lines
drivers/media/platform/qcom/venus/hfi_venus.c +3 -0
 	}
@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)
 	u32 mask_val;
 	int ret;
 
+	if (IS_AR50_LITE(hdev->core))
+		return 0;
+
 	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
 		writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6);
 

drivers/media/platform/qcom/venus/hfi_venus.c static irqreturn_t venus_isr(struct venus_core *core) · line 1143

Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_venus.c +2 -1
@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core)
 	wrapper_base = hdev->core->wrapper_base;
 
 	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
+
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
 		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||

WD mask is incorrect, pls fix.

Quoted 23 lines
drivers/media/platform/qcom/venus/hfi_venus.c +2 -2
 		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
 			hdev->irq_status = status;
 	}
 	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
-	if (!(IS_IRIS2(core) || IS_IRIS2_1(core)))
+	if (!(IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)))
 		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
 
 	return IRQ_WAKE_THREAD;
@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
Quoted 15 lines
Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_venus.c +1 -1
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
drivers/media/platform/qcom/venus/pm_helpers.c +0 -0
index 409aa9bd0b5d..5d9dfe3fd043 100644

drivers/media/platform/qcom/venus/pm_helpers.c const struct venus_pm_ops *venus_pm_get(enum hfi_version version) · line 1171

Quoted 4 lines
drivers/media/platform/qcom/venus/pm_helpers.c +1 -0
@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)
 		return &pm_ops_v3;
 	case HFI_VERSION_4XX:
 	case HFI_VERSION_6XX:
+	case HFI_VERSION_6XX_LITE:

s/HFI_VERSION_6XX_LITE/HFI_VERSION_4XX_LITE

yep

Quoted 58 lines

Thanks,
Dikshita

Quoted 55 lines
drivers/media/platform/qcom/venus/pm_helpers.c +0 -0
 		return &pm_ops_v4;
 	}
 
drivers/media/platform/qcom/venus/vdec.c +7 -8
index 99ce5fd41577..87c7901b280e 100644
@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 {
 	struct venus_inst *inst = to_inst(file);
 	struct vb2_queue *dst_vq;
-	struct hfi_frame_data fdata = {0};
+	struct hfi_frame_data fdata;
 	int ret;
 
 	ret = v4l2_m2m_ioctl_try_decoder_cmd(file, fh, cmd);
@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 
 	if (cmd->cmd == V4L2_DEC_CMD_STOP) {
 		/*
-		 * Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on
+		 * Implement V4L2_DEC_CMD_STOP by enqueue a buffer on
 		 * decoder input to signal EOS.
 		 */
 		if (!(inst->streamon_out && inst->streamon_cap))
 			goto unlock;
 
-		fdata.buffer_type = HFI_BUFFER_INPUT;
-		fdata.flags |= HFI_BUFFERFLAG_EOS;
-		if (IS_V6(inst->core) && is_fw_rev_or_older(inst->core, 1, 0, 87))
-			fdata.device_addr = 0;
-		else
-			fdata.device_addr = 0xdeadb000;
+		ret = venus_helper_alloc_eos_buf(inst, &fdata);
+		if (ret)
+			goto unlock;
 
 		ret = hfi_session_process_buf(inst, &fdata);
 
@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)
 		hfi_session_abort(inst);
 
 	venus_helper_free_dpb_bufs(inst);
+	venus_helper_free_eos_bufs(inst);
 	venus_pm_load_scale(inst);
 	INIT_LIST_HEAD(&inst->registeredbufs);
 	mutex_unlock(&inst->lock);
@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)
 	if (!inst)
 		return -ENOMEM;
 
+	INIT_LIST_HEAD(&inst->eosbufs);
 	INIT_LIST_HEAD(&inst->dpbbufs);
 	INIT_LIST_HEAD(&inst->registeredbufs);
 	INIT_LIST_HEAD(&inst->internalbufs);
#37 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

In reply to Vikash Garodia
Quoted 91 lines · Vikash Garodia
Quoted 89 lines · Jorge Ramirez
Quoted 77 lines · Vikash Garodia
Quoted 75 lines · Jorge Ramirez
Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 18 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			status = "okay";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

Quoted 6 lines
Quoted 5 lines

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Most likely you have referred incorrect downstream file. Refer scuba-vidc.dtsi.

I took them from actual documents (which might or might not be obsolete, hard to say but they were the latest version and as such, they contradict the downstream dtsi).

Quoted 5 lines
Quoted 2 lines

So I'd rather not use downstream - could you point me to the reference you used please - I wonder if the fix is required downstream instead of here?

You can look for this file gcc-scuba.c and refer gcc_video_venus_clk_src which is the src for different venus clocks.

This is not a good source in general, GCC often has more rates defined than the consumer is supposed to finally run at (because they were deemed power-inefficient or similar, you can pretty much set any rate you want on the clocks fwiw)

Konrad

#38 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

Quoted 95 lines · Konrad Dybcio
Quoted 94 lines · Vikash Garodia
Quoted 91 lines · Jorge Ramirez
Quoted 77 lines · Vikash Garodia
Quoted 75 lines · Jorge Ramirez
Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 18 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			status = "okay";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

Quoted 6 lines
Quoted 5 lines

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Most likely you have referred incorrect downstream file. Refer scuba-vidc.dtsi.

I took them from actual documents (which might or might not be obsolete, hard to say but they were the latest version and as such, they contradict the downstream dtsi).

So I'd rather not use downstream - could you point me to the reference you used please - I wonder if the fix is required downstream instead of here?

Quoted 7 lines
Quoted 2 lines

You can look for this file gcc-scuba.c and refer gcc_video_venus_clk_src which is the src for different venus clocks.

This is not a good source in general, GCC often has more rates defined than the consumer is supposed to finally run at (because they were deemed power-inefficient or similar, you can pretty much set any rate you want on the clocks fwiw)

Count wise, i agree. Value-wise, afaik, corners should match OR are you saying client scaling request for 133.0 MHz is ok when src is generating 133.33 MHz ?

Quoted 2 lines

Konrad

#39 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

Quoted 100 lines · Vikash Garodia
Quoted 98 lines · Konrad Dybcio
Quoted 96 lines · Vikash Garodia
Quoted 83 lines · Jorge Ramirez
Quoted 82 lines · Vikash Garodia
Quoted 80 lines · Jorge Ramirez
Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 10 lines
Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			status = "okay";
+
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Quoted 8 lines
Quoted 1 line

Most likely you have referred incorrect downstream file. Refer scuba-vidc.dtsi.

I took them from actual documents (which might or might not be obsolete, hard to say but they were the latest version and as such, they contradict the downstream dtsi).

So I'd rather not use downstream - could you point me to the reference you used please - I wonder if the fix is required downstream instead of here?

You can look for this file gcc-scuba.c and refer gcc_video_venus_clk_src which is the src for different venus clocks.

Quoted 6 lines
Quoted 4 lines

This is not a good source in general, GCC often has more rates defined than the consumer is supposed to finally run at (because they were deemed power-inefficient or similar, you can pretty much set any rate you want on the clocks fwiw)

Count wise, i agree. Value-wise, afaik, corners should match OR are you saying client scaling request for 133.0 MHz is ok when src is generating 133.33 MHz ?

I *think* we're running a closest-match in there.. but I'd love to have the clock and consumer drivers agree on the rate exactly (which in this case would be 133333333 - and the clock plan in our docs agrees)

Konrad

#12 lore raw

Re: [PATCH v5 2/5] media: venus: vdec: AR50_LITE video core support

In reply to Jorge Ramirez
Quoted 209 lines · Jorge Ramirez
Quoted 79 lines · Dikshita Agarwal
Quoted 76 lines · Jorge Ramirez-Ortiz

The AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.

---
 drivers/media/platform/qcom/venus/core.c      | 11 ++-
 drivers/media/platform/qcom/venus/core.h      | 11 ++-
 drivers/media/platform/qcom/venus/firmware.c  |  8 +-
 drivers/media/platform/qcom/venus/helpers.c   | 80 +++++++++++++++++++
 drivers/media/platform/qcom/venus/helpers.h   |  2 +
 .../media/platform/qcom/venus/hfi_helper.h    | 10 ++-
 drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++--
 .../media/platform/qcom/venus/pm_helpers.c    |  1 +
 drivers/media/platform/qcom/venus/vdec.c      | 15 ++--
 9 files changed, 128 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
index d305d74bb152..736ef53d988d 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
 static void venus_assign_register_offsets(struct venus_core *core)
 {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		core->cpu_base = core->base + CPU_BASE_V6;
 		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
 		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
 		core->wrapper_base = core->base + WRAPPER_BASE_V6;
 		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
 	} else {
 		core->vbif_base = core->base + VBIF_BASE;
 		core->cpu_base = core->base + CPU_BASE;
drivers/media/platform/qcom/venus/core.h +4 -1
index b412e0c5515a..e755a28e919b 100644
@@ -382,6 +382,7 @@ enum venus_inst_modes {
  * @lock:	instance lock
  * @core:	a reference to the core struct
  * @clk_data:	clock data per core ID
+ * @eosbufs:	a lit of EOS buffers
  * @dpbbufs:	a list of decoded picture buffers
  * @internalbufs:	a list of internal bufferes
  * @registeredbufs:	a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {
 	struct mutex lock;
 	struct venus_core *core;
 	struct clock_data clk_data;
+	struct list_head eosbufs;
 	struct list_head dpbbufs;
 	struct list_head internalbufs;
 	struct list_head registeredbufs;
@@ -520,7 +522,14 @@ struct venus_inst {
 #define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
 #define IS_V3(core)	((core)->res->hfi_version == HFI_VERSION_3XX)
 #define IS_V4(core)	((core)->res->hfi_version == HFI_VERSION_4XX)
-#define IS_V6(core)	((core)->res->hfi_version == HFI_VERSION_6XX)
+static inline bool IS_V6(struct venus_core *core)
+{
Quoted 8 lines

drivers/media/platform/qcom/venus/core.h struct venus_inst { · line 532

Quoted 6 lines
drivers/media/platform/qcom/venus/core.h +6 -0
+	if (WARN_ON_ONCE(!core))
+		return false;
+
+	return core->res->hfi_version == HFI_VERSION_6XX ||
+	       core->res->hfi_version == HFI_VERSION_6XX_LITE;
+}

It should be HFI_VERSION_4XX_LITE for AR50_LITE. 4XX represents SC7280 and SDM845 which are AR50.

ah good information - where is this documented? I never found this information... I'd appreciate if you could confirm with some document for future reference.

Quoted 38 lines
Quoted 38 lines
drivers/media/platform/qcom/venus/core.h +0 -0
 #define IS_AR50(core)		((core)->res->vpu_version == VPU_VERSION_AR50)
 #define IS_AR50_LITE(core)	((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +3 -3
index 66a18830e66d..f8dcef0426ac 100644
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	u32 fw_size = core->fw.mapped_mem_size;
 	void __iomem *wrapper_base;
 
-	if (IS_IRIS2_1(core))
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 		wrapper_base = core->wrapper_tz_base;
 	else
 		wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR);
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR);
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Bring XTSS out of reset */
 		writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET);
 	} else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)
 	if (resume) {
 		venus_reset_cpu(core);
 	} else {
-		if (IS_IRIS2_1(core))
+		if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 			writel(WRAPPER_XTSS_SW_RESET_BIT,
 			       core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
 		else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)
 	void __iomem *wrapper_base = core->wrapper_base;
 	void __iomem *wrapper_tz_base = core->wrapper_tz_base;
 
Quoted 5 lines

drivers/media/platform/qcom/venus/firmware.c static int venus_shutdown_no_tz(struct venus_core *core) · line 186

Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.c +1 -1
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Assert the reset to XTSS */
 		reg = readl(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);

No need to handle no-tz case. Pls drop.

ok

Quoted 61 lines
Quoted 61 lines
drivers/media/platform/qcom/venus/firmware.c +0 -0
 		reg |= WRAPPER_XTSS_SW_RESET_BIT;
drivers/media/platform/qcom/venus/helpers.c +52 -0
index 8295542e1a7c..812bec9a05be 100644
@@ -230,6 +230,79 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
 }
 EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs);
 
+static void free_eos_buf(struct venus_inst *inst, struct intbuf *buf)
+{
+	list_del_init(&buf->list);
+	dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da,
+		       buf->attrs);
+	kfree(buf);
+}
+
+int venus_helper_free_eos_bufs(struct venus_inst *inst)
+{
+	struct intbuf *buf, *n;
+
+	list_for_each_entry_safe(buf, n, &inst->eosbufs, list) {
+		free_eos_buf(inst, buf);
+	}
+
+	if (list_empty(&inst->eosbufs))
+		INIT_LIST_HEAD(&inst->eosbufs);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(venus_helper_free_eos_bufs);
+
+int venus_helper_alloc_eos_buf(struct venus_inst *inst,
+			       struct hfi_frame_data *data)
+{
+	struct venus_core *core = inst->core;
+	struct device *dev = core->dev;
+	struct intbuf *buf;
+	int ret = 0;
+
+	memset(data, 0, sizeof(*data));
+
+	data->buffer_type = HFI_BUFFER_INPUT;
+	data->flags = HFI_BUFFERFLAG_EOS;
+
+	if (IS_AR50_LITE(inst->core)) {
+		/* We must send valid sizes and addresses */
+		buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+		if (!buf) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		buf->type = HFI_BUFFER_INPUT;
+		buf->size = SZ_4K;
+		buf->attrs = DMA_ATTR_NO_KERNEL_MAPPING;
+		buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL,
+					  buf->attrs);
+		if (!buf->va) {
+			ret = -ENOMEM;
+			goto fail;
Quoted 8 lines

drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 291

Quoted 7 lines
drivers/media/platform/qcom/venus/helpers.c +7 -0
+		}
+
+		list_add_tail(&buf->list, &inst->eosbufs);
+
+		data->alloc_len = buf->size;
+		data->device_addr = buf->da;
+

why this special handling for eos buffer is needed for AR50_LITE?

Quoted 3 lines

this _fix_ was develope through testing: without it there is no EOS and errors are reporting upon killing the player

Would be better to see why there is no EOS from firmware, there shouldn't be the need to have a dma allocation for this dummy buffers, as there is no useful info in the buffer. Having the device address as 0 or 0xdeadb000 should be enough.

Quoted 32 lines
Quoted 22 lines
Quoted 22 lines
drivers/media/platform/qcom/venus/helpers.c +14 -0
+	} else if (IS_V6(inst->core) &&
+		   is_fw_rev_or_older(inst->core, 1, 0, 87)) {
+		data->device_addr = 0;
+	} else {
+		data->device_addr = 0xdeadb000;
+	}
+
+	return 0;
+fail:
+	kfree(buf);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(venus_helper_alloc_eos_buf);
+
 static int intbufs_set_buffer(struct venus_inst *inst, u32 type)
 {
 	struct venus_core *core = inst->core;
@@ -630,6 +703,13 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,
 	if (!hfi_plat || !hfi_plat->bufreq)
 		return -EINVAL;
 
Quoted 9 lines

drivers/media/platform/qcom/venus/helpers.c static int platform_get_bufreq(struct venus_inst *inst, u32 buftype, · line 712

Quoted 7 lines
drivers/media/platform/qcom/venus/helpers.c +7 -0
+	/* Firmware buffer requirements for internal buffers only */
+	if (IS_AR50_LITE(inst->core))
+		if (buftype != HFI_BUFFER_INPUT &&
+		    buftype != HFI_BUFFER_OUTPUT &&
+		    buftype != HFI_BUFFER_OUTPUT2)
+			return -EINVAL;
+

why this check is needed here? Buffer requirements for all buffer types should come from firmware for all V4 based targets.

Quoted 1 line

because I used V6 as you saw earlier.

Yes, pls use v4, and in that case all buffer requirements will come from firmware.

Thanks,
Dikshita

Quoted 189 lines
Quoted 40 lines
Quoted 40 lines
drivers/media/platform/qcom/venus/helpers.c +0 -0
 	params.version = version;
 	params.num_vpp_pipes = inst->core->res->num_vpp_pipes;
 
drivers/media/platform/qcom/venus/helpers.h +2 -0
index 358e4f39c9c0..bf55fe3b8747 100644
@@ -58,6 +58,8 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt,
 bool venus_helper_check_format(struct venus_inst *inst, u32 v4l2_pixfmt);
 int venus_helper_alloc_dpb_bufs(struct venus_inst *inst);
 int venus_helper_free_dpb_bufs(struct venus_inst *inst);
+int venus_helper_alloc_eos_buf(struct venus_inst *inst, struct hfi_frame_data *data);
+int venus_helper_free_eos_bufs(struct venus_inst *inst);
 int venus_helper_intbufs_alloc(struct venus_inst *inst);
 int venus_helper_intbufs_free(struct venus_inst *inst);
 int venus_helper_intbufs_realloc(struct venus_inst *inst);
drivers/media/platform/qcom/venus/hfi_helper.h +6 -3
index f44059f19505..128ddf8e3cd5 100644
@@ -397,13 +397,16 @@
 #define HFI_BUFFER_INTERNAL_PERSIST_1		0x5
 #define HFI_BUFFER_INTERNAL_SCRATCH(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x6 : 0x1000001)
 #define HFI_BUFFER_INTERNAL_SCRATCH_1(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x7 : 0x1000005)
 #define HFI_BUFFER_INTERNAL_SCRATCH_2(ver)	\
 	(((ver) == HFI_VERSION_4XX ||		\
-	(ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006)
+	(ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \
+	? 0x8 : 0x1000006)
 #define HFI_BUFFER_EXTRADATA_INPUT(ver)		\
 	(((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_helper.h enum hfi_version { · line 567

Quoted 6 lines
drivers/media/platform/qcom/venus/hfi_helper.h +1 -0
 #define HFI_BUFFER_EXTRADATA_OUTPUT(ver)	\
@@ -561,6 +564,7 @@ enum hfi_version {
 	HFI_VERSION_3XX,
 	HFI_VERSION_4XX,
 	HFI_VERSION_6XX,
+	HFI_VERSION_6XX_LITE,

s/HFI_VERSION_6XX_LITE/HFI_VERSION_4XX_LITE.
update all applicable places.

sure, I'll validate that - I remember starting with V4 but it didnt work so switched to 6xx. I'll try again.

Quoted 60 lines
Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_helper.h +0 -0
 };
 
 struct hfi_buffer_info {
drivers/media/platform/qcom/venus/hfi_venus.c +0 -0
index b5f2ea879950..302776bf8fe6 100644

drivers/media/platform/qcom/venus/hfi_venus.c static int venus_boot_core(struct venus_hfi_device *hdev) · line 502

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_venus.c +1 -1
@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)
 	if (count >= max_tries)
 		ret = -ETIMEDOUT;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core)) {
 		writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6);
 		writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);

CPU_CS_X2RPMH_V6 is not needed for AR50_LITE, pls drop.

Quoted 12 lines
drivers/media/platform/qcom/venus/hfi_venus.c +3 -0
 	}
@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)
 	u32 mask_val;
 	int ret;
 
+	if (IS_AR50_LITE(hdev->core))
+		return 0;
+
 	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
 		writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6);
 

drivers/media/platform/qcom/venus/hfi_venus.c static irqreturn_t venus_isr(struct venus_core *core) · line 1143

Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_venus.c +2 -1
@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core)
 	wrapper_base = hdev->core->wrapper_base;
 
 	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
+
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
 		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||

WD mask is incorrect, pls fix.

Quoted 23 lines
drivers/media/platform/qcom/venus/hfi_venus.c +2 -2
 		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
 			hdev->irq_status = status;
 	}
 	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
-	if (!(IS_IRIS2(core) || IS_IRIS2_1(core)))
+	if (!(IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)))
 		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
 
 	return IRQ_WAKE_THREAD;
@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
Quoted 15 lines
Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_venus.c +1 -1
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
drivers/media/platform/qcom/venus/pm_helpers.c +0 -0
index 409aa9bd0b5d..5d9dfe3fd043 100644

drivers/media/platform/qcom/venus/pm_helpers.c const struct venus_pm_ops *venus_pm_get(enum hfi_version version) · line 1171

Quoted 4 lines
drivers/media/platform/qcom/venus/pm_helpers.c +1 -0
@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)
 		return &pm_ops_v3;
 	case HFI_VERSION_4XX:
 	case HFI_VERSION_6XX:
+	case HFI_VERSION_6XX_LITE:

s/HFI_VERSION_6XX_LITE/HFI_VERSION_4XX_LITE

yep

Quoted 58 lines

Thanks,
Dikshita

Quoted 55 lines
drivers/media/platform/qcom/venus/pm_helpers.c +0 -0
 		return &pm_ops_v4;
 	}
 
drivers/media/platform/qcom/venus/vdec.c +7 -8
index 99ce5fd41577..87c7901b280e 100644
@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 {
 	struct venus_inst *inst = to_inst(file);
 	struct vb2_queue *dst_vq;
-	struct hfi_frame_data fdata = {0};
+	struct hfi_frame_data fdata;
 	int ret;
 
 	ret = v4l2_m2m_ioctl_try_decoder_cmd(file, fh, cmd);
@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 
 	if (cmd->cmd == V4L2_DEC_CMD_STOP) {
 		/*
-		 * Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on
+		 * Implement V4L2_DEC_CMD_STOP by enqueue a buffer on
 		 * decoder input to signal EOS.
 		 */
 		if (!(inst->streamon_out && inst->streamon_cap))
 			goto unlock;
 
-		fdata.buffer_type = HFI_BUFFER_INPUT;
-		fdata.flags |= HFI_BUFFERFLAG_EOS;
-		if (IS_V6(inst->core) && is_fw_rev_or_older(inst->core, 1, 0, 87))
-			fdata.device_addr = 0;
-		else
-			fdata.device_addr = 0xdeadb000;
+		ret = venus_helper_alloc_eos_buf(inst, &fdata);
+		if (ret)
+			goto unlock;
 
 		ret = hfi_session_process_buf(inst, &fdata);
 
@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)
 		hfi_session_abort(inst);
 
 	venus_helper_free_dpb_bufs(inst);
+	venus_helper_free_eos_bufs(inst);
 	venus_pm_load_scale(inst);
 	INIT_LIST_HEAD(&inst->registeredbufs);
 	mutex_unlock(&inst->lock);
@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)
 	if (!inst)
 		return -ENOMEM;
 
+	INIT_LIST_HEAD(&inst->eosbufs);
 	INIT_LIST_HEAD(&inst->dpbbufs);
 	INIT_LIST_HEAD(&inst->registeredbufs);
 	INIT_LIST_HEAD(&inst->internalbufs);
#4 lore raw

Re: [PATCH v5 1/5] media: dt-bindings: venus: Add qcm2290 dt schema

In reply to Vikash Garodia
Quoted 56 lines · Vikash Garodia
Quoted 54 lines · Jorge Ramirez-Ortiz

Add a schema for the venus video encoder/decoder on the qcm2290.

---
 .../bindings/media/qcom,qcm2290-venus.yaml    | 127 ++++++++++++++++++
 1 file changed, 127 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +39 -0
new file mode 100644
index 000000000000..a9f89b545334
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/qcom,qcm2290-venus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm QCM2290 Venus video encode and decode accelerators
+
+maintainers:
+  - Vikash Garodia <[email protected]>
+
+description:
+  The Venus AR50_LITE IP is a video encode and decode accelerator present
+  on Qualcomm platforms
+
+allOf:
+  - $ref: qcom,venus-common.yaml#
+
+properties:
+  compatible:
+    const: qcom,qcm2290-venus
+
+  power-domains:
+    maxItems: 3
+
+  power-domain-names:
+    items:
+      - const: venus
+      - const: vcodec0
+      - const: cx
+
+  clocks:
+    maxItems: 6
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+      - const: bus
Quoted 8 lines

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 46

Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +7 -0
+      - const: throttle
+      - const: vcodec0_core
+      - const: vcodec0_bus
+
+  iommus:
+    minItems: 1
+    maxItems: 5

2 should be good to support non secure usecases. 5 not needed.

ok

Quoted 77 lines
Quoted 50 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +50 -0
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  operating-points-v2: true
+  opp-table:
+    type: object
+
+required:
+  - compatible
+  - power-domain-names
+  - iommus
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/qcom,gcc-qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,rpm-icc.h>
+    #include <dt-bindings/power/qcom-rpmpd.h>
+
+    venus: video-codec@5a00000 {
+        compatible = "qcom,qcm2290-venus";
+        reg = <0x5a00000 0xf0000>;
+        interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+        power-domains = <&gcc GCC_VENUS_GDSC>,
+                        <&gcc GCC_VCODEC0_GDSC>,
+                        <&rpmpd QCM2290_VDDCX>;
+        power-domain-names = "venus",
+                             "vcodec0",
+                             "cx";
+        operating-points-v2 = <&venus_opp_table>;
+
+        clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+                 <&gcc GCC_VIDEO_AHB_CLK>,
+                 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+                 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+                 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+                 <&gcc GCC_VCODEC0_AXI_CLK>;
+        clock-names = "core",
+                       "iface",
+                       "bus",

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10 -0
+                       "throttle",
+                       "vcodec0_core",
+                       "vcodec0_bus";
+
+        memory-region = <&pil_video_mem>;
+        iommus = <&apps_smmu 0x860 0x0>,
+                 <&apps_smmu 0x880 0x0>,
+                 <&apps_smmu 0x861 0x04>,
+                 <&apps_smmu 0x863 0x0>,
+                 <&apps_smmu 0x804 0xE0>;

update this accordingly.

Quoted 5 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +5 -0
+
+        interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+                         &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+                        <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+                         &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 121

Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10 -0
+        interconnect-names = "video-mem",
+                             "cpu-cfg";
+
+        venus_opp_table: opp-table {
+            compatible = "operating-points-v2";
+
+            opp-133000000 {
+                opp-hz = /bits/ 64 <133000000>;
+                required-opps = <&rpmpd_opp_low_svs>;
+            };

This value is incorrect, fix it to 133330000.

Quoted 5 lines

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 124

Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +3 -0
+            opp-240000000 {
+                opp-hz = /bits/ 64 <240000000>;
+                required-opps = <&rpmpd_opp_svs>;

Do you see other corners in the reference catalog as well, not just the downstream code ? OR did you limit this as the usecase do not demand higher corner ?

there was an internal AR50_LITE presentation where only these two claimed to be supported - all of the others were not. so I went for the most restrictive option (ie, this one).

how do you want me to proceed then? should I just use IPCAT, or downstream?

Quoted 6 lines

Regards,
Vikash

Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +3 -0
+            };
+        };
+    };
#25 lore raw

Re: [PATCH v5 4/5] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Dikshita Agarwal
Quoted 23 lines · Dikshita Agarwal
Quoted 20 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the venus core.

Video encoding support is not exposed until the relevant hardware capabilities are enabled.

---
 drivers/media/platform/qcom/venus/core.c | 39 ++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/media/platform/qcom/venus/core.c +0 -0
index 736ef53d988d..f1f211ca1ce2 100644
@@ -1062,6 +1062,44 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
Quoted 6 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1069

Quoted 5 lines
drivers/media/platform/qcom/venus/core.c +5 -0
+static const struct freq_tbl qcm2290_freq_table[] = {
+	{ 352800, 240000000 },	/* 1920x1088 @ 30 + 1280x720 @ 30 */
+	{ 244800, 133000000 },	/* 1920x1088 @ 30 */
+};
+

fix this corner.

ok, will wait for Vikash to confirm the other ones.

Quoted 5 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1073

Quoted 4 lines
drivers/media/platform/qcom/venus/core.c +4 -0
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 244800, 2128000, 0, 2128000, 0}, /* 1920x1088 @ 30 */
+};
+

what is the reference for this?

Quoted 15 lines
Quoted 4 lines
drivers/media/platform/qcom/venus/core.c +4 -0
+static const struct venus_resources qcm2290_res = {
+	.freq_tbl = qcm2290_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(qcm2290_freq_table),
+	.bw_tbl_dec = qcm2290_bw_table_dec,

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1087

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +10 -0
+	.bw_tbl_dec_size = ARRAY_SIZE(qcm2290_bw_table_dec),
+	.clks = { "core", "iface", "bus", "throttle" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
+	.vcodec_clks_num = 2,
+	.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx" },
+	.vcodec_num = 1,
+	.hfi_version = HFI_VERSION_6XX_LITE,

s/HFI_VERSION_6XX_LITE/HFI_VERSION_4XX_LITE

um right, going to rewrite this whole bit and get rid of 6XX_LITE/4XX_LITE (will post 4XX with a lite option instead, which is closer to the intended abstraction - even though the 6XX/4XX abstractions are kind of dubious...)

Quoted 29 lines

Thanks,
Dikshita

Quoted 26 lines
drivers/media/platform/qcom/venus/core.c +16 -0
+	.vpu_version = VPU_VERSION_AR50_LITE,
+	.max_load = 352800,
+	.num_vpp_pipes = 1,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x70800000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x24800000,
+	.dma_mask = 0xe0000000 - 1,
+	.fwname = "qcom/venus-6.0/venus.mbn",
+	.dec_nodename = "video-decoder",
+};
+
 static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
 	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
@@ -1072,6 +1110,7 @@ static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
 	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
 	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
+	{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, venus_dt_match);
#19 lore raw

Re: [PATCH v5 3/5] media: venus: hfi_plat_v6_lite: Populate decode capabilities

In reply to Dikshita Agarwal
Quoted 14 lines · Dikshita Agarwal
Quoted 11 lines · Jorge Ramirez-Ortiz

Add hfi platform file with decoding capabilities for hfi v6_lite.

---
 drivers/media/platform/qcom/venus/Makefile    |   2 +-
 .../media/platform/qcom/venus/hfi_platform.c  |   2 +
 .../media/platform/qcom/venus/hfi_platform.h  |   1 +
 .../qcom/venus/hfi_platform_v6_lite.c         | 148 ++++++++++++++++++
 4 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
Quoted 11 lines

drivers/media/platform/qcom/venus/Makefile venus-core-objs += core.o helpers.o firmware.o \ · line 8

Quoted 10 lines
drivers/media/platform/qcom/venus/Makefile +1 -1
index 91ee6be10292..4a6a942db58b 100644
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \
 		   hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \
 		   hfi_parser.o pm_helpers.o dbgfs.o \
 		   hfi_platform.o hfi_platform_v4.o \
-		   hfi_platform_v6.o hfi_plat_bufs_v6.o \
+		   hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \

s/hfi_platform_v6_lite/hfi_platform_v4_lite

will remove, will use platform_v4 instead

Quoted 14 lines

drivers/media/platform/qcom/venus/hfi_platform.c const struct hfi_platform *hfi_platform_get(enum hfi_version version) · line 17

Quoted 13 lines
drivers/media/platform/qcom/venus/Makefile +0 -0
 venus-dec-objs += vdec.o vdec_ctrls.o
 venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
index 643e5aa138f5..f56b8f9946d7 100644
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
 		return &hfi_plat_v4;
 	case HFI_VERSION_6XX:
 		return &hfi_plat_v6;
+	case HFI_VERSION_6XX_LITE:
+		return &hfi_plat_v6_lite;

update here as well.

yes, this function wont get changed

Quoted 9 lines
Quoted 9 lines
drivers/media/platform/qcom/venus/hfi_platform.c +0 -0
 	default:
 		break;
 	}
drivers/media/platform/qcom/venus/hfi_platform.h +0 -0
index ec89a90a8129..6356e4bd0de2 100644
@@ -58,6 +58,7 @@ struct hfi_platform {
 
Quoted 4 lines

drivers/media/platform/qcom/venus/hfi_platform.h struct hfi_platform { · line 61

Quoted 3 lines
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
 extern const struct hfi_platform hfi_plat_v4;
 extern const struct hfi_platform hfi_plat_v6;
+extern const struct hfi_platform hfi_plat_v6_lite;

ditto

neither this one

Quoted 25 lines
Quoted 25 lines
drivers/media/platform/qcom/venus/hfi_platform.h +0 -0
 const struct hfi_platform *hfi_platform_get(enum hfi_version version);
 unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +16 -0
new file mode 100644
index 000000000000..41958a3e353b
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2025, The Linux Foundation. All rights reserved.
+ */
+#include "hfi_platform.h"
+
+static const struct hfi_plat_caps caps[] = {
+{
+	.codec = HFI_VIDEO_CODEC_H264,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 23

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +7 -0
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_1},
+	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_41},
+	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_5},
+	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_41},
+	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_41},

what is the reference for these values?

what do you mean? what should be the reference? I didnt see a downstream equivalente to base on so based on the 4XX settings these seem consistent.

IS there any internal document that you can point me to please?

Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +12 -0
+	.num_pl = 5,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_HEVC,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 42

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +7 -0
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_HEVC_PROFILE_MAIN, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_MAIN},
+	.pl[1] = {HFI_HEVC_PROFILE_MAIN10, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_MAIN},

what is the reference for these values?

same as above.

what internal documents do you typically reference to? Havent seen these references in previous commits.

could you clarify please?

Quoted 98 lines
Quoted 98 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +98 -0
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_VP9,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_VP9_PROFILE_P0, 200},
+	.pl[1] = {HFI_VP9_PROFILE_P2_10B, 200},
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+} };
+
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+{
+	*entries = ARRAY_SIZE(caps);
+	return caps;
+}
+
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+{
+	*enc_codecs = 0x0;
+	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
+		      HFI_VIDEO_CODEC_VP9;
+	*count = 3;
+}
+
+static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
+	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+};
+
+static const struct hfi_platform_codec_freq_data *
+get_codec_freq_data(u32 session_type, u32 pixfmt)
+{
+	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
+	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
+	const struct hfi_platform_codec_freq_data *found = NULL;
+
+	for (i = 0; i < data_size; i++) {
+		if (data[i].pixfmt == pixfmt &&
+		    data[i].session_type == session_type) {
+			found = &data[i];
+			break;
+		}
+	}
+
+	return found;
+}
+
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->vpp_freq;
+
+	return 0;
+}
+
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->vsp_freq;
+
+	return 0;
+}
+
+static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->low_power_freq;
+
+	return 0;
+}
+
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 147

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +7 -0
+const struct hfi_platform hfi_plat_v6_lite = {
+	.codec_vpp_freq = codec_vpp_freq,
+	.codec_vsp_freq = codec_vsp_freq,
+	.codec_lp_freq = codec_lp_freq,
+	.codecs = get_codecs,
+	.capabilities = get_capabilities,
+	.bufreq = hfi_plat_bufreq_v6,

buffer requirement should come from firmware, pls drop.

yes, this will be hfi_plat_v4 only

Quoted 4 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 148

Quoted 1 line
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +1 -0
+};

lot of code duplication here, pls see the possibility to commonize the

Quoted 1 line

code.

this file is no longer needed

Quoted 3 lines

Thanks,
Dikshita

#41 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

In reply to Vikash Garodia
Quoted 91 lines · Vikash Garodia
Quoted 89 lines · Jorge Ramirez
Quoted 77 lines · Vikash Garodia
Quoted 75 lines · Jorge Ramirez
Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 18 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			status = "okay";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

Quoted 6 lines
Quoted 5 lines

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Most likely you have referred incorrect downstream file. Refer scuba-vidc.dtsi.

I took them from actual documents (which might or might not be obsolete, hard to say but they were the latest version and as such, they contradict the downstream dtsi).

Quoted 5 lines
Quoted 2 lines

So I'd rather not use downstream - could you point me to the reference you used please - I wonder if the fix is required downstream instead of here?

You can look for this file gcc-scuba.c and refer gcc_video_venus_clk_src which is the src for different venus clocks.

sure, but the question remains, how do I know these are correct when the documentation I have claims the opposite?

AFAIK downstream could be wrong, no?

Quoted 27 lines
Quoted 27 lines
Quoted 5 lines

Again, good reference for such cases would IP catalogues and if not, gcc driver in this case which have structures defining different corners for video.

The PM document for this chip only confirms two values - the other 4 ones claim they are not supported on 50_LT

but we can discuss offline.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

Regards,
Vikash

Quoted 11 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +8 -0
+
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
 		mdss: display-subsystem@5e00000 {
 			compatible = "qcom,qcm2290-mdss";
 			reg = <0x0 0x05e00000 0x0 0x1000>;
#40 lore raw

Re: [PATCH v5 5/5] arm64: dts: qcom: qcm2290: Add venus video node

In reply to Konrad Dybcio
Quoted 105 lines · Konrad Dybcio
Quoted 104 lines · Vikash Garodia
Quoted 102 lines · Konrad Dybcio
Quoted 91 lines · Vikash Garodia
Quoted 89 lines · Jorge Ramirez
Quoted 77 lines · Vikash Garodia
Quoted 75 lines · Jorge Ramirez
Quoted 44 lines · Vikash Garodia
Quoted 42 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +25 -0
index f49ac1c1f8a3..5326c91a0ff0 100644
@@ -1628,6 +1628,63 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
Quoted 8 lines

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1662

Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;

keep only the non secure ones.

ok

Quoted 18 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1679

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10 -0
+
+			status = "okay";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133000000 {
+					opp-hz = /bits/ 64 <133000000>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};

Fix the corner freq value

Quoted 6 lines
Quoted 5 lines

can you add some reference please?

I took this data from an internal document - not sure why the downstream driver supports different values or where those were taken from (AFAIK they are not supported)

Most likely you have referred incorrect downstream file. Refer scuba-vidc.dtsi.

I took them from actual documents (which might or might not be obsolete, hard to say but they were the latest version and as such, they contradict the downstream dtsi).

Quoted 5 lines
Quoted 2 lines

So I'd rather not use downstream - could you point me to the reference you used please - I wonder if the fix is required downstream instead of here?

You can look for this file gcc-scuba.c and refer gcc_video_venus_clk_src which is the src for different venus clocks.

This is not a good source in general, GCC often has more rates defined than the consumer is supposed to finally run at (because they were deemed power-inefficient or similar, you can pretty much set any rate you want on the clocks fwiw)

Quoted 8 lines
Quoted 2 lines

Count wise, i agree. Value-wise, afaik, corners should match OR are you saying client scaling request for 133.0 MHz is ok when src is generating 133.33 MHz ?

I *think* we're running a closest-match in there.. but I'd love to have the clock and consumer drivers agree on the rate exactly (which in this case would be 133333333 - and the clock plan in our docs agrees)

ok, will use this instead

Quoted 1 line

Konrad

#26 lore raw

Re: [PATCH v5 4/5] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Jorge Ramirez
Quoted 24 lines · Jorge Ramirez
Quoted 23 lines · Dikshita Agarwal
Quoted 20 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the venus core.

Video encoding support is not exposed until the relevant hardware capabilities are enabled.

---
 drivers/media/platform/qcom/venus/core.c | 39 ++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/media/platform/qcom/venus/core.c +0 -0
index 736ef53d988d..f1f211ca1ce2 100644
@@ -1062,6 +1062,44 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
Quoted 8 lines
Quoted 6 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1069

Quoted 5 lines
drivers/media/platform/qcom/venus/core.c +5 -0
+static const struct freq_tbl qcm2290_freq_table[] = {
+	{ 352800, 240000000 },	/* 1920x1088 @ 30 + 1280x720 @ 30 */
+	{ 244800, 133000000 },	/* 1920x1088 @ 30 */
+};
+

fix this corner.

ok, will wait for Vikash to confirm the other ones.

Actually you can get rid of it now, I think:

https://git.linuxtv.org/media.git/commit/?id=b179234b5e59013f8772da17b273f463f9720bdd

Konrad

#5 lore raw

Re: [PATCH v5 1/5] media: dt-bindings: venus: Add qcm2290 dt schema

In reply to Jorge Ramirez
Quoted 66 lines · Jorge Ramirez
Quoted 56 lines · Vikash Garodia
Quoted 54 lines · Jorge Ramirez-Ortiz

Add a schema for the venus video encoder/decoder on the qcm2290.

---
 .../bindings/media/qcom,qcm2290-venus.yaml    | 127 ++++++++++++++++++
 1 file changed, 127 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +39 -0
new file mode 100644
index 000000000000..a9f89b545334
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/qcom,qcm2290-venus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm QCM2290 Venus video encode and decode accelerators
+
+maintainers:
+  - Vikash Garodia <[email protected]>
+
+description:
+  The Venus AR50_LITE IP is a video encode and decode accelerator present
+  on Qualcomm platforms
+
+allOf:
+  - $ref: qcom,venus-common.yaml#
+
+properties:
+  compatible:
+    const: qcom,qcm2290-venus
+
+  power-domains:
+    maxItems: 3
+
+  power-domain-names:
+    items:
+      - const: venus
+      - const: vcodec0
+      - const: cx
+
+  clocks:
+    maxItems: 6
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+      - const: bus
Quoted 8 lines

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 46

Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +7 -0
+      - const: throttle
+      - const: vcodec0_core
+      - const: vcodec0_bus
+
+  iommus:
+    minItems: 1
+    maxItems: 5

2 should be good to support non secure usecases. 5 not needed.

Quoted 1 line

ok

isnt it better to just leave 5 here - thinking of the future support for secure buffers - and just update the dts?

Quoted 97 lines
Quoted 78 lines
Quoted 51 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +50 -0
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  operating-points-v2: true
+  opp-table:
+    type: object
+
+required:
+  - compatible
+  - power-domain-names
+  - iommus
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/qcom,gcc-qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,rpm-icc.h>
+    #include <dt-bindings/power/qcom-rpmpd.h>
+
+    venus: video-codec@5a00000 {
+        compatible = "qcom,qcm2290-venus";
+        reg = <0x5a00000 0xf0000>;
+        interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+        power-domains = <&gcc GCC_VENUS_GDSC>,
+                        <&gcc GCC_VCODEC0_GDSC>,
+                        <&rpmpd QCM2290_VDDCX>;
+        power-domain-names = "venus",
+                             "vcodec0",
+                             "cx";
+        operating-points-v2 = <&venus_opp_table>;
+
+        clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+                 <&gcc GCC_VIDEO_AHB_CLK>,
+                 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+                 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+                 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+                 <&gcc GCC_VCODEC0_AXI_CLK>;
+        clock-names = "core",
+                       "iface",
+                       "bus",

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10 -0
+                       "throttle",
+                       "vcodec0_core",
+                       "vcodec0_bus";
+
+        memory-region = <&pil_video_mem>;
+        iommus = <&apps_smmu 0x860 0x0>,
+                 <&apps_smmu 0x880 0x0>,
+                 <&apps_smmu 0x861 0x04>,
+                 <&apps_smmu 0x863 0x0>,
+                 <&apps_smmu 0x804 0xE0>;

update this accordingly.

Quoted 5 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +5 -0
+
+        interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+                         &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+                        <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+                         &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 121

Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10 -0
+        interconnect-names = "video-mem",
+                             "cpu-cfg";
+
+        venus_opp_table: opp-table {
+            compatible = "operating-points-v2";
+
+            opp-133000000 {
+                opp-hz = /bits/ 64 <133000000>;
+                required-opps = <&rpmpd_opp_low_svs>;
+            };

This value is incorrect, fix it to 133330000.

Quoted 5 lines

Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 124

Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +3 -0
+            opp-240000000 {
+                opp-hz = /bits/ 64 <240000000>;
+                required-opps = <&rpmpd_opp_svs>;

Do you see other corners in the reference catalog as well, not just the downstream code ? OR did you limit this as the usecase do not demand higher corner ?

there was an internal AR50_LITE presentation where only these two claimed to be supported - all of the others were not. so I went for the most restrictive option (ie, this one).

how do you want me to proceed then? should I just use IPCAT, or downstream?

Quoted 6 lines

Regards,
Vikash

Quoted 3 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +3 -0
+            };
+        };
+    };
#20 lore raw

Re: [PATCH v5 3/5] media: venus: hfi_plat_v6_lite: Populate decode capabilities

In reply to Jorge Ramirez
Quoted 96 lines · Jorge Ramirez
Quoted 14 lines · Dikshita Agarwal
Quoted 11 lines · Jorge Ramirez-Ortiz

Add hfi platform file with decoding capabilities for hfi v6_lite.

---
 drivers/media/platform/qcom/venus/Makefile    |   2 +-
 .../media/platform/qcom/venus/hfi_platform.c  |   2 +
 .../media/platform/qcom/venus/hfi_platform.h  |   1 +
 .../qcom/venus/hfi_platform_v6_lite.c         | 148 ++++++++++++++++++
 4 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
Quoted 11 lines

drivers/media/platform/qcom/venus/Makefile venus-core-objs += core.o helpers.o firmware.o \ · line 8

Quoted 10 lines
drivers/media/platform/qcom/venus/Makefile +1 -1
index 91ee6be10292..4a6a942db58b 100644
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \
 		   hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \
 		   hfi_parser.o pm_helpers.o dbgfs.o \
 		   hfi_platform.o hfi_platform_v4.o \
-		   hfi_platform_v6.o hfi_plat_bufs_v6.o \
+		   hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \

s/hfi_platform_v6_lite/hfi_platform_v4_lite

will remove, will use platform_v4 instead

Quoted 14 lines

drivers/media/platform/qcom/venus/hfi_platform.c const struct hfi_platform *hfi_platform_get(enum hfi_version version) · line 17

Quoted 13 lines
drivers/media/platform/qcom/venus/Makefile +0 -0
 venus-dec-objs += vdec.o vdec_ctrls.o
 venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
index 643e5aa138f5..f56b8f9946d7 100644
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
 		return &hfi_plat_v4;
 	case HFI_VERSION_6XX:
 		return &hfi_plat_v6;
+	case HFI_VERSION_6XX_LITE:
+		return &hfi_plat_v6_lite;

update here as well.

yes, this function wont get changed

Quoted 9 lines
Quoted 9 lines
drivers/media/platform/qcom/venus/hfi_platform.c +0 -0
 	default:
 		break;
 	}
drivers/media/platform/qcom/venus/hfi_platform.h +0 -0
index ec89a90a8129..6356e4bd0de2 100644
@@ -58,6 +58,7 @@ struct hfi_platform {
 
Quoted 4 lines

drivers/media/platform/qcom/venus/hfi_platform.h struct hfi_platform { · line 61

Quoted 3 lines
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
 extern const struct hfi_platform hfi_plat_v4;
 extern const struct hfi_platform hfi_plat_v6;
+extern const struct hfi_platform hfi_plat_v6_lite;

ditto

neither this one

Quoted 25 lines
Quoted 25 lines
drivers/media/platform/qcom/venus/hfi_platform.h +0 -0
 const struct hfi_platform *hfi_platform_get(enum hfi_version version);
 unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +16 -0
new file mode 100644
index 000000000000..41958a3e353b
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2025, The Linux Foundation. All rights reserved.
+ */
+#include "hfi_platform.h"
+
+static const struct hfi_plat_caps caps[] = {
+{
+	.codec = HFI_VIDEO_CODEC_H264,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 23

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +7 -0
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_1},
+	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_41},
+	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_5},
+	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_41},
+	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_41},

what is the reference for these values?

Quoted 4 lines

what do you mean? what should be the reference? I didnt see a downstream equivalente to base on so based on the 4XX settings these seem consistent.

My question was regarding the profile and level mapping. The profiles added are consistent with 4xx, I agree. But the value of levels mapped with each profile is not matching with [1], hence the question about the reference used for this mapping.

[1]
https://elixir.bootlin.com/linux/v6.16-rc4/source/drivers/media/platform/qcom/venus/hfi_platform_v4.c#L23

Thanks,
Dikshita

Quoted 151 lines

IS there any internal document that you can point me to please?

Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +12 -0
+	.num_pl = 5,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_HEVC,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 42

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +7 -0
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_HEVC_PROFILE_MAIN, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_MAIN},
+	.pl[1] = {HFI_HEVC_PROFILE_MAIN10, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_MAIN},

what is the reference for these values?

same as above.

what internal documents do you typically reference to? Havent seen these references in previous commits.

could you clarify please?

Quoted 98 lines
Quoted 98 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +98 -0
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_VP9,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_VP9_PROFILE_P0, 200},
+	.pl[1] = {HFI_VP9_PROFILE_P2_10B, 200},
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+} };
+
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+{
+	*entries = ARRAY_SIZE(caps);
+	return caps;
+}
+
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+{
+	*enc_codecs = 0x0;
+	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
+		      HFI_VIDEO_CODEC_VP9;
+	*count = 3;
+}
+
+static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
+	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+};
+
+static const struct hfi_platform_codec_freq_data *
+get_codec_freq_data(u32 session_type, u32 pixfmt)
+{
+	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
+	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
+	const struct hfi_platform_codec_freq_data *found = NULL;
+
+	for (i = 0; i < data_size; i++) {
+		if (data[i].pixfmt == pixfmt &&
+		    data[i].session_type == session_type) {
+			found = &data[i];
+			break;
+		}
+	}
+
+	return found;
+}
+
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->vpp_freq;
+
+	return 0;
+}
+
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->vsp_freq;
+
+	return 0;
+}
+
+static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+{
+	const struct hfi_platform_codec_freq_data *data;
+
+	data = get_codec_freq_data(session_type, codec);
+	if (data)
+		return data->low_power_freq;
+
+	return 0;
+}
+
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 147

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +7 -0
+const struct hfi_platform hfi_plat_v6_lite = {
+	.codec_vpp_freq = codec_vpp_freq,
+	.codec_vsp_freq = codec_vsp_freq,
+	.codec_lp_freq = codec_lp_freq,
+	.codecs = get_codecs,
+	.capabilities = get_capabilities,
+	.bufreq = hfi_plat_bufreq_v6,

buffer requirement should come from firmware, pls drop.

yes, this will be hfi_plat_v4 only

Quoted 4 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 148

Quoted 1 line
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +1 -0
+};

lot of code duplication here, pls see the possibility to commonize the

Quoted 1 line

code.

this file is no longer needed

Quoted 3 lines

Thanks,
Dikshita

#6 lore raw

Re: [PATCH v5 1/5] media: dt-bindings: venus: Add qcm2290 dt schema

In reply to Jorge Ramirez
Quoted 5 lines · Jorge Ramirez
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

+ maxItems: 5

2 should be good to support non secure usecases. 5 not needed.

ok

isnt it better to just leave 5 here - thinking of the future support for secure buffers - and just update the dts?

It should describe the real capabilities of the hardware, not the expected use-cases.

---
bod

#7 lore raw

Re: [PATCH v5 1/5] media: dt-bindings: venus: Add qcm2290 dt schema

Quoted 10 lines · Bryan O'Donoghue
Quoted 5 lines · Jorge Ramirez
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

+ maxItems: 5

2 should be good to support non secure usecases. 5 not needed.

ok

isnt it better to just leave 5 here - thinking of the future support for secure buffers - and just update the dts?

It should describe the real capabilities of the hardware, not the expected use-cases.

then five.

Quoted 2 lines

---
bod

#21 lore raw

Re: [PATCH v5 3/5] media: venus: hfi_plat_v6_lite: Populate decode capabilities

In reply to Dikshita Agarwal
Quoted 103 lines · Dikshita Agarwal
Quoted 96 lines · Jorge Ramirez
Quoted 14 lines · Dikshita Agarwal
Quoted 11 lines · Jorge Ramirez-Ortiz

Add hfi platform file with decoding capabilities for hfi v6_lite.

---
 drivers/media/platform/qcom/venus/Makefile    |   2 +-
 .../media/platform/qcom/venus/hfi_platform.c  |   2 +
 .../media/platform/qcom/venus/hfi_platform.h  |   1 +
 .../qcom/venus/hfi_platform_v6_lite.c         | 148 ++++++++++++++++++
 4 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
Quoted 11 lines

drivers/media/platform/qcom/venus/Makefile venus-core-objs += core.o helpers.o firmware.o \ · line 8

Quoted 10 lines
drivers/media/platform/qcom/venus/Makefile +1 -1
index 91ee6be10292..4a6a942db58b 100644
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \
 		   hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \
 		   hfi_parser.o pm_helpers.o dbgfs.o \
 		   hfi_platform.o hfi_platform_v4.o \
-		   hfi_platform_v6.o hfi_plat_bufs_v6.o \
+		   hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \

s/hfi_platform_v6_lite/hfi_platform_v4_lite

will remove, will use platform_v4 instead

Quoted 14 lines

drivers/media/platform/qcom/venus/hfi_platform.c const struct hfi_platform *hfi_platform_get(enum hfi_version version) · line 17

Quoted 13 lines
drivers/media/platform/qcom/venus/Makefile +0 -0
 venus-dec-objs += vdec.o vdec_ctrls.o
 venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
index 643e5aa138f5..f56b8f9946d7 100644
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
 		return &hfi_plat_v4;
 	case HFI_VERSION_6XX:
 		return &hfi_plat_v6;
+	case HFI_VERSION_6XX_LITE:
+		return &hfi_plat_v6_lite;

update here as well.

yes, this function wont get changed

Quoted 9 lines
Quoted 9 lines
drivers/media/platform/qcom/venus/hfi_platform.c +0 -0
 	default:
 		break;
 	}
drivers/media/platform/qcom/venus/hfi_platform.h +0 -0
index ec89a90a8129..6356e4bd0de2 100644
@@ -58,6 +58,7 @@ struct hfi_platform {
 
Quoted 4 lines

drivers/media/platform/qcom/venus/hfi_platform.h struct hfi_platform { · line 61

Quoted 3 lines
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
 extern const struct hfi_platform hfi_plat_v4;
 extern const struct hfi_platform hfi_plat_v6;
+extern const struct hfi_platform hfi_plat_v6_lite;

ditto

neither this one

Quoted 25 lines
Quoted 25 lines
drivers/media/platform/qcom/venus/hfi_platform.h +0 -0
 const struct hfi_platform *hfi_platform_get(enum hfi_version version);
 unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +16 -0
new file mode 100644
index 000000000000..41958a3e353b
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2025, The Linux Foundation. All rights reserved.
+ */
+#include "hfi_platform.h"
+
+static const struct hfi_plat_caps caps[] = {
+{
+	.codec = HFI_VIDEO_CODEC_H264,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1080, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 23

Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +7 -0
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_1},
+	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_41},
+	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_5},
+	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_41},
+	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_41},

what is the reference for these values?

Quoted 4 lines

what do you mean? what should be the reference? I didnt see a downstream equivalente to base on so based on the 4XX settings these seem consistent.

Quoted 7 lines

My question was regarding the profile and level mapping. The profiles added are consistent with 4xx, I agree. But the value of levels mapped with each profile is not matching with [1], hence the question about the reference used for this mapping.

[1]
https://elixir.bootlin.com/linux/v6.16-rc4/source/drivers/media/platform/qcom/venus/hfi_platform_v4.c#L23

ah right, AR50_LITE does not support 52 (the highest is 5).
I see your point - you are right of course.
I was doing a quite a bit of testing with fluster and I left the wrong values. My fault. will fix.

thanks!

#13 lore raw

Re: [PATCH v5 2/5] media: venus: vdec: AR50_LITE video core support

In reply to Dikshita Agarwal
Quoted 212 lines · Dikshita Agarwal
Quoted 209 lines · Jorge Ramirez
Quoted 79 lines · Dikshita Agarwal
Quoted 76 lines · Jorge Ramirez-Ortiz

The AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.

---
 drivers/media/platform/qcom/venus/core.c      | 11 ++-
 drivers/media/platform/qcom/venus/core.h      | 11 ++-
 drivers/media/platform/qcom/venus/firmware.c  |  8 +-
 drivers/media/platform/qcom/venus/helpers.c   | 80 +++++++++++++++++++
 drivers/media/platform/qcom/venus/helpers.h   |  2 +
 .../media/platform/qcom/venus/hfi_helper.h    | 10 ++-
 drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++--
 .../media/platform/qcom/venus/pm_helpers.c    |  1 +
 drivers/media/platform/qcom/venus/vdec.c      | 15 ++--
 9 files changed, 128 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
index d305d74bb152..736ef53d988d 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
 static void venus_assign_register_offsets(struct venus_core *core)
 {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		core->cpu_base = core->base + CPU_BASE_V6;
 		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
 		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
 		core->wrapper_base = core->base + WRAPPER_BASE_V6;
 		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
 	} else {
 		core->vbif_base = core->base + VBIF_BASE;
 		core->cpu_base = core->base + CPU_BASE;
drivers/media/platform/qcom/venus/core.h +4 -1
index b412e0c5515a..e755a28e919b 100644
@@ -382,6 +382,7 @@ enum venus_inst_modes {
  * @lock:	instance lock
  * @core:	a reference to the core struct
  * @clk_data:	clock data per core ID
+ * @eosbufs:	a lit of EOS buffers
  * @dpbbufs:	a list of decoded picture buffers
  * @internalbufs:	a list of internal bufferes
  * @registeredbufs:	a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {
 	struct mutex lock;
 	struct venus_core *core;
 	struct clock_data clk_data;
+	struct list_head eosbufs;
 	struct list_head dpbbufs;
 	struct list_head internalbufs;
 	struct list_head registeredbufs;
@@ -520,7 +522,14 @@ struct venus_inst {
 #define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
 #define IS_V3(core)	((core)->res->hfi_version == HFI_VERSION_3XX)
 #define IS_V4(core)	((core)->res->hfi_version == HFI_VERSION_4XX)
-#define IS_V6(core)	((core)->res->hfi_version == HFI_VERSION_6XX)
+static inline bool IS_V6(struct venus_core *core)
+{
Quoted 8 lines

drivers/media/platform/qcom/venus/core.h struct venus_inst { · line 532

Quoted 6 lines
drivers/media/platform/qcom/venus/core.h +6 -0
+	if (WARN_ON_ONCE(!core))
+		return false;
+
+	return core->res->hfi_version == HFI_VERSION_6XX ||
+	       core->res->hfi_version == HFI_VERSION_6XX_LITE;
+}

It should be HFI_VERSION_4XX_LITE for AR50_LITE. 4XX represents SC7280 and SDM845 which are AR50.

ah good information - where is this documented? I never found this information... I'd appreciate if you could confirm with some document for future reference.

Quoted 38 lines
Quoted 38 lines
drivers/media/platform/qcom/venus/core.h +0 -0
 #define IS_AR50(core)		((core)->res->vpu_version == VPU_VERSION_AR50)
 #define IS_AR50_LITE(core)	((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +3 -3
index 66a18830e66d..f8dcef0426ac 100644
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	u32 fw_size = core->fw.mapped_mem_size;
 	void __iomem *wrapper_base;
 
-	if (IS_IRIS2_1(core))
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 		wrapper_base = core->wrapper_tz_base;
 	else
 		wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR);
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR);
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Bring XTSS out of reset */
 		writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET);
 	} else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)
 	if (resume) {
 		venus_reset_cpu(core);
 	} else {
-		if (IS_IRIS2_1(core))
+		if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 			writel(WRAPPER_XTSS_SW_RESET_BIT,
 			       core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
 		else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)
 	void __iomem *wrapper_base = core->wrapper_base;
 	void __iomem *wrapper_tz_base = core->wrapper_tz_base;
 
Quoted 5 lines

drivers/media/platform/qcom/venus/firmware.c static int venus_shutdown_no_tz(struct venus_core *core) · line 186

Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.c +1 -1
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Assert the reset to XTSS */
 		reg = readl(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);

No need to handle no-tz case. Pls drop.

ok

Quoted 69 lines
Quoted 58 lines
drivers/media/platform/qcom/venus/firmware.c +0 -0
 		reg |= WRAPPER_XTSS_SW_RESET_BIT;
drivers/media/platform/qcom/venus/helpers.c +49 -0
index 8295542e1a7c..812bec9a05be 100644
@@ -230,6 +230,79 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
 }
 EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs);
 
+static void free_eos_buf(struct venus_inst *inst, struct intbuf *buf)
+{
+	list_del_init(&buf->list);
+	dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da,
+		       buf->attrs);
+	kfree(buf);
+}
+
+int venus_helper_free_eos_bufs(struct venus_inst *inst)
+{
+	struct intbuf *buf, *n;
+
+	list_for_each_entry_safe(buf, n, &inst->eosbufs, list) {
+		free_eos_buf(inst, buf);
+	}
+
+	if (list_empty(&inst->eosbufs))
+		INIT_LIST_HEAD(&inst->eosbufs);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(venus_helper_free_eos_bufs);
+
+int venus_helper_alloc_eos_buf(struct venus_inst *inst,
+			       struct hfi_frame_data *data)
+{
+	struct venus_core *core = inst->core;
+	struct device *dev = core->dev;
+	struct intbuf *buf;
+	int ret = 0;
+
+	memset(data, 0, sizeof(*data));
+
+	data->buffer_type = HFI_BUFFER_INPUT;
+	data->flags = HFI_BUFFERFLAG_EOS;
+
+	if (IS_AR50_LITE(inst->core)) {
+		/* We must send valid sizes and addresses */
+		buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+		if (!buf) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		buf->type = HFI_BUFFER_INPUT;
+		buf->size = SZ_4K;
+		buf->attrs = DMA_ATTR_NO_KERNEL_MAPPING;
+		buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL,
+					  buf->attrs);

drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 291

Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10 -0
+		if (!buf->va) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		list_add_tail(&buf->list, &inst->eosbufs);
+
+		data->alloc_len = buf->size;
+		data->device_addr = buf->da;
+

why this special handling for eos buffer is needed for AR50_LITE?

Quoted 8 lines
Quoted 3 lines

this _fix_ was develope through testing: without it there is no EOS and errors are reporting upon killing the player

Would be better to see why there is no EOS from firmware, there shouldn't be the need to have a dma allocation for this dummy buffers, as there is no useful info in the buffer. Having the device address as 0 or 0xdeadb000 should be enough.

hi dikshita,

I am still keeping this on v6 as per our internal discussions and because v6 is quite different from v5 so wanted to provide early access to users.

if the firwmare is fixed to address this issue on time, I might revert the EOS page buffer.

TIA
jorge

#14 lore raw

Re: [PATCH v5 2/5] media: venus: vdec: AR50_LITE video core support

Quoted 222 lines · Jorge Ramirez
Quoted 212 lines · Dikshita Agarwal
Quoted 209 lines · Jorge Ramirez
Quoted 79 lines · Dikshita Agarwal
Quoted 76 lines · Jorge Ramirez-Ortiz

The AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.

---
 drivers/media/platform/qcom/venus/core.c      | 11 ++-
 drivers/media/platform/qcom/venus/core.h      | 11 ++-
 drivers/media/platform/qcom/venus/firmware.c  |  8 +-
 drivers/media/platform/qcom/venus/helpers.c   | 80 +++++++++++++++++++
 drivers/media/platform/qcom/venus/helpers.h   |  2 +
 .../media/platform/qcom/venus/hfi_helper.h    | 10 ++-
 drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++--
 .../media/platform/qcom/venus/pm_helpers.c    |  1 +
 drivers/media/platform/qcom/venus/vdec.c      | 15 ++--
 9 files changed, 128 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
index d305d74bb152..736ef53d988d 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
 static void venus_assign_register_offsets(struct venus_core *core)
 {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		core->cpu_base = core->base + CPU_BASE_V6;
 		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
 		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
 		core->wrapper_base = core->base + WRAPPER_BASE_V6;
 		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
 	} else {
 		core->vbif_base = core->base + VBIF_BASE;
 		core->cpu_base = core->base + CPU_BASE;
drivers/media/platform/qcom/venus/core.h +4 -1
index b412e0c5515a..e755a28e919b 100644
@@ -382,6 +382,7 @@ enum venus_inst_modes {
  * @lock:	instance lock
  * @core:	a reference to the core struct
  * @clk_data:	clock data per core ID
+ * @eosbufs:	a lit of EOS buffers
  * @dpbbufs:	a list of decoded picture buffers
  * @internalbufs:	a list of internal bufferes
  * @registeredbufs:	a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {
 	struct mutex lock;
 	struct venus_core *core;
 	struct clock_data clk_data;
+	struct list_head eosbufs;
 	struct list_head dpbbufs;
 	struct list_head internalbufs;
 	struct list_head registeredbufs;
@@ -520,7 +522,14 @@ struct venus_inst {
 #define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
 #define IS_V3(core)	((core)->res->hfi_version == HFI_VERSION_3XX)
 #define IS_V4(core)	((core)->res->hfi_version == HFI_VERSION_4XX)
-#define IS_V6(core)	((core)->res->hfi_version == HFI_VERSION_6XX)
+static inline bool IS_V6(struct venus_core *core)
+{
Quoted 8 lines

drivers/media/platform/qcom/venus/core.h struct venus_inst { · line 532

Quoted 6 lines
drivers/media/platform/qcom/venus/core.h +6 -0
+	if (WARN_ON_ONCE(!core))
+		return false;
+
+	return core->res->hfi_version == HFI_VERSION_6XX ||
+	       core->res->hfi_version == HFI_VERSION_6XX_LITE;
+}

It should be HFI_VERSION_4XX_LITE for AR50_LITE. 4XX represents SC7280 and SDM845 which are AR50.

ah good information - where is this documented? I never found this information... I'd appreciate if you could confirm with some document for future reference.

Quoted 38 lines
Quoted 38 lines
drivers/media/platform/qcom/venus/core.h +0 -0
 #define IS_AR50(core)		((core)->res->vpu_version == VPU_VERSION_AR50)
 #define IS_AR50_LITE(core)	((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +3 -3
index 66a18830e66d..f8dcef0426ac 100644
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	u32 fw_size = core->fw.mapped_mem_size;
 	void __iomem *wrapper_base;
 
-	if (IS_IRIS2_1(core))
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 		wrapper_base = core->wrapper_tz_base;
 	else
 		wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR);
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR);
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Bring XTSS out of reset */
 		writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET);
 	} else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)
 	if (resume) {
 		venus_reset_cpu(core);
 	} else {
-		if (IS_IRIS2_1(core))
+		if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 			writel(WRAPPER_XTSS_SW_RESET_BIT,
 			       core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
 		else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)
 	void __iomem *wrapper_base = core->wrapper_base;
 	void __iomem *wrapper_tz_base = core->wrapper_tz_base;
 
Quoted 5 lines

drivers/media/platform/qcom/venus/firmware.c static int venus_shutdown_no_tz(struct venus_core *core) · line 186

Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.c +1 -1
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Assert the reset to XTSS */
 		reg = readl(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);

No need to handle no-tz case. Pls drop.

ok

Quoted 69 lines
Quoted 58 lines
drivers/media/platform/qcom/venus/firmware.c +0 -0
 		reg |= WRAPPER_XTSS_SW_RESET_BIT;
drivers/media/platform/qcom/venus/helpers.c +49 -0
index 8295542e1a7c..812bec9a05be 100644
@@ -230,6 +230,79 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
 }
 EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs);
 
+static void free_eos_buf(struct venus_inst *inst, struct intbuf *buf)
+{
+	list_del_init(&buf->list);
+	dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da,
+		       buf->attrs);
+	kfree(buf);
+}
+
+int venus_helper_free_eos_bufs(struct venus_inst *inst)
+{
+	struct intbuf *buf, *n;
+
+	list_for_each_entry_safe(buf, n, &inst->eosbufs, list) {
+		free_eos_buf(inst, buf);
+	}
+
+	if (list_empty(&inst->eosbufs))
+		INIT_LIST_HEAD(&inst->eosbufs);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(venus_helper_free_eos_bufs);
+
+int venus_helper_alloc_eos_buf(struct venus_inst *inst,
+			       struct hfi_frame_data *data)
+{
+	struct venus_core *core = inst->core;
+	struct device *dev = core->dev;
+	struct intbuf *buf;
+	int ret = 0;
+
+	memset(data, 0, sizeof(*data));
+
+	data->buffer_type = HFI_BUFFER_INPUT;
+	data->flags = HFI_BUFFERFLAG_EOS;
+
+	if (IS_AR50_LITE(inst->core)) {
+		/* We must send valid sizes and addresses */
+		buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+		if (!buf) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		buf->type = HFI_BUFFER_INPUT;
+		buf->size = SZ_4K;
+		buf->attrs = DMA_ATTR_NO_KERNEL_MAPPING;
+		buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL,
+					  buf->attrs);

drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 291

Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10 -0
+		if (!buf->va) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		list_add_tail(&buf->list, &inst->eosbufs);
+
+		data->alloc_len = buf->size;
+		data->device_addr = buf->da;
+

why this special handling for eos buffer is needed for AR50_LITE?

Quoted 8 lines
Quoted 3 lines

this _fix_ was develope through testing: without it there is no EOS and errors are reporting upon killing the player

Would be better to see why there is no EOS from firmware, there shouldn't be the need to have a dma allocation for this dummy buffers, as there is no useful info in the buffer. Having the device address as 0 or 0xdeadb000 should be enough.

Quoted 9 lines

hi dikshita,

I am still keeping this on v6 as per our internal discussions and because v6 is quite different from v5 so wanted to provide early access to users.

if the firwmare is fixed to address this issue on time, I might revert the EOS page buffer.

I'd prefer to resolve this via correct EOS handling or gain clarity on why AR50_LITE requires special treatment, instead of proceeding with new patch sets built around this design.

Thanks,
Dikshita

Quoted 2 lines

TIA
jorge

#15 lore raw

Re: [PATCH v5 2/5] media: venus: vdec: AR50_LITE video core support

Quoted 231 lines · Dikshita Agarwal
Quoted 228 lines · Jorge Ramirez
Quoted 212 lines · Dikshita Agarwal
Quoted 209 lines · Jorge Ramirez
Quoted 79 lines · Dikshita Agarwal
Quoted 76 lines · Jorge Ramirez-Ortiz

The AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.

---
 drivers/media/platform/qcom/venus/core.c      | 11 ++-
 drivers/media/platform/qcom/venus/core.h      | 11 ++-
 drivers/media/platform/qcom/venus/firmware.c  |  8 +-
 drivers/media/platform/qcom/venus/helpers.c   | 80 +++++++++++++++++++
 drivers/media/platform/qcom/venus/helpers.h   |  2 +
 .../media/platform/qcom/venus/hfi_helper.h    | 10 ++-
 drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++--
 .../media/platform/qcom/venus/pm_helpers.c    |  1 +
 drivers/media/platform/qcom/venus/vdec.c      | 15 ++--
 9 files changed, 128 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
index d305d74bb152..736ef53d988d 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
 static void venus_assign_register_offsets(struct venus_core *core)
 {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		core->cpu_base = core->base + CPU_BASE_V6;
 		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
 		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
 		core->wrapper_base = core->base + WRAPPER_BASE_V6;
 		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
 	} else {
 		core->vbif_base = core->base + VBIF_BASE;
 		core->cpu_base = core->base + CPU_BASE;
drivers/media/platform/qcom/venus/core.h +4 -1
index b412e0c5515a..e755a28e919b 100644
@@ -382,6 +382,7 @@ enum venus_inst_modes {
  * @lock:	instance lock
  * @core:	a reference to the core struct
  * @clk_data:	clock data per core ID
+ * @eosbufs:	a lit of EOS buffers
  * @dpbbufs:	a list of decoded picture buffers
  * @internalbufs:	a list of internal bufferes
  * @registeredbufs:	a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {
 	struct mutex lock;
 	struct venus_core *core;
 	struct clock_data clk_data;
+	struct list_head eosbufs;
 	struct list_head dpbbufs;
 	struct list_head internalbufs;
 	struct list_head registeredbufs;
@@ -520,7 +522,14 @@ struct venus_inst {
 #define IS_V1(core)	((core)->res->hfi_version == HFI_VERSION_1XX)
 #define IS_V3(core)	((core)->res->hfi_version == HFI_VERSION_3XX)
 #define IS_V4(core)	((core)->res->hfi_version == HFI_VERSION_4XX)
-#define IS_V6(core)	((core)->res->hfi_version == HFI_VERSION_6XX)
+static inline bool IS_V6(struct venus_core *core)
+{
Quoted 8 lines

drivers/media/platform/qcom/venus/core.h struct venus_inst { · line 532

Quoted 6 lines
drivers/media/platform/qcom/venus/core.h +6 -0
+	if (WARN_ON_ONCE(!core))
+		return false;
+
+	return core->res->hfi_version == HFI_VERSION_6XX ||
+	       core->res->hfi_version == HFI_VERSION_6XX_LITE;
+}

It should be HFI_VERSION_4XX_LITE for AR50_LITE. 4XX represents SC7280 and SDM845 which are AR50.

ah good information - where is this documented? I never found this information... I'd appreciate if you could confirm with some document for future reference.

Quoted 38 lines
Quoted 38 lines
drivers/media/platform/qcom/venus/core.h +0 -0
 #define IS_AR50(core)		((core)->res->vpu_version == VPU_VERSION_AR50)
 #define IS_AR50_LITE(core)	((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +3 -3
index 66a18830e66d..f8dcef0426ac 100644
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	u32 fw_size = core->fw.mapped_mem_size;
 	void __iomem *wrapper_base;
 
-	if (IS_IRIS2_1(core))
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 		wrapper_base = core->wrapper_tz_base;
 	else
 		wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR);
 	writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR);
 
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Bring XTSS out of reset */
 		writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET);
 	} else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)
 	if (resume) {
 		venus_reset_cpu(core);
 	} else {
-		if (IS_IRIS2_1(core))
+		if (IS_IRIS2_1(core) || IS_AR50_LITE(core))
 			writel(WRAPPER_XTSS_SW_RESET_BIT,
 			       core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
 		else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)
 	void __iomem *wrapper_base = core->wrapper_base;
 	void __iomem *wrapper_tz_base = core->wrapper_tz_base;
 
Quoted 5 lines

drivers/media/platform/qcom/venus/firmware.c static int venus_shutdown_no_tz(struct venus_core *core) · line 186

Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.c +1 -1
-	if (IS_IRIS2_1(core)) {
+	if (IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		/* Assert the reset to XTSS */
 		reg = readl(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);

No need to handle no-tz case. Pls drop.

ok

Quoted 69 lines
Quoted 58 lines
drivers/media/platform/qcom/venus/firmware.c +0 -0
 		reg |= WRAPPER_XTSS_SW_RESET_BIT;
drivers/media/platform/qcom/venus/helpers.c +49 -0
index 8295542e1a7c..812bec9a05be 100644
@@ -230,6 +230,79 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst)
 }
 EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs);
 
+static void free_eos_buf(struct venus_inst *inst, struct intbuf *buf)
+{
+	list_del_init(&buf->list);
+	dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da,
+		       buf->attrs);
+	kfree(buf);
+}
+
+int venus_helper_free_eos_bufs(struct venus_inst *inst)
+{
+	struct intbuf *buf, *n;
+
+	list_for_each_entry_safe(buf, n, &inst->eosbufs, list) {
+		free_eos_buf(inst, buf);
+	}
+
+	if (list_empty(&inst->eosbufs))
+		INIT_LIST_HEAD(&inst->eosbufs);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(venus_helper_free_eos_bufs);
+
+int venus_helper_alloc_eos_buf(struct venus_inst *inst,
+			       struct hfi_frame_data *data)
+{
+	struct venus_core *core = inst->core;
+	struct device *dev = core->dev;
+	struct intbuf *buf;
+	int ret = 0;
+
+	memset(data, 0, sizeof(*data));
+
+	data->buffer_type = HFI_BUFFER_INPUT;
+	data->flags = HFI_BUFFERFLAG_EOS;
+
+	if (IS_AR50_LITE(inst->core)) {
+		/* We must send valid sizes and addresses */
+		buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+		if (!buf) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		buf->type = HFI_BUFFER_INPUT;
+		buf->size = SZ_4K;
+		buf->attrs = DMA_ATTR_NO_KERNEL_MAPPING;
+		buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL,
+					  buf->attrs);

drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 291

Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10 -0
+		if (!buf->va) {
+			ret = -ENOMEM;
+			goto fail;
+		}
+
+		list_add_tail(&buf->list, &inst->eosbufs);
+
+		data->alloc_len = buf->size;
+		data->device_addr = buf->da;
+

why this special handling for eos buffer is needed for AR50_LITE?

Quoted 8 lines
Quoted 3 lines

this _fix_ was develope through testing: without it there is no EOS and errors are reporting upon killing the player

Would be better to see why there is no EOS from firmware, there shouldn't be the need to have a dma allocation for this dummy buffers, as there is no useful info in the buffer. Having the device address as 0 or 0xdeadb000 should be enough.

hi dikshita,

I am still keeping this on v6 as per our internal discussions and because v6 is quite different from v5 so wanted to provide early access to users.

Quoted 7 lines
Quoted 3 lines

if the firwmare is fixed to address this issue on time, I might revert the EOS page buffer.

I'd prefer to resolve this via correct EOS handling or gain clarity on why AR50_LITE requires special treatment, instead of proceeding with new patch sets built around this design.

Fully agree.

However this patch is the actual proper implementation - it follows the HFI spec - while the current code upstream is not.

We should revert over time the current implementation to avoid hitting issues when the firmware stops checking for things like 0xdeadb000.

#27 lore raw

Re: [PATCH v5 4/5] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Konrad Dybcio
Quoted 32 lines · Konrad Dybcio
Quoted 31 lines · Jorge Ramirez
Quoted 29 lines · Dikshita Agarwal
Quoted 17 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the venus core.

Video encoding support is not exposed until the relevant hardware capabilities are enabled.

---
 drivers/media/platform/qcom/venus/core.c | 39 ++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/media/platform/qcom/venus/core.c +0 -0
index 736ef53d988d..f1f211ca1ce2 100644

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1069

Quoted 8 lines
drivers/media/platform/qcom/venus/core.c +5 -0
@@ -1062,6 +1062,44 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct freq_tbl qcm2290_freq_table[] = {
+	{ 352800, 240000000 },	/* 1920x1088 @ 30 + 1280x720 @ 30 */
+	{ 244800, 133000000 },	/* 1920x1088 @ 30 */
+};
+

fix this corner.

Quoted 7 lines
Quoted 1 line

ok, will wait for Vikash to confirm the other ones.

Actually you can get rid of it now, I think:

https://git.linuxtv.org/media.git/commit/?id=b179234b5e59013f8772da17b273f463f9720bdd

Konrad

yes, thanks!

#8 lore raw

Re: [PATCH v5 1/5] media: dt-bindings: venus: Add qcm2290 dt schema

In reply to Jorge Ramirez
Quoted 5 lines · Jorge Ramirez
Quoted 4 lines · Bryan O'Donoghue
Quoted 3 lines · Jorge Ramirez
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

+ maxItems: 5

2 should be good to support non secure usecases. 5 not needed.

ok

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

isnt it better to just leave 5 here - thinking of the future support for secure buffers - and just update the dts?

It should describe the real capabilities of the hardware, not the expected use-cases.

then five.

Just list all IOMMUs, if we know how to handle them properly.

Quoted 3 lines
Quoted 3 lines

---
bod

Signature · 2 lines
With best wishes
Dmitry