media: qcom: venus: add MSM8939 support
Subsystems (8)
v5 cover media: qcom: venus: add MSM8939 support
This patch series adds support for Venus on MSM8939. It is mostly similar to MSM8916 Venus, except it needs two additional cores to be powered on before it can start decoding.
As per Dmitry's request, I am attaching Fluster results and v4l2-compliance output. Fluster results were very inconsistent and caused power collapse fails.
H.264: https://pastebin.com/C15qeq5W
H.265 (HEVC): https://pastebin.com/WDsnxvuk
VP8: https://pastebin.com/egAgEm15
v4l2-compliance: https://pastebin.com/VpBhEFc1
Power collapse fail log: https://pastebin.com/rTivMcpK
---
Changes in v5:
- Undid the merge of vcodec_clks, they are split back to
vcodec{0,1}_clks now.
- Extracted a dev_pm_domain_attach_list() call into a function of its
own to reduce nesting.
- Added missing "power-domain-names" required property to device tree
binding.
- Renamed vcodec clocks and power domains to match other Venus bindings.
- Reordered commits and grouped them by subsystems. Now first come DTB patches, then clock, then media.
- Removed "status = "disabled"" in the device tree example.
- Link to v4: https://patch.msgid.link/[email protected]
Changes in v4:
- Removed vcodec{0,1}_pmdomains and merged vcodec{0,1}_clks into
vcodec_clks instead for MSM8939.
- Inlined video decoder and encoder device tree nodes in the driver and removed them from the binding.
- Kept vdec and venc methods for HFI v3 separate from HFI v1.
- {vdec,venc}_get() are now called as early as before, since it is no
longer needed for us to attach power domains to dev_dec and dev_enc.
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Added missing vcodec1_clks to resource struct.
- Removed enc_nodename from resource struct since we include
video-decoder now.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Enabled GDSCs during encoding as well.
- Merged vcodec{0,1}_pmdomains_num into vcodec_pmdomains_num.
- Reworded commit for marking GDSCs as hardware controlled. Same
situation as in cdc59600bccf ("clk: qcom: gcc-msm8953: fix stuck venus0_core0 clock")
- Clarified the reason for missing firmware-name property in device
tree.
- Clarified the reason for moving vdec_get and venc_get for later.
- Link to v1: https://patch.msgid.link/[email protected]
To: Bryan O'Donoghue <[email protected]>
To: Vikash Garodia <[email protected]>
To: Dikshita Agarwal <[email protected]>
To: Mauro Carvalho Chehab <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: André Apitzsch <[email protected]>
To: Erikas Bitovtas <[email protected]>
To: Bjorn Andersson <[email protected]>
To: Konrad Dybcio <[email protected]>
To: Michael Turquette <[email protected]>
To: Stephen Boyd <[email protected]>
To: Brian Masney <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
André Apitzsch (4):
media: dt-bindings: venus: Add qcom,msm8939 schema
arm64: dts: qcom: msm8939: Add venus node
arm64: dts: qcom: msm8939-longcheer-l9100: Enable venus node
media: qcom: venus: Add msm8939 resource struct
Erikas Bitovtas (4):
arm64: dts: qcom: msm8939-asus-z00t: add Venus
clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
media: qcom: venus: add power domain enable logic for Venus cores
media: qcom: venus: Enable HEVC decoding for MSM8939
.../bindings/media/qcom,msm8939-venus.yaml | 79 +++++++++++ arch/arm64/boot/dts/qcom/msm8939-asus-z00t.dts | 8 ++ .../boot/dts/qcom/msm8939-longcheer-l9100.dts | 8 ++ arch/arm64/boot/dts/qcom/msm8939.dtsi | 23 ++++ drivers/clk/qcom/gcc-msm8939.c | 4 + drivers/media/platform/qcom/venus/core.c | 43 ++++++ drivers/media/platform/qcom/venus/hfi_parser.c | 3 +- drivers/media/platform/qcom/venus/pm_helpers.c | 149 ++++++++++++++++++++- 8 files changed, 312 insertions(+), 5 deletions(-)
---
base-commit: 735d2f48cadaa9a87e7c7601667878de70c771c5
change-id: 20260416-msm8939-venus-rfc-c025c4c74fae
Best regards,
Signature · 1 line
Erikas Bitovtas <[email protected]>
PATCH v5 1/8 media: dt-bindings: venus: Add qcom,msm8939 schema
From: André Apitzsch <[email protected]>
Add a schema description for the Venus video decoder/encoder IP in MSM8939.
--- .../bindings/media/qcom,msm8939-venus.yaml | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+)
Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml new file +79 -0
@@ -0,0 +1,79 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/qcom,msm8939-venus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm MSM8939 Venus video encode and decode accelerators + +maintainers: + - André Apitzsch <[email protected]> + - Erikas Bitovtas <[email protected]> + +description: + The Venus IP is a video encode and decode accelerator present + on Qualcomm platforms + +allOf: + - $ref: qcom,venus-common.yaml# + +properties: + compatible: + const: qcom,msm8939-venus + + power-domains: + maxItems: 3 + + power-domain-names: + items: + - const: venus + - const: vcodec0 + - const: vcodec1 + + clocks: + maxItems: 5 + + clock-names: + items: + - const: core + - const: iface + - const: bus + - const: vcodec0_core + - const: vcodec1_core + + iommus: + maxItems: 1 + +required: + - compatible + - iommus + - power-domain-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/qcom,gcc-msm8939.h> + + video-codec@1d00000 { + compatible = "qcom,msm8939-venus"; + reg = <0x01d00000 0xff000>; + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>, + <&gcc GCC_VENUS0_AHB_CLK>, + <&gcc GCC_VENUS0_AXI_CLK>, + <&gcc GCC_VENUS0_CORE0_VCODEC0_CLK>, + <&gcc GCC_VENUS0_CORE1_VCODEC0_CLK>; + clock-names = "core", + "iface", + "bus", + "vcodec0_core", + "vcodec1_core"; + power-domains = <&gcc VENUS_GDSC>, + <&gcc VENUS_CORE0_GDSC>, + <&gcc VENUS_CORE1_GDSC>; + power-domain-names = "venus", "vcodec0", "vcodec1"; + iommus = <&apps_iommu 5>; + memory-region = <&venus_mem>; + };
Signature · 1 line
2.54.0
Re: [PATCH v5 1/8] media: dt-bindings: venus: Add qcom,msm8939 schema
Quoted 98 lines · Erikas Bitovtas
From: André Apitzsch <[email protected]>
Add a schema description for the Venus video decoder/encoder IP in MSM8939.
Signed-off-by André Apitzsch <[email protected]>Signed-off-by Erikas Bitovtas <[email protected]>--- .../bindings/media/qcom,msm8939-venus.yaml | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+)Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml new file +79
-1@@ -0,0 +1,79 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/qcom,msm8939-venus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm MSM8939 Venus video encode and decode accelerators + +maintainers: + - André Apitzsch <[email protected]> + - Erikas Bitovtas <[email protected]> + +description: + The Venus IP is a video encode and decode accelerator present + on Qualcomm platforms + +allOf: + - $ref: qcom,venus-common.yaml# + +properties: + compatible: + const: qcom,msm8939-venus + + power-domains: + maxItems: 3 + + power-domain-names: + items: + - const: venus + - const: vcodec0 + - const: vcodec1 + + clocks: + maxItems: 5 + + clock-names: + items: + - const: core + - const: iface + - const: bus + - const: vcodec0_core + - const: vcodec1_core + + iommus: + maxItems: 1 + +required: + - compatible + - iommus + - power-domain-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/qcom,gcc-msm8939.h> + + video-codec@1d00000 { + compatible = "qcom,msm8939-venus"; + reg = <0x01d00000 0xff000>; + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>, + <&gcc GCC_VENUS0_AHB_CLK>, + <&gcc GCC_VENUS0_AXI_CLK>, + <&gcc GCC_VENUS0_CORE0_VCODEC0_CLK>, + <&gcc GCC_VENUS0_CORE1_VCODEC0_CLK>; + clock-names = "core", + "iface", + "bus", + "vcodec0_core", + "vcodec1_core"; + power-domains = <&gcc VENUS_GDSC>, + <&gcc VENUS_CORE0_GDSC>, + <&gcc VENUS_CORE1_GDSC>; + power-domain-names = "venus", "vcodec0", "vcodec1"; + iommus = <&apps_iommu 5>; + memory-region = <&venus_mem>; + }; --
Quoted 2 lines
2.54.0
PATCH v5 2/8 arm64: dts: qcom: msm8939: Add venus node
In reply to Erikas BitovtasFrom: André Apitzsch <[email protected]>
Add DT entries for the msm8939 venus encoder/decoder.
--- arch/arm64/boot/dts/qcom/msm8939.dtsi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/arm64/boot/dts/qcom/msm8939.dtsi +23 -0
@@ -1627,6 +1627,29 @@ opp-19200000 { }; }; + venus: video-codec@1d00000 { + compatible = "qcom,msm8939-venus"; + reg = <0x01d00000 0xff000>; + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>, + <&gcc GCC_VENUS0_AHB_CLK>, + <&gcc GCC_VENUS0_AXI_CLK>, + <&gcc GCC_VENUS0_CORE0_VCODEC0_CLK>, + <&gcc GCC_VENUS0_CORE1_VCODEC0_CLK>; + clock-names = "core", + "iface", + "bus", + "vcodec0_core", + "vcodec1_core"; + power-domains = <&gcc VENUS_GDSC>, + <&gcc VENUS_CORE0_GDSC>, + <&gcc VENUS_CORE1_GDSC>; + power-domain-names = "venus", "vcodec0", "vcodec1"; + iommus = <&apps_iommu 5>; + memory-region = <&venus_mem>; + status = "disabled"; + }; + apps_iommu: iommu@1ef0000 { compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1"; reg = <0x01ef0000 0x3000>;
Signature · 1 line
2.54.0
Re: [PATCH v5 2/8] arm64: dts: qcom: msm8939: Add venus node
Quoted 46 lines · Erikas Bitovtas
From: André Apitzsch <[email protected]>
Add DT entries for the msm8939 venus encoder/decoder.
Signed-off-by André Apitzsch <[email protected]>Signed-off-by Erikas Bitovtas <[email protected]>--- arch/arm64/boot/dts/qcom/msm8939.dtsi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)arch/arm64/boot/dts/qcom/msm8939.dtsi +23
-1@@ -1627,6 +1627,29 @@ opp-19200000 { }; }; + venus: video-codec@1d00000 { + compatible = "qcom,msm8939-venus"; + reg = <0x01d00000 0xff000>; + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>, + <&gcc GCC_VENUS0_AHB_CLK>, + <&gcc GCC_VENUS0_AXI_CLK>, + <&gcc GCC_VENUS0_CORE0_VCODEC0_CLK>, + <&gcc GCC_VENUS0_CORE1_VCODEC0_CLK>; + clock-names = "core", + "iface", + "bus", + "vcodec0_core", + "vcodec1_core"; + power-domains = <&gcc VENUS_GDSC>, + <&gcc VENUS_CORE0_GDSC>, + <&gcc VENUS_CORE1_GDSC>; + power-domain-names = "venus", "vcodec0", "vcodec1"; + iommus = <&apps_iommu 5>; + memory-region = <&venus_mem>; + status = "disabled"; + }; + apps_iommu: iommu@1ef0000 { compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1"; reg = <0x01ef0000 0x3000>; --
Quoted 2 lines
2.54.0
PATCH v5 3/8 arm64: dts: qcom: msm8939-longcheer-l9100: Enable venus node
In reply to Erikas BitovtasFrom: André Apitzsch <[email protected]>
Enable the venus node so that the video encoder/decoder will start working.
Default paths for firmware work on BQ Aquaris M5, which means firmware-name property can be left out.
--- arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts +8 -0
@@ -314,6 +314,14 @@ &usb_hs_phy { extcon = <&usb_id>; }; +&venus { + status = "okay"; +}; + +&venus_mem { + status = "okay"; +}; + &wcnss { status = "okay"; };
Signature · 1 line
2.54.0
Re: [PATCH v5 3/8] arm64: dts: qcom: msm8939-longcheer-l9100: Enable venus node
Quoted 34 lines · Erikas Bitovtas
From: André Apitzsch <[email protected]>
Enable the venus node so that the video encoder/decoder will start working.
Default paths for firmware work on BQ Aquaris M5, which means firmware-name property can be left out.
Signed-off-by André Apitzsch <[email protected]>--- arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts | 8 ++++++++ 1 file changed, 8 insertions(+)arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts +8
-1@@ -314,6 +314,14 @@ &usb_hs_phy { extcon = <&usb_id>; }; +&venus { + status = "okay"; +}; + +&venus_mem { + status = "okay"; +}; + &wcnss { status = "okay"; }; --
Quoted 2 lines
2.54.0
PATCH v5 4/8 arm64: dts: qcom: msm8939-asus-z00t: add Venus
In reply to Erikas BitovtasEnable Venus video encoder/decoder for Asus ZenFone 2 Laser/Selfie.
Default firmware paths work on Asus ZenFone 2 Laser/Selfie, which means firmware-name property can be left out.
--- arch/arm64/boot/dts/qcom/msm8939-asus-z00t.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/qcom/msm8939-asus-z00t.dts +8 -0
@@ -267,6 +267,14 @@ &usb_hs_phy { extcon = <&usb_id>; }; +&venus { + status = "okay"; +}; + +&venus_mem { + status = "okay"; +}; + &wcnss { status = "okay"; };
Signature · 1 line
2.54.0
Re: [PATCH v5 4/8] arm64: dts: qcom: msm8939-asus-z00t: add Venus
Quoted 31 lines · Erikas Bitovtas
Enable Venus video encoder/decoder for Asus ZenFone 2 Laser/Selfie.
Default firmware paths work on Asus ZenFone 2 Laser/Selfie, which means firmware-name property can be left out.
Signed-off-by Erikas Bitovtas <[email protected]>--- arch/arm64/boot/dts/qcom/msm8939-asus-z00t.dts | 8 ++++++++ 1 file changed, 8 insertions(+)arch/arm64/boot/dts/qcom/msm8939-asus-z00t.dts +8
-1@@ -267,6 +267,14 @@ &usb_hs_phy { extcon = <&usb_id>; }; +&venus { + status = "okay"; +}; + +&venus_mem { + status = "okay"; +}; + &wcnss { status = "okay"; }; --
Quoted 2 lines
2.54.0
PATCH v5 5/8 clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
In reply to Erikas BitovtasSince in downstream kernel VENUS_CORE0_GDSC and VENUS_CORE1_GDSC have a device tree property "qcom,supports-hw-trigger", add a HW_CTRL flag to these GDSCs to indicate that they are hardware controlled.
Venus core clock cannot be enabled if Venus core GDSCs are switched off. But since they are hardware controlled, they can be switched off at any moment. Vote for the Venus core clock to enable it later when GDSCs get turned on.
--- drivers/clk/qcom/gcc-msm8939.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/qcom/gcc-msm8939.c +4 -0
@@ -3664,6 +3664,7 @@ static struct clk_branch gcc_venus0_vcodec0_clk = {static struct clk_branch gcc_venus0_core0_vcodec0_clk = { .halt_reg =0x4c02c , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x4c02c , .enable_mask =BIT (0 ),
@@ -3681,6 +3682,7 @@ static struct clk_branch gcc_venus0_core0_vcodec0_clk = {static struct clk_branch gcc_venus0_core1_vcodec0_clk = { .halt_reg =0x4c034 , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x4c034 , .enable_mask =BIT (0 ),
@@ -3753,6 +3755,7 @@ static struct gdsc venus_core0_gdsc = { .pd = { .name = "venus_core0", }, + .flags = HW_CTRL, .pwrsts = PWRSTS_OFF_ON, };
@@ -3761,6 +3764,7 @@ static struct gdsc venus_core1_gdsc = { .pd = { .name = "venus_core1", }, + .flags = HW_CTRL, .pwrsts = PWRSTS_OFF_ON, };
Signature · 1 line
2.54.0
Bryan O'Donoghue
maintainerRe: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 3 lines · Erikas Bitovtas
Since in downstream kernel
VENUS_CORE0_GDSCandVENUS_CORE1_GDSChave a device tree property "qcom,supports-hw-trigger", add aHW_CTRLflag to these GDSCs to indicate that they are hardware controlled.
This is a misreading/misunderstanding - supports-hw-trigger means the GDSC is capable of being configured this way - not that it _must_ be configured this way.
Which leads me back to my previous point/feedback to you in the previous cycle.
If you _don't_ apply this patch, do you get different behaviour when trying to switch on the encoder ?
Quoted 1 line
Venus core clock cannot be enabled if Venus core GDSCs are switched off.
True.
Quoted 1 line
But since they are hardware controlled
False. Your patch makes it so.
The question is, is that change actually required and/or beneficial here ?
they can be switched off at
Quoted 50 lines
any moment. Vote for the Venus core clock to enable it later when GDSCs get turned on.
Signed-off-by Erikas Bitovtas <[email protected]>--- drivers/clk/qcom/gcc-msm8939.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/clk/qcom/gcc-msm8939.c +4
-1@@ -3664,6 +3664,7 @@ static struct clk_branch gcc_venus0_vcodec0_clk = {static struct clk_branch gcc_venus0_core0_vcodec0_clk = { .halt_reg =0x4c02c , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x4c02c , .enable_mask =BIT (0 ),@@ -3681,6 +3682,7 @@ static struct clk_branch gcc_venus0_core0_vcodec0_clk = {static struct clk_branch gcc_venus0_core1_vcodec0_clk = { .halt_reg =0x4c034 , + .halt_check =BRANCH_HALT_SKIP , .clkr = { .enable_reg =0x4c034 , .enable_mask =BIT (0 ),@@ -3753,6 +3755,7 @@ static struct gdsc venus_core0_gdsc = { .pd = { .name = "venus_core0", }, + .flags = HW_CTRL, .pwrsts = PWRSTS_OFF_ON, };@@ -3761,6 +3764,7 @@ static struct gdsc venus_core1_gdsc = { .pd = { .name = "venus_core1", }, + .flags = HW_CTRL, .pwrsts = PWRSTS_OFF_ON, }; --2.54.0
Re: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 9 lines · Bryan O'Donoghue
Quoted 3 lines · Erikas Bitovtas
Since in downstream kernel
VENUS_CORE0_GDSCandVENUS_CORE1_GDSChave a device tree property "qcom,supports-hw-trigger", add aHW_CTRLflag to these GDSCs to indicate that they are hardware controlled.This is a misreading/misunderstanding - supports-hw-trigger means the GDSC is capable of being configured this way - not that it _must_ be configured this way.
Quoted 6 lines
Which leads me back to my previous point/feedback to you in the previous cycle.
If you _don't_ apply this patch, do you get different behaviour when trying to switch on the encoder ?
Running the following ffmpeg command:
ffmpeg -i Videos/big_buck_bunny_1080p_H264_AAC_25fps_7200K.mp4 -input_format h264 -c:v vp8_v4l2m2m -pix_fmt nv12 big_buck_bunny_1080p_H264_AAC_25fps_7200K.vp8.mp4
Fails with:
[vp8_v4l2m2m @ 0xffffb0386870] Using device /dev/video1 [vp8_v4l2m2m @ 0xffffb0386870] driver 'qcom-venus' on card 'Qualcomm Venus video encoder' in mplane mode
[vp8_v4l2m2m @ 0xffffb0386870] requesting formats: output=NV12/nv12 capture=VP80/none
[mp4 @ 0xffffb4b3b7e0] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
[out#0/mp4 @ 0xffffb4265e70] Could not write header (incorrect codec parameters ?): Invalid argument
[vf#0:0 @ 0xffffb72105b0] Error sending frames to consumers: Invalid argument
[vf#0:0 @ 0xffffb72105b0] Task finished with error code: -22 (Invalid argument)
[vf#0:0 @ 0xffffb72105b0] Terminating thread with return code -22 (Invalid argument)
If I revert the patch, both decoder and encoder fail. This time, encoder fails with the following error:
[vp8_v4l2m2m @ 0xffff8d356870] Could not find a valid device [vp8_v4l2m2m @ 0xffff8d356870] can't configure encoder [vost#0:0/vp8_v4l2m2m @ 0xffff91b3ba80] [enc:vp8_v4l2m2m @ 0xffff8eb78f40] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[vf#0:0 @ 0xffff941f25b0] Error sending frames to consumers: Invalid argument
[vf#0:0 @ 0xffff941f25b0] Task finished with error code: -22 (Invalid argument)
[vf#0:0 @ 0xffff941f25b0] Terminating thread with return code -22 (Invalid argument)
[vost#0:0/vp8_v4l2m2m @ 0xffff91b3ba80] [enc:vp8_v4l2m2m @ 0xffff8eb78f40] Could not open encoder before EOF [vost#0:0/vp8_v4l2m2m @ 0xffff91b3ba80] Task finished with error code:
-22 (Invalid argument)
[vost#0:0/vp8_v4l2m2m @ 0xffff91b3ba80] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 0xffff91265e70] Nothing was written into output file, because at least one of its streams received no packets.
Quoted 13 lines
Quoted 1 line
Venus core clock cannot be enabled if Venus core GDSCs are switched off.
True.
Quoted 1 line
But since they are hardware controlled
False. Your patch makes it so.
The question is, is that change actually required and/or beneficial here ?
they can be switched off at
Quoted 2 lines
any moment. Vote for the Venus core clock to enable it later when GDSCs get turned on.
Bryan O'Donoghue
maintainerRe: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 5 lines · Erikas Bitovtas
Running the following ffmpeg command:
ffmpeg -i Videos/big_buck_bunny_1080p_H264_AAC_25fps_7200K.mp4 -input_format h264 -c:vvp8_v4l2m2m-pix_fmt nv12 big_buck_bunny_1080p_H264_AAC_25fps_7200K.vp8.mp4
Quoted 8 lines
Fails with:
[vp8_v4l2m2m@0xffffb0386870] Using device/dev/video1[vp8_v4l2m2m@0xffffb0386870] driver 'qcom-venus' on card 'Qualcomm Venus video encoder' in mplane mode
[vp8_v4l2m2m@0xffffb0386870] requesting formats: output=NV12/nv12 capture=VP80/none
[mp4 @0xffffb4b3b7e0] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
This is an ffmpeg error, rejecting saving vp8 in an mp4 file. Anyway this would do nothing on the encoder /dev/video1 is 'Qualcomm Venus video encoder' above
Try:
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H264 --stream-mmap --stream-out-mmap --stream-from=/media/cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d /dev/video1
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=HEVC --stream-mmap --stream-out-mmap --stream-from=/media/cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.hevc -d /dev/video1
---
bod
Re: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 9 lines
Try:
v4l2-ctl --verbose --set-fmt-video- out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt- video=pixelformat=H264 --stream-mmap --stream-out-mmap --stream-from=/ media/cyclists_1280x720_92frames.yuv --stream-to=/tmp/ cyclists_1280x720_92frames.h264 -d
/dev/video1
Quoted 7 lines
v4l2-ctl --verbose --set-fmt-video- out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt- video=pixelformat=HEVC --stream-mmap --stream-out-mmap --stream-from=/ media/cyclists_1280x720_92frames.yuv --stream-to=/tmp/ cyclists_1280x720_92frames.hevc -d
/dev/video1
Sorry, but I couldn't find the file you were referring to. Do you happen to have a link where I could download it? Thank you in advance.
Quoted 2 lines
---
bod
Bryan O'Donoghue
maintainerRe: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 16 lines · Erikas Bitovtas
Quoted 9 lines
Try:
v4l2-ctl --verbose --set-fmt-video- out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt- video=pixelformat=H264 --stream-mmap --stream-out-mmap --stream-from=/ media/cyclists_1280x720_92frames.yuv --stream-to=/tmp/ cyclists_1280x720_92frames.h264 -d
/dev/video1Quoted 7 lines
v4l2-ctl --verbose --set-fmt-video- out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt- video=pixelformat=HEVC --stream-mmap --stream-out-mmap --stream-from=/ media/cyclists_1280x720_92frames.yuv --stream-to=/tmp/ cyclists_1280x720_92frames.hevc -d
/dev/video1
Quoted 5 lines
Sorry, but I couldn't find the file you were referring to. Do you happen to have a link where I could download it? Thank you in advance.
Quoted 2 lines
---
bod
wget https://media.xiph.org/video/derf/y4m/crowd_run_1080p50.y4m
ffmpeg -i crowd_run_1080p50.y4m -vf scale=1280:720 -pix_fmt nv12 -frames:v 92 -f rawvideo cyclists_1280x720_92frames.yuv
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H264 --stream-mmap --stream-out-mmap --stream-from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d /dev/video1
---
bod
Re: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 6 lines · Bryan O'Donoghue
v4l2-ctl --verbose --set-fmt-video- out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt- video=pixelformat=H264 --stream-mmap --stream-out-mmap --stream- from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/ cyclists_1280x720_92frames.h264 -d
/dev/video1
With the patch kept:
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H26
4 --stream-mmap --stream-out-mmap --stream-from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d /dev/video1VIDIOC_QUERYCAP: okVIDIOC_G_FMT: okVIDIOC_S_FMT: ok
Format Video Capture Multiplanar:
Width/Height : 1280/736 Pixel Format : 'H264' (H.264) Field : None Number of planes : 1 Flags : Colorspace : Default
Transfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Plane 0 :
Bytes per Line : 0
Size Image : 708608VIDIOC_G_FMT: okVIDIOC_S_FMT: ok
Format Video Output Multiplanar:
Width/Height : 1280/736 Pixel Format : 'NV12' (Y/UV 4:2:0) Field : None Number of planes : 1 Flags : Colorspace : Default
Transfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Plane 0 :
Bytes per Line : 1280
Size Image : 1425408VIDIOC_G_SELECTION: okVIDIOC_S_SELECTION: ok
VIDIOC_G_FMT returned 0 (No error information) VIDIOC_G_FMT returned 0 (No error information) VIDIOC_G_FMT returned 0 (No error information) VIDIOC_REQBUFS returned -1 (Invalid argument)
With the patch reverted:
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H26
4 --stream-mmap --stream-out-mmap --stream-from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d /dev/video1VIDIOC_QUERYCAP: okVIDIOC_G_FMT: ok
The pixelformat 'H264' is invalidVIDIOC_G_FMT: ok
The pixelformat 'NV12' is invalid
Decoding breaks if I revert the patch as well, it fails with a power collapse fail.
Bryan O'Donoghue
maintainerRe: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 70 lines · Erikas Bitovtas
Quoted 6 lines · Bryan O'Donoghue
v4l2-ctl --verbose --set-fmt-video- out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt- video=pixelformat=H264 --stream-mmap --stream-out-mmap --stream- from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/ cyclists_1280x720_92frames.h264 -d
/dev/video1With the patch kept:
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H26
4 --stream-mmap --stream-out-mmap --stream-from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d/dev/video1VIDIOC_QUERYCAP: okVIDIOC_G_FMT: okVIDIOC_S_FMT: ok
Format Video Capture Multiplanar:Width/Height : 1280/736 Pixel Format : 'H264' (H.264) Field : None Number of planes : 1 Flags : Colorspace : DefaultTransfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Plane 0 :
Bytes per Line : 0
Size Image : 708608VIDIOC_G_FMT: okVIDIOC_S_FMT: ok
Format Video Output Multiplanar:Width/Height : 1280/736 Pixel Format : 'NV12' (Y/UV 4:2:0) Field : None Number of planes : 1 Flags : Colorspace : DefaultTransfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Plane 0 :
Bytes per Line : 1280
Size Image : 1425408VIDIOC_G_SELECTION: okVIDIOC_S_SELECTION: ok
VIDIOC_G_FMTreturned 0 (No error information)VIDIOC_G_FMTreturned 0 (No error information)VIDIOC_G_FMTreturned 0 (No error information)VIDIOC_REQBUFSreturned -1 (Invalid argument)With the patch reverted:
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H26
4 --stream-mmap --stream-out-mmap --stream-from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d/dev/video1VIDIOC_QUERYCAP: okVIDIOC_G_FMT: ok
The pixelformat 'H264' is invalidVIDIOC_G_FMT: ok
The pixelformat 'NV12' is invalid
Quoted 2 lines
Decoding breaks if I revert the patch as well, it fails with a power collapse fail.
If you declare both as decoders can you successfully decode @ video0 and video1 ?
ie be sure the error is encoder and not core specific.
---
bod
Re: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 71 lines · Bryan O'Donoghue
Quoted 70 lines · Erikas Bitovtas
Quoted 6 lines · Bryan O'Donoghue
v4l2-ctl --verbose --set-fmt-video- out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt- video=pixelformat=H264 --stream-mmap --stream-out-mmap --stream- from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/ cyclists_1280x720_92frames.h264 -d
/dev/video1With the patch kept:
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H26
4 --stream-mmap --stream-out-mmap --stream-from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d/dev/video1VIDIOC_QUERYCAP: okVIDIOC_G_FMT: okVIDIOC_S_FMT: ok
Format Video Capture Multiplanar:
Width/Height : 1280/736
Pixel Format : 'H264' (H.264)
Field : None
Number of planes : 1
Flags :
Colorspace : Default
Transfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Plane 0 :
Bytes per Line : 0
Size Image : 708608VIDIOC_G_FMT: okVIDIOC_S_FMT: ok
Format Video Output Multiplanar:
Width/Height : 1280/736
Pixel Format : 'NV12' (Y/UV 4:2:0)
Field : None
Number of planes : 1
Flags :
Colorspace : Default
Transfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Plane 0 :
Bytes per Line : 1280
Size Image : 1425408VIDIOC_G_SELECTION: okVIDIOC_S_SELECTION: ok
VIDIOC_G_FMTreturned 0 (No error information)VIDIOC_G_FMTreturned 0 (No error information)VIDIOC_G_FMTreturned 0 (No error information)VIDIOC_REQBUFSreturned -1 (Invalid argument)With the patch reverted:
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H26
4 --stream-mmap --stream-out-mmap --stream-from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d/dev/video1VIDIOC_QUERYCAP: okVIDIOC_G_FMT: ok
The pixelformat 'H264' is invalidVIDIOC_G_FMT: ok
The pixelformat 'NV12' is invalid
Quoted 6 lines
Quoted 2 lines
Decoding breaks if I revert the patch as well, it fails with a power collapse fail.
If you declare both as decoders can you successfully decode @ video0 and video1 ?
Apparently device nodes for encoder and decoder are not persistent
across reboots, so when I reverted the patch, I was actually testing against decoder, not encoder.
So, the result is the same when the patch is applied, when it is reverted, and when testing against v1 where the cores are enabled only for decoding.
Bryan O'Donoghue
maintainerRe: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 6 lines · Erikas Bitovtas
across reboots, so when I reverted the patch, I was actually testing against decoder, not encoder.
So, the result is the same when the patch is applied, when it is reverted, and when testing against v1 where the cores are enabled only for decoding.
OK but this is testing encoding
v4l2-ctl --verbose --set-fmt-video-out=width=1280,height=720,pixelformat=NV12 --set-selection-output target=crop,top=0,left=0,width=1280,height=720 --set-fmt-video=pixelformat=H26
4 --stream-mmap --stream-out-mmap --stream-from=cyclists_1280x720_92frames.yuv --stream-to=/tmp/cyclists_1280x720_92frames.h264 -d /dev/video1
I think the GDSC patch specifically isn't too much of a concern.
1. Core0 works as decoder
2. Core1 doesn't work right now.
So what I'm trying to ask is if we could test it both as an encoder or as a decoder.
If decoder works when both cores are declared decoder, we know there's a problem with encoder and could potentially proceed with upstream decoder x 2.
OTOH if Core1 can't be coaxed into working in either mode, we are better off either holding off on this series until the breakages is root caused or leaving out Core1 entirely for now.
i.e. there is no utility in declaring an encoder or decoder to userspace that is known to be broken.
---
bod
Re: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 7 lines
OTOH if Core1 can't be coaxed into working in either mode, we are better off either holding off on this series until the breakages is root caused or leaving out Core1 entirely for now.
i.e. there is no utility in declaring an encoder or decoder to userspace that is known to be broken.
Last time I tried to enable only 1 of the cores, the following would happen:
- If core0 is enabled, HEVC decoding would work, but not the other codecs.
- If core1 is enabled, the rest of codecs would work, but not HEVC. Given we don't really have a way to power up a core based on which codec we are dealing with, I suggest we leave both cores in the binding and enable them indiscriminately.
Bryan O'Donoghue
maintainerRe: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 9 lines · Erikas Bitovtas
Quoted 7 lines
OTOH if Core1 can't be coaxed into working in either mode, we are better off either holding off on this series until the breakages is root caused or leaving out Core1 entirely for now.
i.e. there is no utility in declaring an encoder or decoder to userspace that is known to be broken.
Last time I tried to enable only 1 of the cores, the following would happen:- If core0 is enabled, HEVC decoding would work, but not the other codecs.
- If core1 is enabled, the rest of codecs would work, but not HEVC.
Can you be a little clearer here do you mean - doesn't work on that core or doesn't work on all cores ?
Quoted 3 lines
Given we don't really have a way to power up a core based on which codec we are dealing with, I suggest we leave both cores in the binding and enable them indiscriminately.
OK the 8916 to 8939 migration guide says HEVC decoder - encoder is not mentioned.
You can have a bitmask flag of whitelist or blacklist per core then - select which codecs are supported on which cores and then declare those to user-space.
---
bod
Re: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Last time I tried to enable only 1 of the cores, the following would happen:
- If core0 is enabled, HEVC decoding would work, but not the other codecs.
- If core1 is enabled, the rest of codecs would work, but not HEVC.Can you be a little clearer here do you mean - doesn't work on that core or doesn't work on all cores ?
By that I mean that when I tried to play an HEVC video with mpv with only core0 enabled, it would play fine, but trying to play videos in another codec would result in power collapse fails. Likewise with core1, but in other codecs.
I assume this is how cores are split - core0 does HEVC decoding and core1 does the rest of codecs. This is confirmed by downstream code as well (although the cores are flipped - core0 is the rest of codecs ("legacy") and core1 is HEVC):
https://github.com/msm8916-mainline/linux-downstream/blob/b20608408caff817ec874f325127b07609fbaeb8/arch/arm/boot/dts/qcom/msm8939-common.dtsi#L1589
https://github.com/msm8916-mainline/linux-downstream/blob/b20608408caff817ec874f325127b07609fbaeb8/Documentation/devicetree/bindings/media/video/msm-vidc.txt#L35
Re: [PATCH v5 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled
Quoted 11 lines · Erikas Bitovtas
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Last time I tried to enable only 1 of the cores, the following would happen:
- If core0 is enabled, HEVC decoding would work, but not the other codecs.
- If core1 is enabled, the rest of codecs would work, but not HEVC.Can you be a little clearer here do you mean - doesn't work on that core or doesn't work on all cores ?
Quoted 7 lines
By that I mean that when I tried to play an HEVC video with mpv with only core0 enabled, it would play fine, but trying to play videos in another codec would result in power collapse fails. Likewise with core1, but in other codecs.
I assume this is how cores are split - core0 does HEVC decoding and core1 does the rest of codecs. This is confirmed by downstream code as
This is correct according to my knowledge.
Quoted 4 lines
well (although the cores are flipped - core0 is the rest of codecs ("legacy") and core1 is HEVC):
https://github.com/msm8916-mainline/linux-downstream/blob/b20608408caff817ec874f325127b07609fbaeb8/arch/arm/boot/dts/qcom/msm8939-common.dtsi#L1589
https://github.com/msm8916-mainline/linux-downstream/blob/b20608408caff817ec874f325127b07609fbaeb8/Documentation/devicetree/bindings/media/video/msm-vidc.txt#L35
Signature · 2 lines
With best wishes Dmitry
PATCH v5 6/8 media: qcom: venus: add power domain enable logic for Venus cores
In reply to Erikas BitovtasAttach power domains for vdec and venc cores and power them up if a vdec or venc session is started.
--- drivers/media/platform/qcom/venus/pm_helpers.c | 149 ++++++++++++++++++++++++- 1 file changed, 145 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/pm_helpers.c +145 -4
@@ -297,10 +297,31 @@ static int load_scale_v1(struct venus_inst *inst)return ret; } +static int vcodec_domains_get_v1 (struct venus_core *core) +{ +struct device *dev = core->dev; +const struct venus_resources *res = core->res; +const struct dev_pm_domain_attach_data vcodec_data = { + .pd_names = res->vcodec_pmdomains, + .num_pd_names = res->vcodec_pmdomains_num, + .pd_flags =PD_FLAG_NO_DEV_LINK , + }; + +if (!res->vcodec_pmdomains) +return 0 ; + +return dev_pm_domain_attach_list (dev, &vcodec_data, + &core->pmdomains); +} +static int core_get_v1 (struct venus_core *core) {int ret; + ret =vcodec_domains_get_v1 (core); +if (ret <0 ) +return ret; + ret =core_clks_get (core);if (ret)return ret;
@@ -319,12 +340,128 @@ static void core_put_v1(struct venus_core *core)static int core_power_v1 (struct venus_core *core,int on) {int ret =0 ; +struct device *pd_dev = core->res->vcodec_pmdomains ? + core->pmdomains->pd_devs[0 ] :NULL ; -if (on ==POWER_ON ) +if (on ==POWER_ON ) { +if (pd_dev) { + ret =pm_runtime_resume_and_get (pd_dev); +if (ret) +return ret; + } ret =core_clks_enable (core); -else +if (ret) { +pm_runtime_put_sync (pd_dev); +return ret; + } + }else { +if (pd_dev) +pm_runtime_put_sync (pd_dev);core_clks_disable (core); + } + +return 0 ; +} + +static int vcodec_domains_enable (struct venus_core *core) +{ +const struct venus_resources *res = core->res; +struct device *pd_dev; +int i =1 , ret; + +if (!res->vcodec_pmdomains) +return 0 ; + +for (; i < res->vcodec_pmdomains_num; i++) { + pd_dev = core->pmdomains->pd_devs[i]; + ret =pm_runtime_resume_and_get (pd_dev); +if (ret) + goto err; + } + +return 0 ; +err: +while (i-- >1 ) +pm_runtime_put_sync (core->pmdomains->pd_devs[i]); +return ret; +} + +static void vcodec_domains_disable (struct venus_core *core) +{ +const struct venus_resources *res = core->res; +struct device *pd_dev; +int i =1 ; + +if (!res->vcodec_pmdomains) +return ; + +for (; i < res->vcodec_pmdomains_num; i++) { + pd_dev = core->pmdomains->pd_devs[i]; +pm_runtime_put_sync (pd_dev); + } +} + +static int vdec_get_v1 (struct device *dev) +{ +struct venus_core *core =dev_get_drvdata (dev); + +return vcodec_clks_get (core, core->dev, core->vcodec0_clks, + core->res->vcodec0_clks); +} + +static int vdec_power_v1 (struct device *dev,int on) +{ +struct venus_core *core =dev_get_drvdata (dev); +int ret; + +if (on ==POWER_ON ) { + ret =vcodec_domains_enable (core); +if (ret) +return ret; + + ret =vcodec_clks_enable (core, core->vcodec0_clks); +if (ret) + goto err; + }else { +vcodec_domains_disable (core); +vcodec_clks_disable (core, core->vcodec0_clks); + } + +return 0 ; +err: +vcodec_domains_disable (core); +return ret; +} +static int venc_get_v1 (struct device *dev) +{ +struct venus_core *core =dev_get_drvdata (dev); + +return vcodec_clks_get (core, core->dev, core->vcodec1_clks, + core->res->vcodec1_clks); +} + +static int venc_power_v1 (struct device *dev,int on) +{ +struct venus_core *core =dev_get_drvdata (dev); +int ret; + +if (on ==POWER_ON ) { + ret =vcodec_domains_enable (core); +if (ret) +return ret; + + ret =vcodec_clks_enable (core, core->vcodec1_clks); +if (ret) + goto err; + }else { +vcodec_domains_disable (core); +vcodec_clks_disable (core, core->vcodec1_clks); + } + +return 0 ; +err: +vcodec_domains_disable (core);return ret; }
@@ -332,6 +469,10 @@ static const struct venus_pm_ops pm_ops_v1 = { .core_get = core_get_v1, .core_put = core_put_v1, .core_power = core_power_v1, + .vdec_get = vdec_get_v1, + .vdec_power = vdec_power_v1, + .venc_get = venc_get_v1, + .venc_power = venc_power_v1, .load_scale = load_scale_v1, };
@@ -875,7 +1016,7 @@ static int venc_power_v4(struct device *dev, int on)return ret; } -static int vcodec_domains_get (struct venus_core *core) +static int vcodec_domains_get_v4 (struct venus_core *core) {int ret;struct device *dev = core->dev;
@@ -993,7 +1134,7 @@ static int core_get_v4(struct venus_core *core)if (ret)return ret; - ret =vcodec_domains_get (core); + ret =vcodec_domains_get_v4 (core);if (ret)return ret;
Signature · 1 line
2.54.0
Re: [PATCH v5 6/8] media: qcom: venus: add power domain enable logic for Venus cores
Quoted 4 lines · Erikas Bitovtas
Attach power domains for vdec and venc cores and power them up if a vdec or venc session is started.
Signed-off-by Erikas Bitovtas <[email protected]>
This looks fine to me but, will need to be tested/verified on 8916 to make sure nothing explodes there prior to hitting -next.
---
bod
PATCH v5 7/8 media: qcom: venus: Add msm8939 resource struct
In reply to Erikas BitovtasFrom: André Apitzsch <[email protected]>
Add msm8939 configuration data and related compatible.
--- drivers/media/platform/qcom/venus/core.c | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
drivers/media/platform/qcom/venus/core.c +41 -0
@@ -688,6 +688,46 @@ static const struct venus_resources msm8916_res = { .enc_nodename = "video-encoder", }; +static const struct freq_tbl msm8939_freq_table[] = { + {489600 ,266670000 },/* 1080p @ 60 */ + {244800 ,133330000 },/* 1080p @ 30 */ + {244800 ,200000000 },/* 1080p @ 30 */ + {220800 ,133330000 },/* 720p @ 60 */ + {108000 ,133330000 },/* 720p @ 30 */ + {108000 ,200000000 },/* 720p @ 30 */ + {72000 ,133330000 },/* VGA @ 60 */ + {36000 ,133330000 },/* VGA @ 30 */ +}; + +static const struct reg_val msm8939_reg_preset[] = { + {0xe0020 ,0x0aaaaaaa }, + {0xe0024 ,0x0aaaaaaa }, + {0x80124 ,0x00000003 }, +}; + +static const struct venus_resources msm8939_res = { + .freq_tbl = msm8939_freq_table, + .freq_tbl_size =ARRAY_SIZE (msm8939_freq_table), + .reg_tbl = msm8939_reg_preset, + .reg_tbl_size =ARRAY_SIZE (msm8939_reg_preset), + .clks = {"core" ,"iface" ,"bus" , }, + .clks_num =3 , + .vcodec0_clks = {"vcodec0_core" ,"vcodec1_core" }, + .vcodec1_clks = {"vcodec0_core" ,"vcodec1_core" }, + .vcodec_clks_num =2 , + .vcodec_pmdomains = (const char *[]) {"venus" ,"vcodec0" ,"vcodec1" }, + .vcodec_pmdomains_num =3 , + .max_load =489600 ,/* 1080p@30 + 1080p@30 */ + .hfi_version =HFI_VERSION_1XX , + .vmem_id =VIDC_RESOURCE_NONE , + .vmem_size =0 , + .vmem_addr =0 , + .dma_mask =0xddc00000 -1 , + .fwname ="qcom/venus-1.8/venus.mbn" , + .dec_nodename ="video-decoder" , + .enc_nodename ="video-encoder" , +}; +static const struct freq_tbl msm8996_freq_table[] = { {1944000 ,520000000 },/* 4k UHD @ 60 (decode only) */ {972000 ,520000000 },/* 4k UHD @ 30 */
@@ -1121,6 +1161,7 @@ static const struct venus_resources qcm2290_res = {static const struct of_device_id venus_dt_match[] = { { .compatible ="qcom,msm8916-venus" , .data = &msm8916_res, }, + { .compatible ="qcom,msm8939-venus" , .data = &msm8939_res, }, { .compatible ="qcom,msm8996-venus" , .data = &msm8996_res, }, { .compatible ="qcom,msm8998-venus" , .data = &msm8998_res, }, { .compatible ="qcom,qcm2290-venus" , .data = &qcm2290_res, },
Signature · 1 line
2.54.0
Re: [PATCH v5 7/8] media: qcom: venus: Add msm8939 resource struct
Quoted 72 lines · Erikas Bitovtas
From: André Apitzsch <[email protected]>
Add msm8939 configuration data and related compatible.
Reviewed-by Dmitry Baryshkov <[email protected]>Signed-off-by André Apitzsch <[email protected]>Signed-off-by Erikas Bitovtas <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)drivers/media/platform/qcom/venus/core.c +41
-1@@ -688,6 +688,46 @@ static const struct venus_resources msm8916_res = { .enc_nodename = "video-encoder", }; +static const struct freq_tbl msm8939_freq_table[] = { + {489600 ,266670000 },/* 1080p @ 60 */ + {244800 ,133330000 },/* 1080p @ 30 */ + {244800 ,200000000 },/* 1080p @ 30 */ + {220800 ,133330000 },/* 720p @ 60 */ + {108000 ,133330000 },/* 720p @ 30 */ + {108000 ,200000000 },/* 720p @ 30 */ + {72000 ,133330000 },/* VGA @ 60 */ + {36000 ,133330000 },/* VGA @ 30 */ +}; + +static const struct reg_val msm8939_reg_preset[] = { + {0xe0020 ,0x0aaaaaaa }, + {0xe0024 ,0x0aaaaaaa }, + {0x80124 ,0x00000003 }, +}; + +static const struct venus_resources msm8939_res = { + .freq_tbl = msm8939_freq_table, + .freq_tbl_size =ARRAY_SIZE (msm8939_freq_table), + .reg_tbl = msm8939_reg_preset, + .reg_tbl_size =ARRAY_SIZE (msm8939_reg_preset), + .clks = {"core" ,"iface" ,"bus" , }, + .clks_num =3 , + .vcodec0_clks = {"vcodec0_core" ,"vcodec1_core" }, + .vcodec1_clks = {"vcodec0_core" ,"vcodec1_core" }, + .vcodec_clks_num =2 , + .vcodec_pmdomains = (const char *[]) {"venus" ,"vcodec0" ,"vcodec1" }, + .vcodec_pmdomains_num =3 , + .max_load =489600 ,/* 1080p@30 + 1080p@30 */ + .hfi_version =HFI_VERSION_1XX , + .vmem_id =VIDC_RESOURCE_NONE , + .vmem_size =0 , + .vmem_addr =0 , + .dma_mask =0xddc00000 -1 , + .fwname ="qcom/venus-1.8/venus.mbn" , + .dec_nodename ="video-decoder" , + .enc_nodename ="video-encoder" , +}; +static const struct freq_tbl msm8996_freq_table[] = { {1944000 ,520000000 },/* 4k UHD @ 60 (decode only) */ {972000 ,520000000 },/* 4k UHD @ 30 */ @@ -1121,6 +1161,7 @@ static const struct venus_resources qcm2290_res = {static const struct of_device_id venus_dt_match[] = { { .compatible ="qcom,msm8916-venus" , .data = &msm8916_res, }, + { .compatible ="qcom,msm8939-venus" , .data = &msm8939_res, }, { .compatible ="qcom,msm8996-venus" , .data = &msm8996_res, }, { .compatible ="qcom,msm8998-venus" , .data = &msm8998_res, }, { .compatible ="qcom,qcm2290-venus" , .data = &qcm2290_res, }, --
Quoted 2 lines
2.54.0
---
bod
PATCH v5 8/8 media: qcom: venus: Enable HEVC decoding for MSM8939
In reply to Erikas BitovtasMSM8939 supports HEVC decoding. Do not disable the HEVC codec HFI bit and add it to codec type converter method so it can be recognized.
--- drivers/media/platform/qcom/venus/core.c | 2 ++ drivers/media/platform/qcom/venus/hfi_parser.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/venus/core.c +2 -0
@@ -178,6 +178,8 @@ static void venus_sys_error_handler(struct work_struct *work)static u32 to_v4l2_codec_type (u32 codec) {switch (codec) { +case HFI_VIDEO_CODEC_HEVC : +return V4L2_PIX_FMT_HEVC ;case HFI_VIDEO_CODEC_H264 :return V4L2_PIX_FMT_H264 ;case HFI_VIDEO_CODEC_H263 :
drivers/media/platform/qcom/venus/hfi_parser.c +2 -1
@@ -207,7 +207,8 @@ static int parse_codecs(struct venus_core *core, void *data) core->enc_codecs = codecs->enc_codecs;if (IS_V1 (core)) { - core->dec_codecs &= ~HFI_VIDEO_CODEC_HEVC ; +if (!device_is_compatible (core->dev,"qcom,msm8939-venus" )) + core->dec_codecs &= ~HFI_VIDEO_CODEC_HEVC ; core->dec_codecs &= ~HFI_VIDEO_CODEC_SPARK ; core->enc_codecs &= ~HFI_VIDEO_CODEC_HEVC ; }
Signature · 1 line
2.54.0
Bryan O'Donoghue
maintainerRe: [PATCH v5 8/8] media: qcom: venus: Enable HEVC decoding for MSM8939
Quoted 27 lines · Erikas Bitovtas
MSM8939 supports HEVC decoding. Do not disable the HEVC codec HFI bit and add it to codec type converter method so it can be recognized.
Signed-off-by Erikas Bitovtas <[email protected]>--- drivers/media/platform/qcom/venus/core.c | 2 ++ drivers/media/platform/qcom/venus/hfi_parser.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)drivers/media/platform/qcom/venus/core.c +2
-0@@ -178,6 +178,8 @@ static void venus_sys_error_handler(struct work_struct *work)static u32 to_v4l2_codec_type (u32 codec) {switch (codec) { +case HFI_VIDEO_CODEC_HEVC : +return V4L2_PIX_FMT_HEVC ;case HFI_VIDEO_CODEC_H264 :return V4L2_PIX_FMT_H264 ;case HFI_VIDEO_CODEC_H263 :drivers/media/platform/qcom/venus/hfi_parser.c +0
-0
drivers/media/platform/qcom/venus/hfi_parser.c static int parse_codecs(struct venus_core *core, void *data) · line 211
Quoted 6 lines
drivers/media/platform/qcom/venus/hfi_parser.c +2
-1@@ -207,7 +207,8 @@ static int parse_codecs(struct venus_core *core, void *data) core->enc_codecs = codecs->enc_codecs;if (IS_V1 (core)) { - core->dec_codecs &= ~HFI_VIDEO_CODEC_HEVC ; +if (!device_is_compatible (core->dev,"qcom,msm8939-venus" )) + core->dec_codecs &= ~HFI_VIDEO_CODEC_HEVC ;
Stylistically I think this should be a flag in a struct.
I'm not a big fan of doing a bunch of strstr()/strcmp() generally. If you extend the struct venus_resource in some way - I think this will work better and be more runtime friendly.
u32 dec_codecs_blacklist; perhaps
---
bod