media: venus: Add QCM2290 support with AR50_LITE core
Subsystems (6)
v7 cover media: venus: Add QCM2290 support with AR50_LITE core
Changes since v6:
v6: https://lore.kernel.org/all/[email protected]/
- patch 1/7: Add qcm2290 dt schema
- no change
- patch 2/7: Conditionally register video nodes
- fixed potential NULL dereference on handling firmware errors when the encoder is not present.
- patch 3/7: Add Support for AR50 LITE video core
- applied Dikshita Agarwal review comments: do not handle no-tz case, fix WD mask
- replaced EOS buffers for a work around (firmware should not access the eos buffers) renamed venus_helper_alloc_eos_buf to venus_helper_prepare_eos_data
- patch 4/7: HFI platform V4 capabilities
- removed 10 bit encoder support as per Dikshita Agarwal review
- patch 5/7: Add DT compatible and capabilities
- removed frequency table as per Konrad Dybcio review (driver now uses opp)
- fixed bw_tables for the supported loads (remove 10 bit support)
- patch 6/7: Add Venus video node for 2290
- no change
- patch 7/7: Enable Venus on 2210 RB1 board
- no change
Changes since v5:
Two additional new patches added to the set to support video encoding.
- patch 1/7: Add qcm2290 dt schema
- added reviewed by: Bryan O'Donoghue
- added reviewed by: Krzysztof Kozlowski
- patch 2/7: Conditionally register video nodes
- new functionality required to support AR50_LITE
- patch 3/7: Add Support for AR50 LITE video core
- completely rewritten - lite platforms are extensions of previous HFI_XXX
- patch 4/7: HFI platform V4 capabilities
- use HFI 4XX instead of HFI 6XX as per review
- patch 5/7: Add DT compatible and capabilities
- added reviewed by: Bryan O'Donoghue
- enabled new option min_fw_version
- patch 6/7: Add Venus video node for 2290
- added reviewed by: Konrad Dybcio
- removed status property
- patch 7/7: Enable Venus on 2210 RB1 board
- new
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.
This series functionally depends on the following patch:
clk: qcom: gcc-qcm2290: Set HW_CTRL_TRIGGER for video GDSC
https://lore.kernel.org/all/[email protected]/
Please ensure the above patch is applied before this series.
The QCM2290 integrates an AR50_LITE core, a low-power implementation of Venus supporting H.264, HEVC (H.265), and VP9 decoding as well as H.264 and H.265 encoding.
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.
Limitations:
- The hardware does not support concurrent operation at FullHD.
- Encoding is not supported in firmware version before 6.0.54
Firmware:
- This code has been tested with 6.0.52, 6.0.53, 6.0.54-PRERELEASE
Some basic Tests:
Decoding and Encoding were 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.
Decoding:
[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
Encoding:
[H.264]
gst-launch-1.0 videotestsrc num-buffers=30 \
! video/x-raw,width=1280,height=720,framerate=30/1 \
! v4l2h264enc ! h264parse ! mp4mux ! filesink location=/tmp/output.mp4
[H.265]
gst-launch-1.0 videotestsrc num-buffers=30 \
! video/x-raw,width=1920,height=1080,framerate=30/1 \
! v4l2h265enc ! h265parse ! mp4mux ! filesink location=/tmp/output.mp4
Concurrency:
gst-launch-1.0 -v videotestsrc num-buffers=1000 \
! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 \
! v4l2h264enc capture-io-mode=4 output-io-mode=2 ! h264parse \
! v4l2h264dec capture-io-mode=4 output-io-mode=2 ! 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 (7):
media: dt-bindings: venus: Add qcm2290 dt schema
media: venus: Conditionally register codec nodes based on firmware
version
media: venus: Add support for AR50_LITE video core
media: venus: hfi_plat_v4: Add capabilities for the 4XX lite core
media: venus: core: Add qcm2290 DT compatible and resource data
arm64: dts: qcom: qcm2290: Add Venus video node
arm64: dts: qcom: qrb2210-rb1: Enable Venus
.../bindings/media/qcom,qcm2290-venus.yaml | 127 +++++++++++++ arch/arm64/boot/dts/qcom/qcm2290.dtsi | 55 ++++++ arch/arm64/boot/dts/qcom/qrb2210-rb1.dts | 4 + drivers/media/platform/qcom/venus/core.c | 142 +++++++++++--- drivers/media/platform/qcom/venus/core.h | 13 ++ drivers/media/platform/qcom/venus/firmware.c | 10 + drivers/media/platform/qcom/venus/firmware.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 30 ++- drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_parser.c | 5 +- .../media/platform/qcom/venus/hfi_platform.c | 20 +- .../media/platform/qcom/venus/hfi_platform.h | 25 +-- .../platform/qcom/venus/hfi_platform_v4.c | 173 ++++++++++++++++-- .../platform/qcom/venus/hfi_platform_v6.c | 32 +++- drivers/media/platform/qcom/venus/hfi_venus.c | 25 ++- .../media/platform/qcom/venus/hfi_venus_io.h | 4 + .../media/platform/qcom/venus/pm_helpers.c | 2 +- drivers/media/platform/qcom/venus/vdec.c | 7 +- 18 files changed, 580 insertions(+), 97 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Signature · 1 line
2.34.1
PATCH v7 1/7 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
@@ -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-133333333 { + opp-hz = /bits/ 64 <133333333>; + required-opps = <&rpmpd_opp_low_svs>; + }; + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + };
Signature · 1 line
2.34.1
PATCH v7 2/7 media: venus: Conditionally register codec nodes based on firmware version
In reply to Jorge Ramirez-OrtizThe encoding and decoding capabilities of a VPU can vary depending on the firmware version in use.
This commit adds support for platforms with OF_DYNAMIC enabled to conditionally skip the creation of codec device nodes at runtime if the loaded firmware does not support the corresponding functionality.
Note that the driver becomes aware of the firmware version only after the HFI layer has been initialized.
--- drivers/media/platform/qcom/venus/core.c | 76 +++++++++++++++--------- drivers/media/platform/qcom/venus/core.h | 8 +++ 2 files changed, 57 insertions(+), 27 deletions(-)
drivers/media/platform/qcom/venus/core.c +49 -27
@@ -28,6 +28,15 @@#include "pm_helpers.h" #include "hfi_venus_io.h" +static inline bool venus_fw_supports_codec (struct venus_core *core, +const struct venus_min_fw *ver) +{ +if (!ver) +return true; + +return is_fw_rev_or_newer (core, ver->major, ver->minor, ver->rev); +} +static void venus_coredump (struct venus_core *core) {struct device *dev;
@@ -103,7 +112,9 @@ static void venus_sys_error_handler(struct work_struct *work) core->state =CORE_UNINIT ;for (i =0 ; i < max_attempts; i++) { -if (!pm_runtime_active (core->dev_dec) && !pm_runtime_active (core->dev_enc)) +/* Not both nodes might be available */ +if ((!core->dev_dec || !pm_runtime_active (core->dev_dec)) && + (!core->dev_enc || !pm_runtime_active (core->dev_enc)))break ;msleep (10 ); }
@@ -202,7 +213,8 @@ static u32 to_v4l2_codec_type(u32 codec) } } -static int venus_enumerate_codecs (struct venus_core *core,u32 type) +static int venus_enumerate_codecs (struct venus_core *core,u32 type, +const struct venus_min_fw *ver) {const struct hfi_inst_ops dummy_ops = {};struct venus_inst *inst;
@@ -213,6 +225,9 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)if (core->res->hfi_version !=HFI_VERSION_1XX )return 0 ; +if (!venus_fw_supports_codec (core, ver)) +return 0 ; + inst =kzalloc (sizeof (*inst),GFP_KERNEL );if (!inst)return -ENOMEM ;
@@ -288,14 +303,14 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id)#if defined(CONFIG_OF_DYNAMIC )static int venus_add_video_core (struct venus_core *core,const char *node_name, -const char *compat) +const char *compat,const struct venus_min_fw *ver) {struct of_changeset *ocs = core->ocs;struct device *dev = core->dev;struct device_node *np, *enp;int ret; -if (!node_name) +if (!node_name || !venus_fw_supports_codec (core, ver))return 0 ; enp =of_find_node_by_name (dev->of_node, node_name);
@@ -330,11 +345,13 @@ static int venus_add_dynamic_nodes(struct venus_core *core)of_changeset_init (core->ocs); - ret =venus_add_video_core (core, core->res->dec_nodename,"venus-decoder" ); + ret =venus_add_video_core (core, core->res->dec_nodename,"venus-decoder" , + core->res->dec_minfw);if (ret) goto err; - ret =venus_add_video_core (core, core->res->enc_nodename,"venus-encoder" ); + ret =venus_add_video_core (core, core->res->enc_nodename,"venus-encoder" , + core->res->enc_minfw);if (ret) goto err;
@@ -363,6 +380,9 @@ static void venus_remove_dynamic_nodes(struct venus_core *core)#else static int venus_add_dynamic_nodes (struct venus_core *core) { +WARN_ONCE (core->res->enc_minfw || core->res->dec_minfw, +"Feature not supported" ); +return 0 ; }
@@ -432,7 +452,7 @@ static int venus_probe(struct platform_device *pdev)IRQF_TRIGGER_HIGH |IRQF_ONESHOT , "venus", core);if (ret) - goto err_core_put; + goto err_hfi_destroy;venus_assign_register_offsets (core);
@@ -448,19 +468,9 @@ static int venus_probe(struct platform_device *pdev)if (ret <0 ) goto err_runtime_disable; -if (core->res->dec_nodename || core->res->enc_nodename) { - ret =venus_add_dynamic_nodes (core); -if (ret) - goto err_runtime_disable; - } - - ret =of_platform_populate (dev->of_node,NULL ,NULL , dev); -if (ret) - goto err_remove_dynamic_nodes; - ret =venus_firmware_init (core);if (ret) - goto err_of_depopulate; + goto err_runtime_disable; ret =venus_boot (core);if (ret)
@@ -474,34 +484,46 @@ static int venus_probe(struct platform_device *pdev)if (ret) goto err_venus_shutdown; - ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_DEC ); +if (core->res->dec_nodename || core->res->enc_nodename) { + ret =venus_add_dynamic_nodes (core); +if (ret) + goto err_core_deinit; + } + + ret =of_platform_populate (dev->of_node,NULL ,NULL , dev);if (ret) - goto err_core_deinit; + goto err_remove_dynamic_nodes; + + ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_DEC , + core->res->dec_minfw); +if (ret) + goto err_of_depopulate; - ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_ENC ); + ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_ENC , + core->res->enc_minfw);if (ret) - goto err_core_deinit; + goto err_of_depopulate; ret =pm_runtime_put_sync (dev);if (ret) {pm_runtime_get_noresume (dev); - goto err_core_deinit; + goto err_of_depopulate; }venus_dbgfs_init (core);return 0 ; +err_of_depopulate: +of_platform_depopulate (dev); +err_remove_dynamic_nodes: +venus_remove_dynamic_nodes (core); err_core_deinit:hfi_core_deinit (core, false); err_venus_shutdown:venus_shutdown (core); err_firmware_deinit:venus_firmware_deinit (core); -err_of_depopulate: -of_platform_depopulate (dev); -err_remove_dynamic_nodes: -venus_remove_dynamic_nodes (core); err_runtime_disable:pm_runtime_put_noidle (dev);pm_runtime_disable (dev);
drivers/media/platform/qcom/venus/core.h +8 -0
@@ -50,6 +50,12 @@ struct bw_tbl {u32 peak_10bit; }; +struct venus_min_fw { +u32 major; +u32 minor; +u32 rev; +}; +enum vpu_version {VPU_VERSION_AR50 ,VPU_VERSION_AR50_LITE ,
@@ -92,6 +98,8 @@ struct venus_resources {u32 cp_nonpixel_start;u32 cp_nonpixel_size;const char *fwname; +const struct venus_min_fw *enc_minfw; +const struct venus_min_fw *dec_minfw;const char *enc_nodename;const char *dec_nodename; };
Signature · 1 line
2.34.1
PATCH v7 3/7 media: venus: Add support for AR50_LITE video core
In reply to Jorge Ramirez-OrtizThe AR50_LITE is a simplified 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, and provides encoding support for H.264 and HEVC.
--- drivers/media/platform/qcom/venus/core.c | 15 +++++++-- drivers/media/platform/qcom/venus/core.h | 5 +++ drivers/media/platform/qcom/venus/firmware.c | 10 ++++++ drivers/media/platform/qcom/venus/firmware.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 30 +++++++++++++++-- drivers/media/platform/qcom/venus/helpers.h | 2 ++ .../media/platform/qcom/venus/hfi_parser.c | 5 +-- .../media/platform/qcom/venus/hfi_platform.c | 20 +++++++----- .../media/platform/qcom/venus/hfi_platform.h | 25 ++++++++------- .../platform/qcom/venus/hfi_platform_v4.c | 31 ++++++++++++------ .../platform/qcom/venus/hfi_platform_v6.c | 32 +++++++++++++------ drivers/media/platform/qcom/venus/hfi_venus.c | 25 +++++++++++---- .../media/platform/qcom/venus/hfi_venus_io.h | 4 +++ .../media/platform/qcom/venus/pm_helpers.c | 2 +- drivers/media/platform/qcom/venus/vdec.c | 7 +--- 15 files changed, 154 insertions(+), 60 deletions(-)
drivers/media/platform/qcom/venus/core.c +12 -3
@@ -269,14 +269,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 ;
@@ -476,6 +481,10 @@ static int venus_probe(struct platform_device *pdev)if (ret) goto err_firmware_deinit; + ret =venus_firmware_cfg (core); +if (ret) + goto err_venus_shutdown; + ret =hfi_core_resume (core, true);if (ret) goto err_venus_shutdown;
drivers/media/platform/qcom/venus/core.h +5 -0
@@ -538,6 +538,11 @@ struct venus_inst {#define IS_IRIS2 (core) ((core)->res->vpu_version == VPU_VERSION_IRIS2)#define IS_IRIS2_1 (core) ((core)->res->vpu_version == VPU_VERSION_IRIS2_1) +static inline bool is_lite (struct venus_core *core) +{ +return IS_AR50_LITE (core); +} +#define ctrl_to_inst (ctrl) \ container_of((ctrl)->handler, struct venus_inst, ctrl_handler)
drivers/media/platform/qcom/venus/firmware.c +10 -0
@@ -207,6 +207,16 @@ static int venus_shutdown_no_tz(struct venus_core *core)return 0 ; } +int venus_firmware_cfg (struct venus_core *core) +{ +void __iomem *cpu_cs_base = core->cpu_cs_base; + +if (IS_AR50_LITE (core)) +writel (CPU_CS_VCICMD_ARP_OFF , cpu_cs_base +CPU_CS_VCICMD ); + +return 0 ; +} +int venus_boot (struct venus_core *core) {struct device *dev = core->dev;
drivers/media/platform/qcom/venus/firmware.h +1 -0
@@ -9,6 +9,7 @@ struct device;int venus_firmware_init (struct venus_core *core);void venus_firmware_deinit (struct venus_core *core); +int venus_firmware_cfg (struct venus_core *core);int venus_boot (struct venus_core *core);int venus_shutdown (struct venus_core *core);int venus_set_hw_state (struct venus_core *core,bool suspend);
drivers/media/platform/qcom/venus/helpers.c +27 -3
@@ -230,6 +230,24 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ; + +if (IS_V6 (core) &&is_fw_rev_or_older (core,1 ,0 ,87 )) +return ; + +if (IS_V4 (core) &&is_lite (core) &&is_fw_rev_or_older (core,6 ,0 ,53 )) + data->alloc_len =1 ; + + data->device_addr =0xdeadb000 ; +} +EXPORT_SYMBOL_GPL (venus_helper_prepare_eos_data); +static int intbufs_set_buffer (struct venus_inst *inst,u32 type) {struct venus_core *core = inst->core;
@@ -1715,11 +1733,17 @@ int venus_helper_session_init(struct venus_inst *inst)if (ret)return ret; - inst->clk_data.vpp_freq =hfi_platform_get_codec_vpp_freq (version, codec, + inst->clk_data.vpp_freq =hfi_platform_get_codec_vpp_freq (version, +is_lite (inst->core), + codec, session_type); - inst->clk_data.vsp_freq =hfi_platform_get_codec_vsp_freq (version, codec, + inst->clk_data.vsp_freq =hfi_platform_get_codec_vsp_freq (version, +is_lite (inst->core), + codec, session_type); - inst->clk_data.low_power_freq =hfi_platform_get_codec_lp_freq (version, codec, + inst->clk_data.low_power_freq =hfi_platform_get_codec_lp_freq (version, +is_lite (inst->core), + codec, session_type);return 0 ;
drivers/media/platform/qcom/venus/helpers.h +2 -0
@@ -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); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data);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_parser.c +3 -2
@@ -277,12 +277,13 @@ static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst)if (inst)return 0 ; - ret =hfi_platform_get_codecs (core, &enc_codecs, &dec_codecs, &count); + ret =hfi_platform_get_codecs (core, &enc_codecs, &dec_codecs, &count, +is_lite (core));if (ret)return ret;if (plat->capabilities) - caps = plat->capabilities (&entries); + caps = plat->capabilities (&entries,is_lite (core));if (!caps || !entries || !count)return -EINVAL ;
drivers/media/platform/qcom/venus/hfi_platform.c +12 -8
@@ -21,7 +21,8 @@ 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,u32 session_type) +hfi_platform_get_codec_vpp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;
@@ -31,13 +32,14 @@ hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 sessionreturn 0 ;if (plat->codec_vpp_freq) - freq = plat->codec_vpp_freq (session_type, codec); + freq = plat->codec_vpp_freq (session_type, codec, lite);return freq; }unsigned long -hfi_platform_get_codec_vsp_freq (enum hfi_version version,u32 codec,u32 session_type) +hfi_platform_get_codec_vsp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;
@@ -47,13 +49,14 @@ hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 sessionreturn 0 ;if (plat->codec_vpp_freq) - freq = plat->codec_vsp_freq (session_type, codec); + freq = plat->codec_vsp_freq (session_type, codec, lite);return freq; }unsigned long -hfi_platform_get_codec_lp_freq (enum hfi_version version,u32 codec,u32 session_type) +hfi_platform_get_codec_lp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;
@@ -63,13 +66,14 @@ hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_return 0 ;if (plat->codec_lp_freq) - freq = plat->codec_lp_freq (session_type, codec); + freq = plat->codec_lp_freq (session_type, codec, lite);return freq; }int -hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs,u32 *count) +hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs,u32 *count, +bool lite) {const struct hfi_platform *plat;
@@ -78,7 +82,7 @@ hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecreturn -EINVAL ;if (plat->codecs) - plat->codecs (enc_codecs, dec_codecs, count); + plat->codecs (enc_codecs, dec_codecs, count, lite);if (IS_IRIS2_1 (core)) { *enc_codecs &= ~HFI_VIDEO_CODEC_VP8 ;
drivers/media/platform/qcom/venus/hfi_platform.h +13 -12
@@ -47,11 +47,12 @@ struct hfi_platform_codec_freq_data { };struct hfi_platform { -unsigned long (*codec_vpp_freq)(u32 session_type,u32 codec); -unsigned long (*codec_vsp_freq)(u32 session_type,u32 codec); -unsigned long (*codec_lp_freq)(u32 session_type,u32 codec); -void (*codecs)(u32 *enc_codecs,u32 *dec_codecs,u32 *count); -const struct hfi_plat_caps *(*capabilities)(unsigned int *entries); +unsigned long (*codec_vpp_freq)(u32 session_type,u32 codec,bool lite); +unsigned long (*codec_vsp_freq)(u32 session_type,u32 codec,bool lite); +unsigned long (*codec_lp_freq)(u32 session_type,u32 codec,bool lite); +void (*codecs)(u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite); +const struct hfi_plat_caps *(*capabilities)(unsigned int *entries, +bool lite);int (*bufreq)(struct hfi_plat_buffers_params *params,u32 session_type,u32 buftype,struct hfi_buffer_requirements *bufreq); };
@@ -60,12 +61,12 @@ extern const struct hfi_platform hfi_plat_v4;extern const struct hfi_platform hfi_plat_v6;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, -u32 session_type); -unsigned long hfi_platform_get_codec_vsp_freq (enum hfi_version version,u32 codec, -u32 session_type); -unsigned long hfi_platform_get_codec_lp_freq (enum hfi_version version,u32 codec, -u32 session_type); +unsigned long hfi_platform_get_codec_vpp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type); +unsigned long hfi_platform_get_codec_vsp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type); +unsigned long hfi_platform_get_codec_lp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type);int hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs, -u32 *count); +u32 *count,bool lite);#endif
drivers/media/platform/qcom/venus/hfi_platform_v4.c +22 -9
@@ -245,14 +245,19 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } }; -static const struct hfi_plat_caps *get_capabilities (unsigned int *entries) +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries, +bool lite) { +WARN_ON (lite); + *entries =ARRAY_SIZE (caps);return caps; } -static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count) +static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite) { +WARN_ON (lite); + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC |HFI_VIDEO_CODEC_VP8 ; *dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
@@ -273,12 +278,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { };static const struct hfi_platform_codec_freq_data * -get_codec_freq_data (u32 session_type,u32 pixfmt) +get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) {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 ; +WARN_ON (lite); +for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];
@@ -289,33 +296,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)return found; } -static unsigned long codec_vpp_freq (u32 session_type,u32 codec) +static unsigned long codec_vpp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;return 0 ; } -static unsigned long codec_vsp_freq (u32 session_type,u32 codec) +static unsigned long codec_vsp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;return 0 ; } -static unsigned long codec_lp_freq (u32 session_type,u32 codec) +static unsigned long codec_lp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;
drivers/media/platform/qcom/venus/hfi_platform_v6.c +23 -9
@@ -245,14 +245,20 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } }; -static const struct hfi_plat_caps *get_capabilities (unsigned int *entries) +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries, +bool lite) { +WARN_ON (lite); + *entries =ARRAY_SIZE (caps);return caps; } -static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count) +static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count, +bool lite) { +WARN_ON (lite); + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC |HFI_VIDEO_CODEC_VP8 ; *dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
@@ -273,12 +279,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { };static const struct hfi_platform_codec_freq_data * -get_codec_freq_data (u32 session_type,u32 pixfmt) +get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) {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 ; +WARN_ON (lite); +for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];
@@ -289,33 +297,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)return found; } -static unsigned long codec_vpp_freq (u32 session_type,u32 codec) +static unsigned long codec_vpp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;return 0 ; } -static unsigned long codec_vsp_freq (u32 session_type,u32 codec) +static unsigned long codec_vsp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;return 0 ; } -static unsigned long codec_lp_freq (u32 session_type,u32 codec) +static unsigned long codec_lp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;
drivers/media/platform/qcom/venus/hfi_venus.c +18 -7
@@ -380,7 +380,7 @@ static void venus_soft_int(struct venus_hfi_device *hdev)void __iomem *cpu_ic_base = hdev->core->cpu_ic_base;u32 clear_bit; -if (IS_V6 (hdev->core)) +if (IS_V6 (hdev->core) || (IS_V4 (hdev->core) &&is_lite (hdev->core))) clear_bit =BIT (CPU_IC_SOFTINT_H2A_SHIFT_V6 );else clear_bit =BIT (CPU_IC_SOFTINT_H2A_SHIFT );
@@ -501,9 +501,11 @@ 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 ); + +if (!IS_AR50_LITE (hdev->core)) +writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }return ret;
@@ -569,6 +571,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 );
@@ -1138,7 +1143,13 @@ 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_AR50_LITE (core)) { +if (status &WRAPPER_INTR_STATUS_A2H_MASK || + status &WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE || + status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK ) + hdev->irq_status = status; + }else if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )
@@ -1150,7 +1161,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 ;
@@ -1535,7 +1546,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 );
@@ -1555,7 +1566,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/hfi_venus_io.h +4 -0
@@ -51,6 +51,9 @@/* Venus cpu */ #define CPU_CS_SCIACMDARG3 0x58 +#define CPU_CS_VCICMD 0x20 +#define CPU_CS_VCICMD_ARP_OFF BIT(0) +#define SFR_ADDR 0x5c#define MMAP_ADDR 0x60#define UC_REGION_ADDR 0x64
@@ -100,6 +103,7 @@#define WRAPPER_INTR_MASK_A2HCPU_MASK 0x4#define WRAPPER_INTR_MASK_A2HCPU_SHIFT 0x2 +#define WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE 0x10#define WRAPPER_INTR_STATUS_A2HWD_MASK_V6 0x8#define WRAPPER_INTR_MASK_A2HWD_BASK_V6 0x8
drivers/media/platform/qcom/venus/pm_helpers.c +1 -1
@@ -51,7 +51,7 @@ static int core_clks_enable(struct venus_core *core)dev_pm_opp_put (opp);for (i =0 ; i < res->clks_num; i++) { -if (IS_V6 (core)) { +if (IS_V6 (core) || (IS_V4 (core) &&is_lite (core))) { ret =clk_set_rate (core->clks[i], freq);if (ret) goto err;
drivers/media/platform/qcom/venus/vdec.c +1 -6
@@ -565,12 +565,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)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 ; +venus_helper_prepare_eos_data (inst, &fdata); ret =hfi_session_process_buf (inst, &fdata);
Signature · 1 line
2.34.1
PATCH v7 4/7 media: venus: hfi_plat_v4: Add capabilities for the 4XX lite core
In reply to Jorge Ramirez-OrtizPopulate the HFI v4 lite capability set used by the AR50_LITE video core.
These capabilities define the supported codec formats and operational limits specific to this streamlined VPU variant.
--- .../platform/qcom/venus/hfi_platform_v4.c | 164 +++++++++++++++--- 1 file changed, 143 insertions(+), 21 deletions(-)
drivers/media/platform/qcom/venus/hfi_platform_v4.c +143 -21
@@ -245,25 +245,145 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } }; +static const struct hfi_plat_caps caps_lite[] = { +{ + .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 ,1920 ,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_5 }, + .pl[1 ] = {HFI_H264_PROFILE_MAIN ,HFI_H264_LEVEL_5 }, + .pl[2 ] = {HFI_H264_PROFILE_HIGH ,HFI_H264_LEVEL_5 }, + .pl[3 ] = {HFI_H264_PROFILE_CONSTRAINED_BASE ,HFI_H264_LEVEL_5 }, + .pl[4 ] = {HFI_H264_PROFILE_CONSTRAINED_HIGH ,HFI_H264_LEVEL_5 }, + .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 ,1920 ,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_HIGH0 <<28 }, + .pl[1 ] = {HFI_HEVC_PROFILE_MAIN10 ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 <<28 }, + .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 ,1920 ,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 , +}, { + .codec =HFI_VIDEO_CODEC_H264 , + .domain =VIDC_SESSION_TYPE_ENC , + .caps[0 ] = {HFI_CAPABILITY_FRAME_WIDTH ,128 ,1920 ,1 }, + .caps[1 ] = {HFI_CAPABILITY_FRAME_HEIGHT ,128 ,1920 ,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 }, + .caps[7 ] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS ,0 ,6 ,1 }, + .caps[8 ] = {HFI_CAPABILITY_ENC_LTR_COUNT ,0 ,4 ,1 }, + .caps[9 ] = {HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE ,0 ,244800 ,1 }, + .caps[10 ] = {HFI_CAPABILITY_I_FRAME_QP ,0 ,51 ,1 }, + .caps[11 ] = {HFI_CAPABILITY_P_FRAME_QP ,0 ,51 ,1 }, + .caps[12 ] = {HFI_CAPABILITY_B_FRAME_QP ,0 ,51 ,1 }, + .caps[13 ] = {HFI_CAPABILITY_SLICE_BYTE ,1 ,10 ,1 }, + .caps[14 ] = {HFI_CAPABILITY_SLICE_MB ,1 ,10 ,1 }, + .num_caps =15 , + .pl[0 ] = {HFI_H264_PROFILE_BASELINE ,HFI_H264_LEVEL_5 }, + .pl[1 ] = {HFI_H264_PROFILE_MAIN ,HFI_H264_LEVEL_5 }, + .pl[2 ] = {HFI_H264_PROFILE_HIGH ,HFI_H264_LEVEL_5 }, + .pl[3 ] = {HFI_H264_PROFILE_CONSTRAINED_BASE ,HFI_H264_LEVEL_5 }, + .pl[4 ] = {HFI_H264_PROFILE_CONSTRAINED_HIGH ,HFI_H264_LEVEL_5 }, + .num_pl =5 , + .fmts[0 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12 }, + .fmts[1 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12_UBWC }, + .num_fmts =2 , +}, { + .codec =HFI_VIDEO_CODEC_HEVC , + .domain =VIDC_SESSION_TYPE_ENC , + .caps[0 ] = {HFI_CAPABILITY_FRAME_WIDTH ,128 ,1920 ,1 }, + .caps[1 ] = {HFI_CAPABILITY_FRAME_HEIGHT ,128 ,1920 ,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 }, + .caps[7 ] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS ,0 ,6 ,1 }, + .caps[8 ] = {HFI_CAPABILITY_ENC_LTR_COUNT ,0 ,4 ,1 }, + .caps[9 ] = {HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE ,0 ,244800 ,1 }, + .caps[10 ] = {HFI_CAPABILITY_I_FRAME_QP ,0 ,51 ,1 }, + .caps[11 ] = {HFI_CAPABILITY_P_FRAME_QP ,0 ,51 ,1 }, + .caps[12 ] = {HFI_CAPABILITY_B_FRAME_QP ,0 ,51 ,1 }, + .caps[13 ] = {HFI_CAPABILITY_SLICE_BYTE ,1 ,10 ,1 }, + .caps[14 ] = {HFI_CAPABILITY_SLICE_MB ,1 ,10 ,1 }, + .num_caps =15 , + .pl[0 ] = {HFI_HEVC_PROFILE_MAIN ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 }, + .pl[1 ] = {HFI_HEVC_PROFILE_MAIN10 ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 }, + .num_pl =2 , + .fmts[0 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12 }, + .fmts[1 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12_UBWC }, + .num_fmts =2 , +} }; +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries,bool lite) { -WARN_ON (lite); + *entries = lite ?ARRAY_SIZE (caps_lite) :ARRAY_SIZE (caps); - *entries =ARRAY_SIZE (caps); -return caps; +return lite ? caps_lite : caps; }static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite) { -WARN_ON (lite); - - *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | -HFI_VIDEO_CODEC_VP8 ; - *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | -HFI_VIDEO_CODEC_VP8 |HFI_VIDEO_CODEC_VP9 | -HFI_VIDEO_CODEC_MPEG2 ; - *count =8 ; +if (lite) { + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC ; + *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP9 ; + *count =5 ; + }else { + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP8 ; + *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP8 |HFI_VIDEO_CODEC_VP9 | +HFI_VIDEO_CODEC_MPEG2 ; + *count =8 ; + } }static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
@@ -277,15 +397,23 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { { V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10, 200 }, }; +static const struct hfi_platform_codec_freq_data codec_freq_data_lite[] = { + {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 }, + {V4L2_PIX_FMT_H264 ,VIDC_SESSION_TYPE_ENC ,675 ,0 ,675 }, + {V4L2_PIX_FMT_HEVC ,VIDC_SESSION_TYPE_ENC ,675 ,0 ,675 }, +}; +static const struct hfi_platform_codec_freq_data *get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) { -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 *data = lite ? + codec_freq_data_lite : codec_freq_data; +unsigned int i, data_size = lite ?ARRAY_SIZE (codec_freq_data_lite) : +ARRAY_SIZE (codec_freq_data);const struct hfi_platform_codec_freq_data *found =NULL ; -WARN_ON (lite); -for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];
@@ -300,8 +428,6 @@ static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;
@@ -313,8 +439,6 @@ static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;
@@ -326,8 +450,6 @@ static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;
Signature · 1 line
2.34.1
PATCH v7 5/7 media: venus: core: Add qcm2290 DT compatible and resource data
In reply to Jorge Ramirez-OrtizAdd a qcm2290 compatible binding to the Cenus core.
The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).
The encoder is not available to firmware versions below 6.0.54 due to an internal requirement for secure buffers.
The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.
--- drivers/media/platform/qcom/venus/core.c | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/media/platform/qcom/venus/core.c +51 -0
@@ -1088,6 +1088,56 @@ static const struct venus_resources sc7280_res = { .enc_nodename = "video-encoder", }; +static const struct bw_tbl qcm2290_bw_table_dec[] = { + {352800 ,597000 ,0 ,746000 ,0 },/* 1080p@30 + 720p@30 */ + {244800 ,413000 ,0 ,516000 ,0 },/* 1080p@30 */ + {216000 ,364000 ,0 ,454000 ,0 },/* 720p@60 */ + {108000 ,182000 ,0 ,227000 ,0 },/* 720p@30 */ +}; + +static const struct bw_tbl qcm2290_bw_table_enc[] = { + {352800 ,396000 ,0 ,0 ,0 },/* 1080p@30 + 720p@30 */ + {244800 ,275000 ,0 ,0 ,0 },/* 1080p@30 */ + {216000 ,242000 ,0 ,0 ,0 },/* 720p@60 */ + {108000 ,121000 ,0 ,0 ,0 },/* 720p@30 */ +}; + +static const struct venus_min_fw min_fw_encode = { + .major =6 , .minor =0 , .rev =54 /* encode min fw version */ +}; + +static const struct venus_resources qcm2290_res = { + .bw_tbl_dec = qcm2290_bw_table_dec, + .bw_tbl_dec_size =ARRAY_SIZE (qcm2290_bw_table_dec), + .bw_tbl_enc = qcm2290_bw_table_enc, + .bw_tbl_enc_size =ARRAY_SIZE (qcm2290_bw_table_enc), + .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_4XX , + .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" , + .dec_minfw =NULL , + .enc_nodename ="video-encoder" , + .enc_minfw = &min_fw_encode, +}; +static const struct of_device_id venus_dt_match[] = { { .compatible ="qcom,msm8916-venus" , .data = &msm8916_res, }, { .compatible ="qcom,msm8996-venus" , .data = &msm8996_res, },
@@ -1098,6 +1148,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
PATCH v7 6/7 arm64: dts: qcom: qcm2290: Add Venus video node
In reply to Jorge Ramirez-OrtizAdd DT entries for the qcm2290 Venus encoder/decoder.
--- arch/arm64/boot/dts/qcom/qcm2290.dtsi | 55 +++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +55 -0
@@ -1628,6 +1628,61 @@ 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"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-133333333 { + opp-hz = /bits/ 64 <133333333>; + 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
PATCH v7 7/7 arm64: dts: qcom: qrb2210-rb1: Enable Venus
In reply to Jorge Ramirez-OrtizEnable Venus on the QRB2210 RB1 development board.
--- arch/arm64/boot/dts/qcom/qrb2210-rb1.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts +4 -0
@@ -711,3 +711,7 @@ &wifi { &xo_board { clock-frequency = <38400000>; }; + +&venus { + status = "okay"; +};
Signature · 1 line
2.34.1
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
In reply to Jorge Ramirez-OrtizQuoted 16 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +0
-0
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0@@ -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]>
Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 26 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +26
-0+ +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
I'm confused to see this is still here
https://lore.kernel.org/linux-media/zk5cmielm4urfm22yszmjmwvi4mqvdsfthlonq6mij7rkijcsp@7evb3ejxuaj7/
I think Dima is right, what's the problem with declaring maxItems: 5 here ?
Quoted 16 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +16
-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
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 73
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+ +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>
Alphabetise includes for preference.
Quoted 23 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +23
-0+ + 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>;
You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
Quoted 11 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +11
-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"; + + 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-133333333 { + opp-hz = /bits/ 64 <133333333>; + required-opps = <&rpmpd_opp_low_svs>; + }; + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + };
---
bod
Re: [PATCH v7 2/7] media: venus: Conditionally register codec nodes based on firmware version
In reply to Jorge Ramirez-OrtizQuoted 37 lines · Jorge Ramirez-Ortiz
The encoding and decoding capabilities of a VPU can vary depending on the firmware version in use.
This commit adds support for platforms with
OF_DYNAMICenabled to conditionally skip the creation of codec device nodes at runtime if the loaded firmware does not support the corresponding functionality.Note that the driver becomes aware of the firmware version only after the HFI layer has been initialized.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 76 +++++++++++++++--------- drivers/media/platform/qcom/venus/core.h | 8 +++ 2 files changed, 57 insertions(+), 27 deletions(-)drivers/media/platform/qcom/venus/core.c +9
-0@@ -28,6 +28,15 @@#include "pm_helpers.h" #include "hfi_venus_io.h" +static inline bool venus_fw_supports_codec (struct venus_core *core, +const struct venus_min_fw *ver) +{ +if (!ver) +return true; + +return is_fw_rev_or_newer (core, ver->major, ver->minor, ver->rev); +} +static void venus_coredump (struct venus_core *core) {struct device *dev;
drivers/media/platform/qcom/venus/core.c static void venus_sys_error_handler(struct work_struct *work) · line 115
Quoted 5 lines
drivers/media/platform/qcom/venus/core.c +1
-1@@ -103,7 +112,9 @@ static void venus_sys_error_handler(struct work_struct *work) core->state =CORE_UNINIT ;for (i =0 ; i < max_attempts; i++) { -if (!pm_runtime_active (core->dev_dec) && !pm_runtime_active (core->dev_enc)) +/* Not both nodes might be available */
"Neither node available" the latter for preference.
drivers/media/platform/qcom/venus/core.c static void venus_sys_error_handler(struct work_struct *work) · line 117
Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2
-0+if ((!core->dev_dec || !pm_runtime_active (core->dev_dec)) && + (!core->dev_enc || !pm_runtime_active (core->dev_enc)))
Is this change about registration or is it a fix trying to sneak in under the radar ?
Quoted 14 lines
drivers/media/platform/qcom/venus/core.c +2
-1break ;msleep (10 ); }@@ -202,7 +213,8 @@ static u32 to_v4l2_codec_type(u32 codec) } } -static int venus_enumerate_codecs (struct venus_core *core,u32 type) +static int venus_enumerate_codecs (struct venus_core *core,u32 type, +const struct venus_min_fw *ver) {const struct hfi_inst_ops dummy_ops = {};struct venus_inst *inst;
drivers/media/platform/qcom/venus/core.c static int venus_enumerate_codecs(struct venus_core *core, u32 type) · line 229
Quoted 5 lines
drivers/media/platform/qcom/venus/core.c +2
-0@@ -213,6 +225,9 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)if (core->res->hfi_version !=HFI_VERSION_1XX )return 0 ; +if (!venus_fw_supports_codec (core, ver)) +return 0 ;
Its not really a codec you're checking there, its a version.
The name should reflect that.
Quoted 138 lines
drivers/media/platform/qcom/venus/core.c +33
-25+ inst =kzalloc (sizeof (*inst),GFP_KERNEL );if (!inst)return -ENOMEM ;@@ -288,14 +303,14 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id)#if defined(CONFIG_OF_DYNAMIC )static int venus_add_video_core (struct venus_core *core,const char *node_name, -const char *compat) +const char *compat,const struct venus_min_fw *ver) {struct of_changeset *ocs = core->ocs;struct device *dev = core->dev;struct device_node *np, *enp;int ret; -if (!node_name) +if (!node_name || !venus_fw_supports_codec (core, ver))return 0 ; enp =of_find_node_by_name (dev->of_node, node_name);@@ -330,11 +345,13 @@ static int venus_add_dynamic_nodes(struct venus_core *core)of_changeset_init (core->ocs); - ret =venus_add_video_core (core, core->res->dec_nodename,"venus-decoder" ); + ret =venus_add_video_core (core, core->res->dec_nodename,"venus-decoder" , + core->res->dec_minfw);if (ret) goto err; - ret =venus_add_video_core (core, core->res->enc_nodename,"venus-encoder" ); + ret =venus_add_video_core (core, core->res->enc_nodename,"venus-encoder" , + core->res->enc_minfw);if (ret) goto err;@@ -363,6 +380,9 @@ static void venus_remove_dynamic_nodes(struct venus_core *core)#else static int venus_add_dynamic_nodes (struct venus_core *core) { +WARN_ONCE (core->res->enc_minfw || core->res->dec_minfw, +"Feature not supported" ); +return 0 ; }@@ -432,7 +452,7 @@ static int venus_probe(struct platform_device *pdev)IRQF_TRIGGER_HIGH |IRQF_ONESHOT , "venus", core);if (ret) - goto err_core_put; + goto err_hfi_destroy;venus_assign_register_offsets (core);@@ -448,19 +468,9 @@ static int venus_probe(struct platform_device *pdev)if (ret <0 ) goto err_runtime_disable; -if (core->res->dec_nodename || core->res->enc_nodename) { - ret =venus_add_dynamic_nodes (core); -if (ret) - goto err_runtime_disable; - } - - ret =of_platform_populate (dev->of_node,NULL ,NULL , dev); -if (ret) - goto err_remove_dynamic_nodes; - ret =venus_firmware_init (core);if (ret) - goto err_of_depopulate; + goto err_runtime_disable; ret =venus_boot (core);if (ret)@@ -474,34 +484,46 @@ static int venus_probe(struct platform_device *pdev)if (ret) goto err_venus_shutdown; - ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_DEC ); +if (core->res->dec_nodename || core->res->enc_nodename) { + ret =venus_add_dynamic_nodes (core); +if (ret) + goto err_core_deinit; + } + + ret =of_platform_populate (dev->of_node,NULL ,NULL , dev);if (ret) - goto err_core_deinit; + goto err_remove_dynamic_nodes; + + ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_DEC , + core->res->dec_minfw); +if (ret) + goto err_of_depopulate; - ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_ENC ); + ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_ENC , + core->res->enc_minfw);if (ret) - goto err_core_deinit; + goto err_of_depopulate; ret =pm_runtime_put_sync (dev);if (ret) {pm_runtime_get_noresume (dev); - goto err_core_deinit; + goto err_of_depopulate; }venus_dbgfs_init (core);return 0 ; +err_of_depopulate: +of_platform_depopulate (dev); +err_remove_dynamic_nodes: +venus_remove_dynamic_nodes (core); err_core_deinit:hfi_core_deinit (core, false); err_venus_shutdown:venus_shutdown (core); err_firmware_deinit:venus_firmware_deinit (core); -err_of_depopulate: -of_platform_depopulate (dev); -err_remove_dynamic_nodes: -venus_remove_dynamic_nodes (core); err_runtime_disable:pm_runtime_put_noidle (dev);pm_runtime_disable (dev);drivers/media/platform/qcom/venus/core.h +0
-0
drivers/media/platform/qcom/venus/core.h struct bw_tbl { · line 57
Quoted 8 lines
drivers/media/platform/qcom/venus/core.h +5
-0@@ -50,6 +50,12 @@ struct bw_tbl {u32 peak_10bit; }; +struct venus_min_fw { +u32 major; +u32 minor; +u32 rev; +};
I'd call this venus_firmware_version
drivers/media/platform/qcom/venus/core.h struct venus_resources { · line 102
Quoted 10 lines
drivers/media/platform/qcom/venus/core.h +3
-0+enum vpu_version {VPU_VERSION_AR50 ,VPU_VERSION_AR50_LITE ,@@ -92,6 +98,8 @@ struct venus_resources {u32 cp_nonpixel_start;u32 cp_nonpixel_size;const char *fwname; +const struct venus_min_fw *enc_minfw; +const struct venus_min_fw *dec_minfw;
and then I'd do as you have done here, indicate that the struct venus_firmware_version is a *enc_min_fw_ver;
Quoted 3 lines
drivers/media/platform/qcom/venus/core.h +0
-0const char *enc_nodename;const char *dec_nodename; };
Re: [PATCH v7 3/7] media: venus: Add support for AR50_LITE video core
In reply to Jorge Ramirez-OrtizQuoted 127 lines · Jorge Ramirez-Ortiz
The
AR50_LITEis a simplified 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, and provides encoding support for H.264 and HEVC.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 15 +++++++-- drivers/media/platform/qcom/venus/core.h | 5 +++ drivers/media/platform/qcom/venus/firmware.c | 10 ++++++ drivers/media/platform/qcom/venus/firmware.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 30 +++++++++++++++-- drivers/media/platform/qcom/venus/helpers.h | 2 ++ .../media/platform/qcom/venus/hfi_parser.c | 5 +-- .../media/platform/qcom/venus/hfi_platform.c | 20 +++++++----- .../media/platform/qcom/venus/hfi_platform.h | 25 ++++++++------- .../platform/qcom/venus/hfi_platform_v4.c | 31 ++++++++++++------ .../platform/qcom/venus/hfi_platform_v6.c | 32 +++++++++++++------ drivers/media/platform/qcom/venus/hfi_venus.c | 25 +++++++++++---- .../media/platform/qcom/venus/hfi_venus_io.h | 4 +++ .../media/platform/qcom/venus/pm_helpers.c | 2 +- drivers/media/platform/qcom/venus/vdec.c | 7 +--- 15 files changed, 154 insertions(+), 60 deletions(-)drivers/media/platform/qcom/venus/core.c +12
-3@@ -269,14 +269,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 ;@@ -476,6 +481,10 @@ static int venus_probe(struct platform_device *pdev)if (ret) goto err_firmware_deinit; + ret =venus_firmware_cfg (core); +if (ret) + goto err_venus_shutdown; + ret =hfi_core_resume (core, true);if (ret) goto err_venus_shutdown;drivers/media/platform/qcom/venus/core.h +5
-0@@ -538,6 +538,11 @@ struct venus_inst {#define IS_IRIS2 (core) ((core)->res->vpu_version == VPU_VERSION_IRIS2)#define IS_IRIS2_1 (core) ((core)->res->vpu_version == VPU_VERSION_IRIS2_1) +static inline bool is_lite (struct venus_core *core) +{ +return IS_AR50_LITE (core); +} +#define ctrl_to_inst (ctrl) \ container_of((ctrl)->handler, struct venus_inst, ctrl_handler)drivers/media/platform/qcom/venus/firmware.c +10
-0@@ -207,6 +207,16 @@ static int venus_shutdown_no_tz(struct venus_core *core)return 0 ; } +int venus_firmware_cfg (struct venus_core *core) +{ +void __iomem *cpu_cs_base = core->cpu_cs_base; + +if (IS_AR50_LITE (core)) +writel (CPU_CS_VCICMD_ARP_OFF , cpu_cs_base +CPU_CS_VCICMD ); + +return 0 ; +} +int venus_boot (struct venus_core *core) {struct device *dev = core->dev;drivers/media/platform/qcom/venus/firmware.h +1
-0@@ -9,6 +9,7 @@ struct device;int venus_firmware_init (struct venus_core *core);void venus_firmware_deinit (struct venus_core *core); +int venus_firmware_cfg (struct venus_core *core);int venus_boot (struct venus_core *core);int venus_shutdown (struct venus_core *core);int venus_set_hw_state (struct venus_core *core,bool suspend);drivers/media/platform/qcom/venus/helpers.c +7
-0@@ -230,6 +230,24 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ;
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 249
Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10
-0+ +if (IS_V6 (core) &&is_fw_rev_or_older (core,1 ,0 ,87 )) +return ; + +if (IS_V4 (core) &&is_lite (core) &&is_fw_rev_or_older (core,6 ,0 ,53 )) + data->alloc_len =1 ; + + data->device_addr =0xdeadb000 ; +} +EXPORT_SYMBOL_GPL (venus_helper_prepare_eos_data);
This function doesn't appear to have alot to do with AR50_LITE as it pertains to IS_V6() and IS_V4().
This I think should be a separate patch with its own commit log to describe the quite complex logic of version numbers going on here.
drivers/media/platform/qcom/venus/helpers.c int venus_helper_session_init(struct venus_inst *inst) · line 1737
Quoted 11 lines
drivers/media/platform/qcom/venus/helpers.c +3
-1+static int intbufs_set_buffer (struct venus_inst *inst,u32 type) {struct venus_core *core = inst->core;@@ -1715,11 +1733,17 @@ int venus_helper_session_init(struct venus_inst *inst)if (ret)return ret; - inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version, codec, + inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version, + is_lite(inst->core),
I'm not trying to awkward questions but is there another 'lite' that this is_lite() logic is supposed to capture if not then why not IS_AR50_LITE()
This differentation should be explained in commit log or inline /* comment */
Quoted 168 lines
drivers/media/platform/qcom/venus/helpers.c +7
-2+ codec, session_type); - inst->clk_data.vsp_freq =hfi_platform_get_codec_vsp_freq (version, codec, + inst->clk_data.vsp_freq =hfi_platform_get_codec_vsp_freq (version, +is_lite (inst->core), + codec, session_type); - inst->clk_data.low_power_freq =hfi_platform_get_codec_lp_freq (version, codec, + inst->clk_data.low_power_freq =hfi_platform_get_codec_lp_freq (version, +is_lite (inst->core), + codec, session_type);return 0 ;drivers/media/platform/qcom/venus/helpers.h +2
-0@@ -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); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data);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_parser.c +3
-2@@ -277,12 +277,13 @@ static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst)if (inst)return 0 ; - ret =hfi_platform_get_codecs (core, &enc_codecs, &dec_codecs, &count); + ret =hfi_platform_get_codecs (core, &enc_codecs, &dec_codecs, &count, +is_lite (core));if (ret)return ret;if (plat->capabilities) - caps = plat->capabilities (&entries); + caps = plat->capabilities (&entries,is_lite (core));if (!caps || !entries || !count)return -EINVAL ;drivers/media/platform/qcom/venus/hfi_platform.c +12
-8@@ -21,7 +21,8 @@ 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,u32 session_type) +hfi_platform_get_codec_vpp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;@@ -31,13 +32,14 @@ hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 sessionreturn 0 ;if (plat->codec_vpp_freq) - freq = plat->codec_vpp_freq (session_type, codec); + freq = plat->codec_vpp_freq (session_type, codec, lite);return freq; }unsigned long -hfi_platform_get_codec_vsp_freq (enum hfi_version version,u32 codec,u32 session_type) +hfi_platform_get_codec_vsp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;@@ -47,13 +49,14 @@ hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 sessionreturn 0 ;if (plat->codec_vpp_freq) - freq = plat->codec_vsp_freq (session_type, codec); + freq = plat->codec_vsp_freq (session_type, codec, lite);return freq; }unsigned long -hfi_platform_get_codec_lp_freq (enum hfi_version version,u32 codec,u32 session_type) +hfi_platform_get_codec_lp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;@@ -63,13 +66,14 @@ hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_return 0 ;if (plat->codec_lp_freq) - freq = plat->codec_lp_freq (session_type, codec); + freq = plat->codec_lp_freq (session_type, codec, lite);return freq; }int -hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs,u32 *count) +hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs,u32 *count, +bool lite) {const struct hfi_platform *plat;@@ -78,7 +82,7 @@ hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecreturn -EINVAL ;if (plat->codecs) - plat->codecs (enc_codecs, dec_codecs, count); + plat->codecs (enc_codecs, dec_codecs, count, lite);if (IS_IRIS2_1 (core)) { *enc_codecs &= ~HFI_VIDEO_CODEC_VP8 ;drivers/media/platform/qcom/venus/hfi_platform.h +13
-12@@ -47,11 +47,12 @@ struct hfi_platform_codec_freq_data { };struct hfi_platform { -unsigned long (*codec_vpp_freq)(u32 session_type,u32 codec); -unsigned long (*codec_vsp_freq)(u32 session_type,u32 codec); -unsigned long (*codec_lp_freq)(u32 session_type,u32 codec); -void (*codecs)(u32 *enc_codecs,u32 *dec_codecs,u32 *count); -const struct hfi_plat_caps *(*capabilities)(unsigned int *entries); +unsigned long (*codec_vpp_freq)(u32 session_type,u32 codec,bool lite); +unsigned long (*codec_vsp_freq)(u32 session_type,u32 codec,bool lite); +unsigned long (*codec_lp_freq)(u32 session_type,u32 codec,bool lite); +void (*codecs)(u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite); +const struct hfi_plat_caps *(*capabilities)(unsigned int *entries, +bool lite);int (*bufreq)(struct hfi_plat_buffers_params *params,u32 session_type,u32 buftype,struct hfi_buffer_requirements *bufreq); };@@ -60,12 +61,12 @@ extern const struct hfi_platform hfi_plat_v4;extern const struct hfi_platform hfi_plat_v6;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, -u32 session_type); -unsigned long hfi_platform_get_codec_vsp_freq (enum hfi_version version,u32 codec, -u32 session_type); -unsigned long hfi_platform_get_codec_lp_freq (enum hfi_version version,u32 codec, -u32 session_type); +unsigned long hfi_platform_get_codec_vpp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type); +unsigned long hfi_platform_get_codec_vsp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type); +unsigned long hfi_platform_get_codec_lp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type);int hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs, -u32 *count); +u32 *count,bool lite);#endif drivers/media/platform/qcom/venus/hfi_platform_v4.c +0
-0
drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_plat_caps caps[] = { · line 252
Quoted 9 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +4
-1@@ -245,14 +245,19 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } }; -static const struct hfi_plat_caps *get_capabilities (unsigned int *entries) +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries, +bool lite) { +WARN_ON (lite); +
Why add a parameter that triggers a warning ?
Just disjunct away from calling this function with the bool you are passing ?!?
Quoted 16 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +3
-1*entries =ARRAY_SIZE (caps);return caps; } -static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count) +static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite) { +WARN_ON (lite); + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC |HFI_VIDEO_CODEC_VP8 ;
*dec_codecs=HFI_VIDEO_CODEC_H264|HFI_VIDEO_CODEC_HEVC|drivers/media/platform/qcom/venus/hfi_platform_v4.c +0
-0@@ -273,12 +278,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { };
drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_platform_codec_freq_data codec_freq_data[] = { · line 288
Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +3
-1static const struct hfi_platform_codec_freq_data * -get_codec_freq_data (u32 session_type,u32 pixfmt) +get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) {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 ; +WARN_ON (lite); +
Yeah this pattern seems a bit mad to me, adding a bool as a parameter and then complaining about it with a WARN()
Why call the functioning if your bool already tells you its verboten ?
Quoted 270 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +12
-6for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];@@ -289,33 +296,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)return found; } -static unsigned long codec_vpp_freq (u32 session_type,u32 codec) +static unsigned long codec_vpp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;return 0 ; } -static unsigned long codec_vsp_freq (u32 session_type,u32 codec) +static unsigned long codec_vsp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;return 0 ; } -static unsigned long codec_lp_freq (u32 session_type,u32 codec) +static unsigned long codec_lp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;drivers/media/platform/qcom/venus/hfi_platform_v6.c +23
-9@@ -245,14 +245,20 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } }; -static const struct hfi_plat_caps *get_capabilities (unsigned int *entries) +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries, +bool lite) { +WARN_ON (lite); + *entries =ARRAY_SIZE (caps);return caps; } -static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count) +static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count, +bool lite) { +WARN_ON (lite); + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC |HFI_VIDEO_CODEC_VP8 ; *dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |@@ -273,12 +279,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { };static const struct hfi_platform_codec_freq_data * -get_codec_freq_data (u32 session_type,u32 pixfmt) +get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) {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 ; +WARN_ON (lite); +for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];@@ -289,33 +297,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)return found; } -static unsigned long codec_vpp_freq (u32 session_type,u32 codec) +static unsigned long codec_vpp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;return 0 ; } -static unsigned long codec_vsp_freq (u32 session_type,u32 codec) +static unsigned long codec_vsp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;return 0 ; } -static unsigned long codec_lp_freq (u32 session_type,u32 codec) +static unsigned long codec_lp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;drivers/media/platform/qcom/venus/hfi_venus.c +18
-7@@ -380,7 +380,7 @@ static void venus_soft_int(struct venus_hfi_device *hdev)void __iomem *cpu_ic_base = hdev->core->cpu_ic_base;u32 clear_bit; -if (IS_V6 (hdev->core)) +if (IS_V6 (hdev->core) || (IS_V4 (hdev->core) &&is_lite (hdev->core))) clear_bit =BIT (CPU_IC_SOFTINT_H2A_SHIFT_V6 );else clear_bit =BIT (CPU_IC_SOFTINT_H2A_SHIFT );@@ -501,9 +501,11 @@ 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 ); + +if (!IS_AR50_LITE (hdev->core)) +writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }return ret;@@ -569,6 +571,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 );@@ -1138,7 +1143,13 @@ 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_AR50_LITE (core)) { +if (status &WRAPPER_INTR_STATUS_A2H_MASK || + status &WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE || + status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK ) + hdev->irq_status = status; + }else if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )@@ -1150,7 +1161,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 ;@@ -1535,7 +1546,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 );@@ -1555,7 +1566,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/hfi_venus_io.h +4
-0@@ -51,6 +51,9 @@/* Venus cpu */ #define CPU_CS_SCIACMDARG3 0x58 +#define CPU_CS_VCICMD 0x20 +#define CPU_CS_VCICMD_ARP_OFF BIT(0) +#define SFR_ADDR 0x5c#define MMAP_ADDR 0x60#define UC_REGION_ADDR 0x64@@ -100,6 +103,7 @@#define WRAPPER_INTR_MASK_A2HCPU_MASK 0x4#define WRAPPER_INTR_MASK_A2HCPU_SHIFT 0x2 +#define WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE 0x10#define WRAPPER_INTR_STATUS_A2HWD_MASK_V6 0x8#define WRAPPER_INTR_MASK_A2HWD_BASK_V6 0x8drivers/media/platform/qcom/venus/pm_helpers.c +1
-1@@ -51,7 +51,7 @@ static int core_clks_enable(struct venus_core *core)dev_pm_opp_put (opp);for (i =0 ; i < res->clks_num; i++) { -if (IS_V6 (core)) { +if (IS_V6 (core) || (IS_V4 (core) &&is_lite (core))) { ret =clk_set_rate (core->clks[i], freq);if (ret) goto err;drivers/media/platform/qcom/venus/vdec.c +1
-6@@ -565,12 +565,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)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 ; +venus_helper_prepare_eos_data (inst, &fdata); ret =hfi_session_process_buf (inst, &fdata);
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
In reply to Bryan O'DonoghueQuoted 22 lines · Bryan O'Donoghue
Quoted 21 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +5
-0@@ -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#
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 5 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +5
-0+ +title: Qualcomm QCM2290 Venus video encode and decode accelerators + +maintainers: + - Vikash Garodia <[email protected]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
happy to do it. The MAINTAINER's file covered all the files named schemas/media/*venus* so my understanding was that I shouldn't.
if you/Vikash/Dikshita could confirm I will do on v8. thanks!.
Quoted 40 lines
Quoted 27 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +26
-0+ +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: 5I'm confused to see this is still here
Quoted 1 line
https://lore.kernel.org/linux-media/zk5cmielm4urfm22yszmjmwvi4mqvdsfthlonq6mij7rkijcsp@7evb3ejxuaj7/
um, I didnt see this review comment - sorry about it Dmitry, I wished I had. Right, there are 5 SIDs.
Quoted 3 lines
I think Dima is right, what's the problem with declaring maxItems: 5 here ?
none. will fix.
Quoted 22 lines
Quoted 22 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +20
-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:
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 73
Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0+ - | + #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>Alphabetise includes for preference.
um this was auto-generated by the build tool. I'll fix.
Quoted 37 lines
Quoted 24 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +23
-0+ + 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>;You're listing five iommus.
Quoted 5 lines
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
once secure buffer support is enabled, I think migration to a child node model will be needed but AFAIK (please let me know if I am wrong!), this approach will maintain future compatibility.
This sort of thing is where we are heading to:
video-codec@5a00000 {
compatible = "qcom,qcm2290-venus";
reg = <0x0 0x5a00000 0x0 0xf0000>;
iommus = <&apps_smmu 0x860 0x0>, <&apps_smmu 0x880 0x0>;
secure-buffers {
iommus = <&apps_smmu 0x861 0x04>,
<&apps_smmu 0x863 0x0>,
<&apps_smmu 0x804 0xe0>;
memory-region = <&pil_video_mem>;
};
};Quoted 24 lines
Quoted 12 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +11
-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"; + + 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-133333333 { + opp-hz = /bits/ 64 <133333333>; + required-opps = <&rpmpd_opp_low_svs>; + }; + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + };---
bod
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
Quoted 32 lines · Jorge Ramirez
Quoted 22 lines · Bryan O'Donoghue
Quoted 21 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +5
-0@@ -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#Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 5 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +5
-0+ +title: Qualcomm QCM2290 Venus video encode and decode accelerators + +maintainers: + - Vikash Garodia <[email protected]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 1 line
happy to do it. The MAINTAINER's file covered all the files named
This should be the person(s) interested and caring about this hardware, which means:
1. Subsystem maintainers: no
2. Driver maintainers: usually yes
3. Author(s) of new hardware support: usually yes
Quoted 1 line
schemas/media/*venus* so my understanding was that I shouldn't.
I cannot comment why people decided to go one way or another in other code, but it as well could be just incorrect choice thinking only people in MAINTAINERS care about hardware.
...
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 106
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +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>;You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Quoted 6 lines
Quoted 2 lines
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
It was never about the driver but about whether you should describe in DTS for non-secure world the entries which are secure world. The answer in general is that you can and there will be benefits (e.g. sharing DTS with secure world implementations).
Best regards,
Krzysztof
Re: [PATCH v7 2/7] media: venus: Conditionally register codec nodes based on firmware version
In reply to Bryan O'DonoghueQuoted 35 lines · Bryan O'Donoghue
Quoted 34 lines · Jorge Ramirez-Ortiz
The encoding and decoding capabilities of a VPU can vary depending on the firmware version in use.
This commit adds support for platforms with
OF_DYNAMICenabled to conditionally skip the creation of codec device nodes at runtime if the loaded firmware does not support the corresponding functionality.Note that the driver becomes aware of the firmware version only after the HFI layer has been initialized.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 76 +++++++++++++++--------- drivers/media/platform/qcom/venus/core.h | 8 +++ 2 files changed, 57 insertions(+), 27 deletions(-)drivers/media/platform/qcom/venus/core.c +9
-0@@ -28,6 +28,15 @@#include "pm_helpers.h" #include "hfi_venus_io.h" +static inline bool venus_fw_supports_codec (struct venus_core *core, +const struct venus_min_fw *ver) +{ +if (!ver) +return true; + +return is_fw_rev_or_newer (core, ver->major, ver->minor, ver->rev); +} +static void venus_coredump (struct venus_core *core) {
Quoted 8 lines
drivers/media/platform/qcom/venus/core.c static void venus_sys_error_handler(struct work_struct *work) · line 114
Quoted 6 lines
drivers/media/platform/qcom/venus/core.c +1
-1struct device *dev;@@ -103,7 +112,9 @@ static void venus_sys_error_handler(struct work_struct *work) core->state =CORE_UNINIT ;for (i =0 ; i < max_attempts; i++) { -if (!pm_runtime_active (core->dev_dec) && !pm_runtime_active (core->dev_enc)) +/* Not both nodes might be available */ "Neither node available" the latter for preference.
what about "One or both nodes may be unavailable" ?
Quoted 6 lines
drivers/media/platform/qcom/venus/core.c static void venus_sys_error_handler(struct work_struct *work) · line 117
Quoted 3 lines
drivers/media/platform/qcom/venus/core.c +2
-0+if ((!core->dev_dec || !pm_runtime_active (core->dev_dec)) && + (!core->dev_enc || !pm_runtime_active (core->dev_enc)))Is this change about registration or is it a fix trying to sneak in under the radar ?
I think this functionality - the ability to enable or disable individual encode/decode nodes based on firmware capabilities - should be standard across multimedia drivers.
For example, on the AR50_LITE platform, the _current_ driver/firmware combo does not support encoding as it requires secure buffer handling which is not yet implemented in the kernel (changes to iommu, etc)
So, rather than disabling Venus entirely, I think it makes sense to expose the decoder node, which remains fully functional and unaffected by the secure buffer requirement.
Hence this commit (so yeah, I am not trying to sneak a fix, I swear!)
Quoted 20 lines
Quoted 14 lines
drivers/media/platform/qcom/venus/core.c +2
-1break ;msleep (10 ); }@@ -202,7 +213,8 @@ static u32 to_v4l2_codec_type(u32 codec) } } -static int venus_enumerate_codecs (struct venus_core *core,u32 type) +static int venus_enumerate_codecs (struct venus_core *core,u32 type, +const struct venus_min_fw *ver) {const struct hfi_inst_ops dummy_ops = {};struct venus_inst *inst;drivers/media/platform/qcom/venus/core.c static int venus_enumerate_codecs(struct venus_core *core, u32 type) · line 228
Quoted 4 lines
drivers/media/platform/qcom/venus/core.c +2
-0@@ -213,6 +225,9 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)if (core->res->hfi_version !=HFI_VERSION_1XX )return 0 ; +if (!venus_fw_supports_codec (core, ver)) +return 0 ;Its not really a codec you're checking there, its a version.
Quoted 1 line
The name should reflect that.
but the check isn't just about the firmware version: it is about whether the firmware in use supports a specific coded based on the firmware version knowledge built in the driver.
so really, while the logic involves a version check, it is really about the codec capability.
I could rename it as is_codec_enabled_by_fw() if the current naming is not clear.
Quoted 122 lines
Quoted 122 lines
drivers/media/platform/qcom/venus/core.c +33
-25+ inst =kzalloc (sizeof (*inst),GFP_KERNEL );if (!inst)return -ENOMEM ;@@ -288,14 +303,14 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id)#if defined(CONFIG_OF_DYNAMIC )static int venus_add_video_core (struct venus_core *core,const char *node_name, -const char *compat) +const char *compat,const struct venus_min_fw *ver) {struct of_changeset *ocs = core->ocs;struct device *dev = core->dev;struct device_node *np, *enp;int ret; -if (!node_name) +if (!node_name || !venus_fw_supports_codec (core, ver))return 0 ; enp =of_find_node_by_name (dev->of_node, node_name);@@ -330,11 +345,13 @@ static int venus_add_dynamic_nodes(struct venus_core *core)of_changeset_init (core->ocs); - ret =venus_add_video_core (core, core->res->dec_nodename,"venus-decoder" ); + ret =venus_add_video_core (core, core->res->dec_nodename,"venus-decoder" , + core->res->dec_minfw);if (ret) goto err; - ret =venus_add_video_core (core, core->res->enc_nodename,"venus-encoder" ); + ret =venus_add_video_core (core, core->res->enc_nodename,"venus-encoder" , + core->res->enc_minfw);if (ret) goto err;@@ -363,6 +380,9 @@ static void venus_remove_dynamic_nodes(struct venus_core *core)#else static int venus_add_dynamic_nodes (struct venus_core *core) { +WARN_ONCE (core->res->enc_minfw || core->res->dec_minfw, +"Feature not supported" ); +return 0 ; }@@ -432,7 +452,7 @@ static int venus_probe(struct platform_device *pdev)IRQF_TRIGGER_HIGH |IRQF_ONESHOT , "venus", core);if (ret) - goto err_core_put; + goto err_hfi_destroy;venus_assign_register_offsets (core);@@ -448,19 +468,9 @@ static int venus_probe(struct platform_device *pdev)if (ret <0 ) goto err_runtime_disable; -if (core->res->dec_nodename || core->res->enc_nodename) { - ret =venus_add_dynamic_nodes (core); -if (ret) - goto err_runtime_disable; - } - - ret =of_platform_populate (dev->of_node,NULL ,NULL , dev); -if (ret) - goto err_remove_dynamic_nodes; - ret =venus_firmware_init (core);if (ret) - goto err_of_depopulate; + goto err_runtime_disable; ret =venus_boot (core);if (ret)@@ -474,34 +484,46 @@ static int venus_probe(struct platform_device *pdev)if (ret) goto err_venus_shutdown; - ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_DEC ); +if (core->res->dec_nodename || core->res->enc_nodename) { + ret =venus_add_dynamic_nodes (core); +if (ret) + goto err_core_deinit; + } + + ret =of_platform_populate (dev->of_node,NULL ,NULL , dev);if (ret) - goto err_core_deinit; + goto err_remove_dynamic_nodes; + + ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_DEC , + core->res->dec_minfw); +if (ret) + goto err_of_depopulate; - ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_ENC ); + ret =venus_enumerate_codecs (core,VIDC_SESSION_TYPE_ENC , + core->res->enc_minfw);if (ret) - goto err_core_deinit; + goto err_of_depopulate; ret =pm_runtime_put_sync (dev);if (ret) {pm_runtime_get_noresume (dev); - goto err_core_deinit; + goto err_of_depopulate; }venus_dbgfs_init (core);return 0 ; +err_of_depopulate: +of_platform_depopulate (dev); +err_remove_dynamic_nodes: +venus_remove_dynamic_nodes (core); err_core_deinit:hfi_core_deinit (core, false); err_venus_shutdown:venus_shutdown (core); err_firmware_deinit:venus_firmware_deinit (core); -err_of_depopulate: -of_platform_depopulate (dev); -err_remove_dynamic_nodes: -venus_remove_dynamic_nodes (core); err_runtime_disable:pm_runtime_put_noidle (dev);pm_runtime_disable (dev);drivers/media/platform/qcom/venus/core.h +0
-0@@ -50,6 +50,12 @@ struct bw_tbl {u32 peak_10bit;
Quoted 8 lines
drivers/media/platform/qcom/venus/core.h struct bw_tbl { · line 57
Quoted 6 lines
drivers/media/platform/qcom/venus/core.h +5
-0}; +struct venus_min_fw { +u32 major; +u32 minor; +u32 rev; +};I'd call this
venus_firmware_version
I guess you right- doing so will enable future extensibility if we need to do some different version checks. ok.
Quoted 14 lines
drivers/media/platform/qcom/venus/core.h struct venus_resources { · line 102
Quoted 11 lines
drivers/media/platform/qcom/venus/core.h +3
-0+enum vpu_version {VPU_VERSION_AR50 ,VPU_VERSION_AR50_LITE ,@@ -92,6 +98,8 @@ struct venus_resources {u32 cp_nonpixel_start;u32 cp_nonpixel_size;const char *fwname; +const struct venus_min_fw *enc_minfw; +const struct venus_min_fw *dec_minfw;and then I'd do as you have done here, indicate that the struct
venus_firmware_versionis a*enc_min_fw_ver;
ack
Quoted 4 lines
Quoted 4 lines
drivers/media/platform/qcom/venus/core.h +0
-0const char *enc_nodename;const char *dec_nodename; };
Re: [PATCH v7 3/7] media: venus: Add support for AR50_LITE video core
In reply to Bryan O'DonoghueQuoted 135 lines · Bryan O'Donoghue
Quoted 120 lines · Jorge Ramirez-Ortiz
The
AR50_LITEis a simplified 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, and provides encoding support for H.264 and HEVC.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 15 +++++++-- drivers/media/platform/qcom/venus/core.h | 5 +++ drivers/media/platform/qcom/venus/firmware.c | 10 ++++++ drivers/media/platform/qcom/venus/firmware.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 30 +++++++++++++++-- drivers/media/platform/qcom/venus/helpers.h | 2 ++ .../media/platform/qcom/venus/hfi_parser.c | 5 +-- .../media/platform/qcom/venus/hfi_platform.c | 20 +++++++----- .../media/platform/qcom/venus/hfi_platform.h | 25 ++++++++------- .../platform/qcom/venus/hfi_platform_v4.c | 31 ++++++++++++------ .../platform/qcom/venus/hfi_platform_v6.c | 32 +++++++++++++------ drivers/media/platform/qcom/venus/hfi_venus.c | 25 +++++++++++---- .../media/platform/qcom/venus/hfi_venus_io.h | 4 +++ .../media/platform/qcom/venus/pm_helpers.c | 2 +- drivers/media/platform/qcom/venus/vdec.c | 7 +--- 15 files changed, 154 insertions(+), 60 deletions(-)drivers/media/platform/qcom/venus/core.c +12
-3@@ -269,14 +269,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 ;@@ -476,6 +481,10 @@ static int venus_probe(struct platform_device *pdev)if (ret) goto err_firmware_deinit; + ret =venus_firmware_cfg (core); +if (ret) + goto err_venus_shutdown; + ret =hfi_core_resume (core, true);if (ret) goto err_venus_shutdown;drivers/media/platform/qcom/venus/core.h +5
-0@@ -538,6 +538,11 @@ struct venus_inst {#define IS_IRIS2 (core) ((core)->res->vpu_version == VPU_VERSION_IRIS2)#define IS_IRIS2_1 (core) ((core)->res->vpu_version == VPU_VERSION_IRIS2_1) +static inline bool is_lite (struct venus_core *core) +{ +return IS_AR50_LITE (core); +} +#define ctrl_to_inst (ctrl) \ container_of((ctrl)->handler, struct venus_inst, ctrl_handler)drivers/media/platform/qcom/venus/firmware.c +10
-0@@ -207,6 +207,16 @@ static int venus_shutdown_no_tz(struct venus_core *core)return 0 ; } +int venus_firmware_cfg (struct venus_core *core) +{ +void __iomem *cpu_cs_base = core->cpu_cs_base; + +if (IS_AR50_LITE (core)) +writel (CPU_CS_VCICMD_ARP_OFF , cpu_cs_base +CPU_CS_VCICMD ); + +return 0 ; +} +int venus_boot (struct venus_core *core) {struct device *dev = core->dev;drivers/media/platform/qcom/venus/firmware.h +1
-0@@ -9,6 +9,7 @@ struct device;int venus_firmware_init (struct venus_core *core);void venus_firmware_deinit (struct venus_core *core); +int venus_firmware_cfg (struct venus_core *core);int venus_boot (struct venus_core *core);int venus_shutdown (struct venus_core *core);int venus_set_hw_state (struct venus_core *core,bool suspend);drivers/media/platform/qcom/venus/helpers.c +7
-0@@ -230,6 +230,24 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ;drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 248
Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10
-0+ +if (IS_V6 (core) &&is_fw_rev_or_older (core,1 ,0 ,87 )) +return ; + +if (IS_V4 (core) &&is_lite (core) &&is_fw_rev_or_older (core,6 ,0 ,53 )) + data->alloc_len =1 ; + + data->device_addr =0xdeadb000 ; +} +EXPORT_SYMBOL_GPL (venus_helper_prepare_eos_data);This function doesn't appear to have alot to do with
AR50_LITEas it pertains toIS_V6()andIS_V4().
Quoted 2 lines
This I think should be a separate patch with its own commit log to describe the quite complex logic of version numbers going on here.
Let me give it some background:
According to the HFI specification, EOS (End-of-Stream) buffers must have 'valid' addresses. While the firmware currently appears to make no use of the EOS buffer contents, allocating and mapping them would have been a better driver choice IMO. Hoever this one has better performance which is probably the reason why it has stayed.
The firmware then does perform operations involving the buffer's size and length fields, and enforces boundary checks accordingly. On the AR50_LITE platform, an earlier firmware version lacked a check on alloc_len, leading to a division-by-zero scenario.
This has been addressed, and we plan to release firmware version 6.0.54, which includes the necessary boundary check for alloc_len.
I should probaly replace IS_V4(core) && is_lite(core) with IS_AR50_LITE() instead of trying to give it the appearence of a design feature.
seems the sensible thing to do, right?
Quoted 15 lines
drivers/media/platform/qcom/venus/helpers.c int venus_helper_session_init(struct venus_inst *inst) · line 1736
Quoted 11 lines
drivers/media/platform/qcom/venus/helpers.c +3
-1+static int intbufs_set_buffer (struct venus_inst *inst,u32 type) {struct venus_core *core = inst->core;@@ -1715,11 +1733,17 @@ int venus_helper_session_init(struct venus_inst *inst)if (ret)return ret; - inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version, codec, + inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version, + is_lite(inst->core),I'm not trying to awkward questions but is there another 'lite' that this
is_lite()logic is supposed to capture if not then why notIS_AR50_LITE()
And I asked myself the same questions.
I can't think of a reason why we wouldnt see additional LITE VPUs in the future. So rather than creating a new platform definition - a near-verbatim copy of the exisiting 4XX platform as was pointed out during the review - I chose to extend the current platform support.
Quoted 155 lines
This differentation should be explained in commit log or inline /* comment */
Quoted 151 lines
drivers/media/platform/qcom/venus/helpers.c +7
-2+ codec, session_type); - inst->clk_data.vsp_freq =hfi_platform_get_codec_vsp_freq (version, codec, + inst->clk_data.vsp_freq =hfi_platform_get_codec_vsp_freq (version, +is_lite (inst->core), + codec, session_type); - inst->clk_data.low_power_freq =hfi_platform_get_codec_lp_freq (version, codec, + inst->clk_data.low_power_freq =hfi_platform_get_codec_lp_freq (version, +is_lite (inst->core), + codec, session_type);return 0 ;drivers/media/platform/qcom/venus/helpers.h +2
-0@@ -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); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data);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_parser.c +3
-2@@ -277,12 +277,13 @@ static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst)if (inst)return 0 ; - ret =hfi_platform_get_codecs (core, &enc_codecs, &dec_codecs, &count); + ret =hfi_platform_get_codecs (core, &enc_codecs, &dec_codecs, &count, +is_lite (core));if (ret)return ret;if (plat->capabilities) - caps = plat->capabilities (&entries); + caps = plat->capabilities (&entries,is_lite (core));if (!caps || !entries || !count)return -EINVAL ;drivers/media/platform/qcom/venus/hfi_platform.c +12
-8@@ -21,7 +21,8 @@ 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,u32 session_type) +hfi_platform_get_codec_vpp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;@@ -31,13 +32,14 @@ hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 sessionreturn 0 ;if (plat->codec_vpp_freq) - freq = plat->codec_vpp_freq (session_type, codec); + freq = plat->codec_vpp_freq (session_type, codec, lite);return freq; }unsigned long -hfi_platform_get_codec_vsp_freq (enum hfi_version version,u32 codec,u32 session_type) +hfi_platform_get_codec_vsp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;@@ -47,13 +49,14 @@ hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 sessionreturn 0 ;if (plat->codec_vpp_freq) - freq = plat->codec_vsp_freq (session_type, codec); + freq = plat->codec_vsp_freq (session_type, codec, lite);return freq; }unsigned long -hfi_platform_get_codec_lp_freq (enum hfi_version version,u32 codec,u32 session_type) +hfi_platform_get_codec_lp_freq (enum hfi_version version,bool lite,u32 codec, +u32 session_type) {const struct hfi_platform *plat;unsigned long freq =0 ;@@ -63,13 +66,14 @@ hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_return 0 ;if (plat->codec_lp_freq) - freq = plat->codec_lp_freq (session_type, codec); + freq = plat->codec_lp_freq (session_type, codec, lite);return freq; }int -hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs,u32 *count) +hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs,u32 *count, +bool lite) {const struct hfi_platform *plat;@@ -78,7 +82,7 @@ hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecreturn -EINVAL ;if (plat->codecs) - plat->codecs (enc_codecs, dec_codecs, count); + plat->codecs (enc_codecs, dec_codecs, count, lite);if (IS_IRIS2_1 (core)) { *enc_codecs &= ~HFI_VIDEO_CODEC_VP8 ;drivers/media/platform/qcom/venus/hfi_platform.h +13
-12@@ -47,11 +47,12 @@ struct hfi_platform_codec_freq_data { };struct hfi_platform { -unsigned long (*codec_vpp_freq)(u32 session_type,u32 codec); -unsigned long (*codec_vsp_freq)(u32 session_type,u32 codec); -unsigned long (*codec_lp_freq)(u32 session_type,u32 codec); -void (*codecs)(u32 *enc_codecs,u32 *dec_codecs,u32 *count); -const struct hfi_plat_caps *(*capabilities)(unsigned int *entries); +unsigned long (*codec_vpp_freq)(u32 session_type,u32 codec,bool lite); +unsigned long (*codec_vsp_freq)(u32 session_type,u32 codec,bool lite); +unsigned long (*codec_lp_freq)(u32 session_type,u32 codec,bool lite); +void (*codecs)(u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite); +const struct hfi_plat_caps *(*capabilities)(unsigned int *entries, +bool lite);int (*bufreq)(struct hfi_plat_buffers_params *params,u32 session_type,u32 buftype,struct hfi_buffer_requirements *bufreq); };@@ -60,12 +61,12 @@ extern const struct hfi_platform hfi_plat_v4;extern const struct hfi_platform hfi_plat_v6;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, -u32 session_type); -unsigned long hfi_platform_get_codec_vsp_freq (enum hfi_version version,u32 codec, -u32 session_type); -unsigned long hfi_platform_get_codec_lp_freq (enum hfi_version version,u32 codec, -u32 session_type); +unsigned long hfi_platform_get_codec_vpp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type); +unsigned long hfi_platform_get_codec_vsp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type); +unsigned long hfi_platform_get_codec_lp_freq (enum hfi_version version,bool lite, +u32 codec,u32 session_type);int hfi_platform_get_codecs (struct venus_core *core,u32 *enc_codecs,u32 *dec_codecs, -u32 *count); +u32 *count,bool lite);#endif drivers/media/platform/qcom/venus/hfi_platform_v4.c +0
-0@@ -245,14 +245,19 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } };
Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_plat_caps caps[] = { · line 252
Quoted 6 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +4
-1-static const struct hfi_plat_caps *get_capabilities (unsigned int *entries) +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries, +bool lite) { +WARN_ON (lite); +Why add a parameter that triggers a warning ?
because this is the new interface that nobody is using at that time - so if someone was to cherrypick this commit and not the other one and lite was set by mistake it should trigger a warning IMO
not sure if it is the right thing to do though so happy to remove it if you think is better
Quoted 3 lines
Just disjunct away from calling this function with the bool you are passing ?!?
is warning to the user that something has been wrongly configured.
Quoted 19 lines
Quoted 19 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +4
-2*entries =ARRAY_SIZE (caps);return caps; } -static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count) +static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite) { +WARN_ON (lite); + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC |HFI_VIDEO_CODEC_VP8 ; *dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |@@ -273,12 +278,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { };static const struct hfi_platform_codec_freq_data * -get_codec_freq_data (u32 session_type,u32 pixfmt) +get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) {
Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_platform_codec_freq_data codec_freq_data[] = { · line 288
Quoted 5 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +2
-0const 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 ; +WARN_ON (lite); +Yeah this pattern seems a bit mad to me, adding a bool as a parameter and then complaining about it with a
WARN()
well, at that point, nobody should be using it. the user comes in the following commit.
Quoted 2 lines
Why call the functioning if your bool already tells you its verboten ?
just being cautious an to help debug misconfigurations.
notice that the AR50_LITE support then removes the warning from the plat_v4 but not from plat_v6 (since there are not plat_v6 lite implementations yet).
Quoted 235 lines
Quoted 234 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +12
-6for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];@@ -289,33 +296,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)return found; } -static unsigned long codec_vpp_freq (u32 session_type,u32 codec) +static unsigned long codec_vpp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;return 0 ; } -static unsigned long codec_vsp_freq (u32 session_type,u32 codec) +static unsigned long codec_vsp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;return 0 ; } -static unsigned long codec_lp_freq (u32 session_type,u32 codec) +static unsigned long codec_lp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;drivers/media/platform/qcom/venus/hfi_platform_v6.c +23
-9@@ -245,14 +245,20 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } }; -static const struct hfi_plat_caps *get_capabilities (unsigned int *entries) +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries, +bool lite) { +WARN_ON (lite); + *entries =ARRAY_SIZE (caps);return caps; } -static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count) +static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count, +bool lite) { +WARN_ON (lite); + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC |HFI_VIDEO_CODEC_VP8 ; *dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |@@ -273,12 +279,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { };static const struct hfi_platform_codec_freq_data * -get_codec_freq_data (u32 session_type,u32 pixfmt) +get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) {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 ; +WARN_ON (lite); +for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];@@ -289,33 +297,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)return found; } -static unsigned long codec_vpp_freq (u32 session_type,u32 codec) +static unsigned long codec_vpp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;return 0 ; } -static unsigned long codec_vsp_freq (u32 session_type,u32 codec) +static unsigned long codec_vsp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;return 0 ; } -static unsigned long codec_lp_freq (u32 session_type,u32 codec) +static unsigned long codec_lp_freq (u32 session_type,u32 codec,bool lite) {const struct hfi_platform_codec_freq_data *data; - data =get_codec_freq_data (session_type, codec); +WARN_ON (lite); + + data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;drivers/media/platform/qcom/venus/hfi_venus.c +18
-7@@ -380,7 +380,7 @@ static void venus_soft_int(struct venus_hfi_device *hdev)void __iomem *cpu_ic_base = hdev->core->cpu_ic_base;u32 clear_bit; -if (IS_V6 (hdev->core)) +if (IS_V6 (hdev->core) || (IS_V4 (hdev->core) &&is_lite (hdev->core))) clear_bit =BIT (CPU_IC_SOFTINT_H2A_SHIFT_V6 );else clear_bit =BIT (CPU_IC_SOFTINT_H2A_SHIFT );@@ -501,9 +501,11 @@ 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 ); + +if (!IS_AR50_LITE (hdev->core)) +writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }return ret;@@ -569,6 +571,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 );@@ -1138,7 +1143,13 @@ 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_AR50_LITE (core)) { +if (status &WRAPPER_INTR_STATUS_A2H_MASK || + status &WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE || + status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK ) + hdev->irq_status = status; + }else if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )@@ -1150,7 +1161,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 ;@@ -1535,7 +1546,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 );@@ -1555,7 +1566,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/hfi_venus_io.h +4
-0@@ -51,6 +51,9 @@/* Venus cpu */ #define CPU_CS_SCIACMDARG3 0x58 +#define CPU_CS_VCICMD 0x20 +#define CPU_CS_VCICMD_ARP_OFF BIT(0) +#define SFR_ADDR 0x5c#define MMAP_ADDR 0x60#define UC_REGION_ADDR 0x64@@ -100,6 +103,7 @@#define WRAPPER_INTR_MASK_A2HCPU_MASK 0x4#define WRAPPER_INTR_MASK_A2HCPU_SHIFT 0x2 +#define WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE 0x10#define WRAPPER_INTR_STATUS_A2HWD_MASK_V6 0x8#define WRAPPER_INTR_MASK_A2HWD_BASK_V6 0x8drivers/media/platform/qcom/venus/pm_helpers.c +1
-1@@ -51,7 +51,7 @@ static int core_clks_enable(struct venus_core *core)dev_pm_opp_put (opp);for (i =0 ; i < res->clks_num; i++) { -if (IS_V6 (core)) { +if (IS_V6 (core) || (IS_V4 (core) &&is_lite (core))) { ret =clk_set_rate (core->clks[i], freq);if (ret) goto err;drivers/media/platform/qcom/venus/vdec.c +1
-6@@ -565,12 +565,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)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 ; +venus_helper_prepare_eos_data (inst, &fdata); ret =hfi_session_process_buf (inst, &fdata);
Re: [PATCH v7 2/7] media: venus: Conditionally register codec nodes based on firmware version
In reply to Jorge RamirezQuoted 45 lines · Jorge Ramirez
Quoted 35 lines · Bryan O'Donoghue
Quoted 34 lines · Jorge Ramirez-Ortiz
The encoding and decoding capabilities of a VPU can vary depending on the firmware version in use.
This commit adds support for platforms with
OF_DYNAMICenabled to conditionally skip the creation of codec device nodes at runtime if the loaded firmware does not support the corresponding functionality.Note that the driver becomes aware of the firmware version only after the HFI layer has been initialized.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 76 +++++++++++++++--------- drivers/media/platform/qcom/venus/core.h | 8 +++ 2 files changed, 57 insertions(+), 27 deletions(-)drivers/media/platform/qcom/venus/core.c +9
-0@@ -28,6 +28,15 @@#include "pm_helpers.h" #include "hfi_venus_io.h" +static inline bool venus_fw_supports_codec (struct venus_core *core, +const struct venus_min_fw *ver) +{ +if (!ver) +return true; + +return is_fw_rev_or_newer (core, ver->major, ver->minor, ver->rev); +} +static void venus_coredump (struct venus_core *core) {Quoted 8 lines
drivers/media/platform/qcom/venus/core.c static void venus_sys_error_handler(struct work_struct *work) · line 114
Quoted 6 lines
drivers/media/platform/qcom/venus/core.c +1
-1struct device *dev;@@ -103,7 +112,9 @@ static void venus_sys_error_handler(struct work_struct *work) core->state =CORE_UNINIT ;for (i =0 ; i < max_attempts; i++) { -if (!pm_runtime_active (core->dev_dec) && !pm_runtime_active (core->dev_enc)) +/* Not both nodes might be available */ "Neither node available" the latter for preference.
Quoted 1 line
what about "One or both nodes may be unavailable" ?
Ah great that actually explains it then, as you can see I didn't get the meaning from the comment.
Quoted 15 lines
Quoted 6 lines
drivers/media/platform/qcom/venus/core.c static void venus_sys_error_handler(struct work_struct *work) · line 117
Quoted 3 lines
drivers/media/platform/qcom/venus/core.c +2
-0+if ((!core->dev_dec || !pm_runtime_active (core->dev_dec)) && + (!core->dev_enc || !pm_runtime_active (core->dev_enc)))Is this change about registration or is it a fix trying to sneak in under the radar ?
I think this functionality - the ability to enable or disable individual encode/decode nodes based on firmware capabilities - should be standard across multimedia drivers.
For example, on the
AR50_LITEplatform, the _current_ driver/firmware combo does not support encoding as it requires secure buffer handling which is not yet implemented in the kernel (changes to iommu, etc)
Quoted 5 lines
So, rather than disabling Venus entirely, I think it makes sense to expose the decoder node, which remains fully functional and unaffected by the secure buffer requirement.
Hence this commit (so yeah, I am not trying to sneak a fix, I swear!)
grand so.
Quoted 21 lines
Quoted 21 lines
Quoted 15 lines
drivers/media/platform/qcom/venus/core.c +2
-1break ;msleep (10 ); }@@ -202,7 +213,8 @@ static u32 to_v4l2_codec_type(u32 codec) } } -static int venus_enumerate_codecs (struct venus_core *core,u32 type) +static int venus_enumerate_codecs (struct venus_core *core,u32 type, +const struct venus_min_fw *ver) {const struct hfi_inst_ops dummy_ops = {};struct venus_inst *inst;drivers/media/platform/qcom/venus/core.c static int venus_enumerate_codecs(struct venus_core *core, u32 type) · line 228
Quoted 4 lines
drivers/media/platform/qcom/venus/core.c +2
-0@@ -213,6 +225,9 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)if (core->res->hfi_version !=HFI_VERSION_1XX )return 0 ; +if (!venus_fw_supports_codec (core, ver)) +return 0 ;Its not really a codec you're checking there, its a version.
Quoted 5 lines
Quoted 1 line
The name should reflect that.
but the check isn't just about the firmware version: it is about whether the firmware in use supports a specific coded based on the firmware version knowledge built in the driver.
No OK "codec" is the right word.
---
bod
Re: [PATCH v7 3/7] media: venus: Add support for AR50_LITE video core
In reply to Jorge RamirezQuoted 40 lines · Jorge Ramirez
Quoted 25 lines
Quoted 12 lines
drivers/media/platform/qcom/venus/helpers.c +7
-0@@ -230,6 +230,24 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ;drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 248
Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10
-0+ +if (IS_V6 (core) &&is_fw_rev_or_older (core,1 ,0 ,87 )) +return ; + +if (IS_V4 (core) &&is_lite (core) &&is_fw_rev_or_older (core,6 ,0 ,53 )) + data->alloc_len =1 ; + + data->device_addr =0xdeadb000 ; +} +EXPORT_SYMBOL_GPL (venus_helper_prepare_eos_data);This function doesn't appear to have alot to do with
AR50_LITEas it pertains toIS_V6()andIS_V4().Quoted 2 lines
This I think should be a separate patch with its own commit log to describe the quite complex logic of version numbers going on here.
Let me give it some background:
According to the HFI specification, EOS (End-of-Stream) buffers must have 'valid' addresses. While the firmware currently appears to make no use of the EOS buffer contents, allocating and mapping them would have been a better driver choice IMO. Hoever this one has better performance which is probably the reason why it has stayed.
The firmware then does perform operations involving the buffer's size and length fields, and enforces boundary checks accordingly. On the
AR50_LITEplatform, an earlier firmware version lacked a check onalloc_len, leading to a division-by-zero scenario.
Quoted 8 lines
This has been addressed, and we plan to release firmware version 6.0.54, which includes the necessary boundary check for
alloc_len.I should probaly replace
IS_V4(core)&&is_lite(core)withIS_AR50_LITE()instead of trying to give it the appearence of a design feature.seems the sensible thing to do, right?
I'll stipulate to all of that.
I know I'm being pedantic but, the title and subject of this patch is "AR50_LITE" does stuff.
As traveler from a mirror-universe - I would read the commit log here, look at this function and be none the wiser what was going on.
The EOS check is a fundamental HFI capability which is why I again reiterate it deserves its own commit log with the above explanation - word-for-word would be fine from my POV, to explain what is going on.
Long live the Empire!
---
bod
Re: [PATCH v7 4/7] media: venus: hfi_plat_v4: Add capabilities for the 4XX lite core
In reply to Jorge Ramirez-OrtizQuoted 147 lines · Jorge Ramirez-Ortiz
Populate the HFI v4 lite capability set used by the
AR50_LITEvideo core.These capabilities define the supported codec formats and operational limits specific to this streamlined VPU variant.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- .../platform/qcom/venus/hfi_platform_v4.c | 164 +++++++++++++++--- 1 file changed, 143 insertions(+), 21 deletions(-)drivers/media/platform/qcom/venus/hfi_platform_v4.c +118
-3@@ -245,25 +245,145 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } }; +static const struct hfi_plat_caps caps_lite[] = { +{ + .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 ,1920 ,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_5 }, + .pl[1 ] = {HFI_H264_PROFILE_MAIN ,HFI_H264_LEVEL_5 }, + .pl[2 ] = {HFI_H264_PROFILE_HIGH ,HFI_H264_LEVEL_5 }, + .pl[3 ] = {HFI_H264_PROFILE_CONSTRAINED_BASE ,HFI_H264_LEVEL_5 }, + .pl[4 ] = {HFI_H264_PROFILE_CONSTRAINED_HIGH ,HFI_H264_LEVEL_5 }, + .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 ,1920 ,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_HIGH0 <<28 }, + .pl[1 ] = {HFI_HEVC_PROFILE_MAIN10 ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 <<28 }, + .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 ,1920 ,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 , +}, { + .codec =HFI_VIDEO_CODEC_H264 , + .domain =VIDC_SESSION_TYPE_ENC , + .caps[0 ] = {HFI_CAPABILITY_FRAME_WIDTH ,128 ,1920 ,1 }, + .caps[1 ] = {HFI_CAPABILITY_FRAME_HEIGHT ,128 ,1920 ,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 }, + .caps[7 ] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS ,0 ,6 ,1 }, + .caps[8 ] = {HFI_CAPABILITY_ENC_LTR_COUNT ,0 ,4 ,1 }, + .caps[9 ] = {HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE ,0 ,244800 ,1 }, + .caps[10 ] = {HFI_CAPABILITY_I_FRAME_QP ,0 ,51 ,1 }, + .caps[11 ] = {HFI_CAPABILITY_P_FRAME_QP ,0 ,51 ,1 }, + .caps[12 ] = {HFI_CAPABILITY_B_FRAME_QP ,0 ,51 ,1 }, + .caps[13 ] = {HFI_CAPABILITY_SLICE_BYTE ,1 ,10 ,1 }, + .caps[14 ] = {HFI_CAPABILITY_SLICE_MB ,1 ,10 ,1 }, + .num_caps =15 , + .pl[0 ] = {HFI_H264_PROFILE_BASELINE ,HFI_H264_LEVEL_5 }, + .pl[1 ] = {HFI_H264_PROFILE_MAIN ,HFI_H264_LEVEL_5 }, + .pl[2 ] = {HFI_H264_PROFILE_HIGH ,HFI_H264_LEVEL_5 }, + .pl[3 ] = {HFI_H264_PROFILE_CONSTRAINED_BASE ,HFI_H264_LEVEL_5 }, + .pl[4 ] = {HFI_H264_PROFILE_CONSTRAINED_HIGH ,HFI_H264_LEVEL_5 }, + .num_pl =5 , + .fmts[0 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12 }, + .fmts[1 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12_UBWC }, + .num_fmts =2 , +}, { + .codec =HFI_VIDEO_CODEC_HEVC , + .domain =VIDC_SESSION_TYPE_ENC , + .caps[0 ] = {HFI_CAPABILITY_FRAME_WIDTH ,128 ,1920 ,1 }, + .caps[1 ] = {HFI_CAPABILITY_FRAME_HEIGHT ,128 ,1920 ,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 }, + .caps[7 ] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS ,0 ,6 ,1 }, + .caps[8 ] = {HFI_CAPABILITY_ENC_LTR_COUNT ,0 ,4 ,1 }, + .caps[9 ] = {HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE ,0 ,244800 ,1 }, + .caps[10 ] = {HFI_CAPABILITY_I_FRAME_QP ,0 ,51 ,1 }, + .caps[11 ] = {HFI_CAPABILITY_P_FRAME_QP ,0 ,51 ,1 }, + .caps[12 ] = {HFI_CAPABILITY_B_FRAME_QP ,0 ,51 ,1 }, + .caps[13 ] = {HFI_CAPABILITY_SLICE_BYTE ,1 ,10 ,1 }, + .caps[14 ] = {HFI_CAPABILITY_SLICE_MB ,1 ,10 ,1 }, + .num_caps =15 , + .pl[0 ] = {HFI_HEVC_PROFILE_MAIN ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 }, + .pl[1 ] = {HFI_HEVC_PROFILE_MAIN10 ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 }, + .num_pl =2 , + .fmts[0 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12 }, + .fmts[1 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12_UBWC }, + .num_fmts =2 , +} }; +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries,bool lite) { -WARN_ON (lite); + *entries = lite ?ARRAY_SIZE (caps_lite) :ARRAY_SIZE (caps); - *entries =ARRAY_SIZE (caps); -return caps; +return lite ? caps_lite : caps; }static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite)
drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_plat_caps caps[] = { · line 374
Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +1
-8{ -WARN_ON (lite); - - *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | -HFI_VIDEO_CODEC_VP8 ; - *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | -HFI_VIDEO_CODEC_VP8 |HFI_VIDEO_CODEC_VP9 | -HFI_VIDEO_CODEC_MPEG2 ; - *count =8 ; +if (lite) {
Ok, now the WARN_ON() makes more sense, its a progressive.
drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_plat_caps caps[] = { · line 386
Quoted 12 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +12
-0+ *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC ; + *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP9 ; + *count =5 ; + }else { + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP8 ; + *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP8 |HFI_VIDEO_CODEC_VP9 | +HFI_VIDEO_CODEC_MPEG2 ; + *count =8 ; + }
I don't much like setting hard-coded values in functions.
It must be possible to pass these as parameters. We have all of these enumeration structures - it seems a shame to move some specific enumerations to hard-coding.
Please consider if there is a way to bury this into one of the enumeration params.
Quoted 14 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +7
-0}static const struct hfi_platform_codec_freq_data codec_freq_data[] = {@@ -277,15 +397,23 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { { V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10, 200 }, }; +static const struct hfi_platform_codec_freq_data codec_freq_data_lite[] = { + {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 }, + {V4L2_PIX_FMT_H264 ,VIDC_SESSION_TYPE_ENC ,675 ,0 ,675 }, + {V4L2_PIX_FMT_HEVC ,VIDC_SESSION_TYPE_ENC ,675 ,0 ,675 }, +};
drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_platform_codec_freq_data codec_freq_data[] = { · line 414
Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +5
-2+static const struct hfi_platform_codec_freq_data *get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) { -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 *data = lite ? + codec_freq_data_lite : codec_freq_data; +unsigned int i, data_size = lite ?ARRAY_SIZE (codec_freq_data_lite) : +ARRAY_SIZE (codec_freq_data);
I'm not a big fan anymore of ternary nor of declaring multiple things on one line.
And I'll preempt Konrad, reverse Christmas tree in the declaration where possible for preference.
Quoted 26 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +0
-6const struct hfi_platform_codec_freq_data *found =NULL ; -WARN_ON (lite); -for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];@@ -300,8 +428,6 @@ static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;@@ -313,8 +439,6 @@ static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;
drivers/media/platform/qcom/venus/hfi_platform_v4.c static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite) · line 455
Quoted 8 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +0
-2@@ -326,8 +450,6 @@ static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;
I suppose the hard-coded *val = 5 || *val = 8; isn't important but it would be _nice_ to not hard-code, up to you how much you want to implement for the next version.
This code all looks reasonably correct/consistent with antecedents.
---
bod
Re: [PATCH v7 7/7] arm64: dts: qcom: qrb2210-rb1: Enable Venus
In reply to Jorge Ramirez-OrtizQuoted 12 lines · Jorge Ramirez-Ortiz
Enable Venus on the QRB2210 RB1 development board.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm64/boot/dts/qcom/qrb2210-rb1.dts | 4 ++++ 1 file changed, 4 insertions(+)arch/arm64/boot/dts/qcom/qrb2210-rb1.dts +0
-0
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts &wifi { · line 717
Quoted 7 lines
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts +4
-0@@ -711,3 +711,7 @@ &wifi { &xo_board { clock-frequency = <38400000>; }; + +&venus { + status = "okay"; +};
goes here
&venus {
status = "okay";
};&wifi {
vdd-0.8-cx-mx-supply = <&pm4125_l7>;
vdd-1.8-xo-supply = <&pm4125_l13>;
vdd-1.3-rfa-supply = <&pm4125_l10>;
vdd-3.3-ch0-supply = <&pm4125_l22>;
qcom,calibration-variant = "Thundercomm_RB1";
firmware-name = "qcm2290";
status = "okay";
};&xo_board {
clock-frequency = <38400000>;
};---
bod
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
In reply to Krzysztof KozlowskiQuoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Jorge Ramirez
Quoted 30 lines · Bryan O'Donoghue
Quoted 16 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +0
-0Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0@@ -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]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 7 lines
Quoted 1 line
happy to do it. The MAINTAINER's file covered all the files named
This should be the person(s) interested and caring about this hardware, which means:
1. Subsystem maintainers: no
2. Driver maintainers: usually yes
3. Author(s) of new hardware support: usually yes
perfect, will do
Quoted 30 lines
Quoted 2 lines
schemas/media/*venus* so my understanding was that I shouldn't.
I cannot comment why people decided to go one way or another in other code, but it as well could be just incorrect choice thinking only people in
MAINTAINERScare about hardware....
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 106
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +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>;You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Quoted 6 lines
Quoted 2 lines
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
Quoted 4 lines
It was never about the driver but about whether you should describe in DTS for non-secure world the entries which are secure world. The answer in general is that you can and there will be benefits (e.g. sharing DTS with secure world implementations).
all right, sounds good then, thanks
Re: [PATCH v7 3/7] media: venus: Add support for AR50_LITE video core
In reply to Bryan O'DonoghueQuoted 50 lines · Bryan O'Donoghue
Quoted 40 lines · Jorge Ramirez
Quoted 25 lines
Quoted 12 lines
drivers/media/platform/qcom/venus/helpers.c +7
-0@@ -230,6 +230,24 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ;drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 248
Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10
-0+ +if (IS_V6 (core) &&is_fw_rev_or_older (core,1 ,0 ,87 )) +return ; + +if (IS_V4 (core) &&is_lite (core) &&is_fw_rev_or_older (core,6 ,0 ,53 )) + data->alloc_len =1 ; + + data->device_addr =0xdeadb000 ; +} +EXPORT_SYMBOL_GPL (venus_helper_prepare_eos_data);This function doesn't appear to have alot to do with
AR50_LITEas it pertains toIS_V6()andIS_V4().Quoted 2 lines
This I think should be a separate patch with its own commit log to describe the quite complex logic of version numbers going on here.
Let me give it some background:
According to the HFI specification, EOS (End-of-Stream) buffers must have 'valid' addresses. While the firmware currently appears to make no use of the EOS buffer contents, allocating and mapping them would have been a better driver choice IMO. Hoever this one has better performance which is probably the reason why it has stayed.
The firmware then does perform operations involving the buffer's size and length fields, and enforces boundary checks accordingly. On the
AR50_LITEplatform, an earlier firmware version lacked a check onalloc_len, leading to a division-by-zero scenario.Quoted 8 lines
This has been addressed, and we plan to release firmware version 6.0.54, which includes the necessary boundary check for
alloc_len.I should probaly replace
IS_V4(core)&&is_lite(core)withIS_AR50_LITE()instead of trying to give it the appearence of a design feature.seems the sensible thing to do, right?
Quoted 7 lines
I'll stipulate to all of that.
I know I'm being pedantic but, the title and subject of this patch is "
AR50_LITE" does stuff.As traveler from a mirror-universe - I would read the commit log here, look at this function and be none the wiser what was going on.
right this is because I think you saw through my inconsistency.
The truth is I should have written the function as below; and I think now there is a case for it being in this patch since it is addressing a firmware issue on the firmware release supporting this core which the patch is adding the functionality for.
void venus_helper_prepare_eos_data(struct venus_inst *inst,
struct hfi_frame_data *data)
{
struct venus_core *core = inst->core;
data->buffer_type = HFI_BUFFER_INPUT;
data->flags = HFI_BUFFERFLAG_EOS;
if (IS_V6(core) && is_fw_rev_or_older(core, 1, 0, 87))
return;
if (IS_AR50_LITE(core) && is_fw_rev_or_older(core, 6, 0, 53))
data->alloc_len = 1;
data->device_addr = 0xdeadb000;
}EXPORT_SYMBOL_GPL(venus_helper_prepare_eos_data);
what do you think? this is really just adding a the AR50_LITE line to the existing implementation.
Quoted 5 lines
The EOS check is a fundamental HFI capability which is why I again reiterate it deserves its own commit log with the above explanation - word-for-word would be fine from my POV, to explain what is going on.
umm not sure yet but if the above does not make you change your mind I'll do it.
Quoted 1 line
Long live the Empire!
:)
Quoted 3 lines
---
bod
Re: [PATCH v7 7/7] arm64: dts: qcom: qrb2210-rb1: Enable Venus
In reply to Bryan O'DonoghueQuoted 8 lines · Bryan O'Donoghue
Quoted 7 lines · Jorge Ramirez-Ortiz
Enable Venus on the QRB2210 RB1 development board.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm64/boot/dts/qcom/qrb2210-rb1.dts | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 15 lines
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts &wifi { · line 717
Quoted 12 lines
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts +4
-0@@ -711,3 +711,7 @@ &wifi { &xo_board { clock-frequency = <38400000>; }; + +&venus { + status = "okay"; +};goes here
sorry, didnt know
Quoted 21 lines
&venus { status = "okay"; };&wifi { vdd-0.8-cx-mx-supply = <&pm4125_l7>; vdd-1.8-xo-supply = <&pm4125_l13>; vdd-1.3-rfa-supply = <&pm4125_l10>; vdd-3.3-ch0-supply = <&pm4125_l22>; qcom,calibration-variant = "Thundercomm_RB1"; firmware-name = "qcm2290"; status = "okay"; };&xo_board { clock-frequency = <38400000>; };---
bod
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
In reply to Jorge RamirezQuoted 74 lines · Jorge Ramirez
Quoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Jorge Ramirez
Quoted 30 lines · Bryan O'Donoghue
Quoted 16 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +0
-0Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0@@ -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]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 7 lines
Quoted 1 line
happy to do it. The MAINTAINER's file covered all the files named
This should be the person(s) interested and caring about this hardware, which means:
1. Subsystem maintainers: no
2. Driver maintainers: usually yes
3. Author(s) of new hardware support: usually yesperfect, will do
Quoted 30 lines
Quoted 2 lines
schemas/media/*venus* so my understanding was that I shouldn't.
I cannot comment why people decided to go one way or another in other code, but it as well could be just incorrect choice thinking only people in
MAINTAINERScare about hardware....
Quoted 19 lines
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 106
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +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>;Quoted 7 lines
You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
Quoted 6 lines
Quoted 4 lines
It was never about the driver but about whether you should describe in DTS for non-secure world the entries which are secure world. The answer in general is that you can and there will be benefits (e.g. sharing DTS with secure world implementations).
all right, sounds good then, thanks
Not sure if I’ve shared this before, but following an internal discussion, I think it’s worth highlighting a functional dependency in the current kernel:
- the driver only works if the first two IOMMUs in the list — the
non-secure ones — are placed at the beginning. Reordering them breaks functionality, which introduces unexpected fragility.
Regardless, this seems like a valid concern to me — a driver shouldn't rely on the order of phandles — and I just wanted to make sure you're aware of it before I post a v8 (likely sometime next week or the following, as I’ll be taking a short break soon).
Do you consider this serious enough to be called out in the commit message, or is this kind of behavior accepted as-is - ie, do you know if the DT binding for iommus rely on the order?
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
Quoted 82 lines · Jorge Ramirez
Quoted 74 lines · Jorge Ramirez
Quoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Jorge Ramirez
Quoted 30 lines · Bryan O'Donoghue
Quoted 16 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +0
-0Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0@@ -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]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 7 lines
Quoted 1 line
happy to do it. The MAINTAINER's file covered all the files named
This should be the person(s) interested and caring about this hardware, which means:
1. Subsystem maintainers: no
2. Driver maintainers: usually yes
3. Author(s) of new hardware support: usually yesperfect, will do
Quoted 30 lines
Quoted 2 lines
schemas/media/*venus* so my understanding was that I shouldn't.
I cannot comment why people decided to go one way or another in other code, but it as well could be just incorrect choice thinking only people in
MAINTAINERScare about hardware....
Quoted 19 lines
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 106
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +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>;Quoted 7 lines
You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
Quoted 6 lines
Quoted 4 lines
It was never about the driver but about whether you should describe in DTS for non-secure world the entries which are secure world. The answer in general is that you can and there will be benefits (e.g. sharing DTS with secure world implementations).
all right, sounds good then, thanks
Quoted 7 lines
Not sure if I’ve shared this before, but following an internal discussion, I think it’s worth highlighting a functional dependency in the current kernel:
- the driver only works if the first two IOMMUs in the list — the
non-secure ones — are placed at the beginning. Reordering them breaks functionality, which introduces unexpected fragility.
by "the driver only works" I mean the firmware will fail to load otherwise (should have been clear about the failure mode).
Quoted 10 lines
Regardless, this seems like a valid concern to me — a driver shouldn't rely on the order of phandles — and I just wanted to make sure you're aware of it before I post a v8 (likely sometime next week or the following, as I’ll be taking a short break soon).
Do you consider this serious enough to be called out in the commit message, or is this kind of behavior accepted as-is - ie, do you know if the DT binding for iommus rely on the order?
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
In reply to Jorge RamirezQuoted 86 lines · Jorge Ramirez
Quoted 74 lines · Jorge Ramirez
Quoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Jorge Ramirez
Quoted 30 lines · Bryan O'Donoghue
Quoted 16 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +0
-0Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0@@ -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]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 7 lines
Quoted 1 line
happy to do it. The MAINTAINER's file covered all the files named
This should be the person(s) interested and caring about this hardware, which means:
1. Subsystem maintainers: no
2. Driver maintainers: usually yes
3. Author(s) of new hardware support: usually yesperfect, will do
Quoted 30 lines
Quoted 2 lines
schemas/media/*venus* so my understanding was that I shouldn't.
I cannot comment why people decided to go one way or another in other code, but it as well could be just incorrect choice thinking only people in
MAINTAINERScare about hardware....
Quoted 19 lines
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 106
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +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>;Quoted 7 lines
You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
Quoted 6 lines
Quoted 4 lines
It was never about the driver but about whether you should describe in DTS for non-secure world the entries which are secure world. The answer in general is that you can and there will be benefits (e.g. sharing DTS with secure world implementations).
all right, sounds good then, thanks
Not sure if I’ve shared this before, but following an internal discussion, I think it’s worth highlighting a functional dependency in the current kernel:
Quoted 8 lines
- the driver only works if the first two IOMMUs in the list — the
non-secure ones — are placed at the beginning. Reordering them breaks functionality, which introduces unexpected fragility.Regardless, this seems like a valid concern to me — a driver shouldn't rely on the order of phandles — and I just wanted to make sure you're aware of it before I post a v8 (likely sometime next week or the following, as I’ll be taking a short break soon).
Hm? Order of lists is strictly defined. That's actually an overlook that we never do it for iommus, but the core rule stays.
Best regards,
Krzysztof
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
Quoted 91 lines · Krzysztof Kozlowski
Quoted 90 lines · Jorge Ramirez
Quoted 74 lines · Jorge Ramirez
Quoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Jorge Ramirez
Quoted 30 lines · Bryan O'Donoghue
Quoted 16 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +0
-0Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0@@ -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]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 7 lines
Quoted 1 line
happy to do it. The MAINTAINER's file covered all the files named
This should be the person(s) interested and caring about this hardware, which means:
1. Subsystem maintainers: no
2. Driver maintainers: usually yes
3. Author(s) of new hardware support: usually yesperfect, will do
Quoted 30 lines
Quoted 2 lines
schemas/media/*venus* so my understanding was that I shouldn't.
I cannot comment why people decided to go one way or another in other code, but it as well could be just incorrect choice thinking only people in
MAINTAINERScare about hardware....
Quoted 19 lines
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 17
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +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>;Quoted 7 lines
You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
Quoted 6 lines
Quoted 4 lines
It was never about the driver but about whether you should describe in DTS for non-secure world the entries which are secure world. The answer in general is that you can and there will be benefits (e.g. sharing DTS with secure world implementations).
all right, sounds good then, thanks
Not sure if I’ve shared this before, but following an internal discussion, I think it’s worth highlighting a functional dependency in the current kernel:
- the driver only works if the first two IOMMUs in the list — the
non-secure ones — are placed at the beginning. Reordering them breaks functionality, which introduces unexpected fragility.
Quoted 8 lines
Quoted 4 lines
Regardless, this seems like a valid concern to me — a driver shouldn't rely on the order of phandles — and I just wanted to make sure you're aware of it before I post a v8 (likely sometime next week or the following, as I’ll be taking a short break soon).
Hm? Order of lists is strictly defined. That's actually an overlook that we never do it for iommus, but the core rule stays.
(FWIW "items:" is an ordered list, "enum:" is unordered)
Konrad
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
Quoted 98 lines · Konrad Dybcio
Quoted 97 lines · Krzysztof Kozlowski
Quoted 94 lines · Jorge Ramirez
Quoted 74 lines · Jorge Ramirez
Quoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Jorge Ramirez
Quoted 30 lines · Bryan O'Donoghue
Quoted 16 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +0
-0Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0@@ -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]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 7 lines
Quoted 1 line
happy to do it. The MAINTAINER's file covered all the files named
This should be the person(s) interested and caring about this hardware, which means:
1. Subsystem maintainers: no
2. Driver maintainers: usually yes
3. Author(s) of new hardware support: usually yesperfect, will do
Quoted 30 lines
Quoted 2 lines
schemas/media/*venus* so my understanding was that I shouldn't.
I cannot comment why people decided to go one way or another in other code, but it as well could be just incorrect choice thinking only people in
MAINTAINERScare about hardware....
Quoted 19 lines
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 17
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +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>;Quoted 7 lines
You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
Quoted 6 lines
Quoted 4 lines
It was never about the driver but about whether you should describe in DTS for non-secure world the entries which are secure world. The answer in general is that you can and there will be benefits (e.g. sharing DTS with secure world implementations).
all right, sounds good then, thanks
Not sure if I’ve shared this before, but following an internal discussion, I think it’s worth highlighting a functional dependency in the current kernel:
- the driver only works if the first two IOMMUs in the list — the
non-secure ones — are placed at the beginning. Reordering them breaks functionality, which introduces unexpected fragility.Regardless, this seems like a valid concern to me — a driver shouldn't rely on the order of phandles — and I just wanted to make sure you're aware of it before I post a v8 (likely sometime next week or the following, as I’ll be taking a short break soon).
Quoted 4 lines
Quoted 2 lines
Hm? Order of lists is strictly defined. That's actually an overlook that we never do it for iommus, but the core rule stays.
(FWIW "items:" is an ordered list, "enum:" is unordered)
enum is not a list, but enumeration, meaning one item of multiple values.
Best regards,
Krzysztof
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
Quoted 99 lines · Krzysztof Kozlowski
Quoted 98 lines · Konrad Dybcio
Quoted 97 lines · Krzysztof Kozlowski
Quoted 94 lines · Jorge Ramirez
Quoted 74 lines · Jorge Ramirez
Quoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Jorge Ramirez
Quoted 30 lines · Bryan O'Donoghue
Quoted 16 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +0
-0Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0@@ -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]>Shouldn't you be on this list ? If you upstream a file I think you should list yourself as responsible for its glory or its mess.
Quoted 7 lines
Quoted 1 line
happy to do it. The MAINTAINER's file covered all the files named
This should be the person(s) interested and caring about this hardware, which means:
1. Subsystem maintainers: no
2. Driver maintainers: usually yes
3. Author(s) of new hardware support: usually yesperfect, will do
Quoted 30 lines
Quoted 2 lines
schemas/media/*venus* so my understanding was that I shouldn't.
I cannot comment why people decided to go one way or another in other code, but it as well could be just incorrect choice thinking only people in
MAINTAINERScare about hardware....
Quoted 19 lines
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 17
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +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>;Quoted 7 lines
You're listing five iommus.
I understand there's some disagreement about whether or not to list all of the potential use-cases but, TBH I don't think those are good arguments.
Unless there's some technical prohibition I can't think of listing all five maxItems:5 .. let's just do that.
since the device tree should describe hardware and not policy, and the driver seems to be able to ignore the unused SIDs I think this is the right thing to do.
Quoted 6 lines
Quoted 4 lines
It was never about the driver but about whether you should describe in DTS for non-secure world the entries which are secure world. The answer in general is that you can and there will be benefits (e.g. sharing DTS with secure world implementations).
all right, sounds good then, thanks
Not sure if I’ve shared this before, but following an internal discussion, I think it’s worth highlighting a functional dependency in the current kernel:
- the driver only works if the first two IOMMUs in the list — the
non-secure ones — are placed at the beginning. Reordering them breaks functionality, which introduces unexpected fragility.Regardless, this seems like a valid concern to me — a driver shouldn't rely on the order of phandles — and I just wanted to make sure you're aware of it before I post a v8 (likely sometime next week or the following, as I’ll be taking a short break soon).
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Hm? Order of lists is strictly defined. That's actually an overlook that we never do it for iommus, but the core rule stays.
(FWIW "items:" is an ordered list, "enum:" is unordered)
enum is not a list, but enumeration, meaning one item of multiple values.
Right, need more caffeine
Konrad
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
In reply to Krzysztof KozlowskiQuoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Konrad Dybcio
Quoted 19 lines · Krzysztof Kozlowski
Quoted 6 lines · Jorge Ramirez
On 17/07/25 13:16:31, Jorge Ramirez wrote:
Not sure if I’ve shared this before, but following an internal discussion, I think it’s worth highlighting a functional dependency in the current kernel:
Quoted 8 lines
- the driver only works if the first two IOMMUs in the list — the
non-secure ones — are placed at the beginning. Reordering them breaks functionality, which introduces unexpected fragility.Regardless, this seems like a valid concern to me — a driver shouldn't rely on the order of phandles — and I just wanted to make sure you're aware of it before I post a v8 (likely sometime next week or the following, as I’ll be taking a short break soon).
Hm? Order of lists is strictly defined. That's actually an overlook that we never do it for iommus, but the core rule stays.
Quoted 6 lines
Quoted 1 line
(FWIW "items:" is an ordered list, "enum:" is unordered)
enum is not a list, but enumeration, meaning one item of multiple values.
Best regards,
Krzysztof
As Krzysztof says the ordering is strict.
I think the right-thing-to-do is to document in the commit log the dependency.
The final three entries are secure entries and the ordering is important.
---
bod
Re: [PATCH v7 5/7] media: venus: core: Add qcm2290 DT compatible and resource data
In reply to Jorge Ramirez-OrtizQuoted 81 lines · Jorge Ramirez-Ortiz
Add a qcm2290 compatible binding to the Cenus core.
The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).
The encoder is not available to firmware versions below 6.0.54 due to an internal requirement for secure buffers.
The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.
Co-developed-by Loic Poulain <[email protected]>Signed-off-by Loic Poulain <[email protected]>Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+)drivers/media/platform/qcom/venus/core.c +50
-0@@ -1088,6 +1088,56 @@ static const struct venus_resources sc7280_res = { .enc_nodename = "video-encoder", }; +static const struct bw_tbl qcm2290_bw_table_dec[] = { + {352800 ,597000 ,0 ,746000 ,0 },/* 1080p@30 + 720p@30 */ + {244800 ,413000 ,0 ,516000 ,0 },/* 1080p@30 */ + {216000 ,364000 ,0 ,454000 ,0 },/* 720p@60 */ + {108000 ,182000 ,0 ,227000 ,0 },/* 720p@30 */ +}; + +static const struct bw_tbl qcm2290_bw_table_enc[] = { + {352800 ,396000 ,0 ,0 ,0 },/* 1080p@30 + 720p@30 */ + {244800 ,275000 ,0 ,0 ,0 },/* 1080p@30 */ + {216000 ,242000 ,0 ,0 ,0 },/* 720p@60 */ + {108000 ,121000 ,0 ,0 ,0 },/* 720p@30 */ +}; + +static const struct venus_min_fw min_fw_encode = { + .major =6 , .minor =0 , .rev =54 /* encode min fw version */ +}; + +static const struct venus_resources qcm2290_res = { + .bw_tbl_dec = qcm2290_bw_table_dec, + .bw_tbl_dec_size =ARRAY_SIZE (qcm2290_bw_table_dec), + .bw_tbl_enc = qcm2290_bw_table_enc, + .bw_tbl_enc_size =ARRAY_SIZE (qcm2290_bw_table_enc), + .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_4XX , + .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" , + .dec_minfw =NULL , + .enc_nodename ="video-encoder" , + .enc_minfw = &min_fw_encode, +}; +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 1154
Quoted 7 lines
drivers/media/platform/qcom/venus/core.c +1
-0@@ -1098,6 +1148,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);
Thanks,
Dikshita
Re: [PATCH v7 5/7] media: venus: core: Add qcm2290 DT compatible and resource data
In reply to Jorge Ramirez-OrtizQuoted 1 line · Jorge Ramirez-Ortiz
Add a qcm2290 compatible binding to the Cenus core.
Nit: Venus.
Quoted 17 lines
The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).
The encoder is not available to firmware versions below 6.0.54 due to an internal requirement for secure buffers.
The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.
Co-developed-by Loic Poulain <[email protected]>Signed-off-by Loic Poulain <[email protected]>Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v7 4/7] media: venus: hfi_plat_v4: Add capabilities for the 4XX lite core
In reply to Bryan O'DonoghueQuoted 173 lines · Bryan O'Donoghue
Quoted 144 lines · Jorge Ramirez-Ortiz
Populate the HFI v4 lite capability set used by the
AR50_LITEvideo core.These capabilities define the supported codec formats and operational limits specific to this streamlined VPU variant.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- .../platform/qcom/venus/hfi_platform_v4.c | 164 +++++++++++++++--- 1 file changed, 143 insertions(+), 21 deletions(-)drivers/media/platform/qcom/venus/hfi_platform_v4.c +118
-3@@ -245,25 +245,145 @@ static const struct hfi_plat_caps caps[] = { .num_fmts = 4, } }; +static const struct hfi_plat_caps caps_lite[] = { +{ + .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 ,1920 ,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_5 }, + .pl[1 ] = {HFI_H264_PROFILE_MAIN ,HFI_H264_LEVEL_5 }, + .pl[2 ] = {HFI_H264_PROFILE_HIGH ,HFI_H264_LEVEL_5 }, + .pl[3 ] = {HFI_H264_PROFILE_CONSTRAINED_BASE ,HFI_H264_LEVEL_5 }, + .pl[4 ] = {HFI_H264_PROFILE_CONSTRAINED_HIGH ,HFI_H264_LEVEL_5 }, + .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 ,1920 ,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_HIGH0 <<28 }, + .pl[1 ] = {HFI_HEVC_PROFILE_MAIN10 ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 <<28 }, + .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 ,1920 ,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 , +}, { + .codec =HFI_VIDEO_CODEC_H264 , + .domain =VIDC_SESSION_TYPE_ENC , + .caps[0 ] = {HFI_CAPABILITY_FRAME_WIDTH ,128 ,1920 ,1 }, + .caps[1 ] = {HFI_CAPABILITY_FRAME_HEIGHT ,128 ,1920 ,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 }, + .caps[7 ] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS ,0 ,6 ,1 }, + .caps[8 ] = {HFI_CAPABILITY_ENC_LTR_COUNT ,0 ,4 ,1 }, + .caps[9 ] = {HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE ,0 ,244800 ,1 }, + .caps[10 ] = {HFI_CAPABILITY_I_FRAME_QP ,0 ,51 ,1 }, + .caps[11 ] = {HFI_CAPABILITY_P_FRAME_QP ,0 ,51 ,1 }, + .caps[12 ] = {HFI_CAPABILITY_B_FRAME_QP ,0 ,51 ,1 }, + .caps[13 ] = {HFI_CAPABILITY_SLICE_BYTE ,1 ,10 ,1 }, + .caps[14 ] = {HFI_CAPABILITY_SLICE_MB ,1 ,10 ,1 }, + .num_caps =15 , + .pl[0 ] = {HFI_H264_PROFILE_BASELINE ,HFI_H264_LEVEL_5 }, + .pl[1 ] = {HFI_H264_PROFILE_MAIN ,HFI_H264_LEVEL_5 }, + .pl[2 ] = {HFI_H264_PROFILE_HIGH ,HFI_H264_LEVEL_5 }, + .pl[3 ] = {HFI_H264_PROFILE_CONSTRAINED_BASE ,HFI_H264_LEVEL_5 }, + .pl[4 ] = {HFI_H264_PROFILE_CONSTRAINED_HIGH ,HFI_H264_LEVEL_5 }, + .num_pl =5 , + .fmts[0 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12 }, + .fmts[1 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12_UBWC }, + .num_fmts =2 , +}, { + .codec =HFI_VIDEO_CODEC_HEVC , + .domain =VIDC_SESSION_TYPE_ENC , + .caps[0 ] = {HFI_CAPABILITY_FRAME_WIDTH ,128 ,1920 ,1 }, + .caps[1 ] = {HFI_CAPABILITY_FRAME_HEIGHT ,128 ,1920 ,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 }, + .caps[7 ] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS ,0 ,6 ,1 }, + .caps[8 ] = {HFI_CAPABILITY_ENC_LTR_COUNT ,0 ,4 ,1 }, + .caps[9 ] = {HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE ,0 ,244800 ,1 }, + .caps[10 ] = {HFI_CAPABILITY_I_FRAME_QP ,0 ,51 ,1 }, + .caps[11 ] = {HFI_CAPABILITY_P_FRAME_QP ,0 ,51 ,1 }, + .caps[12 ] = {HFI_CAPABILITY_B_FRAME_QP ,0 ,51 ,1 }, + .caps[13 ] = {HFI_CAPABILITY_SLICE_BYTE ,1 ,10 ,1 }, + .caps[14 ] = {HFI_CAPABILITY_SLICE_MB ,1 ,10 ,1 }, + .num_caps =15 , + .pl[0 ] = {HFI_HEVC_PROFILE_MAIN ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 }, + .pl[1 ] = {HFI_HEVC_PROFILE_MAIN10 ,HFI_HEVC_LEVEL_5 |HFI_HEVC_TIER_HIGH0 }, + .num_pl =2 , + .fmts[0 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12 }, + .fmts[1 ] = {HFI_BUFFER_INPUT ,HFI_COLOR_FORMAT_NV12_UBWC }, + .num_fmts =2 , +} }; +static const struct hfi_plat_caps *get_capabilities (unsigned int *entries,bool lite) { -WARN_ON (lite); + *entries = lite ?ARRAY_SIZE (caps_lite) :ARRAY_SIZE (caps); - *entries =ARRAY_SIZE (caps); -return caps; +return lite ? caps_lite : caps; }static void get_codecs (u32 *enc_codecs,u32 *dec_codecs,u32 *count,bool lite)drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_plat_caps caps[] = { · line 371
Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +1
-8{ -WARN_ON (lite); - - *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | -HFI_VIDEO_CODEC_VP8 ; - *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | -HFI_VIDEO_CODEC_VP8 |HFI_VIDEO_CODEC_VP9 | -HFI_VIDEO_CODEC_MPEG2 ; - *count =8 ; +if (lite) {Ok, now the
WARN_ON()makes more sense, its a progressive.drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_plat_caps caps[] = { · line 386
Quoted 12 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +12
-0+ *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC ; + *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP9 ; + *count =5 ; + }else { + *enc_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP8 ; + *dec_codecs =HFI_VIDEO_CODEC_H264 |HFI_VIDEO_CODEC_HEVC | +HFI_VIDEO_CODEC_VP8 |HFI_VIDEO_CODEC_VP9 | +HFI_VIDEO_CODEC_MPEG2 ; + *count =8 ; + }I don't much like setting hard-coded values in functions.
Quoted 6 lines
It must be possible to pass these as parameters. We have all of these enumeration structures - it seems a shame to move some specific enumerations to hard-coding.
Please consider if there is a way to bury this into one of the enumeration params.
yep, you are right lets do that. fixed in v8
Quoted 71 lines
Quoted 13 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +7
-0}static const struct hfi_platform_codec_freq_data codec_freq_data[] = {@@ -277,15 +397,23 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = { { V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10, 200 }, }; +static const struct hfi_platform_codec_freq_data codec_freq_data_lite[] = { + {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 }, + {V4L2_PIX_FMT_H264 ,VIDC_SESSION_TYPE_ENC ,675 ,0 ,675 }, + {V4L2_PIX_FMT_HEVC ,VIDC_SESSION_TYPE_ENC ,675 ,0 ,675 }, +};drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_platform_codec_freq_data codec_freq_data[] = { · line 413
Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +5
-2+static const struct hfi_platform_codec_freq_data *get_codec_freq_data (u32 session_type,u32 pixfmt,bool lite) { -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 *data = lite ? + codec_freq_data_lite : codec_freq_data; +unsigned int i, data_size = lite ?ARRAY_SIZE (codec_freq_data_lite) : +ARRAY_SIZE (codec_freq_data);I'm not a big fan anymore of ternary nor of declaring multiple things on one line.
And I'll preempt Konrad, reverse Christmas tree in the declaration where possible for preference.
Quoted 23 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +0
-6const struct hfi_platform_codec_freq_data *found =NULL ; -WARN_ON (lite); -for (i =0 ; i < data_size; i++) {if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) { found = &data[i];@@ -300,8 +428,6 @@ static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vpp_freq;@@ -313,8 +439,6 @@ static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->vsp_freq;drivers/media/platform/qcom/venus/hfi_platform_v4.c static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite) · line 454
Quoted 7 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +0
-2@@ -326,8 +450,6 @@ static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite) {const struct hfi_platform_codec_freq_data *data; -WARN_ON (lite); - data =get_codec_freq_data (session_type, codec, lite);if (data)return data->low_power_freq;I suppose the hard-coded *val = 5 || *val = 8; isn't important but it would be _nice_ to not hard-code, up to you how much you want to implement for the next version.
This code all looks reasonably correct/consistent with antecedents.
Reviewed-by Bryan O'Donoghue <[email protected]>---
bod
Re: [PATCH v7 1/7] media: dt-bindings: venus: Add qcm2290 dt schema
In reply to Bryan O'DonoghueQuoted 30 lines · Bryan O'Donoghue
Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Konrad Dybcio
Quoted 19 lines · Krzysztof Kozlowski
Quoted 6 lines · Jorge Ramirez
On 17/07/25 13:16:31, Jorge Ramirez wrote:
Not sure if I’ve shared this before, but following an internal discussion, I think it’s worth highlighting a functional dependency in the current kernel:
Quoted 8 lines
- the driver only works if the first two IOMMUs in the list — the
non-secure ones — are placed at the beginning. Reordering them breaks functionality, which introduces unexpected fragility.Regardless, this seems like a valid concern to me — a driver shouldn't rely on the order of phandles — and I just wanted to make sure you're aware of it before I post a v8 (likely sometime next week or the following, as I’ll be taking a short break soon).
Hm? Order of lists is strictly defined. That's actually an overlook that we never do it for iommus, but the core rule stays.
Quoted 6 lines
Quoted 1 line
(FWIW "items:" is an ordered list, "enum:" is unordered)
enum is not a list, but enumeration, meaning one item of multiple values.
Best regards,
Krzysztof
Quoted 6 lines
As Krzysztof says the ordering is strict.
I think the right-thing-to-do is to document in the commit log the dependency.
The final three entries are secure entries and the ordering is important.
sure, will do that
Quoted 3 lines
---
bod
Re: [PATCH v7 2/7] media: venus: Conditionally register codec nodes based on firmware version
In reply to Bryan O'DonoghueQuoted 97 lines · Bryan O'Donoghue
Quoted 45 lines · Jorge Ramirez
Quoted 35 lines · Bryan O'Donoghue
Quoted 34 lines · Jorge Ramirez-Ortiz
The encoding and decoding capabilities of a VPU can vary depending on the firmware version in use.
This commit adds support for platforms with
OF_DYNAMICenabled to conditionally skip the creation of codec device nodes at runtime if the loaded firmware does not support the corresponding functionality.Note that the driver becomes aware of the firmware version only after the HFI layer has been initialized.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 76 +++++++++++++++--------- drivers/media/platform/qcom/venus/core.h | 8 +++ 2 files changed, 57 insertions(+), 27 deletions(-)drivers/media/platform/qcom/venus/core.c +9
-0@@ -28,6 +28,15 @@#include "pm_helpers.h" #include "hfi_venus_io.h" +static inline bool venus_fw_supports_codec (struct venus_core *core, +const struct venus_min_fw *ver) +{ +if (!ver) +return true; + +return is_fw_rev_or_newer (core, ver->major, ver->minor, ver->rev); +} +static void venus_coredump (struct venus_core *core) {Quoted 8 lines
drivers/media/platform/qcom/venus/core.c static void venus_sys_error_handler(struct work_struct *work) · line 114
Quoted 6 lines
drivers/media/platform/qcom/venus/core.c +1
-1struct device *dev;@@ -103,7 +112,9 @@ static void venus_sys_error_handler(struct work_struct *work) core->state =CORE_UNINIT ;for (i =0 ; i < max_attempts; i++) { -if (!pm_runtime_active (core->dev_dec) && !pm_runtime_active (core->dev_enc)) +/* Not both nodes might be available */ "Neither node available" the latter for preference.
Quoted 1 line
what about "One or both nodes may be unavailable" ?
Ah great that actually explains it then, as you can see I didn't get the meaning from the comment.
Quoted 15 lines
Quoted 6 lines
drivers/media/platform/qcom/venus/core.c static void venus_sys_error_handler(struct work_struct *work) · line 117
Quoted 3 lines
drivers/media/platform/qcom/venus/core.c +2
-0+if ((!core->dev_dec || !pm_runtime_active (core->dev_dec)) && + (!core->dev_enc || !pm_runtime_active (core->dev_enc)))Is this change about registration or is it a fix trying to sneak in under the radar ?
I think this functionality - the ability to enable or disable individual encode/decode nodes based on firmware capabilities - should be standard across multimedia drivers.
For example, on the
AR50_LITEplatform, the _current_ driver/firmware combo does not support encoding as it requires secure buffer handling which is not yet implemented in the kernel (changes to iommu, etc)Quoted 5 lines
So, rather than disabling Venus entirely, I think it makes sense to expose the decoder node, which remains fully functional and unaffected by the secure buffer requirement.
Hence this commit (so yeah, I am not trying to sneak a fix, I swear!)
grand so.
Quoted 23 lines
Quoted 22 lines
Quoted 15 lines
drivers/media/platform/qcom/venus/core.c +2
-1break ;msleep (10 ); }@@ -202,7 +213,8 @@ static u32 to_v4l2_codec_type(u32 codec) } } -static int venus_enumerate_codecs (struct venus_core *core,u32 type) +static int venus_enumerate_codecs (struct venus_core *core,u32 type, +const struct venus_min_fw *ver) {const struct hfi_inst_ops dummy_ops = {};struct venus_inst *inst;drivers/media/platform/qcom/venus/core.c static int venus_enumerate_codecs(struct venus_core *core, u32 type) · line 228
Quoted 4 lines
drivers/media/platform/qcom/venus/core.c +2
-0@@ -213,6 +225,9 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)if (core->res->hfi_version !=HFI_VERSION_1XX )return 0 ; +if (!venus_fw_supports_codec (core, ver)) +return 0 ;Its not really a codec you're checking there, its a version.
The name should reflect that.
Quoted 8 lines
Quoted 3 lines
but the check isn't just about the firmware version: it is about whether the firmware in use supports a specific coded based on the firmware version knowledge built in the driver.
No OK "codec" is the right word.
---
bod
as per internal discussion - offline - I am replacing this feature for a simplified an "all or nothing" version: either the firmware version can support both the encoder and the decoder or none of them.
Re: [PATCH v7 3/7] media: venus: Add support for AR50_LITE video core
In reply to Jorge RamirezQuoted 93 lines · Jorge Ramirez
Quoted 50 lines · Bryan O'Donoghue
Quoted 40 lines · Jorge Ramirez
Quoted 25 lines
Quoted 12 lines
drivers/media/platform/qcom/venus/helpers.c +7
-0@@ -230,6 +230,24 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +void venus_helper_prepare_eos_data (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ;drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 248
Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10
-0+ +if (IS_V6 (core) &&is_fw_rev_or_older (core,1 ,0 ,87 )) +return ; + +if (IS_V4 (core) &&is_lite (core) &&is_fw_rev_or_older (core,6 ,0 ,53 )) + data->alloc_len =1 ; + + data->device_addr =0xdeadb000 ; +} +EXPORT_SYMBOL_GPL (venus_helper_prepare_eos_data);This function doesn't appear to have alot to do with
AR50_LITEas it pertains toIS_V6()andIS_V4().Quoted 2 lines
This I think should be a separate patch with its own commit log to describe the quite complex logic of version numbers going on here.
Let me give it some background:
According to the HFI specification, EOS (End-of-Stream) buffers must have 'valid' addresses. While the firmware currently appears to make no use of the EOS buffer contents, allocating and mapping them would have been a better driver choice IMO. Hoever this one has better performance which is probably the reason why it has stayed.
The firmware then does perform operations involving the buffer's size and length fields, and enforces boundary checks accordingly. On the
AR50_LITEplatform, an earlier firmware version lacked a check onalloc_len, leading to a division-by-zero scenario.Quoted 8 lines
This has been addressed, and we plan to release firmware version 6.0.54, which includes the necessary boundary check for
alloc_len.I should probaly replace
IS_V4(core)&&is_lite(core)withIS_AR50_LITE()instead of trying to give it the appearence of a design feature.seems the sensible thing to do, right?
Quoted 7 lines
I'll stipulate to all of that.
I know I'm being pedantic but, the title and subject of this patch is "
AR50_LITE" does stuff.As traveler from a mirror-universe - I would read the commit log here, look at this function and be none the wiser what was going on.
right this is because I think you saw through my inconsistency.
The truth is I should have written the function as below; and I think now there is a case for it being in this patch since it is addressing a firmware issue on the firmware release supporting this core which the patch is adding the functionality for.
void venus_helper_prepare_eos_data(struct
venus_inst*inst,
structhfi_frame_data*data){ struct venus_core *core = inst->core; data->buffer_type = HFI_BUFFER_INPUT; data->flags = HFI_BUFFERFLAG_EOS; if (IS_V6(core) && is_fw_rev_or_older(core, 1, 0, 87)) return; if (IS_AR50_LITE(core) && is_fw_rev_or_older(core, 6, 0, 53)) data->alloc_len = 1; data->device_addr = 0xdeadb000; }
EXPORT_SYMBOL_GPL(venus_helper_prepare_eos_data);what do you think? this is really just adding a the
AR50_LITEline to the existing implementation.Quoted 5 lines
The EOS check is a fundamental HFI capability which is why I again reiterate it deserves its own commit log with the above explanation - word-for-word would be fine from my POV, to explain what is going on.
Quoted 10 lines
umm not sure yet but if the above does not make you change your mind I'll do it.
Quoted 1 line
Long live the Empire!
:)
Quoted 3 lines
---
bod
will drop this - not needed since the decoder will not work except with the incoming 6.0.55 release (see below)
https://gitlab.com/kernel-firmware/linux-firmware/-/merge_requests/630
This firmware - on top of supporting the encoding functionality- removes the need for the dummy length.