media: venus: Add QCM2290 support with AR50_LITE core
Subsystems (6)
cover media: venus: Add QCM2290 support with AR50_LITE core
This patch series adds support for the Venus video decoder/encoder block present on the Qualcomm QCM2290.
The QCM2290 integrates an AR50_LITE core, a low-power implementation of Venus supporting H.264, HEVC (H.265), and VP9 decoding.
The series includes:
• DT binding schema for qcom,qcm2290-venus
• SoC integration via qcm2290.dtsi
• Resource table definitions and frequency scaling
• Platform capability registration for the AR50_LITE core
Decoding was verified on the QCOM RB1 platform using GStreamer with V4L2-based decode plugins. The following pipelines were used for playback 1280x720 and 1920x1080 H.264, HVEC and VP9 videos from https://www.elecard.com/videos.
[H.264]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h264parse ! v4l2h264dec \
! videoconvert ! autovideosink
[H.265]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h265parse ! v4l2h265dec \
! videoconvert ! autovideosink
[VP9]
gst-launch-1.0 filesrc location=videos/xxxxx.webm \
! matroskademus ! queue ! v4l2vp8dec \
! videoconvert ! autovideosink
---
Jorge Ramirez-Ortiz (5):
dt-bindings: media: venus: Add qcm2290 dt schema
arm64: dts: qcom: qcm2290: Add venus video node
media: venus: vdec: AR50_LITE video core support
media: venus: hfi_plat_v6_lite: Populate decode capabilities
media: venus: core: Add qcm2290 DT compatible and resource data
---
PATCH 1/5 dt-bindings: media: venus: Add qcm2290 dt schema
Add a schema for the venus video encoder/decoder on the qcm2290.
--- .../bindings/media/qcom,qcm2290-venus.yaml | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +153 -0
@@ -0,0 +1,153 @@ +# 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: + - Stanimir Varbanov <[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: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2 + 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 + + video-decoder: + type: object + + properties: + compatible: + const: venus-decoder + + required: + - compatible + + deprecated: true + additionalProperties: false + + video-encoder: + type: object + + properties: + compatible: + const: venus-encoder + + required: + - compatible + + deprecated: true + additionalProperties: false + +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 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + + video-decoder { + compatible = "venus-decoder"; + }; + + video-encoder { + compatible = "venus-encoder"; + }; + };
Signature · 1 line
2.34.1
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 152
Quoted 7 lines · Jorge Ramirez-Ortiz
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +7
-0+ video-decoder { + compatible = "venus-decoder"; + }; + + video-encoder { + compatible = "venus-encoder"; + };
Not necessary, drop.
---
bod
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 10 lines · Bryan O'Donoghue
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 152
Quoted 7 lines · Jorge Ramirez-Ortiz
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +7
-0+ video-decoder { + compatible = "venus-decoder"; + }; + + video-encoder { + compatible = "venus-encoder"; + };Not necessary, drop.
ok
Quoted 3 lines
---
bod
Re: [PATCH 1/5] dt-bindings: media: 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]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +2
-0@@ -0,0 +1,153 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 12
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+--- +$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: + - Stanimir Varbanov <[email protected]> + +description: |
Do not need '|' unless you need to preserve formatting.
Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0+ The Venus AR50_LITE IP is a video encode and decode accelerator present + on Qualcomm platforms + +allOf: + - $ref: qcom,venus-common.yaml# +
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+properties: + compatible: + const: qcom,qcm2290-venus + + power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2
Why is this flexible? Either you have two or three. Not mixed.
Quoted 34 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +34
-0+ 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 + + video-decoder:
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 72
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+ type: object + + properties: + compatible: + const: venus-decoder + + required: + - compatible + + deprecated: true
No, you cannot add new device which is already deprecated. It's like adding something which you already know is wrong, obsolete, legacy, something you don't want. If you don't want, don't add.
Best regards,
Krzysztof
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlDocumentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0@@ -0,0 +1,153 @@ +# 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 12
Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0+title: Qualcomm QCM2290 Venus video encode and decode accelerators + +maintainers: + - Stanimir Varbanov <[email protected]> + +description: |Do not need '|' unless you need to preserve formatting.
ack
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+ 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 +
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 28
Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0+ power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
please check 5b380f242f360256c96e96adabeb7ce9ec784306
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 20 lines · Jorge Ramirez
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+ 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 +Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 28
Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0+ power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306
This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
BTW, also subject prefixes needs fixing. For DTS: it is never "arch". For this patch: wrong order (see DT submitting patches).
Best regards,
Krzysztof
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez
Quoted 19 lines
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0+ The Venus AR50_LITE IP is a video encode and decode accelerator present + on Qualcomm platforms + +allOf: + - $ref: qcom,venus-common.yaml# +Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+properties: + compatible: + const: qcom,qcm2290-venus + + power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 5 lines
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
thanks for quick the follow up.
but bear with me please because I dont follow - why can the same logic be used - it being applicable - and therefore result in a definition similar to those other platforms?
how would I capture such a requirement if not as done in this patch?
Quoted 2 lines
BTW, also subject prefixes needs fixing. For DTS: it is never "arch".
right, that is for patch 2 but ok, will fix there.
Quoted 1 line
For this patch: wrong order (see DT submitting patches).
yep, that is addressed in the next series
TIA!
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 28 lines · Jorge Ramirez
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez
Quoted 19 lines
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0+ The Venus AR50_LITE IP is a video encode and decode accelerator present + on Qualcomm platforms + +allOf: + - $ref: qcom,venus-common.yaml# +Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+properties: + compatible: + const: qcom,qcm2290-venus + + power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 5 lines
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
Quoted 5 lines
thanks for quick the follow up.
but bear with me please because I dont follow - why can the same logic be used - it being applicable - and therefore result in a definition similar to those other platforms?
Because this platform either has 2 or 3, not both. Unless that's not true, but then please share some arguments.
Best regards,
Krzysztof
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Jorge Ramirez
Quoted 26 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +10
-0+ 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 +Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml line 28
Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +6
-0+ power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
Quoted 8 lines
Quoted 5 lines
thanks for quick the follow up.
but bear with me please because I dont follow - why can the same logic be used - it being applicable - and therefore result in a definition similar to those other platforms?
Because this platform either has 2 or 3, not both. Unless that's not true, but then please share some arguments.
as with every other venus schema with more than 1 power domain, the argument is the same one that I have shared with you a couple of messages back (DVFS).
verbatim:
Venus needs to vote for the performance state of a power domain (cx) to be able to support DVFS. This 'cx' power domain is controlled by rpm and is a common power domain (scalable) not specific to venus alone. This is optional in the sense that, leaving this power domain out does not really impact the functionality but just makes the platform a little less power efficient.
Seeing all these venus schemas follow the same pattern, it seems to me that this is the correct way of implementing the above.
You seem to disagree. please could you explain?
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 43 lines · Jorge Ramirez
Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Jorge Ramirez
Quoted 26 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez
Quoted 11 lines
Quoted 11 lines
(quoted diff) +10
-0+ 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 +Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
Quoted 8 lines
Quoted 5 lines
thanks for quick the follow up.
but bear with me please because I dont follow - why can the same logic be used - it being applicable - and therefore result in a definition similar to those other platforms?
Because this platform either has 2 or 3, not both. Unless that's not true, but then please share some arguments.
as with every other venus schema with more than 1 power domain, the argument is the same one that I have shared with you a couple of messages back (DVFS).
Quoted 7 lines
verbatim:
Venus needs to vote for the performance state of a power domain (cx) to be able to support DVFS. This 'cx' power domain is controlled by rpm and is a common power domain (scalable) not specific to venus alone. This is optional in the sense that, leaving this power domain out does not really impact the functionality but just makes the platform a little less power efficient.
That's not definition of optional. The domain is needed for this device, the device is one way or another having its rails routed to that domain. It is not optional.
Quoted 3 lines
Seeing all these venus schemas follow the same pattern, it seems to me that this is the correct way of implementing the above.
No for the reason I mentioned earlier.
Quoted 2 lines
You seem to disagree. please could you explain?
I already explained. You add new device, so argument to preserve ABI, which was accepted THAT TIME, is not valid. You do not have ABI.
Best regards,
Krzysztof
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 57 lines · Krzysztof Kozlowski
Quoted 43 lines · Jorge Ramirez
Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Jorge Ramirez
Quoted 26 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez
Quoted 11 lines
Quoted 11 lines
(quoted diff) +10
-0+ 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 +Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
Quoted 8 lines
Quoted 5 lines
thanks for quick the follow up.
but bear with me please because I dont follow - why can the same logic be used - it being applicable - and therefore result in a definition similar to those other platforms?
Because this platform either has 2 or 3, not both. Unless that's not true, but then please share some arguments.
as with every other venus schema with more than 1 power domain, the argument is the same one that I have shared with you a couple of messages back (DVFS).
Quoted 7 lines
verbatim:
Venus needs to vote for the performance state of a power domain (cx) to be able to support DVFS. This 'cx' power domain is controlled by rpm and is a common power domain (scalable) not specific to venus alone. This is optional in the sense that, leaving this power domain out does not really impact the functionality but just makes the platform a little less power efficient.That's not definition of optional. The domain is needed for this device, the device is one way or another having its rails routed to that domain. It is not optional.
Quoted 1 line
Quoted 4 lines
Quoted 2 lines
Seeing all these venus schemas follow the same pattern, it seems to me that this is the correct way of implementing the above.
No for the reason I mentioned earlier.
So just to close this story up, were these two commits wrongly reviewed and signed off then ? Please do notice they were also - just like this one - new additions and not a change in an ABI preserving way as you characterize them.
e48b839b6699c2268e545360e06962bb76ff5b8d8d3a1cb32124eaeb3f2efe4889de214d3b658d8d
Quoted 6 lines
Quoted 3 lines
You seem to disagree. please could you explain?
I already explained. You add new device, so argument to preserve ABI, which was accepted THAT TIME, is not valid. You do not have ABI.
as per the two commits above, this is not an argument to 'presereve' an ABI - this looks to me like an implementation.
anyhow, if everyone agrees this is the only way to move this forward will do just fix this to three then.
please let me know.
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 63 lines · Jorge Ramirez
Quoted 57 lines · Krzysztof Kozlowski
Quoted 43 lines · Jorge Ramirez
Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Jorge Ramirez
Quoted 26 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez
Quoted 11 lines
Quoted 11 lines
(quoted diff) +10
-0+ 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 +Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
Quoted 8 lines
Quoted 5 lines
thanks for quick the follow up.
but bear with me please because I dont follow - why can the same logic be used - it being applicable - and therefore result in a definition similar to those other platforms?
Because this platform either has 2 or 3, not both. Unless that's not true, but then please share some arguments.
as with every other venus schema with more than 1 power domain, the argument is the same one that I have shared with you a couple of messages back (DVFS).
Quoted 7 lines
verbatim:
Venus needs to vote for the performance state of a power domain (cx) to be able to support DVFS. This 'cx' power domain is controlled by rpm and is a common power domain (scalable) not specific to venus alone. This is optional in the sense that, leaving this power domain out does not really impact the functionality but just makes the platform a little less power efficient.That's not definition of optional. The domain is needed for this device, the device is one way or another having its rails routed to that domain. It is not optional.
Quoted 1 line
Quoted 4 lines
Quoted 2 lines
Seeing all these venus schemas follow the same pattern, it seems to me that this is the correct way of implementing the above.
No for the reason I mentioned earlier.
Quoted 7 lines
So just to close this story up, were these two commits wrongly reviewed and signed off then ? Please do notice they were also - just like this one - new additions and not a change in an ABI preserving way as you characterize them.
e48b839b6699c2268e545360e06962bb76ff5b8d8d3a1cb32124eaeb3f2efe4889de214d3b658d8d
I was waiting for this argument: there was something similar some years ago (but even months ago...) and it got reviewed, so I can do the same.
You can even go further back. Take commits for DT bindings from 2013 and use that against our new review. So many different things were accepted in 2013.
You can take any driver code from 2013. Huh, people actually do! People still send .owner=THIS_MODULE. In 2013 this was reviewed and accepted, so I can send it, right?
And then people are not happy that they patches receive too much detailed review or review takes too much time or whatever other reason... Yeah if any review you ever give will be some day used against you, you would think 10 times and be 10 times more picky then necessary.
This is like an ultimate, super, triple combo argument against reviewers and maintainers to discredit their work. I will not play such games.
Best regards,
Krzysztof
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 69 lines · Krzysztof Kozlowski
Quoted 68 lines · Jorge Ramirez
Quoted 57 lines · Krzysztof Kozlowski
Quoted 43 lines · Jorge Ramirez
Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Jorge Ramirez
Quoted 26 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez
Quoted 11 lines
Quoted 11 lines
(quoted diff) +10
-0+ 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 +Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
Quoted 8 lines
Quoted 5 lines
thanks for quick the follow up.
but bear with me please because I dont follow - why can the same logic be used - it being applicable - and therefore result in a definition similar to those other platforms?
Because this platform either has 2 or 3, not both. Unless that's not true, but then please share some arguments.
as with every other venus schema with more than 1 power domain, the argument is the same one that I have shared with you a couple of messages back (DVFS).
Quoted 7 lines
verbatim:
Venus needs to vote for the performance state of a power domain (cx) to be able to support DVFS. This 'cx' power domain is controlled by rpm and is a common power domain (scalable) not specific to venus alone. This is optional in the sense that, leaving this power domain out does not really impact the functionality but just makes the platform a little less power efficient.That's not definition of optional. The domain is needed for this device, the device is one way or another having its rails routed to that domain. It is not optional.
Quoted 1 line
Quoted 4 lines
Quoted 2 lines
Seeing all these venus schemas follow the same pattern, it seems to me that this is the correct way of implementing the above.
No for the reason I mentioned earlier.
So just to close this story up, were these two commits wrongly reviewed and signed off then ? Please do notice they were also - just like this one - new additions and not a change in an ABI preserving way as you characterize them.
Quoted 6 lines
Quoted 2 lines
e48b839b6699c2268e545360e06962bb76ff5b8d8d3a1cb32124eaeb3f2efe4889de214d3b658d8dI was waiting for this argument: there was something similar some years ago (but even months ago...) and it got reviewed, so I can do the same.
how could you not? two opposing schema views can not be right. If you knew this, you should have raised. There is only so many hours in a day.
Quoted 8 lines
You can even go further back. Take commits for DT bindings from 2013 and use that against our new review. So many different things were accepted in 2013.
You can take any driver code from 2013. Huh, people actually do! People still send .owner=THIS_MODULE. In 2013 this was reviewed and accepted, so I can send it, right?
Quoted 7 lines
And then people are not happy that they patches receive too much detailed review or review takes too much time or whatever other reason... Yeah if any review you ever give will be some day used against you, you would think 10 times and be 10 times more picky then necessary.
This is like an ultimate, super, triple combo argument against reviewers and maintainers to discredit their work. I will not play such games.
huh? You are overthinking this: I have zero interest on evaluating anyones work; however I need to make sure we do the right thing when merging this - discussing previous interpretations in search of a coherent story is not "discrediting" but the obvious thing to do (do not assume malice let alone throw straw-man my way).
What you are asking me to do is not consistent with what has been done in the past: since those commits were signed by well known maintainers just as yourself I needed to understand the delta as well as making sure everyone is aligned.
I understood your point, but I also understood theirs as being accepted. hence I need someone to confirm which way to go. if that someone is yourself, just confirm it and I'll move forward.
Re: [PATCH 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 70 lines · Jorge Ramirez
Quoted 69 lines · Krzysztof Kozlowski
Quoted 68 lines · Jorge Ramirez
Quoted 57 lines · Krzysztof Kozlowski
Quoted 43 lines · Jorge Ramirez
Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Jorge Ramirez
Quoted 26 lines · Krzysztof Kozlowski
Quoted 20 lines · Jorge Ramirez
Quoted 11 lines
Quoted 11 lines
(quoted diff) +10
-0+ 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 +Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ power-domains: + minItems: 2 + maxItems: 3 + + power-domain-names: + minItems: 2Why is this flexible? Either you have two or three. Not mixed.
Quoted 1 line
please check
5b380f242f360256c96e96adabeb7ce9ec784306This does not explain why this is optional HERE. You cannot use for a new platform an argument that some existing platform was changed in ABI-preserving way.
Quoted 8 lines
Quoted 5 lines
thanks for quick the follow up.
but bear with me please because I dont follow - why can the same logic be used - it being applicable - and therefore result in a definition similar to those other platforms?
Because this platform either has 2 or 3, not both. Unless that's not true, but then please share some arguments.
as with every other venus schema with more than 1 power domain, the argument is the same one that I have shared with you a couple of messages back (DVFS).
Quoted 7 lines
verbatim:
Venus needs to vote for the performance state of a power domain (cx) to be able to support DVFS. This 'cx' power domain is controlled by rpm and is a common power domain (scalable) not specific to venus alone. This is optional in the sense that, leaving this power domain out does not really impact the functionality but just makes the platform a little less power efficient.That's not definition of optional. The domain is needed for this device, the device is one way or another having its rails routed to that domain. It is not optional.
Quoted 1 line
Quoted 4 lines
Quoted 2 lines
Seeing all these venus schemas follow the same pattern, it seems to me that this is the correct way of implementing the above.
No for the reason I mentioned earlier.
So just to close this story up, were these two commits wrongly reviewed and signed off then ? Please do notice they were also - just like this one - new additions and not a change in an ABI preserving way as you characterize them.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
e48b839b6699c2268e545360e06962bb76ff5b8d8d3a1cb32124eaeb3f2efe4889de214d3b658d8dI was waiting for this argument: there was something similar some years ago (but even months ago...) and it got reviewed, so I can do the same.
Waiting and hoping discussion will end earlier... but I guess I should anticipate your arguments and find preemptively some commits from 4 years ago. Well, I have just 100 patches on patchwork with status "Needs Review", so I will not go through past commits anticipating other persons arguments when reviewing that person's patches.
Help in reviews is always appreciated, especially if by any chance you are unhappy with me not having time to bring past commits into the review discussions.
Best regards,
Krzysztof
PATCH 2/5 arch: 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 | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +53 -0
@@ -1628,6 +1628,59 @@ adreno_smmu: iommu@59a0000 { #iommu-cells = <2>; }; + venus: video-codec@5a00000 { + compatible = "qcom,qcm2290-venus"; + reg = <0 0x5a00000 0 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + + video-decoder { + compatible = "venus-decoder"; + }; + + video-encoder { + compatible = "venus-encoder"; + }; + }; + mdss: display-subsystem@5e00000 { compatible = "qcom,qcm2290-mdss"; reg = <0x0 0x05e00000 0x0 0x1000>;
Signature · 1 line
2.34.1
Re: [PATCH 2/5] arch: arm64: dts: qcom: qcm2290: Add venus video node
Quoted 56 lines · Jorge Ramirez-Ortiz
Add DT entries for the qcm2290 venus encoder/decoder.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm64/boot/dts/qcom/qcm2290.dtsi | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)arch/arm64/boot/dts/qcom/qcm2290.dtsi +41
-0@@ -1628,6 +1628,59 @@ adreno_smmu: iommu@59a0000 { #iommu-cells = <2>; }; + venus: video-codec@5a00000 { + compatible = "qcom,qcm2290-venus"; + reg = <0 0x5a00000 0 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>;
arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1681
Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10
-0+ }; + }; + + video-decoder { + compatible = "venus-decoder"; + }; + + video-encoder { + compatible = "venus-encoder"; + };
These should be dropped in favour of static config in the driver.
arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1686
Quoted 5 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +2
-0+ }; + mdss: display-subsystem@5e00000 { compatible = "qcom,qcm2290-mdss"; reg = <0x0 0x05e00000 0x0 0x1000>;
---
bod
Re: [PATCH 2/5] arch: arm64: dts: qcom: qcm2290: Add venus video node
Quoted 60 lines · Bryan O'Donoghue
Quoted 59 lines · Jorge Ramirez-Ortiz
Add DT entries for the qcm2290 venus encoder/decoder.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm64/boot/dts/qcom/qcm2290.dtsi | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)arch/arm64/boot/dts/qcom/qcm2290.dtsi +45
-0@@ -1628,6 +1628,59 @@ adreno_smmu: iommu@59a0000 { #iommu-cells = <2>; }; + venus: video-codec@5a00000 { + compatible = "qcom,qcm2290-venus"; + reg = <0 0x5a00000 0 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + + video-decoder {
Quoted 9 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1681
Quoted 6 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +6
-0+ compatible = "venus-decoder"; + }; + + video-encoder { + compatible = "venus-encoder"; + };These should be dropped in favour of static config in the driver.
OK
Quoted 8 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1686
Quoted 5 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +2
-0+ }; + mdss: display-subsystem@5e00000 { compatible = "qcom,qcm2290-mdss"; reg = <0x0 0x05e00000 0x0 0x1000>;---
bod
Re: [PATCH 2/5] arch: arm64: dts: qcom: qcm2290: Add venus video node
In reply to Jorge Ramirez-OrtizQuoted 5 lines · Jorge Ramirez-Ortiz
Add DT entries for the qcm2290 venus encoder/decoder.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm64/boot/dts/qcom/qcm2290.dtsi | 53 +++++++++++++++++++++++++++
DTS cannot be a dependency for driver. Order your patches correctly (see dts coding style, soc maintainer rules or internal guidelines).
Quoted 46 lines
1 file changed, 53 insertions(+)arch/arm64/boot/dts/qcom/qcm2290.dtsi +36
-0@@ -1628,6 +1628,59 @@ adreno_smmu: iommu@59a0000 { #iommu-cells = <2>; }; + venus: video-codec@5a00000 { + compatible = "qcom,qcm2290-venus"; + reg = <0 0x5a00000 0 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>;
arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1676
Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +10
-0+ }; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + + video-decoder { + compatible = "venus-decoder";
Don't add deprecated properties.
Best regards,
Krzysztof
Re: [PATCH 2/5] arch: arm64: dts: qcom: qcm2290: Add venus video node
Quoted 60 lines · Krzysztof Kozlowski
Quoted 5 lines · Jorge Ramirez-Ortiz
Add DT entries for the qcm2290 venus encoder/decoder.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm64/boot/dts/qcom/qcm2290.dtsi | 53 +++++++++++++++++++++++++++DTS cannot be a dependency for driver. Order your patches correctly (see dts coding style, soc maintainer rules or internal guidelines).
Quoted 50 lines
1 file changed, 53 insertions(+)arch/arm64/boot/dts/qcom/qcm2290.dtsi +40
-0@@ -1628,6 +1628,59 @@ adreno_smmu: iommu@59a0000 { #iommu-cells = <2>; }; + venus: video-codec@5a00000 { + compatible = "qcom,qcm2290-venus"; + reg = <0 0x5a00000 0 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000>;
Quoted 8 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1676
Quoted 6 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +6
-0+ required-opps = <&rpmpd_opp_svs>; + }; + }; + + video-decoder { + compatible = "venus-decoder";Don't add deprecated properties.
right - Bryan mentioned. my bad.
Quoted 3 lines
Best regards,
Krzysztof
PATCH 3/5 media: venus: vdec: ar50_lite video core support
In reply to Jorge Ramirez-OrtizThe AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.
It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.
--- drivers/media/platform/qcom/venus/core.c | 11 ++- drivers/media/platform/qcom/venus/core.h | 5 +- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 +++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 ++- drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++-- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 ++-- 9 files changed, 123 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)static void venus_assign_register_offsets (struct venus_core *core) { -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { - core->vbif_base = core->base +VBIF_BASE ; +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) { core->cpu_base = core->base +CPU_BASE_V6 ; core->cpu_cs_base = core->base +CPU_CS_BASE_V6 ; core->cpu_ic_base = core->base +CPU_IC_BASE_V6 ; core->wrapper_base = core->base +WRAPPER_BASE_V6 ; core->wrapper_tz_base = core->base +WRAPPER_TZ_BASE_V6 ; - core->aon_base = core->base +AON_BASE_V6 ; +if (IS_AR50_LITE (core)) { + core->vbif_base =NULL ; + core->aon_base =NULL ; + }else { + core->vbif_base = core->base +VBIF_BASE ; + core->aon_base = core->base +AON_BASE_V6 ; + } }else { core->vbif_base = core->base +VBIF_BASE ; core->cpu_base = core->base +CPU_BASE ;
drivers/media/platform/qcom/venus/core.h +4 -1
@@ -382,6 +382,7 @@ enum venus_inst_modes {* @lock: instance lock * @core: a reference to the core struct * @clk_data: clock data per core ID +* @eosbufs: a lit of EOS buffers * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {struct mutex lock;struct venus_core *core;struct clock_data clk_data; +struct list_head eosbufs;struct list_head dpbbufs;struct list_head internalbufs;struct list_head registeredbufs;
@@ -520,7 +522,8 @@ struct venus_inst {#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)#define IS_V3 (core) ((core)->res->hfi_version == HFI_VERSION_3XX)#define IS_V4 (core) ((core)->res->hfi_version == HFI_VERSION_4XX) -#define IS_V6 (core) ((core)->res->hfi_version == HFI_VERSION_6XX) +#define IS_V6 (core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \ + ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))#define IS_AR50 (core) ((core)->res->vpu_version == VPU_VERSION_AR50)#define IS_AR50_LITE (core) ((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +4 -4
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)u32 fw_size = core->fw.mapped_mem_size;void __iomem *wrapper_base; -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) wrapper_base = core->wrapper_tz_base;else wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)writel (fw_size, wrapper_base +WRAPPER_NONPIX_START_ADDR );writel (fw_size, wrapper_base +WRAPPER_NONPIX_END_ADDR ); -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Bring XTSS out of reset */ writel (0 , wrapper_base +WRAPPER_TZ_XTSS_SW_RESET ); }else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)if (resume) {venus_reset_cpu (core); }else { -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))writel (WRAPPER_XTSS_SW_RESET_BIT , core->wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET );else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)void __iomem *wrapper_base = core->wrapper_base;void __iomem *wrapper_tz_base = core->wrapper_tz_base; -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Assert the reset to XTSS */ reg =readl (wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET ); reg |=WRAPPER_XTSS_SW_RESET_BIT ;
drivers/media/platform/qcom/venus/helpers.c +81 -0
93 lines not on this page · raw message
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); +int venus_helper_alloc_eos_buf (struct venus_inst *inst,struct hfi_frame_data *data); +int venus_helper_free_eos_bufs (struct venus_inst *inst);int venus_helper_intbufs_alloc (struct venus_inst *inst);int venus_helper_intbufs_free (struct venus_inst *inst);int venus_helper_intbufs_realloc (struct venus_inst *inst);
drivers/media/platform/qcom/venus/hfi_helper.h +7 -3
@@ -397,13 +397,16 @@#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5#define HFI_BUFFER_INTERNAL_SCRATCH (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x6 : 0x1000001)#define HFI_BUFFER_INTERNAL_SCRATCH_1 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x7 : 0x1000005)#define HFI_BUFFER_INTERNAL_SCRATCH_2 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x8 : 0x1000006)#define HFI_BUFFER_EXTRADATA_INPUT (ver) \ (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)#define HFI_BUFFER_EXTRADATA_OUTPUT (ver) \
@@ -561,6 +564,7 @@ enum hfi_version {HFI_VERSION_3XX ,HFI_VERSION_4XX ,HFI_VERSION_6XX , + HFI_VERSION_6XX_LITE, }; struct hfi_buffer_info {
drivers/media/platform/qcom/venus/hfi_venus.c +9 -5
@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)if (count >= max_tries) ret = -ETIMEDOUT ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) {writel (0x1 , cpu_cs_base +CPU_CS_H2XSOFTINTEN_V6 );writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }
@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)u32 mask_val;int ret; +if (IS_AR50_LITE (hdev->core)) +return 0 ; +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) {writel (0x3 , cpu_cs_base +CPU_CS_X2RPMH_V6 );
@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base = hdev->core->wrapper_base; status =readl (wrapper_base +WRAPPER_INTR_STATUS ); -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { + +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )
@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core) hdev->irq_status = status; }writel (1 , cpu_cs_base +CPU_CS_A2HSOFTINTCLR ); -if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core))) +if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)))writel (status, wrapper_base +WRAPPER_INTR_CLEAR );return IRQ_WAKE_THREAD ;
@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );
@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );
drivers/media/platform/qcom/venus/pm_helpers.c +1 -0
@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)return &pm_ops_v3;case HFI_VERSION_4XX :case HFI_VERSION_6XX : +case HFI_VERSION_6XX_LITE :return &pm_ops_v4; }
drivers/media/platform/qcom/venus/vdec.c +7 -8
@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) {struct venus_inst *inst =to_inst (file);struct vb2_queue *dst_vq; -struct hfi_frame_data fdata = {0 }; +struct hfi_frame_data fdata;int ret; ret =v4l2_m2m_ioctl_try_decoder_cmd (file, fh, cmd);
@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)if (cmd->cmd ==V4L2_DEC_CMD_STOP ) {/* -* Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on +* Implement V4L2_DEC_CMD_STOP by enqueue a buffer on * decoder input to signal EOS. */ if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; - fdata.buffer_type =HFI_BUFFER_INPUT ; - fdata.flags |=HFI_BUFFERFLAG_EOS ; -if (IS_V6 (inst->core) &&is_fw_rev_or_older (inst->core,1 ,0 ,87 )) - fdata.device_addr =0 ; -else - fdata.device_addr =0xdeadb000 ; + ret =venus_helper_alloc_eos_buf (inst, &fdata); +if (ret) + goto unlock; ret =hfi_session_process_buf (inst, &fdata);
@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)hfi_session_abort (inst);venus_helper_free_dpb_bufs (inst); +venus_helper_free_eos_bufs (inst);venus_pm_load_scale (inst);INIT_LIST_HEAD (&inst->registeredbufs);mutex_unlock (&inst->lock);
@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)if (!inst)return -ENOMEM ; +INIT_LIST_HEAD (&inst->eosbufs);INIT_LIST_HEAD (&inst->dpbbufs);INIT_LIST_HEAD (&inst->registeredbufs);INIT_LIST_HEAD (&inst->internalbufs);
Signature · 1 line
2.34.1
Re: [PATCH 3/5] media: venus: vdec: ar50_lite video core support
Quoted 24 lines · Jorge Ramirez-Ortiz
The
AR50_LITEis a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 11 ++- drivers/media/platform/qcom/venus/core.h | 5 +- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 +++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 ++- drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++-- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 ++-- 9 files changed, 123 insertions(+), 24 deletions(-)drivers/media/platform/qcom/venus/core.c +0
-0
drivers/media/platform/qcom/venus/core.c static int venus_enumerate_codecs(struct venus_core *core, u32 type) · line 257
Quoted 6 lines
drivers/media/platform/qcom/venus/core.c +1
-2@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)static void venus_assign_register_offsets (struct venus_core *core) { -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { - core->vbif_base = core->base +VBIF_BASE ; +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {
Is there a property that IS_IRIS_2_1 || IS_AR50_LITE that we could use instead of expanding this IS_THING list ?
Quoted 51 lines
drivers/media/platform/qcom/venus/core.c +7
-1core->cpu_base = core->base +CPU_BASE_V6 ; core->cpu_cs_base = core->base +CPU_CS_BASE_V6 ; core->cpu_ic_base = core->base +CPU_IC_BASE_V6 ; core->wrapper_base = core->base +WRAPPER_BASE_V6 ; core->wrapper_tz_base = core->base +WRAPPER_TZ_BASE_V6 ; - core->aon_base = core->base +AON_BASE_V6 ; +if (IS_AR50_LITE (core)) { + core->vbif_base =NULL ; + core->aon_base =NULL ; + }else { + core->vbif_base = core->base +VBIF_BASE ; + core->aon_base = core->base +AON_BASE_V6 ; + } }else { core->vbif_base = core->base +VBIF_BASE ; core->cpu_base = core->base +CPU_BASE ;drivers/media/platform/qcom/venus/core.h +4
-1@@ -382,6 +382,7 @@ enum venus_inst_modes {* @lock: instance lock * @core: a reference to the core struct * @clk_data: clock data per core ID +* @eosbufs: a lit of EOS buffers * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes @@ -450,6 +451,7 @@ struct venus_inst {struct mutex lock;struct venus_core *core;struct clock_data clk_data; +struct list_head eosbufs;struct list_head dpbbufs;struct list_head internalbufs;struct list_head registeredbufs;@@ -520,7 +522,8 @@ struct venus_inst {#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)#define IS_V3 (core) ((core)->res->hfi_version == HFI_VERSION_3XX)#define IS_V4 (core) ((core)->res->hfi_version == HFI_VERSION_4XX) -#define IS_V6 (core) ((core)->res->hfi_version == HFI_VERSION_6XX) +#define IS_V6 (core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \ + ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))#define IS_AR50 (core) ((core)->res->vpu_version == VPU_VERSION_AR50)#define IS_AR50_LITE (core) ((core)->res->vpu_version == VPU_VERSION_AR50_LITE)drivers/media/platform/qcom/venus/firmware.c +0
-0
drivers/media/platform/qcom/venus/firmware.c static void venus_reset_cpu(struct venus_core *core) · line 33
Quoted 5 lines
drivers/media/platform/qcom/venus/firmware.c +1
-1@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)u32 fw_size = core->fw.mapped_mem_size;void __iomem *wrapper_base; -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))
For example here.
Quoted 51 lines
drivers/media/platform/qcom/venus/firmware.c +3
-3wrapper_base = core->wrapper_tz_base; else wrapper_base = core->wrapper_base;@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)writel (fw_size, wrapper_base +WRAPPER_NONPIX_START_ADDR );writel (fw_size, wrapper_base +WRAPPER_NONPIX_END_ADDR ); -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Bring XTSS out of reset */ writel (0 , wrapper_base +WRAPPER_TZ_XTSS_SW_RESET ); }else {@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)if (resume) {venus_reset_cpu (core); }else { -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))writel (WRAPPER_XTSS_SW_RESET_BIT , core->wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET );else @@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)void __iomem *wrapper_base = core->wrapper_base;void __iomem *wrapper_tz_base = core->wrapper_tz_base; -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Assert the reset to XTSS */ reg =readl (wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET ); reg |=WRAPPER_XTSS_SW_RESET_BIT ;drivers/media/platform/qcom/venus/helpers.c +13
-0@@ -230,6 +230,80 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +static void free_eos_buf (struct venus_inst *inst,struct intbuf *buf) +{ +list_del_init (&buf->list); +dma_free_attrs (inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); +kfree (buf); +} + +int venus_helper_free_eos_bufs (struct venus_inst *inst) +{ +struct intbuf *buf, *n; + +list_for_each_entry_safe (buf, n, &inst->eosbufs, list) {
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 255
Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10
-0+free_eos_buf (inst, buf); + } + +if (list_empty (&inst->eosbufs)) +INIT_LIST_HEAD (&inst->eosbufs); + +return 0 ; + +} +EXPORT_SYMBOL_GPL (venus_helper_free_eos_bufs);
These EOS buf things look like they are not specific to ar50, could you add these in a preceding patch to this ?
Quoted 40 lines
drivers/media/platform/qcom/venus/helpers.c +40
-0+ +int venus_helper_alloc_eos_buf (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; +struct device *dev = core->dev; +struct intbuf *buf; +int ret =0 ; + +memset (data,0 ,sizeof (*data)); + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ; + +if (IS_AR50_LITE (inst->core)) { +/* We must send valid sizes and addresses */ + buf =kzalloc (sizeof (*buf),GFP_KERNEL ); +if (!buf) { + ret = -ENOMEM ; + goto fail; + } + + buf->type =HFI_BUFFER_INPUT ; + buf->size =SZ_4K ; + buf->attrs =DMA_ATTR_NO_KERNEL_MAPPING ; + buf->va =dma_alloc_attrs (dev, buf->size, &buf->da,GFP_KERNEL , + buf->attrs); +if (!buf->va) { + ret = -ENOMEM ; + goto fail; + } + +list_add_tail (&buf->list, &inst->eosbufs); + + data->alloc_len = buf->size; + data->device_addr = buf->da; + + }else if (IS_V6 (inst->core) && +is_fw_rev_or_older (inst->core,1 ,0 ,87 )) { + data->device_addr =0 ;
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 305
Quoted 10 lines
drivers/media/platform/qcom/venus/helpers.c +10
-0+ }else { + data->device_addr =0xdeadb000 ; + } + +return 0 ; +fail: +kfree (buf); +return ret; +} +EXPORT_SYMBOL_GPL (venus_helper_alloc_eos_buf);
I think the series would be nicer if the EOS buf decomposition stuff went into a patch that preceded this one, and then you add the IS_AR50_LITE() in the next patch progressively.
Quoted 180 lines
drivers/media/platform/qcom/venus/helpers.c +8
-0+static int intbufs_set_buffer (struct venus_inst *inst,u32 type) {struct venus_core *core = inst->core;@@ -630,6 +704,13 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,if (!hfi_plat || !hfi_plat->bufreq)return -EINVAL ; +/* Firmware buffer requirements for internal buffers only */ +if (IS_AR50_LITE (inst->core)) +if ((buftype !=HFI_BUFFER_INPUT ) && + (buftype !=HFI_BUFFER_OUTPUT ) && + (buftype !=HFI_BUFFER_OUTPUT2 )) +return -EINVAL ; + params.version = version; params.num_vpp_pipes = inst->core->res->num_vpp_pipes;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); +int venus_helper_alloc_eos_buf (struct venus_inst *inst,struct hfi_frame_data *data); +int venus_helper_free_eos_bufs (struct venus_inst *inst);int venus_helper_intbufs_alloc (struct venus_inst *inst);int venus_helper_intbufs_free (struct venus_inst *inst);int venus_helper_intbufs_realloc (struct venus_inst *inst);drivers/media/platform/qcom/venus/hfi_helper.h +7
-3@@ -397,13 +397,16 @@#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5#define HFI_BUFFER_INTERNAL_SCRATCH (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x6 : 0x1000001)#define HFI_BUFFER_INTERNAL_SCRATCH_1 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x7 : 0x1000005)#define HFI_BUFFER_INTERNAL_SCRATCH_2 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x8 : 0x1000006)#define HFI_BUFFER_EXTRADATA_INPUT (ver) \ (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)#define HFI_BUFFER_EXTRADATA_OUTPUT (ver) \@@ -561,6 +564,7 @@ enum hfi_version {HFI_VERSION_3XX ,HFI_VERSION_4XX ,HFI_VERSION_6XX , + HFI_VERSION_6XX_LITE, }; struct hfi_buffer_info {drivers/media/platform/qcom/venus/hfi_venus.c +9
-5@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)if (count >= max_tries) ret = -ETIMEDOUT ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) {writel (0x1 , cpu_cs_base +CPU_CS_H2XSOFTINTEN_V6 );writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)u32 mask_val;int ret; +if (IS_AR50_LITE (hdev->core)) +return 0 ; +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) {writel (0x3 , cpu_cs_base +CPU_CS_X2RPMH_V6 );@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base = hdev->core->wrapper_base; status =readl (wrapper_base +WRAPPER_INTR_STATUS ); -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { + +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core) hdev->irq_status = status; }writel (1 , cpu_cs_base +CPU_CS_A2HSOFTINTCLR ); -if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core))) +if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)))writel (status, wrapper_base +WRAPPER_INTR_CLEAR );return IRQ_WAKE_THREAD ;@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );drivers/media/platform/qcom/venus/pm_helpers.c +1
-0@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)return &pm_ops_v3;case HFI_VERSION_4XX :case HFI_VERSION_6XX : +case HFI_VERSION_6XX_LITE :return &pm_ops_v4; }drivers/media/platform/qcom/venus/vdec.c +6
-8@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) {struct venus_inst *inst =to_inst (file);struct vb2_queue *dst_vq; -struct hfi_frame_data fdata = {0 }; +struct hfi_frame_data fdata;int ret; ret =v4l2_m2m_ioctl_try_decoder_cmd (file, fh, cmd);@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)if (cmd->cmd ==V4L2_DEC_CMD_STOP ) {/* -* Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on +* Implement V4L2_DEC_CMD_STOP by enqueue a buffer on * decoder input to signal EOS. */ if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; - fdata.buffer_type =HFI_BUFFER_INPUT ; - fdata.flags |=HFI_BUFFERFLAG_EOS ; -if (IS_V6 (inst->core) &&is_fw_rev_or_older (inst->core,1 ,0 ,87 )) - fdata.device_addr =0 ; -else - fdata.device_addr =0xdeadb000 ; + ret =venus_helper_alloc_eos_buf (inst, &fdata); +if (ret) + goto unlock; ret =hfi_session_process_buf (inst, &fdata);@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)hfi_session_abort (inst);venus_helper_free_dpb_bufs (inst); +venus_helper_free_eos_bufs (inst);venus_pm_load_scale (inst);INIT_LIST_HEAD (&inst->registeredbufs);mutex_unlock (&inst->lock);
drivers/media/platform/qcom/venus/vdec.c static int vdec_open(struct file *file) · line 1686
Quoted 7 lines
drivers/media/platform/qcom/venus/vdec.c +1
-0@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)if (!inst)return -ENOMEM ; +INIT_LIST_HEAD (&inst->eosbufs);INIT_LIST_HEAD (&inst->dpbbufs);INIT_LIST_HEAD (&inst->registeredbufs);INIT_LIST_HEAD (&inst->internalbufs);
Otherwise LGTM.
---
bod
Re: [PATCH 3/5] media: venus: vdec: ar50_lite video core support
Quoted 20 lines · Bryan O'Donoghue
Quoted 19 lines · Jorge Ramirez-Ortiz
The
AR50_LITEis a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 11 ++- drivers/media/platform/qcom/venus/core.h | 5 +- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 +++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 ++- drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++-- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 ++-- 9 files changed, 123 insertions(+), 24 deletions(-)
Quoted 13 lines
drivers/media/platform/qcom/venus/core.c static int venus_enumerate_codecs(struct venus_core *core, u32 type) · line 256
Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +1
-2@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)static void venus_assign_register_offsets (struct venus_core *core) { -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { - core->vbif_base = core->base +VBIF_BASE ; +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {Is there a property that
IS_IRIS_2_1||IS_AR50_LITEthat we could use instead of expanding thisIS_THINGlist ?
I know what you mean but I think looking for possible comonalities between cores will just make the partitioning more obscure.
we could perhaps define a different type of macro ie, something like IS_CORE(core, IRIS2, IRIS2_1, AR50_LITE) ? shall I go ahead with this type of macro instead?
Quoted 112 lines
Quoted 52 lines
drivers/media/platform/qcom/venus/core.c +7
-1core->cpu_base = core->base +CPU_BASE_V6 ; core->cpu_cs_base = core->base +CPU_CS_BASE_V6 ; core->cpu_ic_base = core->base +CPU_IC_BASE_V6 ; core->wrapper_base = core->base +WRAPPER_BASE_V6 ; core->wrapper_tz_base = core->base +WRAPPER_TZ_BASE_V6 ; - core->aon_base = core->base +AON_BASE_V6 ; +if (IS_AR50_LITE (core)) { + core->vbif_base =NULL ; + core->aon_base =NULL ; + }else { + core->vbif_base = core->base +VBIF_BASE ; + core->aon_base = core->base +AON_BASE_V6 ; + } }else { core->vbif_base = core->base +VBIF_BASE ; core->cpu_base = core->base +CPU_BASE ;drivers/media/platform/qcom/venus/core.h +4
-1@@ -382,6 +382,7 @@ enum venus_inst_modes {* @lock: instance lock * @core: a reference to the core struct * @clk_data: clock data per core ID +* @eosbufs: a lit of EOS buffers * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes @@ -450,6 +451,7 @@ struct venus_inst {struct mutex lock;struct venus_core *core;struct clock_data clk_data; +struct list_head eosbufs;struct list_head dpbbufs;struct list_head internalbufs;struct list_head registeredbufs;@@ -520,7 +522,8 @@ struct venus_inst {#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)#define IS_V3 (core) ((core)->res->hfi_version == HFI_VERSION_3XX)#define IS_V4 (core) ((core)->res->hfi_version == HFI_VERSION_4XX) -#define IS_V6 (core) ((core)->res->hfi_version == HFI_VERSION_6XX) +#define IS_V6 (core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \ + ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))#define IS_AR50 (core) ((core)->res->vpu_version == VPU_VERSION_AR50)#define IS_AR50_LITE (core) ((core)->res->vpu_version == VPU_VERSION_AR50_LITE)drivers/media/platform/qcom/venus/firmware.c +0
-0drivers/media/platform/qcom/venus/firmware.c static void venus_reset_cpu(struct venus_core *core) · line 32
Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.c +1
-1@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)u32 fw_size = core->fw.mapped_mem_size;void __iomem *wrapper_base; -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))For example here.
Quoted 53 lines
drivers/media/platform/qcom/venus/firmware.c +3
-3wrapper_base = core->wrapper_tz_base; else wrapper_base = core->wrapper_base;@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)writel (fw_size, wrapper_base +WRAPPER_NONPIX_START_ADDR );writel (fw_size, wrapper_base +WRAPPER_NONPIX_END_ADDR ); -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Bring XTSS out of reset */ writel (0 , wrapper_base +WRAPPER_TZ_XTSS_SW_RESET ); }else {@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)if (resume) {venus_reset_cpu (core); }else { -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))writel (WRAPPER_XTSS_SW_RESET_BIT , core->wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET );else @@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)void __iomem *wrapper_base = core->wrapper_base;void __iomem *wrapper_tz_base = core->wrapper_tz_base; -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Assert the reset to XTSS */ reg =readl (wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET ); reg |=WRAPPER_XTSS_SW_RESET_BIT ;drivers/media/platform/qcom/venus/helpers.c +18
-0@@ -230,6 +230,80 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +static void free_eos_buf (struct venus_inst *inst,struct intbuf *buf) +{ +list_del_init (&buf->list); +dma_free_attrs (inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); +kfree (buf); +} + +int venus_helper_free_eos_bufs (struct venus_inst *inst) +{ +struct intbuf *buf, *n; + +list_for_each_entry_safe (buf, n, &inst->eosbufs, list) { +free_eos_buf (inst, buf); + } + +if (list_empty (&inst->eosbufs)) +INIT_LIST_HEAD (&inst->eosbufs);
Quoted 8 lines
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 255
Quoted 5 lines
drivers/media/platform/qcom/venus/helpers.c +5
-0+ +return 0 ; + +} +EXPORT_SYMBOL_GPL (venus_helper_free_eos_bufs);These EOS buf things look like they are not specific to ar50, could you add these in a preceding patch to this ?
um, previous cores seemed to tolerate passing empty pointers to the VPU firmware without issue. Unfortunately, with the AR50_LITE, this results in segmentation faults in the _firmware_. The purpose of this function is to add support for AR50_LITE while preserving the existing behaviour for other cores...introducing a dedicated function felt cleaner than further complicating the existing conditional.
Given that the previous conditional was just an if/else I don’t really see a lot of benefit in refactoring the earlier conditionals _before_ adding the AR50_LITE logic. Would you be OK if we keep it as proposed?
Quoted 47 lines
Quoted 47 lines
drivers/media/platform/qcom/venus/helpers.c +46
-0+ +int venus_helper_alloc_eos_buf (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; +struct device *dev = core->dev; +struct intbuf *buf; +int ret =0 ; + +memset (data,0 ,sizeof (*data)); + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ; + +if (IS_AR50_LITE (inst->core)) { +/* We must send valid sizes and addresses */ + buf =kzalloc (sizeof (*buf),GFP_KERNEL ); +if (!buf) { + ret = -ENOMEM ; + goto fail; + } + + buf->type =HFI_BUFFER_INPUT ; + buf->size =SZ_4K ; + buf->attrs =DMA_ATTR_NO_KERNEL_MAPPING ; + buf->va =dma_alloc_attrs (dev, buf->size, &buf->da,GFP_KERNEL , + buf->attrs); +if (!buf->va) { + ret = -ENOMEM ; + goto fail; + } + +list_add_tail (&buf->list, &inst->eosbufs); + + data->alloc_len = buf->size; + data->device_addr = buf->da; + + }else if (IS_V6 (inst->core) && +is_fw_rev_or_older (inst->core,1 ,0 ,87 )) { + data->device_addr =0 ; + }else { + data->device_addr =0xdeadb000 ; + } + +return 0 ; +fail:
Quoted 8 lines
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 305
Quoted 4 lines
drivers/media/platform/qcom/venus/helpers.c +4
-0+kfree (buf); +return ret; +} +EXPORT_SYMBOL_GPL (venus_helper_alloc_eos_buf);I think the series would be nicer if the EOS buf decomposition stuff went into a patch that preceded this one, and then you add the
IS_AR50_LITE()in the next patch progressively.
see above
Quoted 175 lines
Quoted 164 lines
drivers/media/platform/qcom/venus/helpers.c +8
-0+static int intbufs_set_buffer (struct venus_inst *inst,u32 type) {struct venus_core *core = inst->core;@@ -630,6 +704,13 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,if (!hfi_plat || !hfi_plat->bufreq)return -EINVAL ; +/* Firmware buffer requirements for internal buffers only */ +if (IS_AR50_LITE (inst->core)) +if ((buftype !=HFI_BUFFER_INPUT ) && + (buftype !=HFI_BUFFER_OUTPUT ) && + (buftype !=HFI_BUFFER_OUTPUT2 )) +return -EINVAL ; + params.version = version; params.num_vpp_pipes = inst->core->res->num_vpp_pipes;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); +int venus_helper_alloc_eos_buf (struct venus_inst *inst,struct hfi_frame_data *data); +int venus_helper_free_eos_bufs (struct venus_inst *inst);int venus_helper_intbufs_alloc (struct venus_inst *inst);int venus_helper_intbufs_free (struct venus_inst *inst);int venus_helper_intbufs_realloc (struct venus_inst *inst);drivers/media/platform/qcom/venus/hfi_helper.h +7
-3@@ -397,13 +397,16 @@#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5#define HFI_BUFFER_INTERNAL_SCRATCH (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x6 : 0x1000001)#define HFI_BUFFER_INTERNAL_SCRATCH_1 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x7 : 0x1000005)#define HFI_BUFFER_INTERNAL_SCRATCH_2 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x8 : 0x1000006)#define HFI_BUFFER_EXTRADATA_INPUT (ver) \ (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)#define HFI_BUFFER_EXTRADATA_OUTPUT (ver) \@@ -561,6 +564,7 @@ enum hfi_version {HFI_VERSION_3XX ,HFI_VERSION_4XX ,HFI_VERSION_6XX , + HFI_VERSION_6XX_LITE, }; struct hfi_buffer_info {drivers/media/platform/qcom/venus/hfi_venus.c +9
-5@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)if (count >= max_tries) ret = -ETIMEDOUT ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) {writel (0x1 , cpu_cs_base +CPU_CS_H2XSOFTINTEN_V6 );writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)u32 mask_val;int ret; +if (IS_AR50_LITE (hdev->core)) +return 0 ; +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) {writel (0x3 , cpu_cs_base +CPU_CS_X2RPMH_V6 );@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base = hdev->core->wrapper_base; status =readl (wrapper_base +WRAPPER_INTR_STATUS ); -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { + +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core) hdev->irq_status = status; }writel (1 , cpu_cs_base +CPU_CS_A2HSOFTINTCLR ); -if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core))) +if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)))writel (status, wrapper_base +WRAPPER_INTR_CLEAR );return IRQ_WAKE_THREAD ;@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );drivers/media/platform/qcom/venus/pm_helpers.c +1
-0@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)return &pm_ops_v3;case HFI_VERSION_4XX :case HFI_VERSION_6XX : +case HFI_VERSION_6XX_LITE :return &pm_ops_v4; }drivers/media/platform/qcom/venus/vdec.c +6
-8@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) {struct venus_inst *inst =to_inst (file);struct vb2_queue *dst_vq; -struct hfi_frame_data fdata = {0 }; +struct hfi_frame_data fdata;int ret; ret =v4l2_m2m_ioctl_try_decoder_cmd (file, fh, cmd);@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)if (cmd->cmd ==V4L2_DEC_CMD_STOP ) {/* -* Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on +* Implement V4L2_DEC_CMD_STOP by enqueue a buffer on * decoder input to signal EOS. */ if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; - fdata.buffer_type =HFI_BUFFER_INPUT ; - fdata.flags |=HFI_BUFFERFLAG_EOS ; -if (IS_V6 (inst->core) &&is_fw_rev_or_older (inst->core,1 ,0 ,87 )) - fdata.device_addr =0 ; -else - fdata.device_addr =0xdeadb000 ; + ret =venus_helper_alloc_eos_buf (inst, &fdata); +if (ret) + goto unlock; ret =hfi_session_process_buf (inst, &fdata);@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)hfi_session_abort (inst);venus_helper_free_dpb_bufs (inst); +venus_helper_free_eos_bufs (inst);venus_pm_load_scale (inst);INIT_LIST_HEAD (&inst->registeredbufs);mutex_unlock (&inst->lock);drivers/media/platform/qcom/venus/vdec.c static int vdec_open(struct file *file) · line 1685
Quoted 6 lines
drivers/media/platform/qcom/venus/vdec.c +1
-0@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)if (!inst)return -ENOMEM ; +INIT_LIST_HEAD (&inst->eosbufs);INIT_LIST_HEAD (&inst->dpbbufs);INIT_LIST_HEAD (&inst->registeredbufs);INIT_LIST_HEAD (&inst->internalbufs);Otherwise LGTM.
---
bod
Bryan O'Donoghue
Reviewed-byRe: [PATCH 3/5] media: venus: vdec: ar50_lite video core support
Quoted 35 lines · Jorge Ramirez
Quoted 20 lines · Bryan O'Donoghue
Quoted 19 lines · Jorge Ramirez-Ortiz
The
AR50_LITEis a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 11 ++- drivers/media/platform/qcom/venus/core.h | 5 +- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 +++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 ++- drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++-- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 ++-- 9 files changed, 123 insertions(+), 24 deletions(-)Quoted 13 lines
drivers/media/platform/qcom/venus/core.c static int venus_enumerate_codecs(struct venus_core *core, u32 type) · line 256
Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +1
-2@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)static void venus_assign_register_offsets (struct venus_core *core) { -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { - core->vbif_base = core->base +VBIF_BASE ; +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {Is there a property that
IS_IRIS_2_1||IS_AR50_LITEthat we could use instead of expanding thisIS_THINGlist ?
Quoted 6 lines
I know what you mean but I think looking for possible comonalities between cores will just make the partitioning more obscure.
we could perhaps define a different type of macro ie, something like
IS_CORE(core, IRIS2, IRIS2_1, AR50_LITE)? shall I go ahead with this type of macro instead?
It feels like a nit-picky point to be making but, I'm just thinking about adding another say two or three SoCs that need this conditional.
In that case this statement would start to look long and ungainley. It would be nice to come up with some common conditional for it.
Quoted 121 lines
Quoted 112 lines
Quoted 52 lines
drivers/media/platform/qcom/venus/core.c +7
-1core->cpu_base = core->base +CPU_BASE_V6 ; core->cpu_cs_base = core->base +CPU_CS_BASE_V6 ; core->cpu_ic_base = core->base +CPU_IC_BASE_V6 ; core->wrapper_base = core->base +WRAPPER_BASE_V6 ; core->wrapper_tz_base = core->base +WRAPPER_TZ_BASE_V6 ; - core->aon_base = core->base +AON_BASE_V6 ; +if (IS_AR50_LITE (core)) { + core->vbif_base =NULL ; + core->aon_base =NULL ; + }else { + core->vbif_base = core->base +VBIF_BASE ; + core->aon_base = core->base +AON_BASE_V6 ; + } }else { core->vbif_base = core->base +VBIF_BASE ; core->cpu_base = core->base +CPU_BASE ;drivers/media/platform/qcom/venus/core.h +4
-1@@ -382,6 +382,7 @@ enum venus_inst_modes {* @lock: instance lock * @core: a reference to the core struct * @clk_data: clock data per core ID +* @eosbufs: a lit of EOS buffers * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes @@ -450,6 +451,7 @@ struct venus_inst {struct mutex lock;struct venus_core *core;struct clock_data clk_data; +struct list_head eosbufs;struct list_head dpbbufs;struct list_head internalbufs;struct list_head registeredbufs;@@ -520,7 +522,8 @@ struct venus_inst {#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)#define IS_V3 (core) ((core)->res->hfi_version == HFI_VERSION_3XX)#define IS_V4 (core) ((core)->res->hfi_version == HFI_VERSION_4XX) -#define IS_V6 (core) ((core)->res->hfi_version == HFI_VERSION_6XX) +#define IS_V6 (core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \ + ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))#define IS_AR50 (core) ((core)->res->vpu_version == VPU_VERSION_AR50)#define IS_AR50_LITE (core) ((core)->res->vpu_version == VPU_VERSION_AR50_LITE)drivers/media/platform/qcom/venus/firmware.c +0
-0drivers/media/platform/qcom/venus/firmware.c static void venus_reset_cpu(struct venus_core *core) · line 32
Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.c +1
-1@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)u32 fw_size = core->fw.mapped_mem_size;void __iomem *wrapper_base; -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))For example here.
Quoted 53 lines
drivers/media/platform/qcom/venus/firmware.c +3
-3wrapper_base = core->wrapper_tz_base; else wrapper_base = core->wrapper_base;@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)writel (fw_size, wrapper_base +WRAPPER_NONPIX_START_ADDR );writel (fw_size, wrapper_base +WRAPPER_NONPIX_END_ADDR ); -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Bring XTSS out of reset */ writel (0 , wrapper_base +WRAPPER_TZ_XTSS_SW_RESET ); }else {@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)if (resume) {venus_reset_cpu (core); }else { -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))writel (WRAPPER_XTSS_SW_RESET_BIT , core->wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET );else @@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)void __iomem *wrapper_base = core->wrapper_base;void __iomem *wrapper_tz_base = core->wrapper_tz_base; -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Assert the reset to XTSS */ reg =readl (wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET ); reg |=WRAPPER_XTSS_SW_RESET_BIT ;drivers/media/platform/qcom/venus/helpers.c +18
-0@@ -230,6 +230,80 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +static void free_eos_buf (struct venus_inst *inst,struct intbuf *buf) +{ +list_del_init (&buf->list); +dma_free_attrs (inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); +kfree (buf); +} + +int venus_helper_free_eos_bufs (struct venus_inst *inst) +{ +struct intbuf *buf, *n; + +list_for_each_entry_safe (buf, n, &inst->eosbufs, list) { +free_eos_buf (inst, buf); + } + +if (list_empty (&inst->eosbufs)) +INIT_LIST_HEAD (&inst->eosbufs);Quoted 8 lines
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 255
Quoted 5 lines
drivers/media/platform/qcom/venus/helpers.c +5
-0+ +return 0 ; + +} +EXPORT_SYMBOL_GPL (venus_helper_free_eos_bufs);These EOS buf things look like they are not specific to ar50, could you add these in a preceding patch to this ?
Quoted 9 lines
um, previous cores seemed to tolerate passing empty pointers to the VPU firmware without issue. Unfortunately, with the
AR50_LITE, this results in segmentation faults in the _firmware_. The purpose of this function is to add support forAR50_LITEwhile preserving the existing behaviour for other cores...introducing a dedicated function felt cleaner than further complicating the existing conditional.
Given that the previous conditional was just an if/else I don’t really see a lot of benefit in refactoring the earlier conditionals _before_ adding theAR50_LITElogic. Would you be OK if we keep it as proposed?
ok
Quoted 57 lines
Quoted 48 lines
Quoted 48 lines
drivers/media/platform/qcom/venus/helpers.c +46
-0+ +int venus_helper_alloc_eos_buf (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; +struct device *dev = core->dev; +struct intbuf *buf; +int ret =0 ; + +memset (data,0 ,sizeof (*data)); + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ; + +if (IS_AR50_LITE (inst->core)) { +/* We must send valid sizes and addresses */ + buf =kzalloc (sizeof (*buf),GFP_KERNEL ); +if (!buf) { + ret = -ENOMEM ; + goto fail; + } + + buf->type =HFI_BUFFER_INPUT ; + buf->size =SZ_4K ; + buf->attrs =DMA_ATTR_NO_KERNEL_MAPPING ; + buf->va =dma_alloc_attrs (dev, buf->size, &buf->da,GFP_KERNEL , + buf->attrs); +if (!buf->va) { + ret = -ENOMEM ; + goto fail; + } + +list_add_tail (&buf->list, &inst->eosbufs); + + data->alloc_len = buf->size; + data->device_addr = buf->da; + + }else if (IS_V6 (inst->core) && +is_fw_rev_or_older (inst->core,1 ,0 ,87 )) { + data->device_addr =0 ; + }else { + data->device_addr =0xdeadb000 ; + } + +return 0 ; +fail:Quoted 8 lines
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 305
Quoted 4 lines
drivers/media/platform/qcom/venus/helpers.c +4
-0+kfree (buf); +return ret; +} +EXPORT_SYMBOL_GPL (venus_helper_alloc_eos_buf);I think the series would be nicer if the EOS buf decomposition stuff went into a patch that preceded this one, and then you add the
IS_AR50_LITE()in the next patch progressively.
Quoted 177 lines
see above
Quoted 175 lines
Quoted 164 lines
drivers/media/platform/qcom/venus/helpers.c +8
-0+static int intbufs_set_buffer (struct venus_inst *inst,u32 type) {struct venus_core *core = inst->core;@@ -630,6 +704,13 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,if (!hfi_plat || !hfi_plat->bufreq)return -EINVAL ; +/* Firmware buffer requirements for internal buffers only */ +if (IS_AR50_LITE (inst->core)) +if ((buftype !=HFI_BUFFER_INPUT ) && + (buftype !=HFI_BUFFER_OUTPUT ) && + (buftype !=HFI_BUFFER_OUTPUT2 )) +return -EINVAL ; + params.version = version; params.num_vpp_pipes = inst->core->res->num_vpp_pipes;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); +int venus_helper_alloc_eos_buf (struct venus_inst *inst,struct hfi_frame_data *data); +int venus_helper_free_eos_bufs (struct venus_inst *inst);int venus_helper_intbufs_alloc (struct venus_inst *inst);int venus_helper_intbufs_free (struct venus_inst *inst);int venus_helper_intbufs_realloc (struct venus_inst *inst);drivers/media/platform/qcom/venus/hfi_helper.h +7
-3@@ -397,13 +397,16 @@#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5#define HFI_BUFFER_INTERNAL_SCRATCH (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x6 : 0x1000001)#define HFI_BUFFER_INTERNAL_SCRATCH_1 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x7 : 0x1000005)#define HFI_BUFFER_INTERNAL_SCRATCH_2 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x8 : 0x1000006)#define HFI_BUFFER_EXTRADATA_INPUT (ver) \ (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)#define HFI_BUFFER_EXTRADATA_OUTPUT (ver) \@@ -561,6 +564,7 @@ enum hfi_version {HFI_VERSION_3XX ,HFI_VERSION_4XX ,HFI_VERSION_6XX , + HFI_VERSION_6XX_LITE, }; struct hfi_buffer_info {drivers/media/platform/qcom/venus/hfi_venus.c +9
-5@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)if (count >= max_tries) ret = -ETIMEDOUT ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) {writel (0x1 , cpu_cs_base +CPU_CS_H2XSOFTINTEN_V6 );writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)u32 mask_val;int ret; +if (IS_AR50_LITE (hdev->core)) +return 0 ; +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) {writel (0x3 , cpu_cs_base +CPU_CS_X2RPMH_V6 );@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base = hdev->core->wrapper_base; status =readl (wrapper_base +WRAPPER_INTR_STATUS ); -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { + +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core) hdev->irq_status = status; }writel (1 , cpu_cs_base +CPU_CS_A2HSOFTINTCLR ); -if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core))) +if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)))writel (status, wrapper_base +WRAPPER_INTR_CLEAR );return IRQ_WAKE_THREAD ;@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );drivers/media/platform/qcom/venus/pm_helpers.c +1
-0@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)return &pm_ops_v3;case HFI_VERSION_4XX :case HFI_VERSION_6XX : +case HFI_VERSION_6XX_LITE :return &pm_ops_v4; }drivers/media/platform/qcom/venus/vdec.c +6
-8@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) {struct venus_inst *inst =to_inst (file);struct vb2_queue *dst_vq; -struct hfi_frame_data fdata = {0 }; +struct hfi_frame_data fdata;int ret; ret =v4l2_m2m_ioctl_try_decoder_cmd (file, fh, cmd);@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)if (cmd->cmd ==V4L2_DEC_CMD_STOP ) {/* -* Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on +* Implement V4L2_DEC_CMD_STOP by enqueue a buffer on * decoder input to signal EOS. */ if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; - fdata.buffer_type =HFI_BUFFER_INPUT ; - fdata.flags |=HFI_BUFFERFLAG_EOS ; -if (IS_V6 (inst->core) &&is_fw_rev_or_older (inst->core,1 ,0 ,87 )) - fdata.device_addr =0 ; -else - fdata.device_addr =0xdeadb000 ; + ret =venus_helper_alloc_eos_buf (inst, &fdata); +if (ret) + goto unlock; ret =hfi_session_process_buf (inst, &fdata);@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)hfi_session_abort (inst);venus_helper_free_dpb_bufs (inst); +venus_helper_free_eos_bufs (inst);venus_pm_load_scale (inst);INIT_LIST_HEAD (&inst->registeredbufs);mutex_unlock (&inst->lock);drivers/media/platform/qcom/venus/vdec.c static int vdec_open(struct file *file) · line 1685
Quoted 6 lines
drivers/media/platform/qcom/venus/vdec.c +1
-0@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)if (!inst)return -ENOMEM ; +INIT_LIST_HEAD (&inst->eosbufs);INIT_LIST_HEAD (&inst->dpbbufs);INIT_LIST_HEAD (&inst->registeredbufs);INIT_LIST_HEAD (&inst->internalbufs);Otherwise LGTM.
---
bod
Re: [PATCH 3/5] media: venus: vdec: ar50_lite video core support
Quoted 43 lines · Bryan O'Donoghue
Quoted 35 lines · Jorge Ramirez
Quoted 20 lines · Bryan O'Donoghue
Quoted 19 lines · Jorge Ramirez-Ortiz
The
AR50_LITEis a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 11 ++- drivers/media/platform/qcom/venus/core.h | 5 +- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 +++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 ++- drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++-- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 ++-- 9 files changed, 123 insertions(+), 24 deletions(-)Quoted 13 lines
drivers/media/platform/qcom/venus/core.c static int venus_enumerate_codecs(struct venus_core *core, u32 type) · line 256
Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +1
-2@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)static void venus_assign_register_offsets (struct venus_core *core) { -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { - core->vbif_base = core->base +VBIF_BASE ; +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {Is there a property that
IS_IRIS_2_1||IS_AR50_LITEthat we could use instead of expanding thisIS_THINGlist ?Quoted 6 lines
I know what you mean but I think looking for possible comonalities between cores will just make the partitioning more obscure.
we could perhaps define a different type of macro ie, something like
IS_CORE(core, IRIS2, IRIS2_1, AR50_LITE)? shall I go ahead with this type of macro instead?
Quoted 5 lines
It feels like a nit-picky point to be making but, I'm just thinking about adding another say two or three SoCs that need this conditional.
In that case this statement would start to look long and ungainley. It would be nice to come up with some common conditional for it.
what about
#define IS_VPU_MATCH(core, type) IS_##type(core)
#define IS_VERSION_MATCH(core, type) IS_##type(core)
#define MATCH_1(CMD, core, a) \ IS_##CMD##_MATCH(core, a) #define MATCH_2(CMD, core, a, b) \ (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b)) #define MATCH_3(CMD, core, a, b, c) \ (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b) || \ IS_##CMD##_MATCH(core, c)) #define MATCH_4(CMD, core, a, b, c, d) \ (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b) || \ IS_##CMD##_MATCH(core, c) || IS_##CMD##_MATCH(core, d))
#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME
#define IS_DISPATCH(CMD, core, ...) \ GET_MACRO(__VA_ARGS__, MATCH_4, MATCH_3, MATCH_2, MATCH_1)\ (CMD, core, __VA_ARGS__)
#define IS_VPU(core, ...) IS_DISPATCH(VPU, core, __VA_ARGS__)
#define IS_HFI(core, ...) IS_DISPATCH(VERSION, core, __VA_ARGS__)
then when there are three or more conditions (not much point for less than 3 IMO) we can just have
if (IS_VPU(core, AR50_LITE, IRIS_2, IRIS_2_1))
would be the same for IS_HFI(core, V3, V4, V6)..
shall I post this as a separate patch and then just use it?
Quoted 369 lines
Quoted 122 lines
Quoted 113 lines
Quoted 53 lines
drivers/media/platform/qcom/venus/core.c +7
-1core->cpu_base = core->base +CPU_BASE_V6 ; core->cpu_cs_base = core->base +CPU_CS_BASE_V6 ; core->cpu_ic_base = core->base +CPU_IC_BASE_V6 ; core->wrapper_base = core->base +WRAPPER_BASE_V6 ; core->wrapper_tz_base = core->base +WRAPPER_TZ_BASE_V6 ; - core->aon_base = core->base +AON_BASE_V6 ; +if (IS_AR50_LITE (core)) { + core->vbif_base =NULL ; + core->aon_base =NULL ; + }else { + core->vbif_base = core->base +VBIF_BASE ; + core->aon_base = core->base +AON_BASE_V6 ; + } }else { core->vbif_base = core->base +VBIF_BASE ; core->cpu_base = core->base +CPU_BASE ;drivers/media/platform/qcom/venus/core.h +4
-1@@ -382,6 +382,7 @@ enum venus_inst_modes {* @lock: instance lock * @core: a reference to the core struct * @clk_data: clock data per core ID +* @eosbufs: a lit of EOS buffers * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes @@ -450,6 +451,7 @@ struct venus_inst {struct mutex lock;struct venus_core *core;struct clock_data clk_data; +struct list_head eosbufs;struct list_head dpbbufs;struct list_head internalbufs;struct list_head registeredbufs;@@ -520,7 +522,8 @@ struct venus_inst {#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)#define IS_V3 (core) ((core)->res->hfi_version == HFI_VERSION_3XX)#define IS_V4 (core) ((core)->res->hfi_version == HFI_VERSION_4XX) -#define IS_V6 (core) ((core)->res->hfi_version == HFI_VERSION_6XX) +#define IS_V6 (core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \ + ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))#define IS_AR50 (core) ((core)->res->vpu_version == VPU_VERSION_AR50)#define IS_AR50_LITE (core) ((core)->res->vpu_version == VPU_VERSION_AR50_LITE)drivers/media/platform/qcom/venus/firmware.c +0
-0drivers/media/platform/qcom/venus/firmware.c static void venus_reset_cpu(struct venus_core *core) · line 32
Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.c +1
-1@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)u32 fw_size = core->fw.mapped_mem_size;void __iomem *wrapper_base; -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))For example here.
Quoted 53 lines
drivers/media/platform/qcom/venus/firmware.c +3
-3wrapper_base = core->wrapper_tz_base; else wrapper_base = core->wrapper_base;@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)writel (fw_size, wrapper_base +WRAPPER_NONPIX_START_ADDR );writel (fw_size, wrapper_base +WRAPPER_NONPIX_END_ADDR ); -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Bring XTSS out of reset */ writel (0 , wrapper_base +WRAPPER_TZ_XTSS_SW_RESET ); }else {@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)if (resume) {venus_reset_cpu (core); }else { -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))writel (WRAPPER_XTSS_SW_RESET_BIT , core->wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET );else @@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)void __iomem *wrapper_base = core->wrapper_base;void __iomem *wrapper_tz_base = core->wrapper_tz_base; -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Assert the reset to XTSS */ reg =readl (wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET ); reg |=WRAPPER_XTSS_SW_RESET_BIT ;drivers/media/platform/qcom/venus/helpers.c +18
-0@@ -230,6 +230,80 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +static void free_eos_buf (struct venus_inst *inst,struct intbuf *buf) +{ +list_del_init (&buf->list); +dma_free_attrs (inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); +kfree (buf); +} + +int venus_helper_free_eos_bufs (struct venus_inst *inst) +{ +struct intbuf *buf, *n; + +list_for_each_entry_safe (buf, n, &inst->eosbufs, list) { +free_eos_buf (inst, buf); + } + +if (list_empty (&inst->eosbufs)) +INIT_LIST_HEAD (&inst->eosbufs);Quoted 8 lines
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 255
Quoted 5 lines
drivers/media/platform/qcom/venus/helpers.c +5
-0+ +return 0 ; + +} +EXPORT_SYMBOL_GPL (venus_helper_free_eos_bufs);These EOS buf things look like they are not specific to ar50, could you add these in a preceding patch to this ?
Quoted 9 lines
um, previous cores seemed to tolerate passing empty pointers to the VPU firmware without issue. Unfortunately, with the
AR50_LITE, this results in segmentation faults in the _firmware_. The purpose of this function is to add support forAR50_LITEwhile preserving the existing behaviour for other cores...introducing a dedicated function felt cleaner than further complicating the existing conditional.
Given that the previous conditional was just an if/else I don’t really see a lot of benefit in refactoring the earlier conditionals _before_ adding theAR50_LITElogic. Would you be OK if we keep it as proposed?ok
Quoted 57 lines
Quoted 48 lines
Quoted 48 lines
drivers/media/platform/qcom/venus/helpers.c +46
-0+ +int venus_helper_alloc_eos_buf (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; +struct device *dev = core->dev; +struct intbuf *buf; +int ret =0 ; + +memset (data,0 ,sizeof (*data)); + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ; + +if (IS_AR50_LITE (inst->core)) { +/* We must send valid sizes and addresses */ + buf =kzalloc (sizeof (*buf),GFP_KERNEL ); +if (!buf) { + ret = -ENOMEM ; + goto fail; + } + + buf->type =HFI_BUFFER_INPUT ; + buf->size =SZ_4K ; + buf->attrs =DMA_ATTR_NO_KERNEL_MAPPING ; + buf->va =dma_alloc_attrs (dev, buf->size, &buf->da,GFP_KERNEL , + buf->attrs); +if (!buf->va) { + ret = -ENOMEM ; + goto fail; + } + +list_add_tail (&buf->list, &inst->eosbufs); + + data->alloc_len = buf->size; + data->device_addr = buf->da; + + }else if (IS_V6 (inst->core) && +is_fw_rev_or_older (inst->core,1 ,0 ,87 )) { + data->device_addr =0 ; + }else { + data->device_addr =0xdeadb000 ; + } + +return 0 ; +fail:Quoted 8 lines
drivers/media/platform/qcom/venus/helpers.c int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) · line 305
Quoted 4 lines
drivers/media/platform/qcom/venus/helpers.c +4
-0+kfree (buf); +return ret; +} +EXPORT_SYMBOL_GPL (venus_helper_alloc_eos_buf);I think the series would be nicer if the EOS buf decomposition stuff went into a patch that preceded this one, and then you add the
IS_AR50_LITE()in the next patch progressively.Quoted 177 lines
see above
Quoted 175 lines
Quoted 164 lines
drivers/media/platform/qcom/venus/helpers.c +8
-0+static int intbufs_set_buffer (struct venus_inst *inst,u32 type) {struct venus_core *core = inst->core;@@ -630,6 +704,13 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,if (!hfi_plat || !hfi_plat->bufreq)return -EINVAL ; +/* Firmware buffer requirements for internal buffers only */ +if (IS_AR50_LITE (inst->core)) +if ((buftype !=HFI_BUFFER_INPUT ) && + (buftype !=HFI_BUFFER_OUTPUT ) && + (buftype !=HFI_BUFFER_OUTPUT2 )) +return -EINVAL ; + params.version = version; params.num_vpp_pipes = inst->core->res->num_vpp_pipes;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); +int venus_helper_alloc_eos_buf (struct venus_inst *inst,struct hfi_frame_data *data); +int venus_helper_free_eos_bufs (struct venus_inst *inst);int venus_helper_intbufs_alloc (struct venus_inst *inst);int venus_helper_intbufs_free (struct venus_inst *inst);int venus_helper_intbufs_realloc (struct venus_inst *inst);drivers/media/platform/qcom/venus/hfi_helper.h +7
-3@@ -397,13 +397,16 @@#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5#define HFI_BUFFER_INTERNAL_SCRATCH (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x6 : 0x1000001)#define HFI_BUFFER_INTERNAL_SCRATCH_1 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x7 : 0x1000005)#define HFI_BUFFER_INTERNAL_SCRATCH_2 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x8 : 0x1000006)#define HFI_BUFFER_EXTRADATA_INPUT (ver) \ (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)#define HFI_BUFFER_EXTRADATA_OUTPUT (ver) \@@ -561,6 +564,7 @@ enum hfi_version {HFI_VERSION_3XX ,HFI_VERSION_4XX ,HFI_VERSION_6XX , + HFI_VERSION_6XX_LITE, }; struct hfi_buffer_info {drivers/media/platform/qcom/venus/hfi_venus.c +9
-5@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)if (count >= max_tries) ret = -ETIMEDOUT ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) {writel (0x1 , cpu_cs_base +CPU_CS_H2XSOFTINTEN_V6 );writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)u32 mask_val;int ret; +if (IS_AR50_LITE (hdev->core)) +return 0 ; +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) {writel (0x3 , cpu_cs_base +CPU_CS_X2RPMH_V6 );@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base = hdev->core->wrapper_base; status =readl (wrapper_base +WRAPPER_INTR_STATUS ); -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { + +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core) hdev->irq_status = status; }writel (1 , cpu_cs_base +CPU_CS_A2HSOFTINTCLR ); -if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core))) +if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)))writel (status, wrapper_base +WRAPPER_INTR_CLEAR );return IRQ_WAKE_THREAD ;@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );drivers/media/platform/qcom/venus/pm_helpers.c +1
-0@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)return &pm_ops_v3;case HFI_VERSION_4XX :case HFI_VERSION_6XX : +case HFI_VERSION_6XX_LITE :return &pm_ops_v4; }drivers/media/platform/qcom/venus/vdec.c +6
-8@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) {struct venus_inst *inst =to_inst (file);struct vb2_queue *dst_vq; -struct hfi_frame_data fdata = {0 }; +struct hfi_frame_data fdata;int ret; ret =v4l2_m2m_ioctl_try_decoder_cmd (file, fh, cmd);@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)if (cmd->cmd ==V4L2_DEC_CMD_STOP ) {/* -* Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on +* Implement V4L2_DEC_CMD_STOP by enqueue a buffer on * decoder input to signal EOS. */ if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; - fdata.buffer_type =HFI_BUFFER_INPUT ; - fdata.flags |=HFI_BUFFERFLAG_EOS ; -if (IS_V6 (inst->core) &&is_fw_rev_or_older (inst->core,1 ,0 ,87 )) - fdata.device_addr =0 ; -else - fdata.device_addr =0xdeadb000 ; + ret =venus_helper_alloc_eos_buf (inst, &fdata); +if (ret) + goto unlock; ret =hfi_session_process_buf (inst, &fdata);@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)hfi_session_abort (inst);venus_helper_free_dpb_bufs (inst); +venus_helper_free_eos_bufs (inst);venus_pm_load_scale (inst);INIT_LIST_HEAD (&inst->registeredbufs);mutex_unlock (&inst->lock);drivers/media/platform/qcom/venus/vdec.c static int vdec_open(struct file *file) · line 1685
Quoted 6 lines
drivers/media/platform/qcom/venus/vdec.c +1
-0@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)if (!inst)return -ENOMEM ; +INIT_LIST_HEAD (&inst->eosbufs);INIT_LIST_HEAD (&inst->dpbbufs);INIT_LIST_HEAD (&inst->registeredbufs);INIT_LIST_HEAD (&inst->internalbufs);Otherwise LGTM.
---
bodReviewed-by Bryan O'Donoghue <[email protected]>
PATCH 4/5 media: venus: hfi_plat_v6_lite: Populate decode capabilities
In reply to Jorge Ramirez-OrtizAdd hfi platform file with decoding capabilities for hfi v6_lite.
--- drivers/media/platform/qcom/venus/Makefile | 2 +- .../media/platform/qcom/venus/hfi_platform.c | 2 + .../media/platform/qcom/venus/hfi_platform.h | 1 + .../qcom/venus/hfi_platform_v6_lite.c | 148 ++++++++++++++++++ 4 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
drivers/media/platform/qcom/venus/Makefile +1 -1
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \ hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \ hfi_parser.o pm_helpers.o dbgfs.o \ hfi_platform.o hfi_platform_v4.o \ - hfi_platform_v6.o hfi_plat_bufs_v6.o \ + hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \ venus-dec-objs += vdec.o vdec_ctrls.o venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)return &hfi_plat_v4;case HFI_VERSION_6XX :return &hfi_plat_v6; +case HFI_VERSION_6XX_LITE : +return &hfi_plat_v6_lite;default :break ; }
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
@@ -58,6 +58,7 @@ struct hfi_platform {extern const struct hfi_platform hfi_plat_v4;extern const struct hfi_platform hfi_plat_v6; +extern const struct hfi_platform hfi_plat_v6_lite;const struct hfi_platform *hfi_platform_get (enum hfi_version version); unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +148 -0
148 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 5/5 media: venus: core: Add qcm2290 DT compatible and resource data
In reply to Jorge Ramirez-OrtizAdd a qcm2290 compatible binding to the venus core.
--- drivers/media/platform/qcom/venus/core.c | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/media/platform/qcom/venus/core.c +39 -0
@@ -1062,6 +1062,44 @@ static const struct venus_resources sc7280_res = { .enc_nodename = "video-encoder", }; +static const struct freq_tbl qcm2290_freq_table[] = { + {352800 ,240000000 },/* 1920x1088 @ 30 + 1280x720 @ 30 */ + {244800 ,133000000 },/* 1920x1088 @ 30 */ +}; + +static const struct bw_tbl qcm2290_bw_table_dec[] = { + {244800 ,2128000 ,0 ,2128000 ,0 },/* 1920x1088 @ 30 */ +}; + +static const struct venus_resources qcm2290_res = { + .freq_tbl = qcm2290_freq_table, + .freq_tbl_size =ARRAY_SIZE (qcm2290_freq_table), + .bw_tbl_dec = qcm2290_bw_table_dec, + .bw_tbl_dec_size =ARRAY_SIZE (qcm2290_bw_table_dec), + .clks = {"core" ,"iface" ,"bus" ,"throttle" }, + .clks_num =4 , + .vcodec0_clks = {"vcodec0_core" ,"vcodec0_bus" }, + .vcodec_clks_num =2 , + .vcodec_pmdomains = (const char *[]) {"venus" ,"vcodec0" }, + .vcodec_pmdomains_num =2 , + .opp_pmdomain = (const char *[]) {"cx" }, + .vcodec_num =1 , + .hfi_version =HFI_VERSION_6XX_LITE , + .vpu_version =VPU_VERSION_AR50_LITE , + .max_load =352800 , + .num_vpp_pipes =1 , + .vmem_id =VIDC_RESOURCE_NONE , + .vmem_size =0 , + .vmem_addr =0 , + .cp_start =0 , + .cp_size =0x70800000 , + .cp_nonpixel_start =0x1000000 , + .cp_nonpixel_size =0x24800000 , + .dma_mask =0xe0000000 -1 , + .fwname ="qcom/venus-6.0/venus.mbn" , + .dec_nodename ="video-decoder" , +}; +static const struct of_device_id venus_dt_match[] = { { .compatible ="qcom,msm8916-venus" , .data = &msm8916_res, }, { .compatible ="qcom,msm8996-venus" , .data = &msm8996_res, },
@@ -1072,6 +1110,7 @@ static const struct of_device_id venus_dt_match[] = { { .compatible = "qcom,sc7180-venus", .data = &sc7180_res, }, { .compatible = "qcom,sc7280-venus", .data = &sc7280_res, }, { .compatible = "qcom,sm8250-venus", .data = &sm8250_res, }, + { .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, }, { } }; MODULE_DEVICE_TABLE(of, venus_dt_match);
Signature · 1 line
2.34.1
Re: [PATCH 5/5] media: venus: core: Add qcm2290 DT compatible and resource data
Quoted 41 lines · Jorge Ramirez-Ortiz
Add a qcm2290 compatible binding to the venus core.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+)drivers/media/platform/qcom/venus/core.c +26
-0@@ -1062,6 +1062,44 @@ static const struct venus_resources sc7280_res = { .enc_nodename = "video-encoder", }; +static const struct freq_tbl qcm2290_freq_table[] = { + {352800 ,240000000 },/* 1920x1088 @ 30 + 1280x720 @ 30 */ + {244800 ,133000000 },/* 1920x1088 @ 30 */ +}; + +static const struct bw_tbl qcm2290_bw_table_dec[] = { + {244800 ,2128000 ,0 ,2128000 ,0 },/* 1920x1088 @ 30 */ +}; + +static const struct venus_resources qcm2290_res = { + .freq_tbl = qcm2290_freq_table, + .freq_tbl_size =ARRAY_SIZE (qcm2290_freq_table), + .bw_tbl_dec = qcm2290_bw_table_dec, + .bw_tbl_dec_size =ARRAY_SIZE (qcm2290_bw_table_dec), + .clks = {"core" ,"iface" ,"bus" ,"throttle" }, + .clks_num =4 , + .vcodec0_clks = {"vcodec0_core" ,"vcodec0_bus" }, + .vcodec_clks_num =2 , + .vcodec_pmdomains = (const char *[]) {"venus" ,"vcodec0" }, + .vcodec_pmdomains_num =2 , + .opp_pmdomain = (const char *[]) {"cx" }, + .vcodec_num =1 , + .hfi_version =HFI_VERSION_6XX_LITE , + .vpu_version =VPU_VERSION_AR50_LITE , + .max_load =352800 , + .num_vpp_pipes =1 ,
drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1100
Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +10
-0+ .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",
No encoder - you declared one in the schema.
I think this should be:
.dec_nodename = "video-decoder",
.enc_nodename = "video-encoder",
drivers/media/platform/qcom/venus/core.c static const struct of_device_id venus_dt_match[] = { · line 1116
Quoted 13 lines
drivers/media/platform/qcom/venus/core.c +3
-0+}; +static const struct of_device_id venus_dt_match[] = { { .compatible ="qcom,msm8916-venus" , .data = &msm8916_res, }, { .compatible ="qcom,msm8996-venus" , .data = &msm8996_res, },@@ -1072,6 +1110,7 @@ static const struct of_device_id venus_dt_match[] = { { .compatible = "qcom,sc7180-venus", .data = &sc7180_res, }, { .compatible = "qcom,sc7280-venus", .data = &sc7280_res, }, { .compatible = "qcom,sm8250-venus", .data = &sm8250_res, }, + { .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, }, { } }; MODULE_DEVICE_TABLE(of, venus_dt_match);
---bod
v2 cover media: venus: Add QCM2290 support with AR50_LITE core
In reply to Jorge Ramirez-OrtizChanges since v1:
- Add IS_HFI macro usage
- Move schema patch to top
- Fix commit messages
This patch series adds support for the Venus video decoder/encoder block present on the Qualcomm QCM2290.
The QCM2290 integrates an AR50_LITE core, a low-power implementation of Venus supporting H.264, HEVC (H.265), and VP9 decoding.
The series includes:
• DT binding schema for qcom,qcm2290-venus
• SoC integration via qcm2290.dtsi
• Resource table definitions and frequency scaling
• Platform capability registration for the AR50_LITE core
Decoding was verified on the QCOM RB1 platform using GStreamer with V4L2-based decode plugins. The following pipelines were used for playback 1280x720 and 1920x1080 H.264, HVEC and VP9 videos from https://www.elecard.com/videos.
[H.264]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h264parse ! v4l2h264dec \
! videoconvert ! autovideosink
[H.265]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h265parse ! v4l2h265dec \
! videoconvert ! autovideosink
[VP9]
gst-launch-1.0 filesrc location=videos/xxxxx.webm \
! matroskademus ! queue ! v4l2vp8dec \
! videoconvert ! autovideosink
---
Jorge Ramirez-Ortiz (7):
dt-bindings: media: venus: Add qcm2290 dt schema
media: venus: helpers: add IS_VPU() and IS_HFI() macros
media: venus: use IS_HFI() macro for multi-version check
media: venus: vdec: AR50_LITE video core support
media: venus: hfi_plat_v6_lite: Populate decode capabilities
media: venus: core: Add qcm2290 DT compatible and resource data
arm64: dts: qcom: qcm2290: Add venus video node
.../bindings/media/qcom,qcm2290-venus.yaml | 117 ++++++++++++++ arch/arm64/boot/dts/qcom/qcm2290.dtsi | 45 ++++++ drivers/media/platform/qcom/venus/Makefile | 2 +- drivers/media/platform/qcom/venus/core.c | 51 +++++- drivers/media/platform/qcom/venus/core.h | 28 +++- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 ++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 +- .../media/platform/qcom/venus/hfi_platform.c | 2 + .../media/platform/qcom/venus/hfi_platform.h | 1 + .../qcom/venus/hfi_platform_v6_lite.c | 148 ++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_venus.c | 19 ++- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 17 +- 15 files changed, 504 insertions(+), 28 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
Signature · 1 line
2.34.1
PATCH v2 1/7 dt-bindings: media: venus: Add qcm2290 dt schema
Add a schema for the venus video encoder/decoder on the qcm2290.
---
v2: power-domains set to 3
.../bindings/media/qcom,qcm2290-venus.yaml | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +117 -0
@@ -0,0 +1,117 @@ +# 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: + - Stanimir Varbanov <[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 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + };
Signature · 1 line
2.34.1
Re: [PATCH v2 1/7] dt-bindings: media: venus: Add qcm2290 dt schema
Review
Quoted 2 lines · Jorge Ramirez-Ortiz
(quoted diff) +2
-0+maintainers: + - Stanimir Varbanov<[email protected]>
I think this is the wrong maintainer entry at this stage.
You can ^should list yourself and/or Vikash, Dikshita and me.
Other than that, LGTM.
---
bod
PATCH v2 2/7 media: venus: helpers: add IS_VPU() and IS_HFI() macros
In reply to Jorge Ramirez-OrtizIntroduce IS_VPU(core, ...) and IS_HFI(core, ...) macros that abstract over multiple version checks for VPU and HFI.
They reuse existing IS_<TYPE>(core) definitions.
Allowing up to 4 versions is a fair compromise. Any more would justify an interface.
--- drivers/media/platform/qcom/venus/core.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/media/platform/qcom/venus/core.h +23 -0
@@ -528,6 +528,29 @@ 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) +#define IS_VPU_MATCH (core, type) IS_##type(core) +#define IS_VERSION_MATCH (core, type) IS_##type(core) + +/* Limit this to 4 versions. Use a helper if >4 versions share logic. */ +#define MATCH_1 (CMD , core, a) \ + IS_##CMD##_MATCH(core, a) +#define MATCH_2 (CMD , core, a, b) \ + (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b)) +#define MATCH_3 (CMD , core, a, b, c) \ + (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b) || \ + IS_##CMD##_MATCH(core, c)) +#define MATCH_4 (CMD , core, a, b, c, d) \ + (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b) || \ + IS_##CMD##_MATCH(core, c) || IS_##CMD##_MATCH(core, d)) + +#define GET_MACRO (_1, _2, _3, _4,NAME , ...) NAME/* _1-_4 are ignored */ +#define IS_DISPATCH (CMD , core, ...) \ + (GET_MACRO(__VA_ARGS__, MATCH_4, MATCH_3, MATCH_2, MATCH_1)( \ + CMD, core, __VA_ARGS__)) + +#define IS_VPU (core, ...) IS_DISPATCH(VPU, core, __VA_ARGS__) +#define IS_HFI (core, ...) IS_DISPATCH(VERSION, core, __VA_ARGS__) +#define ctrl_to_inst (ctrl) \ container_of((ctrl)->handler, struct venus_inst, ctrl_handler)
Signature · 1 line
2.34.1
PATCH v2 3/7 media: venus: use IS_HFI() macro for multi-version check
In reply to Jorge Ramirez-OrtizReplace repeated hfi_version checks. This improves readability and avoids repetition of logical OR conditions.
No functional change intended.
--- drivers/media/platform/qcom/venus/hfi_venus.c | 2 +- drivers/media/platform/qcom/venus/vdec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/hfi_venus.c +1 -1
@@ -1634,7 +1634,7 @@ static int venus_suspend_3xx(struct venus_core *core)static int venus_suspend (struct venus_core *core) { -if (IS_V3 (core) ||IS_V4 (core) ||IS_V6 (core)) +if (IS_HFI (core,V3 ,V4 ,V6 ))return venus_suspend_3xx (core);return venus_suspend_1xx (core);
drivers/media/platform/qcom/venus/vdec.c +1 -1
@@ -823,7 +823,7 @@ static int vdec_output_conf(struct venus_inst *inst)return ret; } -if (IS_V3 (core) ||IS_V4 (core) ||IS_V6 (core)) { +if (IS_HFI (core,V3 ,V4 ,V6 )) { ret =venus_helper_get_bufreq (inst,HFI_BUFFER_OUTPUT , &bufreq);if (ret)return ret;
Signature · 1 line
2.34.1
PATCH v2 4/7 media: venus: vdec: AR50_LITE video core support
In reply to Jorge Ramirez-OrtizThe AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.
It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.
---
v2: use IS_VPU macro to simplify conditionals
added Loic Poulain as co-developer (should be on v1)
drivers/media/platform/qcom/venus/core.c | 11 ++- drivers/media/platform/qcom/venus/core.h | 5 +- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 +++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 ++- drivers/media/platform/qcom/venus/hfi_venus.c | 17 ++-- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 ++-- 9 files changed, 125 insertions(+), 25 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)static void venus_assign_register_offsets (struct venus_core *core) { -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { - core->vbif_base = core->base +VBIF_BASE ; +if (IS_VPU (core,IRIS2 ,IRIS2_1 ,AR50_LITE )) { core->cpu_base = core->base +CPU_BASE_V6 ; core->cpu_cs_base = core->base +CPU_CS_BASE_V6 ; core->cpu_ic_base = core->base +CPU_IC_BASE_V6 ; core->wrapper_base = core->base +WRAPPER_BASE_V6 ; core->wrapper_tz_base = core->base +WRAPPER_TZ_BASE_V6 ; - core->aon_base = core->base +AON_BASE_V6 ; +if (IS_AR50_LITE (core)) { + core->vbif_base =NULL ; + core->aon_base =NULL ; + }else { + core->vbif_base = core->base +VBIF_BASE ; + core->aon_base = core->base +AON_BASE_V6 ; + } }else { core->vbif_base = core->base +VBIF_BASE ; core->cpu_base = core->base +CPU_BASE ;
drivers/media/platform/qcom/venus/core.h +4 -1
@@ -382,6 +382,7 @@ enum venus_inst_modes {* @lock: instance lock * @core: a reference to the core struct * @clk_data: clock data per core ID +* @eosbufs: a lit of EOS buffers * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {struct mutex lock;struct venus_core *core;struct clock_data clk_data; +struct list_head eosbufs;struct list_head dpbbufs;struct list_head internalbufs;struct list_head registeredbufs;
@@ -520,7 +522,8 @@ struct venus_inst {#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)#define IS_V3 (core) ((core)->res->hfi_version == HFI_VERSION_3XX)#define IS_V4 (core) ((core)->res->hfi_version == HFI_VERSION_4XX) -#define IS_V6 (core) ((core)->res->hfi_version == HFI_VERSION_6XX) +#define IS_V6 (core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \ + ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))#define IS_AR50 (core) ((core)->res->vpu_version == VPU_VERSION_AR50)#define IS_AR50_LITE (core) ((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +4 -4
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)u32 fw_size = core->fw.mapped_mem_size;void __iomem *wrapper_base; -if (IS_IRIS2_1 (core)) +if (IS_VPU (core,IRIS2_1 ,AR50_LITE )) wrapper_base = core->wrapper_tz_base;else wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)writel (fw_size, wrapper_base +WRAPPER_NONPIX_START_ADDR );writel (fw_size, wrapper_base +WRAPPER_NONPIX_END_ADDR ); -if (IS_IRIS2_1 (core)) { +if (IS_VPU (core,IRIS2_1 ,AR50_LITE )) {/* Bring XTSS out of reset */ writel (0 , wrapper_base +WRAPPER_TZ_XTSS_SW_RESET ); }else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)if (resume) {venus_reset_cpu (core); }else { -if (IS_IRIS2_1 (core)) +if (IS_VPU (core,IRIS2_1 ,AR50_LITE ))writel (WRAPPER_XTSS_SW_RESET_BIT , core->wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET );else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)void __iomem *wrapper_base = core->wrapper_base;void __iomem *wrapper_tz_base = core->wrapper_tz_base; -if (IS_IRIS2_1 (core)) { +if (IS_VPU (core,IRIS2_1 ,AR50_LITE )) {/* Assert the reset to XTSS */ reg =readl (wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET ); reg |=WRAPPER_XTSS_SW_RESET_BIT ;
drivers/media/platform/qcom/venus/helpers.c +81 -0
93 lines not on this page · raw message
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); +int venus_helper_alloc_eos_buf (struct venus_inst *inst,struct hfi_frame_data *data); +int venus_helper_free_eos_bufs (struct venus_inst *inst);int venus_helper_intbufs_alloc (struct venus_inst *inst);int venus_helper_intbufs_free (struct venus_inst *inst);int venus_helper_intbufs_realloc (struct venus_inst *inst);
drivers/media/platform/qcom/venus/hfi_helper.h +7 -3
@@ -397,13 +397,16 @@#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5#define HFI_BUFFER_INTERNAL_SCRATCH (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x6 : 0x1000001)#define HFI_BUFFER_INTERNAL_SCRATCH_1 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x7 : 0x1000005)#define HFI_BUFFER_INTERNAL_SCRATCH_2 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x8 : 0x1000006)#define HFI_BUFFER_EXTRADATA_INPUT (ver) \ (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)#define HFI_BUFFER_EXTRADATA_OUTPUT (ver) \
@@ -561,6 +564,7 @@ enum hfi_version {HFI_VERSION_3XX ,HFI_VERSION_4XX ,HFI_VERSION_6XX , + HFI_VERSION_6XX_LITE, }; struct hfi_buffer_info {
drivers/media/platform/qcom/venus/hfi_venus.c +11 -6
@@ -469,7 +469,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)void __iomem *wrapper_base = hdev->core->wrapper_base;int ret =0 ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_VPU (hdev->core,IRIS2 ,IRIS2_1 )) { mask_val =readl (wrapper_base +WRAPPER_INTR_MASK ); mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BASK_V6 |WRAPPER_INTR_MASK_A2HCPU_MASK );
@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)if (count >= max_tries) ret = -ETIMEDOUT ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_VPU (hdev->core,IRIS2 ,IRIS2_1 ,AR50_LITE )) {writel (0x1 , cpu_cs_base +CPU_CS_H2XSOFTINTEN_V6 );writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }
@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)u32 mask_val;int ret; +if (IS_AR50_LITE (hdev->core)) +return 0 ; +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) {writel (0x3 , cpu_cs_base +CPU_CS_X2RPMH_V6 );
@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base = hdev->core->wrapper_base; status =readl (wrapper_base +WRAPPER_INTR_STATUS ); -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { + +if (IS_VPU (core,IRIS2 ,IRIS2_1 ,AR50_LITE )) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )
@@ -1146,7 +1150,8 @@ 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_VPU (core,IRIS2 ,IRIS2_1 ,AR50_LITE ))writel (status, wrapper_base +WRAPPER_INTR_CLEAR );return IRQ_WAKE_THREAD ;
@@ -1531,7 +1536,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_VPU (hdev->core,IRIS2 ,IRIS2_1 ,AR50_LITE )) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );
@@ -1551,7 +1556,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_VPU (hdev->core,IRIS2 ,IRIS2_1 ,AR50_LITE )) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );
drivers/media/platform/qcom/venus/pm_helpers.c +1 -0
@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)return &pm_ops_v3;case HFI_VERSION_4XX :case HFI_VERSION_6XX : +case HFI_VERSION_6XX_LITE :return &pm_ops_v4; }
drivers/media/platform/qcom/venus/vdec.c +7 -8
@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) {struct venus_inst *inst =to_inst (file);struct vb2_queue *dst_vq; -struct hfi_frame_data fdata = {0 }; +struct hfi_frame_data fdata;int ret; ret =v4l2_m2m_ioctl_try_decoder_cmd (file, fh, cmd);
@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)if (cmd->cmd ==V4L2_DEC_CMD_STOP ) {/* -* Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on +* Implement V4L2_DEC_CMD_STOP by enqueue a buffer on * decoder input to signal EOS. */ if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; - fdata.buffer_type =HFI_BUFFER_INPUT ; - fdata.flags |=HFI_BUFFERFLAG_EOS ; -if (IS_V6 (inst->core) &&is_fw_rev_or_older (inst->core,1 ,0 ,87 )) - fdata.device_addr =0 ; -else - fdata.device_addr =0xdeadb000 ; + ret =venus_helper_alloc_eos_buf (inst, &fdata); +if (ret) + goto unlock; ret =hfi_session_process_buf (inst, &fdata);
@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)hfi_session_abort (inst);venus_helper_free_dpb_bufs (inst); +venus_helper_free_eos_bufs (inst);venus_pm_load_scale (inst);INIT_LIST_HEAD (&inst->registeredbufs);mutex_unlock (&inst->lock);
@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)if (!inst)return -ENOMEM ; +INIT_LIST_HEAD (&inst->eosbufs);INIT_LIST_HEAD (&inst->dpbbufs);INIT_LIST_HEAD (&inst->registeredbufs);INIT_LIST_HEAD (&inst->internalbufs);
Signature · 1 line
2.34.1
Re: [PATCH v2 4/7] media: venus: vdec: AR50_LITE video core support
Quoted 393 lines · Jorge Ramirez-Ortiz
The
AR50_LITEis a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>Co-developed-by Loic Poulain <[email protected]>Signed-off-by Loic Poulain <[email protected]>---
v2: use
IS_VPUmacro to simplify conditionals
added Loic Poulain as co-developer (should be on v1)drivers/media/platform/qcom/venus/core.c | 11 ++- drivers/media/platform/qcom/venus/core.h | 5 +- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 +++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 ++- drivers/media/platform/qcom/venus/hfi_venus.c | 17 ++-- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 ++-- 9 files changed, 125 insertions(+), 25 deletions(-)drivers/media/platform/qcom/venus/core.c +8
-3@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)static void venus_assign_register_offsets (struct venus_core *core) { -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { - core->vbif_base = core->base +VBIF_BASE ; +if (IS_VPU (core,IRIS2 ,IRIS2_1 ,AR50_LITE )) { core->cpu_base = core->base +CPU_BASE_V6 ; core->cpu_cs_base = core->base +CPU_CS_BASE_V6 ; core->cpu_ic_base = core->base +CPU_IC_BASE_V6 ; core->wrapper_base = core->base +WRAPPER_BASE_V6 ; core->wrapper_tz_base = core->base +WRAPPER_TZ_BASE_V6 ; - core->aon_base = core->base +AON_BASE_V6 ; +if (IS_AR50_LITE (core)) { + core->vbif_base =NULL ; + core->aon_base =NULL ; + }else { + core->vbif_base = core->base +VBIF_BASE ; + core->aon_base = core->base +AON_BASE_V6 ; + } }else { core->vbif_base = core->base +VBIF_BASE ; core->cpu_base = core->base +CPU_BASE ;drivers/media/platform/qcom/venus/core.h +4
-1@@ -382,6 +382,7 @@ enum venus_inst_modes {* @lock: instance lock * @core: a reference to the core struct * @clk_data: clock data per core ID +* @eosbufs: a lit of EOS buffers * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes @@ -450,6 +451,7 @@ struct venus_inst {struct mutex lock;struct venus_core *core;struct clock_data clk_data; +struct list_head eosbufs;struct list_head dpbbufs;struct list_head internalbufs;struct list_head registeredbufs;@@ -520,7 +522,8 @@ struct venus_inst {#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)#define IS_V3 (core) ((core)->res->hfi_version == HFI_VERSION_3XX)#define IS_V4 (core) ((core)->res->hfi_version == HFI_VERSION_4XX) -#define IS_V6 (core) ((core)->res->hfi_version == HFI_VERSION_6XX) +#define IS_V6 (core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \ + ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))#define IS_AR50 (core) ((core)->res->vpu_version == VPU_VERSION_AR50)#define IS_AR50_LITE (core) ((core)->res->vpu_version == VPU_VERSION_AR50_LITE)drivers/media/platform/qcom/venus/firmware.c +4
-4@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)u32 fw_size = core->fw.mapped_mem_size;void __iomem *wrapper_base; -if (IS_IRIS2_1 (core)) +if (IS_VPU (core,IRIS2_1 ,AR50_LITE )) wrapper_base = core->wrapper_tz_base;else wrapper_base = core->wrapper_base;@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)writel (fw_size, wrapper_base +WRAPPER_NONPIX_START_ADDR );writel (fw_size, wrapper_base +WRAPPER_NONPIX_END_ADDR ); -if (IS_IRIS2_1 (core)) { +if (IS_VPU (core,IRIS2_1 ,AR50_LITE )) {/* Bring XTSS out of reset */ writel (0 , wrapper_base +WRAPPER_TZ_XTSS_SW_RESET ); }else {@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)if (resume) {venus_reset_cpu (core); }else { -if (IS_IRIS2_1 (core)) +if (IS_VPU (core,IRIS2_1 ,AR50_LITE ))writel (WRAPPER_XTSS_SW_RESET_BIT , core->wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET );else @@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)void __iomem *wrapper_base = core->wrapper_base;void __iomem *wrapper_tz_base = core->wrapper_tz_base; -if (IS_IRIS2_1 (core)) { +if (IS_VPU (core,IRIS2_1 ,AR50_LITE )) {/* Assert the reset to XTSS */ reg =readl (wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET ); reg |=WRAPPER_XTSS_SW_RESET_BIT ;drivers/media/platform/qcom/venus/helpers.c +81
-0@@ -230,6 +230,80 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) }EXPORT_SYMBOL_GPL (venus_helper_alloc_dpb_bufs); +static void free_eos_buf (struct venus_inst *inst,struct intbuf *buf) +{ +list_del_init (&buf->list); +dma_free_attrs (inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); +kfree (buf); +} + +int venus_helper_free_eos_bufs (struct venus_inst *inst) +{ +struct intbuf *buf, *n; + +list_for_each_entry_safe (buf, n, &inst->eosbufs, list) { +free_eos_buf (inst, buf); + } + +if (list_empty (&inst->eosbufs)) +INIT_LIST_HEAD (&inst->eosbufs); + +return 0 ; + +} +EXPORT_SYMBOL_GPL (venus_helper_free_eos_bufs); + +int venus_helper_alloc_eos_buf (struct venus_inst *inst, +struct hfi_frame_data *data) +{ +struct venus_core *core = inst->core; +struct device *dev = core->dev; +struct intbuf *buf; +int ret =0 ; + +memset (data,0 ,sizeof (*data)); + + data->buffer_type =HFI_BUFFER_INPUT ; + data->flags =HFI_BUFFERFLAG_EOS ; + +if (IS_AR50_LITE (inst->core)) { +/* We must send valid sizes and addresses */ + buf =kzalloc (sizeof (*buf),GFP_KERNEL ); +if (!buf) { + ret = -ENOMEM ; + goto fail; + } + + buf->type =HFI_BUFFER_INPUT ; + buf->size =SZ_4K ; + buf->attrs =DMA_ATTR_NO_KERNEL_MAPPING ; + buf->va =dma_alloc_attrs (dev, buf->size, &buf->da,GFP_KERNEL , + buf->attrs); +if (!buf->va) { + ret = -ENOMEM ; + goto fail; + } + +list_add_tail (&buf->list, &inst->eosbufs); + + data->alloc_len = buf->size; + data->device_addr = buf->da; + + }else if (IS_V6 (inst->core) && +is_fw_rev_or_older (inst->core,1 ,0 ,87 )) { + data->device_addr =0 ; + }else { + data->device_addr =0xdeadb000 ; + } + +return 0 ; +fail: +kfree (buf); +return ret; +} +EXPORT_SYMBOL_GPL (venus_helper_alloc_eos_buf); +static int intbufs_set_buffer (struct venus_inst *inst,u32 type) {struct venus_core *core = inst->core;@@ -630,6 +704,13 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype,if (!hfi_plat || !hfi_plat->bufreq)return -EINVAL ; +/* Firmware buffer requirements for internal buffers only */ +if (IS_AR50_LITE (inst->core)) +if ((buftype !=HFI_BUFFER_INPUT ) && + (buftype !=HFI_BUFFER_OUTPUT ) && + (buftype !=HFI_BUFFER_OUTPUT2 )) +return -EINVAL ; + params.version = version; params.num_vpp_pipes = inst->core->res->num_vpp_pipes;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); +int venus_helper_alloc_eos_buf (struct venus_inst *inst,struct hfi_frame_data *data); +int venus_helper_free_eos_bufs (struct venus_inst *inst);int venus_helper_intbufs_alloc (struct venus_inst *inst);int venus_helper_intbufs_free (struct venus_inst *inst);int venus_helper_intbufs_realloc (struct venus_inst *inst);drivers/media/platform/qcom/venus/hfi_helper.h +7
-3@@ -397,13 +397,16 @@#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5#define HFI_BUFFER_INTERNAL_SCRATCH (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x6 : 0x1000001)#define HFI_BUFFER_INTERNAL_SCRATCH_1 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x7 : 0x1000005)#define HFI_BUFFER_INTERNAL_SCRATCH_2 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x8 : 0x1000006)#define HFI_BUFFER_EXTRADATA_INPUT (ver) \ (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)#define HFI_BUFFER_EXTRADATA_OUTPUT (ver) \@@ -561,6 +564,7 @@ enum hfi_version {HFI_VERSION_3XX ,HFI_VERSION_4XX ,HFI_VERSION_6XX , + HFI_VERSION_6XX_LITE, }; struct hfi_buffer_info {drivers/media/platform/qcom/venus/hfi_venus.c +11
-6@@ -469,7 +469,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)void __iomem *wrapper_base = hdev->core->wrapper_base;int ret =0 ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_VPU (hdev->core,IRIS2 ,IRIS2_1 )) { mask_val =readl (wrapper_base +WRAPPER_INTR_MASK ); mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BASK_V6 |WRAPPER_INTR_MASK_A2HCPU_MASK );@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)if (count >= max_tries) ret = -ETIMEDOUT ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_VPU (hdev->core,IRIS2 ,IRIS2_1 ,AR50_LITE )) {writel (0x1 , cpu_cs_base +CPU_CS_H2XSOFTINTEN_V6 );writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)u32 mask_val;int ret; +if (IS_AR50_LITE (hdev->core)) +return 0 ; +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) {writel (0x3 , cpu_cs_base +CPU_CS_X2RPMH_V6 );@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base = hdev->core->wrapper_base; status =readl (wrapper_base +WRAPPER_INTR_STATUS ); -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { + +if (IS_VPU (core,IRIS2 ,IRIS2_1 ,AR50_LITE )) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )@@ -1146,7 +1150,8 @@ 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_VPU (core,IRIS2 ,IRIS2_1 ,AR50_LITE ))writel (status, wrapper_base +WRAPPER_INTR_CLEAR );return IRQ_WAKE_THREAD ;@@ -1531,7 +1536,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_VPU (hdev->core,IRIS2 ,IRIS2_1 ,AR50_LITE )) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );@@ -1551,7 +1556,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_VPU (hdev->core,IRIS2 ,IRIS2_1 ,AR50_LITE )) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );drivers/media/platform/qcom/venus/pm_helpers.c +1
-0@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)return &pm_ops_v3;case HFI_VERSION_4XX :case HFI_VERSION_6XX : +case HFI_VERSION_6XX_LITE :return &pm_ops_v4; }drivers/media/platform/qcom/venus/vdec.c +6
-8@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) {struct venus_inst *inst =to_inst (file);struct vb2_queue *dst_vq; -struct hfi_frame_data fdata = {0 }; +struct hfi_frame_data fdata;int ret; ret =v4l2_m2m_ioctl_try_decoder_cmd (file, fh, cmd);@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)if (cmd->cmd ==V4L2_DEC_CMD_STOP ) {/* -* Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on +* Implement V4L2_DEC_CMD_STOP by enqueue a buffer on * decoder input to signal EOS. */ if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; - fdata.buffer_type =HFI_BUFFER_INPUT ; - fdata.flags |=HFI_BUFFERFLAG_EOS ; -if (IS_V6 (inst->core) &&is_fw_rev_or_older (inst->core,1 ,0 ,87 )) - fdata.device_addr =0 ; -else - fdata.device_addr =0xdeadb000 ; + ret =venus_helper_alloc_eos_buf (inst, &fdata); +if (ret) + goto unlock; ret =hfi_session_process_buf (inst, &fdata);@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)hfi_session_abort (inst);venus_helper_free_dpb_bufs (inst); +venus_helper_free_eos_bufs (inst);venus_pm_load_scale (inst);INIT_LIST_HEAD (&inst->registeredbufs);mutex_unlock (&inst->lock);
drivers/media/platform/qcom/venus/vdec.c static int vdec_open(struct file *file) · line 1686
Quoted 7 lines
drivers/media/platform/qcom/venus/vdec.c +1
-0@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)if (!inst)return -ENOMEM ; +INIT_LIST_HEAD (&inst->eosbufs);INIT_LIST_HEAD (&inst->dpbbufs);INIT_LIST_HEAD (&inst->registeredbufs);INIT_LIST_HEAD (&inst->internalbufs);
PATCH v2 5/7 media: venus: hfi_plat_v6_lite: Populate decode capabilities
In reply to Jorge Ramirez-OrtizAdd hfi platform file with decoding capabilities for hfi v6_lite.
--- drivers/media/platform/qcom/venus/Makefile | 2 +- .../media/platform/qcom/venus/hfi_platform.c | 2 + .../media/platform/qcom/venus/hfi_platform.h | 1 + .../qcom/venus/hfi_platform_v6_lite.c | 148 ++++++++++++++++++ 4 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
drivers/media/platform/qcom/venus/Makefile +1 -1
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \ hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \ hfi_parser.o pm_helpers.o dbgfs.o \ hfi_platform.o hfi_platform_v4.o \ - hfi_platform_v6.o hfi_plat_bufs_v6.o \ + hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \ venus-dec-objs += vdec.o vdec_ctrls.o venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)return &hfi_plat_v4;case HFI_VERSION_6XX :return &hfi_plat_v6; +case HFI_VERSION_6XX_LITE : +return &hfi_plat_v6_lite;default :break ; }
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
@@ -58,6 +58,7 @@ struct hfi_platform {extern const struct hfi_platform hfi_plat_v4;extern const struct hfi_platform hfi_plat_v6; +extern const struct hfi_platform hfi_plat_v6_lite;const struct hfi_platform *hfi_platform_get (enum hfi_version version); unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +148 -0
148 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 5/7] media: venus: hfi_plat_v6_lite: Populate decode capabilities
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 88
Quoted 5 lines · Jorge Ramirez-Ortiz
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +5
-0+static const struct hfi_platform_codec_freq_data codec_freq_data[] = { + {V4L2_PIX_FMT_H264 ,VIDC_SESSION_TYPE_DEC ,440 ,0 ,440 }, + {V4L2_PIX_FMT_HEVC ,VIDC_SESSION_TYPE_DEC ,440 ,0 ,440 }, + {V4L2_PIX_FMT_VP9 ,VIDC_SESSION_TYPE_DEC ,440 ,0 ,440 }, +};
This looks off, why is there no TYPE_ENC ?
You're declaring the encoder in patch 6/7 - what's going on here ?
---
bod
Re: [PATCH v2 5/7] media: venus: hfi_plat_v6_lite: Populate decode capabilities
Quoted 8 lines · Bryan O'Donoghue
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c line 88
Quoted 5 lines · Jorge Ramirez-Ortiz
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +5
-0+static const struct hfi_platform_codec_freq_data codec_freq_data[] = { + {V4L2_PIX_FMT_H264 ,VIDC_SESSION_TYPE_DEC ,440 ,0 ,440 }, + {V4L2_PIX_FMT_HEVC ,VIDC_SESSION_TYPE_DEC ,440 ,0 ,440 }, + {V4L2_PIX_FMT_VP9 ,VIDC_SESSION_TYPE_DEC ,440 ,0 ,440 }, +};This looks off, why is there no
TYPE_ENC?
yes
Quoted 2 lines
You're declaring the encoder in patch 6/7 - what's going on here ?
right, so at this stage, only decode support is being enabled, as mentioned in the cover letter and reflected in the series. Patch 6/7 acknowledges that the hardware does support encoding, but the driver is not enabling it yet.
I'm currently investigating an issue that causes a reboot during encoding, and I plan to submit encoder support once that is resolved — likely in the coming weeks.
Splitting the series this way should allow decode support to land without delay, while encoder enablement can follow as a separate, self-contained update. I hope this is acceptable.
Quoted 3 lines
---
bod
PATCH v2 6/7 media: venus: core: Add qcm2290 DT compatible and resource data
In reply to Jorge Ramirez-OrtizAdd a qcm2290 compatible binding to the venus core.
---
v2: fixed missing enc_nodename
added Loic Poulain as co-developer (should be on v1)
drivers/media/platform/qcom/venus/core.c | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/media/platform/qcom/venus/core.c +40 -0
@@ -1062,6 +1062,45 @@ static const struct venus_resources sc7280_res = { .enc_nodename = "video-encoder", }; +static const struct freq_tbl qcm2290_freq_table[] = { + {352800 ,240000000 },/* 1920x1088 @ 30 + 1280x720 @ 30 */ + {244800 ,133000000 },/* 1920x1088 @ 30 */ +}; + +static const struct bw_tbl qcm2290_bw_table_dec[] = { + {244800 ,2128000 ,0 ,2128000 ,0 },/* 1920x1088 @ 30 */ +}; + +static const struct venus_resources qcm2290_res = { + .freq_tbl = qcm2290_freq_table, + .freq_tbl_size =ARRAY_SIZE (qcm2290_freq_table), + .bw_tbl_dec = qcm2290_bw_table_dec, + .bw_tbl_dec_size =ARRAY_SIZE (qcm2290_bw_table_dec), + .clks = {"core" ,"iface" ,"bus" ,"throttle" }, + .clks_num =4 , + .vcodec0_clks = {"vcodec0_core" ,"vcodec0_bus" }, + .vcodec_clks_num =2 , + .vcodec_pmdomains = (const char *[]) {"venus" ,"vcodec0" }, + .vcodec_pmdomains_num =2 , + .opp_pmdomain = (const char *[]) {"cx" }, + .vcodec_num =1 , + .hfi_version =HFI_VERSION_6XX_LITE , + .vpu_version =VPU_VERSION_AR50_LITE , + .max_load =352800 , + .num_vpp_pipes =1 , + .vmem_id =VIDC_RESOURCE_NONE , + .vmem_size =0 , + .vmem_addr =0 , + .cp_start =0 , + .cp_size =0x70800000 , + .cp_nonpixel_start =0x1000000 , + .cp_nonpixel_size =0x24800000 , + .dma_mask =0xe0000000 -1 , + .fwname ="qcom/venus-6.0/venus.mbn" , + .dec_nodename ="video-decoder" , + .enc_nodename ="video-encoder" , +}; +static const struct of_device_id venus_dt_match[] = { { .compatible ="qcom,msm8916-venus" , .data = &msm8916_res, }, { .compatible ="qcom,msm8996-venus" , .data = &msm8996_res, },
@@ -1072,6 +1111,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 v2 7/7 arm64: dts: qcom: qcm2290: Add venus video node
In reply to Jorge Ramirez-OrtizAdd DT entries for the qcm2290 venus encoder/decoder.
---
v2: removed deprecated properties
arch/arm64/boot/dts/qcom/qcm2290.dtsi | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +45 -0
@@ -1628,6 +1628,51 @@ adreno_smmu: iommu@59a0000 { #iommu-cells = <2>; }; + venus: video-codec@5a00000 { + compatible = "qcom,qcm2290-venus"; + reg = <0 0x5a00000 0 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + + 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
Quoted 63 lines · Jorge Ramirez-Ortiz
Changes since v1:
- AddIS_HFImacro usage
- Move schema patch to top
- Fix commit messagesThis patch series adds support for the Venus video decoder/encoder block present on the Qualcomm QCM2290.
The QCM2290 integrates an
AR50_LITEcore, a low-power implementation of Venus supporting H.264, HEVC (H.265), and VP9 decoding.The series includes:
• DT binding schema for qcom,qcm2290-venus
• SoC integration viaqcm2290.dtsi
• Resource table definitions and frequency scaling
• Platform capability registration for theAR50_LITEcoreDecoding was verified on the QCOM RB1 platform using GStreamer with V4L2-based decode plugins. The following pipelines were used for playback 1280x720 and 1920x1080 H.264, HVEC and VP9 videos from https://www.elecard.com/videos.
[H.264]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h264parse ! v4l2h264dec \
! videoconvert ! autovideosink[H.265]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h265parse ! v4l2h265dec \
! videoconvert ! autovideosink[VP9]
gst-launch-1.0 filesrc location=videos/xxxxx.webm \
! matroskademus ! queue ! v4l2vp8dec \
! videoconvert ! autovideosink---
Jorge Ramirez-Ortiz (7):
dt-bindings: media: venus: Add qcm2290 dt schema
media: venus: helpers: addIS_VPU()andIS_HFI()macros
media: venus: useIS_HFI()macro for multi-version check
media: venus: vdec:AR50_LITEvideo core support
media: venus:hfi_plat_v6_lite: Populate decode capabilities
media: venus: core: Add qcm2290 DT compatible and resource data
arm64: dts: qcom: qcm2290: Add venus video node.../bindings/media/qcom,qcm2290-venus.yaml | 117 ++++++++++++++ arch/arm64/boot/dts/qcom/qcm2290.dtsi | 45 ++++++ drivers/media/platform/qcom/venus/Makefile | 2 +- drivers/media/platform/qcom/venus/core.c | 51 +++++- drivers/media/platform/qcom/venus/core.h | 28 +++- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 ++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 +- .../media/platform/qcom/venus/hfi_platform.c | 2 + .../media/platform/qcom/venus/hfi_platform.h | 1 + .../qcom/venus/hfi_platform_v6_lite.c | 148 ++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_venus.c | 19 ++- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 17 +- 15 files changed, 504 insertions(+), 28 deletions(-)
Quoted 3 lines
create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlcreate mode 100644drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
Please fix the following.
~/my-environment/bin/checkset.sh
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #16:
new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 117 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.
0001-dt-bindings-media-venus-Add-qcm2290-dt-schema.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
CHECK: Macro argument reuse 'core' - possible side-effects? #33: FILE: drivers/media/platform/qcom/venus/core.h:537:
+#define MATCH_2(CMD, core, a, b) \
+ (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b))
CHECK: Macro argument reuse 'core' - possible side-effects? #35: FILE: drivers/media/platform/qcom/venus/core.h:539:
+#define MATCH_3(CMD, core, a, b, c) \
+ (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b) || \
+ IS_##CMD##_MATCH(core, c))
CHECK: Macro argument reuse 'core' - possible side-effects? #38: FILE: drivers/media/platform/qcom/venus/core.h:542:
+#define MATCH_4(CMD, core, a, b, c, d) \
+ (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b) || \
+ IS_##CMD##_MATCH(core, c) || IS_##CMD##_MATCH(core, d))
WARNING: Argument '_1' is not used in function-like macro
#42: FILE: drivers/media/platform/qcom/venus/core.h:546:
+#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME /* _1-_4 are ignored */
WARNING: Argument '_2' is not used in function-like macro
#42: FILE: drivers/media/platform/qcom/venus/core.h:546:
+#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME /* _1-_4 are ignored */
WARNING: Argument '_3' is not used in function-like macro
#42: FILE: drivers/media/platform/qcom/venus/core.h:546:
+#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME /* _1-_4 are ignored */
WARNING: Argument '_4' is not used in function-like macro
#42: FILE: drivers/media/platform/qcom/venus/core.h:546:
+#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME /* _1-_4 are ignored */
total: 0 errors, 4 warnings, 3 checks, 29 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.
0002-media-venus-helpers-add-IS_VPU-and-IS_HFI-macros.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 16 lines checked
0003-media-venus-use-IS_HFI-macro-for-multi-version-check.patch has no obvious style problems and is ready for submission.
CHECK: Macro argument reuse 'core' - possible side-effects?
#79: FILE: drivers/media/platform/qcom/venus/core.h:525:
+#define IS_V6(core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \
+ ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))
CHECK: Blank lines aren't necessary before a close brace '}' #153: FILE: drivers/media/platform/qcom/venus/helpers.c:254:
+
+}
CHECK: Unnecessary parentheses around 'buftype != HFI_BUFFER_INPUT' #215: FILE: drivers/media/platform/qcom/venus/helpers.c:709:
+ if ((buftype != HFI_BUFFER_INPUT) &&
+ (buftype != HFI_BUFFER_OUTPUT) &&
+ (buftype != HFI_BUFFER_OUTPUT2))
CHECK: Unnecessary parentheses around 'buftype != HFI_BUFFER_OUTPUT' #215: FILE: drivers/media/platform/qcom/venus/helpers.c:709:
+ if ((buftype != HFI_BUFFER_INPUT) &&
+ (buftype != HFI_BUFFER_OUTPUT) &&
+ (buftype != HFI_BUFFER_OUTPUT2))
CHECK: Unnecessary parentheses around 'buftype != HFI_BUFFER_OUTPUT2' #215: FILE: drivers/media/platform/qcom/venus/helpers.c:709:
+ if ((buftype != HFI_BUFFER_INPUT) &&
+ (buftype != HFI_BUFFER_OUTPUT) &&
+ (buftype != HFI_BUFFER_OUTPUT2))
total: 0 errors, 0 warnings, 5 checks, 314 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.
0004-media-venus-vdec-AR50_LITE-video-core-support.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
0004-media-venus-vdec-AR50_LITE-video-core-support.patch:64: bufferes ==> buffers, buffered 0004-media-venus-vdec-AR50_LITE-video-core-support.patch:65: bufferes ==> buffers, buffered
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #57:
new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 171 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.
0005-media-venus-hfi_plat_v6_lite-Populate-decode-capabil.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 52 lines checked
0006-media-venus-core-Add-qcm2290-DT-compatible-and-resou.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 51 lines checked
0007-arm64-dts-qcom-qcm2290-Add-venus-video-node.patch has no obvious style problems and is ready for submission.
~/Development/worktree/merges/linux-6.17-media-platform-qcom-next
(linux-6.17-media-platform-qcom-next*) [03:28:03]
deckard$
deckard$ cat ~/my-environment/bin/checkset.sh
#!/bin/sh
if [ -z "$KERNELPATH" ]
then
echo "Setting KERNELPATH to this directory which is probably what you want" echo "Please set KERNELPATH when running this utility to over-ride"; echo "KERNELPATH=pwd ~/my-environment/bin/checkset.sh" KERNELPATH=pwd
fi
for file in *.patch;
do $KERNELPATH/scripts/checkpatch.pl --strict $file;
codespell $file;
done
---
bod
Quoted 99 lines · Bryan O'Donoghue
Quoted 63 lines · Jorge Ramirez-Ortiz
Changes since v1:
- AddIS_HFImacro usage
- Move schema patch to top
- Fix commit messagesThis patch series adds support for the Venus video decoder/encoder block present on the Qualcomm QCM2290.
The QCM2290 integrates an
AR50_LITEcore, a low-power implementation of Venus supporting H.264, HEVC (H.265), and VP9 decoding.The series includes:
• DT binding schema for qcom,qcm2290-venus
• SoC integration viaqcm2290.dtsi
• Resource table definitions and frequency scaling
• Platform capability registration for theAR50_LITEcoreDecoding was verified on the QCOM RB1 platform using GStreamer with V4L2-based decode plugins. The following pipelines were used for playback 1280x720 and 1920x1080 H.264, HVEC and VP9 videos from https://www.elecard.com/videos.
[H.264]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h264parse ! v4l2h264dec \
! videoconvert ! autovideosink[H.265]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h265parse ! v4l2h265dec \
! videoconvert ! autovideosink[VP9]
gst-launch-1.0 filesrc location=videos/xxxxx.webm \
! matroskademus ! queue ! v4l2vp8dec \
! videoconvert ! autovideosink---
Jorge Ramirez-Ortiz (7):
dt-bindings: media: venus: Add qcm2290 dt schema
media: venus: helpers: addIS_VPU()andIS_HFI()macros
media: venus: useIS_HFI()macro for multi-version check
media: venus: vdec:AR50_LITEvideo core support
media: venus:hfi_plat_v6_lite: Populate decode capabilities
media: venus: core: Add qcm2290 DT compatible and resource data
arm64: dts: qcom: qcm2290: Add venus video node.../bindings/media/qcom,qcm2290-venus.yaml | 117 ++++++++++++++ arch/arm64/boot/dts/qcom/qcm2290.dtsi | 45 ++++++ drivers/media/platform/qcom/venus/Makefile | 2 +- drivers/media/platform/qcom/venus/core.c | 51 +++++- drivers/media/platform/qcom/venus/core.h | 28 +++- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 81 ++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 +- .../media/platform/qcom/venus/hfi_platform.c | 2 + .../media/platform/qcom/venus/hfi_platform.h | 1 + .../qcom/venus/hfi_platform_v6_lite.c | 148 ++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_venus.c | 19 ++- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 17 +- 15 files changed, 504 insertions(+), 28 deletions(-)Quoted 3 lines
create mode 100644
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yamlcreate mode 100644drivers/media/platform/qcom/venus/hfi_platform_v6_lite.cPlease fix the following.
~/my-environment/bin/checkset.sh
WARNING: added, moved or deleted file(s), doesMAINTAINERSneed updating? #16:
new file mode 100644total: 0 errors, 1 warnings, 0 checks, 117 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.0001-dt-bindings-media-venus-Add-qcm2290-dt-schema.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.
CHECK: Macro argument reuse 'core' - possible side-effects? #33: FILE:drivers/media/platform/qcom/venus/core.h:537:(quoted diff) +2
-0+#define MATCH_2(CMD, core, a, b) \ + (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b))CHECK: Macro argument reuse 'core' - possible side-effects? #35: FILE:
drivers/media/platform/qcom/venus/core.h:539:(quoted diff) +3
-0+#define MATCH_3(CMD, core, a, b, c) \ + (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b) || \ + IS_##CMD##_MATCH(core, c))CHECK: Macro argument reuse 'core' - possible side-effects? #38: FILE:
drivers/media/platform/qcom/venus/core.h:542:
Review
Quoted 3 lines
(quoted diff) +3
-0+#define MATCH_4(CMD, core, a, b, c, d) \ + (IS_##CMD##_MATCH(core, a) || IS_##CMD##_MATCH(core, b) || \ + IS_##CMD##_MATCH(core, c) || IS_##CMD##_MATCH(core, d))
um ok, I'll rename core, makes sense.
Quoted 9 lines
WARNING: Argument '_1' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */WARNING: Argument '_2' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */
Quoted 7 lines
WARNING: Argument '_3' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */WARNING: Argument '_4' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */
about the warnings there is nothing that can be done - those parameters as per the comments are necessarily ignored - that is the way the macro is supposed to work.
can we not live with them? otherwise I cant do it in a nice way.
Quoted 23 lines
total: 0 errors, 4 warnings, 3 checks, 29 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.0002-media-venus-helpers-add-IS_VPU-and-IS_HFI-macros.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 16 lines checked0003-media-venus-use-IS_HFI-macro-for-multi-version-check.patch has no obvious style problems and is ready for submission.
CHECK: Macro argument reuse 'core' - possible side-effects? #79: FILE:drivers/media/platform/qcom/venus/core.h:525:(quoted diff) +2
-0+#define IS_V6(core) (((core)->res->hfi_version == HFI_VERSION_6XX) || \ + ((core)->res->hfi_version == HFI_VERSION_6XX_LITE))CHECK: Blank lines aren't necessary before a close brace '}' #153: FILE:
drivers/media/platform/qcom/venus/helpers.c:254:
Review
Quoted 2 lines
(quoted diff) +2
-0+ +}
ok, will remove core from macros
Quoted 16 lines
CHECK: Unnecessary parentheses around 'buftype !=
HFI_BUFFER_INPUT' #215: FILE:drivers/media/platform/qcom/venus/helpers.c:709:(quoted diff) +3
-0+ if ((buftype != HFI_BUFFER_INPUT) && + (buftype != HFI_BUFFER_OUTPUT) && + (buftype != HFI_BUFFER_OUTPUT2))CHECK: Unnecessary parentheses around 'buftype !=
HFI_BUFFER_OUTPUT' #215: FILE:drivers/media/platform/qcom/venus/helpers.c:709:(quoted diff) +3
-0+ if ((buftype != HFI_BUFFER_INPUT) && + (buftype != HFI_BUFFER_OUTPUT) && + (buftype != HFI_BUFFER_OUTPUT2))CHECK: Unnecessary parentheses around 'buftype !=
HFI_BUFFER_OUTPUT2' #215: FILE:drivers/media/platform/qcom/venus/helpers.c:709:
Review
Quoted 3 lines
(quoted diff) +3
-0+ if ((buftype != HFI_BUFFER_INPUT) && + (buftype != HFI_BUFFER_OUTPUT) && + (buftype != HFI_BUFFER_OUTPUT2))
yeah, ok
Quoted 36 lines
total: 0 errors, 0 warnings, 5 checks, 314 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.0004-media-venus-vdec-AR50_LITE-video-core-support.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.
0004-media-venus-vdec-AR50_LITE-video-core-support.patch:64: bufferes ==> buffers, buffered 0004-media-venus-vdec-AR50_LITE-video-core-support.patch:65: bufferes ==> buffers, buffered
WARNING: added, moved or deleted file(s), doesMAINTAINERSneed updating? #57:
new file mode 100644total: 0 errors, 1 warnings, 0 checks, 171 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or
--fix-inplace.0005-media-venus-hfi_plat_v6_lite-Populate-decode-capabil.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 52 lines checked0006-media-venus-core-Add-qcm2290-DT-compatible-and-resou.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 51 lines checked
Quoted 6 lines
0007-arm64-dts-qcom-qcm2290-Add-venus-video-node.patch has no obvious style problems and is ready for submission.
~/Development/worktree/merges/linux-6.17-media-platform-qcom-next
(linux-6.17-media-platform-qcom-next*) [03:28:03]
deckard$
ah thanks, was just going to ask
Quoted 16 lines
deckard$ cat
~/my-environment/bin/checkset.sh
#!/bin/sh
if [ -z "$KERNELPATH" ]
then
echo "Setting KERNELPATH to this directory which is probably what you want" echo "Please set KERNELPATH when running this utility to over-ride"; echo "KERNELPATH=pwd~/my-environment/bin/checkset.sh" KERNELPATH=pwd
fi
for file in *.patch;
do$KERNELPATH/scripts/checkpatch.pl--strict $file;
codespell $file;
done---
bod
Quoted 20 lines · Jorge Ramirez
Quoted 8 lines
WARNING: Argument '_1' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */WARNING: Argument '_2' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */Quoted 7 lines
WARNING: Argument '_3' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */WARNING: Argument '_4' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */about the warnings there is nothing that can be done - those parameters as per the comments are necessarily ignored - that is the way the macro is supposed to work.
Quoted 1 line
can we not live with them? otherwise I cant do it in a nice way.
For preference I'd like to avoid adding warnings.
Let's just stick with your first version instead.
---
bod
Quoted 21 lines · Bryan O'Donoghue
Quoted 20 lines · Jorge Ramirez
Quoted 8 lines
WARNING: Argument '_1' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */WARNING: Argument '_2' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */Quoted 7 lines
WARNING: Argument '_3' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */WARNING: Argument '_4' is not used in function-like macro
#42: FILE:drivers/media/platform/qcom/venus/core.h:546:
+#defineGET_MACRO(_1, _2, _3, _4, NAME, ...)NAME /* _1-_4 are ignored */about the warnings there is nothing that can be done - those parameters as per the comments are necessarily ignored - that is the way the macro is supposed to work.
Quoted 5 lines
Quoted 1 line
can we not live with them? otherwise I cant do it in a nice way.
For preference I'd like to avoid adding warnings.
Let's just stick with your first version instead.
ok - but I think this made the code more readable
Quoted 3 lines
---
bod
v3 cover media: venus: Add QCM2290 support with AR50_LITE core
In reply to Jorge Ramirez-OrtizChanges 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.
The QCM2290 integrates an AR50_LITE core, a low-power implementation of Venus supporting H.264, HEVC (H.265), and VP9 decoding.
The series includes:
- DT binding schema for qcom,qcm2290-venus
- SoC integration via qcm2290.dtsi
- Resource table definitions and frequency scaling
- Platform capability registration for the AR50_LITE core
Decoding was verified on the QCOM RB1 platform using GStreamer with V4L2-based decode plugins. The following pipelines were used for playback 1280x720 and 1920x1080 H.264, HEVC and VP9 videos from https://www.elecard.com/videos.
[H.264]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h264parse ! v4l2h264dec \
! videoconvert ! autovideosink
[H.265]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h265parse ! v4l2h265dec \
! videoconvert ! autovideosink
[VP9]
gst-launch-1.0 filesrc location=videos/xxxxx.webm \
! matroskademux ! queue ! v4l2vp9dec \
! videoconvert ! autovideosink
[Fluster]
The H.264 decoder was also tested using the Fluster test suite (version: v0.4.0-12-g33566abd0964).
Target: GStreamer-H.264-V4L2-Gst1.0, Test Suite: JVT-AVC_V1
Result: 126/135 tests passed
Failures:
FM1_BT_B, FM1_FT_E, FM2_SVA_C, BA3_SVA_C, SP1_BT_A, SP2_BT_B, MR6_BT_B, MR7_BT_B, MR8_BT_B
---
Jorge Ramirez-Ortiz (5):
dt-bindings: media: venus: Add qcm2290 dt schema
media: venus: vdec: AR50_LITE video core support
media: venus: hfi_plat_v6_lite: Populate decode capabilities
media: venus: core: Add qcm2290 DT compatible and resource data
arm64: dts: qcom: qcm2290: Add venus video node
.../bindings/media/qcom,qcm2290-venus.yaml | 117 ++++++++++++++ arch/arm64/boot/dts/qcom/qcm2290.dtsi | 45 ++++++ drivers/media/platform/qcom/venus/Makefile | 2 +- drivers/media/platform/qcom/venus/core.c | 51 +++++- drivers/media/platform/qcom/venus/core.h | 11 +- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 80 ++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 +- .../media/platform/qcom/venus/hfi_platform.c | 2 + .../media/platform/qcom/venus/hfi_platform.h | 1 + .../qcom/venus/hfi_platform_v6_lite.c | 148 ++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_venus.c | 14 +- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 +- 15 files changed, 482 insertions(+), 25 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
--
2.34.1
PATCH v3 1/5 dt-bindings: media: venus: Add qcm2290 dt schema
Add a schema for the venus video encoder/decoder on the qcm2290.
--- .../bindings/media/qcom,qcm2290-venus.yaml | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +117 -0
@@ -0,0 +1,117 @@ +# 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 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + required-opps = <&rpmpd_opp_svs>; + }; + }; + };
Signature · 1 line
2.34.1
Re: [PATCH v3 1/5] dt-bindings: media: venus: Add qcm2290 dt schema
Quoted 6 lines · Jorge Ramirez-Ortiz
Add a schema for the venus video encoder/decoder on the qcm2290.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- .../bindings/media/qcom,qcm2290-venus.yaml | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+)
So now I see the reason why v2 and v3 did not pop up in my inbox.
Subject prefix is still incorrect/reversed.
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters
Best regards,
Krzysztof
PATCH v3 2/5 media: venus: vdec: AR50_LITE video core support
In reply to Jorge Ramirez-OrtizThe AR50_LITE is a streamlined variant of the AR50 video core, designed for power and cost-efficient platforms.
It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats.
--- drivers/media/platform/qcom/venus/core.c | 11 ++- drivers/media/platform/qcom/venus/core.h | 11 ++- drivers/media/platform/qcom/venus/firmware.c | 8 +- drivers/media/platform/qcom/venus/helpers.c | 80 +++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + .../media/platform/qcom/venus/hfi_helper.h | 10 ++- drivers/media/platform/qcom/venus/hfi_venus.c | 14 ++-- .../media/platform/qcom/venus/pm_helpers.c | 1 + drivers/media/platform/qcom/venus/vdec.c | 15 ++-- 9 files changed, 128 insertions(+), 24 deletions(-)
drivers/media/platform/qcom/venus/core.c +8 -3
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)static void venus_assign_register_offsets (struct venus_core *core) { -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { - core->vbif_base = core->base +VBIF_BASE ; +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) { core->cpu_base = core->base +CPU_BASE_V6 ; core->cpu_cs_base = core->base +CPU_CS_BASE_V6 ; core->cpu_ic_base = core->base +CPU_IC_BASE_V6 ; core->wrapper_base = core->base +WRAPPER_BASE_V6 ; core->wrapper_tz_base = core->base +WRAPPER_TZ_BASE_V6 ; - core->aon_base = core->base +AON_BASE_V6 ; +if (IS_AR50_LITE (core)) { + core->vbif_base =NULL ; + core->aon_base =NULL ; + }else { + core->vbif_base = core->base +VBIF_BASE ; + core->aon_base = core->base +AON_BASE_V6 ; + } }else { core->vbif_base = core->base +VBIF_BASE ; core->cpu_base = core->base +CPU_BASE ;
drivers/media/platform/qcom/venus/core.h +10 -1
@@ -382,6 +382,7 @@ enum venus_inst_modes {* @lock: instance lock * @core: a reference to the core struct * @clk_data: clock data per core ID +* @eosbufs: a lit of EOS buffers * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes
@@ -450,6 +451,7 @@ struct venus_inst {struct mutex lock;struct venus_core *core;struct clock_data clk_data; +struct list_head eosbufs;struct list_head dpbbufs;struct list_head internalbufs;struct list_head registeredbufs;
@@ -520,7 +522,14 @@ struct venus_inst {#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)#define IS_V3 (core) ((core)->res->hfi_version == HFI_VERSION_3XX)#define IS_V4 (core) ((core)->res->hfi_version == HFI_VERSION_4XX) -#define IS_V6 (core) ((core)->res->hfi_version == HFI_VERSION_6XX) +static inline bool IS_V6 (struct venus_core *core) +{ +if (WARN_ON_ONCE (!core)) +return false; + +return core->res->hfi_version ==HFI_VERSION_6XX || + core->res->hfi_version ==HFI_VERSION_6XX_LITE ; +}#define IS_AR50 (core) ((core)->res->vpu_version == VPU_VERSION_AR50)#define IS_AR50_LITE (core) ((core)->res->vpu_version == VPU_VERSION_AR50_LITE)
drivers/media/platform/qcom/venus/firmware.c +4 -4
@@ -30,7 +30,7 @@ static void venus_reset_cpu(struct venus_core *core)u32 fw_size = core->fw.mapped_mem_size;void __iomem *wrapper_base; -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) wrapper_base = core->wrapper_tz_base;else wrapper_base = core->wrapper_base;
@@ -42,7 +42,7 @@ static void venus_reset_cpu(struct venus_core *core)writel (fw_size, wrapper_base +WRAPPER_NONPIX_START_ADDR );writel (fw_size, wrapper_base +WRAPPER_NONPIX_END_ADDR ); -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Bring XTSS out of reset */ writel (0 , wrapper_base +WRAPPER_TZ_XTSS_SW_RESET ); }else {
@@ -68,7 +68,7 @@ int venus_set_hw_state(struct venus_core *core, bool resume)if (resume) {venus_reset_cpu (core); }else { -if (IS_IRIS2_1 (core)) +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core))writel (WRAPPER_XTSS_SW_RESET_BIT , core->wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET );else
@@ -181,7 +181,7 @@ static int venus_shutdown_no_tz(struct venus_core *core)void __iomem *wrapper_base = core->wrapper_base;void __iomem *wrapper_tz_base = core->wrapper_tz_base; -if (IS_IRIS2_1 (core)) { +if (IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {/* Assert the reset to XTSS */ reg =readl (wrapper_tz_base +WRAPPER_TZ_XTSS_SW_RESET ); reg |=WRAPPER_XTSS_SW_RESET_BIT ;
drivers/media/platform/qcom/venus/helpers.c +80 -0
92 lines not on this page · raw message
drivers/media/platform/qcom/venus/helpers.h +2 -0
@@ -58,6 +58,8 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt,bool venus_helper_check_format (struct venus_inst *inst,u32 v4l2_pixfmt);int venus_helper_alloc_dpb_bufs (struct venus_inst *inst);int venus_helper_free_dpb_bufs (struct venus_inst *inst); +int venus_helper_alloc_eos_buf (struct venus_inst *inst,struct hfi_frame_data *data); +int venus_helper_free_eos_bufs (struct venus_inst *inst);int venus_helper_intbufs_alloc (struct venus_inst *inst);int venus_helper_intbufs_free (struct venus_inst *inst);int venus_helper_intbufs_realloc (struct venus_inst *inst);
drivers/media/platform/qcom/venus/hfi_helper.h +7 -3
@@ -397,13 +397,16 @@#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5#define HFI_BUFFER_INTERNAL_SCRATCH (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x6 : 0x1000001)#define HFI_BUFFER_INTERNAL_SCRATCH_1 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x7 : 0x1000005)#define HFI_BUFFER_INTERNAL_SCRATCH_2 (ver) \ (((ver) == HFI_VERSION_4XX || \ - (ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006) + (ver) == HFI_VERSION_6XX || (ver) == HFI_VERSION_6XX_LITE) \ + ? 0x8 : 0x1000006)#define HFI_BUFFER_EXTRADATA_INPUT (ver) \ (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)#define HFI_BUFFER_EXTRADATA_OUTPUT (ver) \
@@ -561,6 +564,7 @@ enum hfi_version {HFI_VERSION_3XX ,HFI_VERSION_4XX ,HFI_VERSION_6XX , + HFI_VERSION_6XX_LITE, }; struct hfi_buffer_info {
drivers/media/platform/qcom/venus/hfi_venus.c +9 -5
@@ -497,7 +497,7 @@ static int venus_boot_core(struct venus_hfi_device *hdev)if (count >= max_tries) ret = -ETIMEDOUT ; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) { +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) {writel (0x1 , cpu_cs_base +CPU_CS_H2XSOFTINTEN_V6 );writel (0x0 , cpu_cs_base +CPU_CS_X2RPMH_V6 ); }
@@ -565,6 +565,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)u32 mask_val;int ret; +if (IS_AR50_LITE (hdev->core)) +return 0 ; +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) {writel (0x3 , cpu_cs_base +CPU_CS_X2RPMH_V6 );
@@ -1134,7 +1137,8 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base = hdev->core->wrapper_base; status =readl (wrapper_base +WRAPPER_INTR_STATUS ); -if (IS_IRIS2 (core) ||IS_IRIS2_1 (core)) { + +if (IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)) {if (status &WRAPPER_INTR_STATUS_A2H_MASK || status &WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status &CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK )
@@ -1146,7 +1150,7 @@ static irqreturn_t venus_isr(struct venus_core *core) hdev->irq_status = status; }writel (1 , cpu_cs_base +CPU_CS_A2HSOFTINTCLR ); -if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core))) +if (!(IS_IRIS2 (core) ||IS_IRIS2_1 (core) ||IS_AR50_LITE (core)))writel (status, wrapper_base +WRAPPER_INTR_CLEAR );return IRQ_WAKE_THREAD ;
@@ -1531,7 +1535,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );
@@ -1551,7 +1555,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;u32 ctrl_status, cpu_status; -if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core)) +if (IS_IRIS2 (hdev->core) ||IS_IRIS2_1 (hdev->core) ||IS_AR50_LITE (hdev->core)) cpu_status =readl (wrapper_tz_base +WRAPPER_TZ_CPU_STATUS_V6 );else cpu_status =readl (wrapper_base +WRAPPER_CPU_STATUS );
drivers/media/platform/qcom/venus/pm_helpers.c +1 -0
@@ -1168,6 +1168,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version)return &pm_ops_v3;case HFI_VERSION_4XX :case HFI_VERSION_6XX : +case HFI_VERSION_6XX_LITE :return &pm_ops_v4; }
drivers/media/platform/qcom/venus/vdec.c +7 -8
@@ -550,7 +550,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) {struct venus_inst *inst =to_inst (file);struct vb2_queue *dst_vq; -struct hfi_frame_data fdata = {0 }; +struct hfi_frame_data fdata;int ret; ret =v4l2_m2m_ioctl_try_decoder_cmd (file, fh, cmd);
@@ -561,18 +561,15 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)if (cmd->cmd ==V4L2_DEC_CMD_STOP ) {/* -* Implement V4L2_DEC_CMD_STOP by enqueue an empty buffer on +* Implement V4L2_DEC_CMD_STOP by enqueue a buffer on * decoder input to signal EOS. */ if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; - fdata.buffer_type =HFI_BUFFER_INPUT ; - fdata.flags |=HFI_BUFFERFLAG_EOS ; -if (IS_V6 (inst->core) &&is_fw_rev_or_older (inst->core,1 ,0 ,87 )) - fdata.device_addr =0 ; -else - fdata.device_addr =0xdeadb000 ; + ret =venus_helper_alloc_eos_buf (inst, &fdata); +if (ret) + goto unlock; ret =hfi_session_process_buf (inst, &fdata);
@@ -1332,6 +1329,7 @@ static void vdec_session_release(struct venus_inst *inst)hfi_session_abort (inst);venus_helper_free_dpb_bufs (inst); +venus_helper_free_eos_bufs (inst);venus_pm_load_scale (inst);INIT_LIST_HEAD (&inst->registeredbufs);mutex_unlock (&inst->lock);
@@ -1682,6 +1680,7 @@ static int vdec_open(struct file *file)if (!inst)return -ENOMEM ; +INIT_LIST_HEAD (&inst->eosbufs);INIT_LIST_HEAD (&inst->dpbbufs);INIT_LIST_HEAD (&inst->registeredbufs);INIT_LIST_HEAD (&inst->internalbufs);
Signature · 1 line
2.34.1
PATCH v3 3/5 media: venus: hfi_plat_v6_lite: Populate decode capabilities
In reply to Jorge Ramirez-OrtizAdd hfi platform file with decoding capabilities for hfi v6_lite.
--- drivers/media/platform/qcom/venus/Makefile | 2 +- .../media/platform/qcom/venus/hfi_platform.c | 2 + .../media/platform/qcom/venus/hfi_platform.h | 1 + .../qcom/venus/hfi_platform_v6_lite.c | 148 ++++++++++++++++++ 4 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c
drivers/media/platform/qcom/venus/Makefile +1 -1
@@ -5,7 +5,7 @@ venus-core-objs += core.o helpers.o firmware.o \ hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o \ hfi_parser.o pm_helpers.o dbgfs.o \ hfi_platform.o hfi_platform_v4.o \ - hfi_platform_v6.o hfi_plat_bufs_v6.o \ + hfi_platform_v6.o hfi_plat_bufs_v6.o hfi_platform_v6_lite.o \ venus-dec-objs += vdec.o vdec_ctrls.o venus-enc-objs += venc.o venc_ctrls.o
drivers/media/platform/qcom/venus/hfi_platform.c +2 -0
@@ -13,6 +13,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)return &hfi_plat_v4;case HFI_VERSION_6XX :return &hfi_plat_v6; +case HFI_VERSION_6XX_LITE : +return &hfi_plat_v6_lite;default :break ; }
drivers/media/platform/qcom/venus/hfi_platform.h +1 -0
@@ -58,6 +58,7 @@ struct hfi_platform {extern const struct hfi_platform hfi_plat_v4;extern const struct hfi_platform hfi_plat_v6; +extern const struct hfi_platform hfi_plat_v6_lite;const struct hfi_platform *hfi_platform_get (enum hfi_version version); unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
drivers/media/platform/qcom/venus/hfi_platform_v6_lite.c new file +148 -0
148 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 4/5 media: venus: core: Add qcm2290 DT compatible and resource data
In reply to Jorge Ramirez-OrtizAdd a qcm2290 compatible binding to the venus core.
--- drivers/media/platform/qcom/venus/core.c | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/media/platform/qcom/venus/core.c +40 -0
@@ -1062,6 +1062,45 @@ static const struct venus_resources sc7280_res = { .enc_nodename = "video-encoder", }; +static const struct freq_tbl qcm2290_freq_table[] = { + {352800 ,240000000 },/* 1920x1088 @ 30 + 1280x720 @ 30 */ + {244800 ,133000000 },/* 1920x1088 @ 30 */ +}; + +static const struct bw_tbl qcm2290_bw_table_dec[] = { + {244800 ,2128000 ,0 ,2128000 ,0 },/* 1920x1088 @ 30 */ +}; + +static const struct venus_resources qcm2290_res = { + .freq_tbl = qcm2290_freq_table, + .freq_tbl_size =ARRAY_SIZE (qcm2290_freq_table), + .bw_tbl_dec = qcm2290_bw_table_dec, + .bw_tbl_dec_size =ARRAY_SIZE (qcm2290_bw_table_dec), + .clks = {"core" ,"iface" ,"bus" ,"throttle" }, + .clks_num =4 , + .vcodec0_clks = {"vcodec0_core" ,"vcodec0_bus" }, + .vcodec_clks_num =2 , + .vcodec_pmdomains = (const char *[]) {"venus" ,"vcodec0" }, + .vcodec_pmdomains_num =2 , + .opp_pmdomain = (const char *[]) {"cx" }, + .vcodec_num =1 , + .hfi_version =HFI_VERSION_6XX_LITE , + .vpu_version =VPU_VERSION_AR50_LITE , + .max_load =352800 , + .num_vpp_pipes =1 , + .vmem_id =VIDC_RESOURCE_NONE , + .vmem_size =0 , + .vmem_addr =0 , + .cp_start =0 , + .cp_size =0x70800000 , + .cp_nonpixel_start =0x1000000 , + .cp_nonpixel_size =0x24800000 , + .dma_mask =0xe0000000 -1 , + .fwname ="qcom/venus-6.0/venus.mbn" , + .dec_nodename ="video-decoder" , + .enc_nodename ="video-encoder" , +}; +static const struct of_device_id venus_dt_match[] = { { .compatible ="qcom,msm8916-venus" , .data = &msm8916_res, }, { .compatible ="qcom,msm8996-venus" , .data = &msm8996_res, },
@@ -1072,6 +1111,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 v3 5/5 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 | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +45 -0
@@ -1628,6 +1628,51 @@ adreno_smmu: iommu@59a0000 { #iommu-cells = <2>; }; + venus: video-codec@5a00000 { + compatible = "qcom,qcm2290-venus"; + reg = <0 0x5a00000 0 0xff000>; + 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 0 &bimc SLAVE_EBI1 0>, + <&bimc MASTER_APPSS_PROC 0 &config_noc SLAVE_VENUS_CFG 0>; + interconnect-names = "video-mem", "cpu-cfg"; + + venus_opp_table: opp-table { + compatible = "operating-points-v2"; + opp-133000000 { + opp-hz = /bits/ 64 <133000000>; + required-opps = <&rpmpd_opp_low_svs>; + }; + + 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
Quoted 5 lines · Jorge Ramirez-Ortiz
Changes since v2:
- Removed IS_HFI/IS_VPU macros
- checkpatch.pl --strict fixes:
- convert macro to static inline to avoid argument reuse side effect
Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets.
Best regards,
Krzysztof
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Jorge Ramirez-Ortiz
Changes since v2:
- Removed IS_HFI/IS_VPU macros
- checkpatch.pl --strict fixes:
- convert macro to static inline to avoid argument reuse side effectDo not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets.
ah interesting, I was reading somewhere that sets should be threaded. sure will stop doing that (found it super annoying as well)
Quoted 3 lines
Best regards,
Krzysztof
Quoted 7 lines · Jorge Ramirez
Quoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Jorge Ramirez-Ortiz
Changes since v2:
- Removed IS_HFI/IS_VPU macros
- checkpatch.pl --strict fixes:
- convert macro to static inline to avoid argument reuse side effect
Quoted 6 lines
Quoted 3 lines
Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets.
ah interesting, I was reading somewhere that sets should be threaded. sure will stop doing that (found it super annoying as well)
https://elixir.bootlin.com/linux/v6.15/source/Documentation/process/submitting-patches.rst#L831
Best regards,
Krzysztof
Quoted 8 lines · Krzysztof Kozlowski
Quoted 7 lines · Jorge Ramirez
Quoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Jorge Ramirez-Ortiz
Changes since v2:
- Removed IS_HFI/IS_VPU macros
- checkpatch.pl --strict fixes:
- convert macro to static inline to avoid argument reuse side effect
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets.
ah interesting, I was reading somewhere that sets should be threaded. sure will stop doing that (found it super annoying as well)
https://elixir.bootlin.com/linux/v6.15/source/Documentation/process/submitting-patches.rst#L831
thanks will respin the patchset to version 4 without waiting then; if this happened to you it will have happened to others. sorry about it.
Quoted 2 lines
Best regards,
Krzysztof