2020-05-01 20:37:15

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 0/2] Add support for venus on msm8939

Konrad Dybcio (2):
media: venus: Add support for MSM8939
dt-bindings: media: Document MSM8939 Venus

.../bindings/media/qcom,msm8939-venus.yaml | 119 ++++++++++++++++++
drivers/media/platform/qcom/venus/core.c | 33 +++++
2 files changed, 152 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml

--
2.26.1


2020-05-01 20:37:23

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 1/2] media: venus: Add support for MSM8939

Signed-off-by: Konrad Dybcio <[email protected]>
---
drivers/media/platform/qcom/venus/core.c | 33 ++++++++++++++++++++++++
1 file changed, 33 insertions(+)

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 194b10b987672..f3a15991ac763 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -405,6 +405,38 @@ static const struct venus_resources msm8916_res = {
.fwname = "qcom/venus-1.8/venus.mdt",
};

+static const struct freq_tbl msm8939_freq_table[] = {
+ { 489600, 266670000 }, /* 1080p @ 60 */
+ { 244800, 200000000 }, /* 1080p @ 30 */
+ { 244800, 133330000 }, /* 1080p @ 30 (decode only) */
+ { 220800, 133330000 }, /* 720p @ 60 (decode only?) */
+ { 108000, 133330000 }, /* 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,
+ .max_load = 489600, /* 1080p @ 60 */
+ .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.mdt",
+};
+
static const struct freq_tbl msm8996_freq_table[] = {
{ 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */
{ 972000, 520000000 }, /* 4k UHD @ 30 */
@@ -567,6 +599,7 @@ static const struct venus_resources sc7180_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,sdm845-venus", .data = &sdm845_res, },
{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
--
2.26.1

2020-05-01 20:37:37

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 2/2] dt-bindings: media: Document MSM8939 Venus

Signed-off-by: Konrad Dybcio <[email protected]>
---
.../bindings/media/qcom,msm8939-venus.yaml | 119 ++++++++++++++++++
1 file changed, 119 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml

diff --git a/Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml b/Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml
new file mode 100644
index 0000000000000..8cc0002d10163
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0 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 Venus video encode and decode accelerators
+
+maintainers:
+ - Stanimir Varbanov <[email protected]>
+
+description: |
+ The Venus IP is a video encode and decode accelerator present
+ on Qualcomm platforms
+
+properties:
+ compatible:
+ const: qcom,msm8939-venus
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ power-domains:
+ maxItems: 1
+
+ clocks:
+ maxItems: 3
+
+ clock-names:
+ items:
+ - const: core
+ - const: iface
+ - const: bus
+
+ iommus:
+ maxItems: 1
+
+ memory-region:
+ maxItems: 1
+
+ video-decoder:
+ type: object
+
+ properties:
+ compatible:
+ const: "venus-decoder"
+
+ required:
+ - compatible
+
+ additionalProperties: false
+
+ video-encoder:
+ type: object
+
+ properties:
+ compatible:
+ const: "venus-encoder"
+
+ required:
+ - compatible
+
+ additionalProperties: false
+
+ video-firmware:
+ type: object
+
+ description: |
+ Firmware subnode is needed when the platform does not
+ have TrustZone.
+
+ properties:
+ iommus:
+ maxItems: 1
+
+ required:
+ - iommus
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - power-domains
+ - clocks
+ - clock-names
+ - iommus
+ - memory-region
+ - video-decoder
+ - video-encoder
+
+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>;
+ clock-names = "core", "iface", "bus";
+ power-domains = <&gcc VENUS_GDSC>;
+ iommus = <&apps_iommu 5>;
+ memory-region = <&venus_mem>;
+
+ video-decoder {
+ compatible = "venus-decoder";
+ };
+
+ video-encoder {
+ compatible = "venus-encoder";
+ };
+ };
--
2.26.1

2020-05-05 03:58:33

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 2/2] dt-bindings: media: Document MSM8939 Venus

On Fri, 1 May 2020 22:35:03 +0200, Konrad Dybcio wrote:
> Signed-off-by: Konrad Dybcio <[email protected]>
> ---
> .../bindings/media/qcom,msm8939-venus.yaml | 119 ++++++++++++++++++
> 1 file changed, 119 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml
>

My bot found errors running 'make dt_binding_check' on your patch:

Documentation/devicetree/bindings/media/qcom,msm8939-venus.example.dts:20:18: fatal error: dt-bindings/clock/qcom,gcc-msm8939.h: No such file or directory
#include <dt-bindings/clock/qcom,gcc-msm8939.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
scripts/Makefile.lib:312: recipe for target 'Documentation/devicetree/bindings/media/qcom,msm8939-venus.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/media/qcom,msm8939-venus.example.dt.yaml] Error 1
make[1]: *** Waiting for unfinished jobs....
Makefile:1300: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1281452

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.

2020-05-05 08:04:46

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 2/2] dt-bindings: media: Document MSM8939 Venus

Ah, mea culpa!

I completely forgot to mention that this depends on the MSM8939 GCC
driver that has been sent a few days ago, sorry.. [1]

Have you found any additional mistakes in this patch that I should
correct besides this one?


[1] https://lwn.net/Articles/818486/

Konrad

2020-05-05 11:42:40

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: [PATCH 0/2] Add support for venus on msm8939

Hi Konrad,

Thanks for the patches!

Could you describe hear what is the status of the new added SoC. Is
Venus driver tested on this new platform or that will happen at some
later point in time.

Also, in both patches the description is missing, please add something.

On 5/1/20 11:35 PM, Konrad Dybcio wrote:
> Konrad Dybcio (2):
> media: venus: Add support for MSM8939
> dt-bindings: media: Document MSM8939 Venus
>
> .../bindings/media/qcom,msm8939-venus.yaml | 119 ++++++++++++++++++
> drivers/media/platform/qcom/venus/core.c | 33 +++++
> 2 files changed, 152 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml
>

--
regards,
Stan

2020-05-05 11:47:11

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: [PATCH 1/2] media: venus: Add support for MSM8939

Hi Konrad,

On 5/1/20 11:35 PM, Konrad Dybcio wrote:
> Signed-off-by: Konrad Dybcio <[email protected]>
> ---
> drivers/media/platform/qcom/venus/core.c | 33 ++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 194b10b987672..f3a15991ac763 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -405,6 +405,38 @@ static const struct venus_resources msm8916_res = {
> .fwname = "qcom/venus-1.8/venus.mdt",
> };
>
> +static const struct freq_tbl msm8939_freq_table[] = {
> + { 489600, 266670000 }, /* 1080p @ 60 */
> + { 244800, 200000000 }, /* 1080p @ 30 */
> + { 244800, 133330000 }, /* 1080p @ 30 (decode only) */
> + { 220800, 133330000 }, /* 720p @ 60 (decode only?) */
> + { 108000, 133330000 }, /* 720p @ 30*/
> + { 72000, 133330000 }, /* VGA @ 60 */
> + { 36000, 133330000 }, /* VGA @ 30 */

133MHz is the minimum clock frequency in the GCC driver? Do you think
that will change?

> +};
> +
> +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,
> + .max_load = 489600, /* 1080p @ 60 */
> + .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.mdt",
> +};
> +
> static const struct freq_tbl msm8996_freq_table[] = {
> { 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */
> { 972000, 520000000 }, /* 4k UHD @ 30 */
> @@ -567,6 +599,7 @@ static const struct venus_resources sc7180_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,sdm845-venus", .data = &sdm845_res, },
> { .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
>

--
regards,
Stan

2020-05-06 21:28:57

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 1/2] media: venus: Add support for MSM8939

Hi Stan,

I have found some issues with the submitted GCC driver, related to
venus, but I have to further look into them locally and work out some
stuff. One of the things is that freq table for venus clock should be
changed to the values found here [1] (currently it has 8916
frequencies). When I find all the causes I'll resubmit this and
include them in the cover letter, as I might've overlooked something
wrt venus driver itself when creating this patch from my WIP branch.
Also it seems like I tested this very patch incorrectly (getting
segfaults in ffmpeg with v4l2m2m now)... Anyways, I'll get back to you
when I make it work for sure. Sorry again for the inconvenience.


[1] https://github.com/konradybcio/android_kernel_asus_msm8916-1/blob/minimal/drivers/clk/qcom/clock-gcc-8936.c#L1613-L1618

Konrad

wt., 5 maj 2020 o 13:43 Stanimir Varbanov
<[email protected]> napisał(a):
>
> Hi Konrad,
>
> On 5/1/20 11:35 PM, Konrad Dybcio wrote:
> > Signed-off-by: Konrad Dybcio <[email protected]>
> > ---
> > drivers/media/platform/qcom/venus/core.c | 33 ++++++++++++++++++++++++
> > 1 file changed, 33 insertions(+)
> >
> > diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> > index 194b10b987672..f3a15991ac763 100644
> > --- a/drivers/media/platform/qcom/venus/core.c
> > +++ b/drivers/media/platform/qcom/venus/core.c
> > @@ -405,6 +405,38 @@ static const struct venus_resources msm8916_res = {
> > .fwname = "qcom/venus-1.8/venus.mdt",
> > };
> >
> > +static const struct freq_tbl msm8939_freq_table[] = {
> > + { 489600, 266670000 }, /* 1080p @ 60 */
> > + { 244800, 200000000 }, /* 1080p @ 30 */
> > + { 244800, 133330000 }, /* 1080p @ 30 (decode only) */
> > + { 220800, 133330000 }, /* 720p @ 60 (decode only?) */
> > + { 108000, 133330000 }, /* 720p @ 30*/
> > + { 72000, 133330000 }, /* VGA @ 60 */
> > + { 36000, 133330000 }, /* VGA @ 30 */
>
> 133MHz is the minimum clock frequency in the GCC driver? Do you think
> that will change?
>
> > +};
> > +
> > +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,
> > + .max_load = 489600, /* 1080p @ 60 */
> > + .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.mdt",
> > +};
> > +
> > static const struct freq_tbl msm8996_freq_table[] = {
> > { 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */
> > { 972000, 520000000 }, /* 4k UHD @ 30 */
> > @@ -567,6 +599,7 @@ static const struct venus_resources sc7180_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,sdm845-venus", .data = &sdm845_res, },
> > { .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
> >
>
> --
> regards,
> Stan

2020-05-06 21:43:06

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 0/2] Add support for venus on msm8939

Hi Stan,

Unfortunately it seems like I made some mistakes, as I've pointed out
in the reply in [1/2] patch,
and therefore this submission can go to the bin and wait for a v2. But
answering your question
wrt to 8939:

The platform is currently shaping out good, as we can reuse a large
number of 8916 drivers.
At the moment we have 4 out of 8 cores working reliably with
out-of-tree patches (8939 doesn't support psci)
and the latter 8 cores aren't there only because of the core
interconnect not being handled yet
(well they can be enabled but performance goes waaaay down when one does so).
As for other features, I have adreno, iommu, i2c, sdhci and other
basic things like that working,
and Vincent Knecht (cc) with an Alcatel Idol 3 5.5 (same SoC) even
reportedly got USB and
Wi-Fi to work (though we have different hardware in both situations).
Currently Vincent and I have local support for the aforementioned
Alcatel, Asus Zenfone 2 Laser
1080p (Z00T) and partial support (as in no panel yet) for Sony Xperia
M4 Aqua with Linaro
folks preparing some drivers (like GCC) for an unknown-to-me 8939 board
(or perhaps a phone, too?). I already pushed Adreno 405 enablement to
mesa, too and it's
going to be there in the next release, so this platform will only get
better from now.

Konrad

2020-05-07 08:15:21

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: [PATCH 1/2] media: venus: Add support for MSM8939

Hi Konrad,

On 5/7/20 12:23 AM, Konrad Dybcio wrote:
> Hi Stan,
>
> I have found some issues with the submitted GCC driver, related to
> venus, but I have to further look into them locally and work out some
> stuff. One of the things is that freq table for venus clock should be
> changed to the values found here [1] (currently it has 8916
> frequencies). When I find all the causes I'll resubmit this and
> include them in the cover letter, as I might've overlooked something
> wrt venus driver itself when creating this patch from my WIP branch.
> Also it seems like I tested this very patch incorrectly (getting
> segfaults in ffmpeg with v4l2m2m now)... Anyways, I'll get back to you
> when I make it work for sure. Sorry again for the inconvenience.

OK. Thanks for the details, I'm waiting for good news :). If you need
some help with Venus bringup ping me on IRC - my nickname is svarbanov
on #v4l channel.

Regarding to venus clocks, these two clocks exist in below gcc driver
but missing in msm8916:

gcc_venus0_core0_vcodec0_clk
gcc_venus0_core1_vcodec0_clk

but the Venus IP block should be the same as in msm8916. Can you point
me to the donwstream gcc driver or check from where they comes.

>
>
> [1] https://github.com/konradybcio/android_kernel_asus_msm8916-1/blob/minimal/drivers/clk/qcom/clock-gcc-8936.c#L1613-L1618
>
> Konrad
>
> wt., 5 maj 2020 o 13:43 Stanimir Varbanov
> <[email protected]> napisał(a):
>>
>> Hi Konrad,
>>
>> On 5/1/20 11:35 PM, Konrad Dybcio wrote:
>>> Signed-off-by: Konrad Dybcio <[email protected]>
>>> ---
>>> drivers/media/platform/qcom/venus/core.c | 33 ++++++++++++++++++++++++
>>> 1 file changed, 33 insertions(+)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
>>> index 194b10b987672..f3a15991ac763 100644
>>> --- a/drivers/media/platform/qcom/venus/core.c
>>> +++ b/drivers/media/platform/qcom/venus/core.c
>>> @@ -405,6 +405,38 @@ static const struct venus_resources msm8916_res = {
>>> .fwname = "qcom/venus-1.8/venus.mdt",
>>> };
>>>
>>> +static const struct freq_tbl msm8939_freq_table[] = {
>>> + { 489600, 266670000 }, /* 1080p @ 60 */
>>> + { 244800, 200000000 }, /* 1080p @ 30 */
>>> + { 244800, 133330000 }, /* 1080p @ 30 (decode only) */
>>> + { 220800, 133330000 }, /* 720p @ 60 (decode only?) */
>>> + { 108000, 133330000 }, /* 720p @ 30*/
>>> + { 72000, 133330000 }, /* VGA @ 60 */
>>> + { 36000, 133330000 }, /* VGA @ 30 */
>>
>> 133MHz is the minimum clock frequency in the GCC driver? Do you think
>> that will change?
>>
>>> +};
>>> +
>>> +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,
>>> + .max_load = 489600, /* 1080p @ 60 */
>>> + .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.mdt",
>>> +};
>>> +
>>> static const struct freq_tbl msm8996_freq_table[] = {
>>> { 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */
>>> { 972000, 520000000 }, /* 4k UHD @ 30 */
>>> @@ -567,6 +599,7 @@ static const struct venus_resources sc7180_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,sdm845-venus", .data = &sdm845_res, },
>>> { .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
>>>
>>
>> --
>> regards,
>> Stan

--
regards,
Stan