Add MFC v12 support.
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): CGME20220907063309epcas5p1793555c0747fd7a11997e97649924552@epcas5p1.samsung.com
v2 cover Add MFC v12 support.
From: aakarsh jain <[email protected]>
This patch series adds MFC v12 support. MFC v12 is used in Tesla FSD SoC.
This adds support for following:
* Add support for VP9 encoder
* Add support for YV12 and I420 format (3-plane)
* Add support for Rate Control, UHD and DMABUF for encoder
* Add support for DPB buffers allocation based on MFC requirement
* Update documentation for control id definitions
Changes since v1:
- Addressed review comments by Andrzej Hajda.
- Addressed review comments by Rob Herring.
- Addressed review comments by Krzysztof Kozlowski.
- Addressed review comments by Hans Verkuil.
- Addressed review comments by Nicolas Dufresne.
- Rebased on latest krzk/for-next tree.
v4l2-complaince:
Total for s5p-mfc device /dev/video0: 45, Succeeded: 39, Failed: 6, Warnings: 0 Total for s5p-mfc device /dev/video1: 45, Succeeded: 34, Failed: 11, Warnings: 3
Smitha T Murthy (15):
dt-bindings: media: s5p-mfc: Add new DT schema for MFC
dt-bindings: media: s5p-mfc: Add mfcv12 variant
media: s5p-mfc: Rename IS_MFCV10 macro
media: s5p-mfc: Add initial support for MFCv12
Documention: v4l: Documentation for VP9 CIDs.
media: v4l2: Add v4l2 control IDs for VP9 encoder.
media: s5p-mfc: Add support for VP9 encoder.
media: s5p-mfc: Add YV12 and I420 multiplanar format support
media: s5p-mfc: Add support for rate controls in MFCv12
media: s5p-mfc: Add support for UHD encoding.
media: s5p-mfc: Add support for DMABUF for encoder
media: s5p-mfc: Set context for valid case before calling try_run
media: s5p-mfc: Load firmware for each run in MFCv12.
media: s5p-mfc: DPB Count Independent of VIDIOC_REQBUF
arm64: dts: fsd: Add MFC related DT enteries
.../devicetree/bindings/media/s5p-mfc.txt | 77 +--- .../bindings/media/samsung,s5p-mfc.yaml | 110 +++++ .../media/v4l/ext-ctrls-codec.rst | 167 +++++++ arch/arm64/boot/dts/tesla/fsd-evb.dts | 4 + arch/arm64/boot/dts/tesla/fsd.dtsi | 22 + .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 60 +++ .../platform/samsung/s5p-mfc/regs-mfc-v7.h | 1 + .../platform/samsung/s5p-mfc/regs-mfc-v8.h | 3 + .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 36 +- .../platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c | 3 + .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 54 ++- .../platform/samsung/s5p-mfc/s5p_mfc_ctrl.c | 9 +- .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 51 ++- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 410 +++++++++++++++-- .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 16 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c | 12 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 433 ++++++++++++++++-- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h | 7 +- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 44 ++ include/uapi/linux/v4l2-controls.h | 33 ++ 20 files changed, 1349 insertions(+), 203 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml create mode 100644 drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h
Signature · 1 line
2.17.1
PATCH v2 1/15 dt-bindings: media: s5p-mfc: Add new DT schema for MFC
Adds DT schema for s5p-mfc in yaml format
--- .../devicetree/bindings/media/s5p-mfc.txt | 77 +------------ .../bindings/media/samsung,s5p-mfc.yaml | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+), 76 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml
Documentation/devicetree/bindings/media/s5p-mfc.txt +1 -76
@@ -1,76 +1 @@ -* Samsung Multi Format Codec (MFC) - -Multi Format Codec (MFC) is the IP present in Samsung SoCs which -supports high resolution decoding and encoding functionalities. -The MFC device driver is a v4l2 driver which can encode/decode -video raw/elementary streams and has support for all popular -video codecs. - -Required properties: - - compatible : value should be either one among the following - (a) "samsung,mfc-v5" for MFC v5 present in Exynos4 SoCs - (b) "samsung,mfc-v6" for MFC v6 present in Exynos5 SoCs - (c) "samsung,mfc-v7" for MFC v7 present in Exynos5420 SoC - (d) "samsung,mfc-v8" for MFC v8 present in Exynos5800 SoC - (e) "samsung,exynos5433-mfc" for MFC v8 present in Exynos5433 SoC - (f) "samsung,mfc-v10" for MFC v10 present in Exynos7880 SoC - - - reg : Physical base address of the IP registers and length of memory - mapped region. - - - interrupts : MFC interrupt number to the CPU. - - clocks : from common clock binding: handle to mfc clock. - - clock-names : from common clock binding: must contain "mfc", - corresponding to entry in the clocks property. - -Optional properties: - - power-domains : power-domain property defined with a phandle - to respective power domain. - - memory-region : from reserved memory binding: phandles to two reserved - memory regions, first is for "left" mfc memory bus interfaces, - second if for the "right" mfc memory bus, used when no SYSMMU - support is available; used only by MFC v5 present in Exynos4 SoCs - -Obsolete properties: - - samsung,mfc-r, samsung,mfc-l : support removed, please use memory-region - property instead - - -Example: -SoC specific DT entry: - -mfc: codec@13400000 { - compatible = "samsung,mfc-v5"; - reg = <0x13400000 0x10000>; - interrupts = <0 94 0>; - power-domains = <&pd_mfc>; - clocks = <&clock 273>; - clock-names = "mfc"; -}; - -Reserved memory specific DT entry for given board (see reserved memory binding -for more information): - -reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - mfc_left: region@51000000 { - compatible = "shared-dma-pool"; - no-map; - reg = <0x51000000 0x800000>; - }; - - mfc_right: region@43000000 { - compatible = "shared-dma-pool"; - no-map; - reg = <0x43000000 0x800000>; - }; -}; - -Board specific DT entry: - -codec@13400000 { - memory-region = <&mfc_left>, <&mfc_right>; -}; +This file has moved to samsung,s5p-mfc.yaml
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFC
Quoted 1 line · Smitha T Murthy
Adds DT schema for s5p-mfc in yaml format
s/Adds/Convert/
(as convert to DT schema)
Please mention here changes to original binding (I see at least adding iommus and dropping some properties).
Quoted 40 lines
Signed-off-by Aakarsh Jain <[email protected]>Signed-off-by Smitha T Murthy <[email protected]>--- .../devicetree/bindings/media/s5p-mfc.txt | 77 +------------ .../bindings/media/samsung,s5p-mfc.yaml | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+), 76 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/samsung,s5p-mfc.yamlDocumentation/devicetree/bindings/media/s5p-mfc.txt +0
-26@@ -1,76 +1 @@ -* Samsung Multi Format Codec (MFC) - -Multi Format Codec (MFC) is the IP present in Samsung SoCs which -supports high resolution decoding and encoding functionalities. -The MFC device driver is a v4l2 driver which can encode/decode -video raw/elementary streams and has support for all popular -video codecs. - -Required properties: - - compatible : value should be either one among the following - (a) "samsung,mfc-v5" for MFC v5 present in Exynos4 SoCs - (b) "samsung,mfc-v6" for MFC v6 present in Exynos5 SoCs - (c) "samsung,mfc-v7" for MFC v7 present in Exynos5420 SoC - (d) "samsung,mfc-v8" for MFC v8 present in Exynos5800 SoC - (e) "samsung,exynos5433-mfc" for MFC v8 present in Exynos5433 SoC - (f) "samsung,mfc-v10" for MFC v10 present in Exynos7880 SoC - - - reg : Physical base address of the IP registers and length of memory - mapped region. - - - interrupts : MFC interrupt number to the CPU. - - clocks : from common clock binding: handle to mfc clock. - - clock-names : from common clock binding: must contain "mfc", - corresponding to entry in the clocks property. - -Optional properties:
Documentation/devicetree/bindings/media/s5p-mfc.txt line 36
Quoted 10 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-10- - power-domains : power-domain property defined with a phandle - to respective power domain. - - memory-region : from reserved memory binding: phandles to two reserved - memory regions, first is for "left" mfc memory bus interfaces, - second if for the "right" mfc memory bus, used when no SYSMMU - support is available; used only by MFC v5 present in Exynos4 SoCs - -Obsolete properties: - - samsung,mfc-r, samsung,mfc-l : support removed, please use memory-region - property instead
When did they become obsolete? Is it enough of time to remove them?
Quoted 31 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-31- - -Example: -SoC specific DT entry: - -mfc: codec@13400000 { - compatible = "samsung,mfc-v5"; - reg = <0x13400000 0x10000>; - interrupts = <0 94 0>; - power-domains = <&pd_mfc>; - clocks = <&clock 273>; - clock-names = "mfc"; -}; - -Reserved memory specific DT entry for given board (see reserved memory binding -for more information): - -reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - mfc_left: region@51000000 { - compatible = "shared-dma-pool"; - no-map; - reg = <0x51000000 0x800000>; - }; - - mfc_right: region@43000000 { - compatible = "shared-dma-pool"; - no-map;
Documentation/devicetree/bindings/media/s5p-mfc.txt line 1
Quoted 10 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +1
-9- reg = <0x43000000 0x800000>; - }; -}; - -Board specific DT entry: - -codec@13400000 { - memory-region = <&mfc_left>, <&mfc_right>; -}; +This file has moved to samsung,s5p-mfc.yaml
Just drop the TXT completely. Nothing references it.
Quoted 7 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +1
-0@@ -0,0 +1,109 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 11
Quoted 10 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +10
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/samsung,s5p-mfc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung Exynos Multi Format Codec (MFC) + +maintainers: + - Marek Szyprowski <[email protected]> + - Aakarsh Jain <[email protected]>
and maybe you as well?
Quoted 11 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +11
-0+ +description: + Multi Format Codec (MFC) is the IP present in Samsung SoCs which + supports high resolution decoding and encoding functionalities. + +properties: + compatible: + enum: + - samsung,mfc-v5 # Exynos4 + - samsung,mfc-v6 # Exynos5 + - samsung,mfc-v7 # Exynos5420
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 32
Quoted 10 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +10
-0+ - samsung,mfc-v8 # Exynos5800 + - samsung,exynos5433-mfc # Exynos5433 + - samsung,mfc-v10 # Exynos7880 + + reg: + maxItems: 1 + + clocks: + minItems: 1 + maxItems: 3
You need to list the items. If this varies per compatible, do it in AllOf.
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 45
Quoted 13 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +13
-0+ + clock-names: + minItems: 1 + maxItems: 3 + + interrupts: + maxItems: 1 + + iommus: + maxItems: 2 + + iommu-names: + maxItems: 2
You need to list the items.
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 51
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +6
-0+ + power-domains: + maxItems: 1 + + memory-region: + maxItems: 1
This misses the description and old binding allowed it only for MFCv5, not for others, right?
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 54
Quoted 3 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +3
-0+ +allOf: + - if:
allOf goes after required section.
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 63
Quoted 9 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +9
-0+ properties: + compatible: + contains: + enum: + - samsung,mfc-v5 + then: + properties: + memory-region: + maxItems: 2
Does not look like you tested the bindings. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions).
This won't work. Test it and you will see it.
Quoted 5 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +5
-0+ +required: + - compatible + - reg + - clocks
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 78
Quoted 10 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +10
-0+ - clock-names + - interrupts + +additionalProperties: false + +examples: + - | + # SoC specific DT entry + mfc: mfc@12880000 { + compatible = "samsung,fsd-mfc";
Does not look like you tested the bindings. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions).
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +6
-0+ reg = <0x0 0x12880000 0x0 0x10000>; + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "mfc"; + clocks = <&clock_mfc MFC_MFC_IPCLKPORT_ACLK>; + iommus = <&smmu_isp 0x1000 0x0>, <&smmu_isp 0x1400 0x0>; + iommu-names = "left", "right";
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 94
Quoted 10 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +10
-0+ power-domains = <&pd_mfc>; + memory-region = <&mfc_left>, <&mfc_right>; + }; + + - | + # Reserved memory specific DT entry for given board + # (see reserved memory binding for more information) + reserved-memory { + #address-cells = <1>; + #size-cells = <1>;
Drop this example, not really related to MFC.
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 95
Quoted 1 line
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +1
-0+ ranges;
Best regards,
Krzysztof
RE: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFC
Quoted 20 lines
-----Original Message-----
From: Krzysztof Kozlowski [mailto:[email protected]]
Sent: 07 September 2022 16:52
To: Smitha T Murthy <[email protected]>; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFC
Quoted 6 lines
Quoted 1 line · Smitha T Murthy
Adds DT schema for s5p-mfc in yaml format
s/Adds/Convert/
(as convert to DT schema)
ok, I will change.
Quoted 3 lines
Please mention here changes to original binding (I see at least adding iommus and dropping some properties).
ok. I will make this changes.
Quoted 53 lines
Quoted 6 lines
Signed-off-by Aakarsh Jain <[email protected]>Signed-off-by Smitha T Murthy <[email protected]>--- .../devicetree/bindings/media/s5p-mfc.txt | 77 +------------ .../bindings/media/samsung,s5p-mfc.yaml | 109++++++++++++++++++
Quoted 15 lines
2 files changed, 110 insertions(+), 76 deletions(-) create mode100644
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yamlDocumentation/devicetree/bindings/media/s5p-mfc.txt +0
-5@@ -1,76 +1 @@ -* Samsung Multi Format Codec (MFC) - -Multi Format Codec (MFC) is the IP present in Samsung SoCs which -supports high resolution decoding and encoding functionalities. -The MFC device driver is a v4l2 driver which can encode/decode -videoraw/elementary streams and has support for all popular -video codecs.
Documentation/devicetree/bindings/media/s5p-mfc.txt
Quoted 8 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-8- -Required properties: - - compatible : value should be either one among the following - (a) "samsung,mfc-v5" for MFC v5 present in Exynos4 SoCs - (b) "samsung,mfc-v6" for MFC v6 present in Exynos5 SoCs - (c) "samsung,mfc-v7" for MFC v7 present in Exynos5420 SoC - (d) "samsung,mfc-v8" for MFC v8 present in Exynos5800 SoC - (e) "samsung,exynos5433-mfc" for MFC v8 present in Exynos5433SoC
Quoted 4 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-4- (f) "samsung,mfc-v10" for MFC v10 present in Exynos7880 SoC - - - reg : Physical base address of the IP registers and length of memory - mapped region.Documentation/devicetree/bindings/media/s5p-mfc.txt
Quoted 10 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-10- - - interrupts : MFC interrupt number to the CPU. - - clocks : from common clock binding: handle to mfc clock. - - clock-names : from common clock binding: must contain "mfc", - corresponding to entry in the clocks property. - -Optional properties: - - power-domains : power-domain property defined with a phandle - to respective power domain. - - memory-region : from reserved memory binding: phandles to tworeserved
Documentation/devicetree/bindings/media/s5p-mfc.txt
Quoted 6 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-6- memory regions, first is for "left" mfc memory bus interfaces, - second if for the "right" mfc memory bus, used when no SYSMMU - support is available; used only by MFC v5 present in Exynos4 SoCs - -Obsolete properties: - - samsung,mfc-r, samsung,mfc-l : support removed, please use memory-region
Quoted 3 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt line 36
Quoted 1 line
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-1- property insteadWhen did they become obsolete? Is it enough of time to remove them?
these properties were there earlier, we didn't added them in obsolete properties.
Quoted 35 lines
Quoted 35 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-15- - -Example: -SoC specific DT entry: - -mfc: codec@13400000 { - compatible = "samsung,mfc-v5"; - reg = <0x13400000 0x10000>; - interrupts = <0 94 0>; - power-domains = <&pd_mfc>; - clocks = <&clock 273>; - clock-names = "mfc"; -}; - -Reserved memory specific DT entry for given board (see reservedmemory binding -for more information):
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-19- -reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - mfc_left: region@51000000 { - compatible = "shared-dma-pool"; - no-map; - reg = <0x51000000 0x800000>; - }; - - mfc_right: region@43000000 { - compatible = "shared-dma-pool"; - no-map; - reg = <0x43000000 0x800000>; - }; -}; -
Quoted 8 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt line 1
Quoted 6 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +1
-5-Board specific DT entry: - -codec@13400000 { - memory-region = <&mfc_left>, <&mfc_right>; -}; +This file has moved to samsung,s5p-mfc.yamlJust drop the TXT completely. Nothing references it.
Okay. will remove this text .
Quoted 24 lines
Quoted 9 lines
diff --git
a/Documentation/devicetree/bindings/media/samsung,s5p-mfc.yamlb/Documentation/devicetree/bindings/media/samsung,s5p-mfc.yamlnew file mode 100644
index 000000000000..7cd26d4acbe4Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 5
Quoted 5 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +5
-0@@ -0,0 +1,109 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause %YAML 1.2 +--- +$id: +https://protect2.fireeye.com/v1/url?k=a9dc6a19-c8577f3c-a9dde156-74fe +485cbff6-58df42a60c876b34&q=1&e=edb5d5a1-11b4-42cd-9005-acaa7257669a&
Quoted 1 line
+u=http%3A%2F%2Fdevicetree.org%2Fschemas%2Fmedia%2Fsamsung%2Cs 5p-mfc.y
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml
Quoted 3 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +3
-0+aml%23 +$schema: +https://protect2.fireeye.com/v1/url?k=1ad7b405-7b5ca120-1ad63f4a-74fe
Quoted 1 line
+485cbff6-5f46417fdb588b6c&q=1&e=edb5d5a1-11b4-42cd-9005-
acaa7257669a&
Quoted 10 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 11
Quoted 7 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +7
-0+u=http%3A%2F%2Fdevicetree.org%2Fmeta-schemas%2Fcore.yaml%23 + +title: Samsung Exynos Multi Format Codec (MFC) + +maintainers: + - Marek Szyprowski <[email protected]> + - Aakarsh Jain <[email protected]>and maybe you as well?
okay. will update the list.
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +15
-0+ +description: + Multi Format Codec (MFC) is the IP present in Samsung SoCs which + supports high resolution decoding and encoding functionalities. + +properties: + compatible: + enum: + - samsung,mfc-v5 # Exynos4 + - samsung,mfc-v6 # Exynos5 + - samsung,mfc-v7 # Exynos5420 + - samsung,mfc-v8 # Exynos5800 + - samsung,exynos5433-mfc # Exynos5433 + - samsung,mfc-v10 # Exynos7880 +
Quoted 9 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 32
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +6
-0+ reg: + maxItems: 1 + + clocks: + minItems: 1 + maxItems: 3You need to list the items. If this varies per compatible, do it in AllOf.
okay. we will do the changes.
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +7
-0+ + clock-names: + minItems: 1 + maxItems: 3 + + interrupts: + maxItems: 1
Quoted 9 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 45
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +6
-0+ + iommus: + maxItems: 2 + + iommu-names: + maxItems: 2You need to list the items.
Okay. We will do the changes.
Quoted 10 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 51
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +6
-0+ + power-domains: + maxItems: 1 + + memory-region: + maxItems: 1This misses the description and old binding allowed it only for MFCv5, not for others, right?
Okay. will add the description. Yes it is for MFCv5 only.
Quoted 6 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 54
Quoted 3 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +3
-0+ +allOf: + - if:allOf goes after required section.
ok. we will change.
Quoted 10 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 63
Quoted 9 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +9
-0+ properties: + compatible: + contains: + enum: + - samsung,mfc-v5 + then: + properties: + memory-region: + maxItems: 2
Quoted 6 lines
Does not look like you tested the bindings. Please run
make dt_binding_check(seeDocumentation/devicetree/bindings/writing-schema.rstfor instructions).This won't work. Test it and you will see it.
Okay .we will check.
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +11
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + +additionalProperties: false + +examples:
Quoted 8 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 78
Quoted 4 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +4
-0+ - | + # SoC specific DT entry + mfc: mfc@12880000 { + compatible = "samsung,fsd-mfc";Does not look like you tested the bindings. Please run
make dt_binding_check(seeDocumentation/devicetree/bindings/writing-schema.rstfor instructions).
we didn't got any errors while running dt_binding_check with path to the yaml file but we are seeing errors while running dt_binding_check without path. we will fix it in next series.
Quoted 18 lines
Quoted 7 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +6
-0+ reg = <0x0 0x12880000 0x0 0x10000>; + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "mfc"; + clocks = <&clock_mfc MFC_MFC_IPCLKPORT_ACLK>; + iommus = <&smmu_isp 0x1000 0x0>, <&smmu_isp 0x1400 0x0>; + iommu-names = "left", "right";Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml line 94
Quoted 10 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml new file +10
-0+ power-domains = <&pd_mfc>; + memory-region = <&mfc_left>, <&mfc_right>; + }; + + - | + # Reserved memory specific DT entry for given board + # (see reserved memory binding for more information) + reserved-memory { + #address-cells = <1>; + #size-cells = <1>;
Quoted 4 lines
Drop this example, not really related to MFC.
Quoted 1 line
+ ranges;
Okay. will remove this.
Thanks for the review.
Quoted 3 lines
Best regards,
Krzysztof
Re: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFC
Quoted 85 lines · Aakarsh Jain
Quoted 20 lines
-----Original Message-----
From: Krzysztof Kozlowski [mailto:[email protected]]
Sent: 07 September 2022 16:52
To: Smitha T Murthy <[email protected]>; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFCQuoted 6 lines
Quoted 1 line · Smitha T Murthy
Adds DT schema for s5p-mfc in yaml format
s/Adds/Convert/
(as convert to DT schema)ok, I will change.
Quoted 3 lines
Please mention here changes to original binding (I see at least adding iommus and dropping some properties).
ok. I will make this changes.
Quoted 53 lines
Quoted 6 lines
Signed-off-by Aakarsh Jain <[email protected]>Signed-off-by Smitha T Murthy <[email protected]>--- .../devicetree/bindings/media/s5p-mfc.txt | 77 +------------ .../bindings/media/samsung,s5p-mfc.yaml | 109++++++++++++++++++
Quoted 15 lines
2 files changed, 110 insertions(+), 76 deletions(-) create mode100644
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yamlDocumentation/devicetree/bindings/media/s5p-mfc.txt +0
-5@@ -1,76 +1 @@ -* Samsung Multi Format Codec (MFC) - -Multi Format Codec (MFC) is the IP present in Samsung SoCs which -supports high resolution decoding and encoding functionalities. -The MFC device driver is a v4l2 driver which can encode/decode -videoraw/elementary streams and has support for all popular -video codecs.
Documentation/devicetree/bindings/media/s5p-mfc.txt
Quoted 8 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-8- -Required properties: - - compatible : value should be either one among the following - (a) "samsung,mfc-v5" for MFC v5 present in Exynos4 SoCs - (b) "samsung,mfc-v6" for MFC v6 present in Exynos5 SoCs - (c) "samsung,mfc-v7" for MFC v7 present in Exynos5420 SoC - (d) "samsung,mfc-v8" for MFC v8 present in Exynos5800 SoC - (e) "samsung,exynos5433-mfc" for MFC v8 present in Exynos5433SoC
Quoted 4 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-4- (f) "samsung,mfc-v10" for MFC v10 present in Exynos7880 SoC - - - reg : Physical base address of the IP registers and length of memory - mapped region.Documentation/devicetree/bindings/media/s5p-mfc.txt
Quoted 10 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-10- - - interrupts : MFC interrupt number to the CPU. - - clocks : from common clock binding: handle to mfc clock. - - clock-names : from common clock binding: must contain "mfc", - corresponding to entry in the clocks property. - -Optional properties: - - power-domains : power-domain property defined with a phandle - to respective power domain. - - memory-region : from reserved memory binding: phandles to tworeserved
Documentation/devicetree/bindings/media/s5p-mfc.txt
Quoted 6 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-6- memory regions, first is for "left" mfc memory bus interfaces, - second if for the "right" mfc memory bus, used when no SYSMMU - support is available; used only by MFC v5 present in Exynos4 SoCs - -Obsolete properties: - - samsung,mfc-r, samsung,mfc-l : support removed, please use memory-region
Quoted 5 lines
Quoted 3 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt line 36
Quoted 1 line
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-1- property insteadWhen did they become obsolete? Is it enough of time to remove them?
these properties were there earlier, we didn't added them in obsolete properties.
This is not the answer to my question. Is it enough of time to remove deprecated properties?
Best regards,
Krzysztof
RE: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFC
Quoted 115 lines
-----Original Message-----
From: Krzysztof Kozlowski [mailto:[email protected]]
Sent: 08 September 2022 20:41
To: Aakarsh Jain <[email protected]>; 'Krzysztof Kozlowski' <[email protected]>; 'Smitha T Murthy' <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFCQuoted 15 lines · Aakarsh Jain
Quoted 15 lines
-----Original Message-----
From: Krzysztof Kozlowski [mailto:[email protected]]
Sent: 07 September 2022 16:52
To: Smitha T Murthy <[email protected]>; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected];Quoted 11 lines
Quoted 11 lines
[email protected]; [email protected]; [email protected]
Subject: Re: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFCQuoted 1 line · Smitha T Murthy
Adds DT schema for s5p-mfc in yaml format
s/Adds/Convert/
(as convert to DT schema)Quoted 15 lines
ok, I will change.
Quoted 3 lines
Please mention here changes to original binding (I see at least adding iommus and dropping some properties).
ok. I will make this changes.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Aakarsh Jain <[email protected]>Signed-off-by Smitha T Murthy <[email protected]>--- .../devicetree/bindings/media/s5p-mfc.txt | 77 +------------ .../bindings/media/samsung,s5p-mfc.yaml | 109++++++++++++++++++
Quoted 2 lines
2 files changed, 110 insertions(+), 76 deletions(-) create mode100644
Documentation/devicetree/bindings/media/samsung,s5p-
mfc.yamlQuoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt line 6
Quoted 13 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-6@@ -1,76 +1 @@ -* Samsung Multi Format Codec (MFC) - -Multi Format Codec (MFC) is the IP present in Samsung SoCs which -supports high resolution decoding and encoding functionalities. -The MFC device driver is a v4l2 driver which can encode/decode -video raw/elementary streams and has support for all popular -videocodecs.
Quoted 36 lines
Quoted 35 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt
Quoted 8 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-8- -Required properties: - - compatible : value should be either one among the following - (a) "samsung,mfc-v5" for MFC v5 present in Exynos4 SoCs - (b) "samsung,mfc-v6" for MFC v6 present in Exynos5 SoCs - (c) "samsung,mfc-v7" for MFC v7 present in Exynos5420 SoC - (d) "samsung,mfc-v8" for MFC v8 present in Exynos5800 SoC - (e) "samsung,exynos5433-mfc" for MFC v8 present in Exynos5433SoC
Quoted 4 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-4- (f) "samsung,mfc-v10" for MFC v10 present in Exynos7880 SoC - - - reg : Physical base address of the IP registers and length of memory - mapped region.Documentation/devicetree/bindings/media/s5p-mfc.txt
Quoted 10 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-10- - - interrupts : MFC interrupt number to the CPU. - - clocks : from common clock binding: handle to mfc clock. - - clock-names : from common clock binding: must contain "mfc", - corresponding to entry in the clocks property. - -Optional properties: - - power-domains : power-domain property defined with a phandle - to respective power domain. - - memory-region : from reserved memory binding: phandles to tworeserved
Quoted 7 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-6- memory regions, first is for "left" mfc memory bus interfaces, - second if for the "right" mfc memory bus, used when no SYSMMU - support is available; used only by MFC v5 present in Exynos4 SoCs - -Obsolete properties: - - samsung,mfc-r, samsung,mfc-l : support removed, please usememory-
region
Documentation/devicetree/bindings/media/s5p-mfc.txt line 36
Quoted 1 line
Documentation/devicetree/bindings/media/s5p-mfc.txt +0
-1- property insteadWhen did they become obsolete? Is it enough of time to remove them?
Quoted 6 lines
Quoted 1 line
these properties were there earlier, we didn't added them in obsolete
properties.
This is not the answer to my question. Is it enough of time to remove deprecated properties?
sorry I misunderstood. These two mfc-l and mfc-r are still used in mfcv5 version as they use MFC_NUM_PORTS as 2, so we cannot make them obsolete yet. In next patch series we will add allOf: if: else: conditions for all the properties of each compatible string. Thanks for the review.
Quoted 4 lines
Best regards,
Krzysztof
Rob Herring
maintainerRe: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFC
In reply to Smitha T MurthyQuoted 10 lines · Smitha T Murthy
Adds DT schema for s5p-mfc in yaml format
Signed-off-by Aakarsh Jain <[email protected]>Signed-off-by Smitha T Murthy <[email protected]>--- .../devicetree/bindings/media/s5p-mfc.txt | 77 +------------ .../bindings/media/samsung,s5p-mfc.yaml | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+), 76 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/media/samsung,s5p-mfc.example.dts:21.11-12 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:384: Documentation/devicetree/bindings/media/samsung,s5p-mfc.example.dtb] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1420: dt_binding_check] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
RE: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFC
Quoted 49 lines
-----Original Message-----
From: Rob Herring [mailto:[email protected]]
Sent: 07 September 2022 20:43
To: Smitha T Murthy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; hverkuil- [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Patch v2 01/15] dt-bindings: media: s5p-mfc: Add new DT schema for MFCQuoted 7 lines · Smitha T Murthy
Adds DT schema for s5p-mfc in yaml format
Signed-off-by Aakarsh Jain <[email protected]>Signed-off-by Smitha T Murthy <[email protected]>--- .../devicetree/bindings/media/s5p-mfc.txt | 77 +------------ .../bindings/media/samsung,s5p-mfc.yaml | 109++++++++++++++++++
Quoted 3 lines
2 files changed, 110 insertions(+), 76 deletions(-) create mode100644
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check'
on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
dtschema/dtc warnings/errors:
Error:Documentation/devicetree/bindings/media/samsung,s5p-mfc.example.dts:21.11-12 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:384:Documentation/devicetree/bindings/media/samsung,s5p-mfc.example.dtb] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1420:dt_binding_check] Error 2
Quoted 7 lines
doc reference errors (make refcheckdocs):
See https://protect2.fireeye.com/v1/url?k=88c9803a-e9429571-88c80b75-
74fe485fb305-6955573d9da6ae9f&q=1&e=4823af8c-cd6a-4171-9c03- cf0e37ae544b&u=https%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2FThis check can fail if there are any dependencies. The base for a patch
series
Quoted 3 lines
is generally the most recent rc1.
If you already ran 'make
dt_binding_check' and didn't see the above
error(s),
Quoted 6 lines
then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
we didn't got any errors while running dt_binding_check with path to the yaml file but we are seeing errors while running dt_binding_check without path.
we will fix it in next series.
Thanks for the review.
Thanks,
Aakarsh
PATCH v2 2/15 dt-bindings: media: s5p-mfc: Add mfcv12 variant
In reply to Smitha T MurthyAdds DT schema for s5p-mfc with a new compatible
string for mfcv12 variant.
--- Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml +1 -0
@@ -23,6 +23,7 @@ properties: - samsung,mfc-v8 # Exynos5800 - samsung,exynos5433-mfc # Exynos5433 - samsung,mfc-v10 # Exynos7880 + - samsung,fsd-mfc # Tesla FSD reg: maxItems: 1
Signature · 1 line
2.17.1
Krzysztof Kozlowski
maintainerRe: [Patch v2 02/15] dt-bindings: media: s5p-mfc: Add mfcv12 variant
Quoted 2 lines · Smitha T Murthy
Adds DT schema for s5p-mfc with a new compatible
string for mfcv12 variant.
This msg is over-complicated. Just: "Add Tesla FSD MFC (MFC v12) compatible".
Quoted 12 lines
Signed-off-by Aakarsh Jain <[email protected]>Signed-off-by Smitha T Murthy <[email protected]>--- Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml +0
-0
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml properties: · line 26
Quoted 4 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml +1
-0@@ -23,6 +23,7 @@ properties: - samsung,mfc-v8 # Exynos5800 - samsung,exynos5433-mfc # Exynos5433 - samsung,mfc-v10 # Exynos7880 + - samsung,fsd-mfc # Tesla FSD
tesla,fsd-mfc
(because FSD is attributed everywhere to Tesla)
Best regards,
Krzysztof
RE: [Patch v2 02/15] dt-bindings: media: s5p-mfc: Add mfcv12 variant
Quoted 20 lines
-----Original Message-----
From: Krzysztof Kozlowski [mailto:[email protected]]
Sent: Wednesday, September 7, 2022 4:54 PM
To: Smitha T Murthy <[email protected]>; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Patch v2 02/15] dt-bindings: media: s5p-mfc: Add mfcv12 variant
Quoted 7 lines
Quoted 2 lines · Smitha T Murthy
Adds DT schema for s5p-mfc with a new compatible string for mfcv12 variant.
This msg is over-complicated. Just: "Add Tesla FSD MFC (MFC v12) compatible".
I will change it in the next series.
Quoted 21 lines
Quoted 14 lines
Signed-off-by Aakarsh Jain <[email protected]>Signed-off-by Smitha T Murthy <[email protected]>--- Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml | 1 + 1 file changed, 1 insertion(+)diff --git
a/Documentation/devicetree/bindings/media/samsung,s5p-mfc.yamlb/Documentation/devicetree/bindings/media/samsung,s5p-mfc.yamlindex7cd26d4acbe4..a806489a9edd100644Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml properties: · line 26
Quoted 4 lines
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml +1
-0@@ -23,6 +23,7 @@ properties: - samsung,mfc-v8 # Exynos5800 - samsung,exynos5433-mfc # Exynos5433 - samsung,mfc-v10 # Exynos7880 + - samsung,fsd-mfc # Tesla FSDtesla,fsd-mfc
Quoted 4 lines
(because FSD is attributed everywhere to Tesla)
Best regards,
Krzysztof
I will make the change in the next series.
Regards,
Smitha
PATCH v2 3/15 media: s5p-mfc: Rename IS_MFCV10 macro
In reply to Smitha T MurthyRenames macro IS_MFCV10 to IS_MFCV10_PLUS so that the MFCv10 code can be resued for MFCv12 support. Since some part of MFCv10 specific code holds good for MFCv12 also.
--- .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 10 +++---- .../platform/samsung/s5p-mfc/s5p_mfc_ctrl.c | 2 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 28 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +5 -5
@@ -771,11 +771,11 @@ void s5p_mfc_cleanup_queue(struct list_head *lh, struct vb2_queue *vq);#define HAS_PORTNUM (dev) (dev ? (dev->variant ? \ (dev->variant->port_num ? 1 : 0) : 0) : 0)#define IS_TWOPORT (dev) (dev->variant->port_num == 2 ? 1 : 0) -#define IS_MFCV6_PLUS (dev) (dev->variant->version >= 0x60 ? 1 : 0) -#define IS_MFCV7_PLUS (dev) (dev->variant->version >= 0x70 ? 1 : 0) -#define IS_MFCV8_PLUS (dev) (dev->variant->version >= 0x80 ? 1 : 0) -#define IS_MFCV10 (dev) (dev->variant->version >= 0xA0 ? 1 : 0) -#define FW_HAS_E_MIN_SCRATCH_BUF (dev) (IS_MFCV10(dev)) +#define IS_MFCV6_PLUS (dev) (dev->variant->version >= 0x60) +#define IS_MFCV7_PLUS (dev) (dev->variant->version >= 0x70) +#define IS_MFCV8_PLUS (dev) (dev->variant->version >= 0x80) +#define IS_MFCV10_PLUS (dev) (dev->variant->version >= 0xA0) +#define FW_HAS_E_MIN_SCRATCH_BUF (dev) (IS_MFCV10_PLUS(dev))#define MFC_V5_BIT BIT(0)#define MFC_V6_BIT BIT(1)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c +1 -1
@@ -236,7 +236,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)else mfc_write (dev,0x3ff ,S5P_FIMV_SW_RESET ); -if (IS_MFCV10 (dev)) +if (IS_MFCV10_PLUS (dev))mfc_write (dev,0x0 ,S5P_FIMV_MFC_CLOCK_OFF_V10 );mfc_debug (2 ,"Will now wait for completion of firmware transfer\n" );
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +14 -14
@@ -72,9 +72,9 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) ctx->luma_size, ctx->chroma_size, ctx->mv_size);mfc_debug (2 ,"Totals bufs: %d\n" , ctx->total_dpb_count); }else if (ctx->type ==MFCINST_ENCODER ) { -if (IS_MFCV10 (dev)) { +if (IS_MFCV10_PLUS (dev)) ctx->tmv_buffer_size =0 ; - }else if (IS_MFCV8_PLUS (dev)) +else if (IS_MFCV8_PLUS (dev)) ctx->tmv_buffer_size =S5P_FIMV_NUM_TMV_BUFFERS_V6 *ALIGN (S5P_FIMV_TMV_BUFFER_SIZE_V8 (mb_width, mb_height),S5P_FIMV_TMV_BUFFER_ALIGN_V6 );
@@ -82,7 +82,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) ctx->tmv_buffer_size =S5P_FIMV_NUM_TMV_BUFFERS_V6 *ALIGN (S5P_FIMV_TMV_BUFFER_SIZE_V6 (mb_width, mb_height),S5P_FIMV_TMV_BUFFER_ALIGN_V6 ); -if (IS_MFCV10 (dev)) { +if (IS_MFCV10_PLUS (dev)) { lcu_width =S5P_MFC_LCU_WIDTH (ctx->img_width); lcu_height =S5P_MFC_LCU_HEIGHT (ctx->img_height);if (ctx->codec_mode !=S5P_FIMV_CODEC_HEVC_ENC ) {
@@ -133,7 +133,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)switch (ctx->codec_mode) {case S5P_MFC_CODEC_H264_DEC :case S5P_MFC_CODEC_H264_MVC_DEC : -if (IS_MFCV10 (dev)) +if (IS_MFCV10_PLUS (dev))mfc_debug (2 ,"Use min scratch buffer size\n" );else if (IS_MFCV8_PLUS (dev)) ctx->scratch_buf_size =
@@ -152,7 +152,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) (ctx->mv_count * ctx->mv_size);break ;case S5P_MFC_CODEC_MPEG4_DEC : -if (IS_MFCV10 (dev)) +if (IS_MFCV10_PLUS (dev))mfc_debug (2 ,"Use min scratch buffer size\n" );else if (IS_MFCV7_PLUS (dev)) { ctx->scratch_buf_size =
@@ -172,7 +172,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)break ;case S5P_MFC_CODEC_VC1RCV_DEC :case S5P_MFC_CODEC_VC1_DEC : -if (IS_MFCV10 (dev)) +if (IS_MFCV10_PLUS (dev))mfc_debug (2 ,"Use min scratch buffer size\n" );else ctx->scratch_buf_size =
@@ -189,7 +189,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) ctx->bank2.size =0 ;break ;case S5P_MFC_CODEC_H263_DEC : -if (IS_MFCV10 (dev)) +if (IS_MFCV10_PLUS (dev))mfc_debug (2 ,"Use min scratch buffer size\n" );else ctx->scratch_buf_size =
@@ -201,7 +201,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) ctx->bank1.size = ctx->scratch_buf_size;break ;case S5P_MFC_CODEC_VP8_DEC : -if (IS_MFCV10 (dev)) +if (IS_MFCV10_PLUS (dev))mfc_debug (2 ,"Use min scratch buffer size\n" );else if (IS_MFCV8_PLUS (dev)) ctx->scratch_buf_size =
@@ -230,7 +230,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)DEC_VP9_STATIC_BUFFER_SIZE ;break ;case S5P_MFC_CODEC_H264_ENC : -if (IS_MFCV10 (dev)) { +if (IS_MFCV10_PLUS (dev)) {mfc_debug (2 ,"Use min scratch buffer size\n" ); ctx->me_buffer_size =ALIGN (ENC_V100_H264_ME_SIZE (mb_width, mb_height),16 );
@@ -254,7 +254,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)break ;case S5P_MFC_CODEC_MPEG4_ENC :case S5P_MFC_CODEC_H263_ENC : -if (IS_MFCV10 (dev)) { +if (IS_MFCV10_PLUS (dev)) {mfc_debug (2 ,"Use min scratch buffer size\n" ); ctx->me_buffer_size = ALIGN(ENC_V100_MPEG4_ME_SIZE(mb_width,
@@ -273,7 +273,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) ctx->bank2.size =0 ;break ;case S5P_MFC_CODEC_VP8_ENC : -if (IS_MFCV10 (dev)) { +if (IS_MFCV10_PLUS (dev)) {mfc_debug (2 ,"Use min scratch buffer size\n" ); ctx->me_buffer_size = ALIGN(ENC_V100_VP8_ME_SIZE(mb_width, mb_height),
@@ -452,7 +452,7 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct s5p_mfc_ctx *ctx)if (ctx->codec_mode ==S5P_MFC_CODEC_H264_DEC || ctx->codec_mode ==S5P_MFC_CODEC_H264_MVC_DEC ) { -if (IS_MFCV10 (dev)) { +if (IS_MFCV10_PLUS (dev)) { ctx->mv_size =S5P_MFC_DEC_MV_SIZE_V10 (ctx->img_width, ctx->img_height); }else {
@@ -668,7 +668,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx)mfc_debug (2 ,"Buf1: %p (%d)\n" , (void *)buf_addr1, buf_size1); -if (IS_MFCV10 (dev)) { +if (IS_MFCV10_PLUS (dev)) {/* start address of per buffer is aligned */ for (i =0 ; i < ctx->pb_count; i++) {writel (buf_addr1, mfc_regs->e_luma_dpb + (4 * i));
@@ -2455,7 +2455,7 @@ const struct s5p_mfc_regs *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev)R (e_h264_options,S5P_FIMV_E_H264_OPTIONS_V8 );R (e_min_scratch_buffer_size,S5P_FIMV_E_MIN_SCRATCH_BUFFER_SIZE_V8 ); -if (!IS_MFCV10 (dev)) +if (!IS_MFCV10_PLUS (dev)) goto done;/* Initialize registers used in MFC v10 only.
Signature · 1 line
2.17.1
PATCH v2 4/15 media: s5p-mfc: Add initial support for MFCv12
In reply to Smitha T MurthyAdd support for MFCv12, with a new register file and necessary hw control, decoder, encoder and structural changes. Add luma dbp, chroma dpb and mv sizes for each codec as per the UM for MFCv12, along with appropriate alignment.
--- .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 50 +++++++++++ .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 30 +++++++ .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 13 ++- .../platform/samsung/s5p-mfc/s5p_mfc_ctrl.c | 2 +- .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 6 +- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 5 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 8 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 85 ++++++++++++++++--- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h | 6 +- 9 files changed, 175 insertions(+), 30 deletions(-) create mode 100644 drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h
drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h new file +50 -0
@@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Register definition file for Samsung MFC V12.x Interface (FIMV) driver +* +* Copyright (c) 2020 Samsung Electronics Co., Ltd. +* http://www.samsung.com/ +*/ + +#ifndef _REGS_MFC_V12_H +#define _REGS_MFC_V12_H + +#include <linux/sizes.h> +#include "regs-mfc-v10.h" + +/* MFCv12 Context buffer sizes */ +#define MFC_CTX_BUF_SIZE_V12 (30 * SZ_1K) +#define MFC_H264_DEC_CTX_BUF_SIZE_V12 (2 * SZ_1M) +#define MFC_OTHER_DEC_CTX_BUF_SIZE_V12 (30 * SZ_1K) +#define MFC_H264_ENC_CTX_BUF_SIZE_V12 (100 * SZ_1K) +#define MFC_HEVC_ENC_CTX_BUF_SIZE_V12 (40 * SZ_1K) +#define MFC_OTHER_ENC_CTX_BUF_SIZE_V12 (25 * SZ_1K) + +/* MFCv12 variant defines */ +#define MAX_FW_SIZE_V12 (SZ_1M) +#define MAX_CPB_SIZE_V12 (7 * SZ_1M) +#define MFC_VERSION_V12 0xC0 +#define MFC_NUM_PORTS_V12 1 +#define S5P_FIMV_CODEC_VP9_ENC 27 + +/* Encoder buffer size for MFCv12 */ +#define ENC_V120_BASE_SIZE (x, y) \ + (((x + 3) * (y + 3) * 8) \ + + (((y * 64) + 2304) * (x + 7) / 8)) + +#define ENC_V120_H264_ME_SIZE (x, y) \ + ALIGN((ENC_V120_BASE_SIZE(x, y) \ + + (DIV_ROUND_UP(x * y, 64) * 32)), 256) + +#define ENC_V120_MPEG4_ME_SIZE (x, y) \ + ALIGN((ENC_V120_BASE_SIZE(x, y) \ + + (DIV_ROUND_UP(x * y, 128) * 16)), 256) + +#define ENC_V120_VP8_ME_SIZE (x, y) \ + ALIGN(ENC_V120_BASE_SIZE(x, y), 256) + +#define ENC_V120_HEVC_ME_SIZE (x, y) \ + ALIGN((((x + 3) * (y + 3) * 32) \ + + (((y * 128) + 2304) * (x + 3) / 4)), 256) + +#endif /*_REGS_MFC_V12_H*/
drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +30 -0
@@ -775,6 +775,8 @@ static int s5p_mfc_open(struct file *file)INIT_LIST_HEAD (&ctx->dst_queue); ctx->src_queue_cnt =0 ; ctx->dst_queue_cnt =0 ; + ctx->is_422 =0 ; + ctx->is_10bit =0 ;/* Get context number */ ctx->num =0 ;while (dev->ctx[ctx->num]) {
@@ -1638,6 +1640,31 @@ static struct s5p_mfc_variant mfc_drvdata_v10 = { .fw_name[0] = "s5p-mfc-v10.fw", }; +static struct s5p_mfc_buf_size_v6 mfc_buf_size_v12 = { + .dev_ctx =MFC_CTX_BUF_SIZE_V12 , + .h264_dec_ctx =MFC_H264_DEC_CTX_BUF_SIZE_V12 , + .other_dec_ctx =MFC_OTHER_DEC_CTX_BUF_SIZE_V12 , + .h264_enc_ctx =MFC_H264_ENC_CTX_BUF_SIZE_V12 , + .hevc_enc_ctx =MFC_HEVC_ENC_CTX_BUF_SIZE_V12 , + .other_enc_ctx =MFC_OTHER_ENC_CTX_BUF_SIZE_V12 , +}; + +static struct s5p_mfc_buf_size buf_size_v12 = { + .fw =MAX_FW_SIZE_V12 , + .cpb =MAX_CPB_SIZE_V12 , + .priv = &mfc_buf_size_v12, +}; + +static struct s5p_mfc_variant mfc_drvdata_v12 = { + .version =MFC_VERSION_V12 , + .version_bit =MFC_V12_BIT , + .port_num =MFC_NUM_PORTS_V12 , + .buf_size = &buf_size_v12, + .fw_name[0 ] ="s5p-mfc-v12.fw" , + .clk_names = {"mfc" }, + .num_clocks =1 , +}; +static const struct of_device_id exynos_mfc_match[] = { { .compatible ="samsung,mfc-v5" ,
@@ -1657,6 +1684,9 @@ static const struct of_device_id exynos_mfc_match[] = { }, { .compatible = "samsung,mfc-v10", .data = &mfc_drvdata_v10, + }, { + .compatible = "samsung,fsd-mfc", + .data = &mfc_drvdata_v12, }, {}, };
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +9 -4
@@ -19,7 +19,7 @@#include <media/v4l2-ioctl.h> #include <media/videobuf2-v4l2.h> #include "regs-mfc.h" -#include "regs-mfc-v10.h" +#include "regs-mfc-v12.h" #define S5P_MFC_NAME "s5p-mfc"
@@ -720,6 +720,8 @@ struct s5p_mfc_ctx {struct v4l2_ctrl *ctrls[MFC_MAX_CTRLS ];struct v4l2_ctrl_handler ctrl_handler;size_t scratch_buf_size; +int is_10bit; +int is_422; };/*
@@ -775,6 +777,7 @@ void s5p_mfc_cleanup_queue(struct list_head *lh, struct vb2_queue *vq);#define IS_MFCV7_PLUS (dev) (dev->variant->version >= 0x70)#define IS_MFCV8_PLUS (dev) (dev->variant->version >= 0x80)#define IS_MFCV10_PLUS (dev) (dev->variant->version >= 0xA0) +#define IS_MFCV12 (dev) (dev->variant->version >= 0xC0)#define FW_HAS_E_MIN_SCRATCH_BUF (dev) (IS_MFCV10_PLUS(dev))#define MFC_V5_BIT BIT(0)
@@ -782,11 +785,13 @@ void s5p_mfc_cleanup_queue(struct list_head *lh, struct vb2_queue *vq);#define MFC_V7_BIT BIT(2)#define MFC_V8_BIT BIT(3)#define MFC_V10_BIT BIT(5) +#define MFC_V12_BIT BIT(7)#define MFC_V5PLUS_BITS (MFC_V5_BIT | MFC_V6_BIT | MFC_V7_BIT | \ - MFC_V8_BIT | MFC_V10_BIT) + MFC_V8_BIT | MFC_V10_BIT | MFC_V12_BIT)#define MFC_V6PLUS_BITS (MFC_V6_BIT | MFC_V7_BIT | MFC_V8_BIT | \ - MFC_V10_BIT) -#define MFC_V7PLUS_BITS (MFC_V7_BIT | MFC_V8_BIT | MFC_V10_BIT) + MFC_V10_BIT | MFC_V12_BIT) +#define MFC_V7PLUS_BITS (MFC_V7_BIT | MFC_V8_BIT | MFC_V10_BIT | \ + MFC_V12_BIT)#endif /* S5P_MFC_COMMON_H_ */
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c +1 -1
@@ -130,7 +130,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev)mfc_write (dev,0 ,S5P_FIMV_REG_CLEAR_BEGIN_V6 + (i*4 ));/* check bus reset control before reset */ -if (dev->risc_on) +if (dev->risc_on && !IS_MFCV12 (dev))if (s5p_mfc_bus_reset (dev))return -EIO ;/* Reset
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +3 -3
@@ -146,7 +146,7 @@ static struct s5p_mfc_fmt formats[] = { .codec_mode = S5P_FIMV_CODEC_HEVC_DEC, .type = MFC_FMT_DEC, .num_planes = 1, - .versions = MFC_V10_BIT, + .versions = MFC_V10_BIT | MFC_V12_BIT, .flags =V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM, },
@@ -155,7 +155,7 @@ static struct s5p_mfc_fmt formats[] = { .codec_mode = S5P_FIMV_CODEC_VP9_DEC, .type = MFC_FMT_DEC, .num_planes = 1, - .versions = MFC_V10_BIT, + .versions = MFC_V10_BIT | MFC_V12_BIT, .flags = V4L2_FMT_FLAG_DYN_RESOLUTION, }, };
@@ -355,7 +355,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) pix_mp->width = ctx->buf_width; pix_mp->height = ctx->buf_height; pix_mp->field =V4L2_FIELD_NONE ; - pix_mp->num_planes =2 ; + pix_mp->num_planes = ctx->dst_fmt->num_planes;/* Set pixelformat to the format in which MFC outputs the decoded frame */ pix_mp->pixelformat = ctx->dst_fmt->fourcc;
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +3 -2
@@ -92,7 +92,7 @@ static struct s5p_mfc_fmt formats[] = { .codec_mode = S5P_FIMV_CODEC_HEVC_ENC, .type = MFC_FMT_ENC, .num_planes = 1, - .versions = MFC_V10_BIT, + .versions = MFC_V10_BIT | MFC_V12_BIT, }, };
@@ -1179,7 +1179,8 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)if (FW_HAS_E_MIN_SCRATCH_BUF (dev)) { ctx->scratch_buf_size =s5p_mfc_hw_call (dev->mfc_ops, get_e_min_scratch_buf_size, dev); - ctx->bank1.size += ctx->scratch_buf_size; +if (!IS_MFCV12 (dev)) + ctx->bank1.size += ctx->scratch_buf_size; } ctx->state =MFCINST_HEAD_PRODUCED ; }
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h +4 -4
@@ -166,9 +166,9 @@ struct s5p_mfc_regs {void __iomem *d_decoded_third_addr;/* only v7 */ void __iomem *d_used_dpb_flag_upper;/* v7 and v8 */ void __iomem *d_used_dpb_flag_lower;/* v7 and v8 */ -void __iomem *d_min_scratch_buffer_size;/* v10 */ -void __iomem *d_static_buffer_addr;/* v10 */ -void __iomem *d_static_buffer_size;/* v10 */ +void __iomem *d_min_scratch_buffer_size;/* v10 and v12 */ +void __iomem *d_static_buffer_addr;/* v10 and v12 */ +void __iomem *d_static_buffer_size;/* v10 and v12 */ /* encoder registers */ void __iomem *e_frame_width;
@@ -268,7 +268,7 @@ struct s5p_mfc_regs {void __iomem *e_vp8_hierarchical_qp_layer0;/* v7 and v8 */ void __iomem *e_vp8_hierarchical_qp_layer1;/* v7 and v8 */ void __iomem *e_vp8_hierarchical_qp_layer2;/* v7 and v8 */ -void __iomem *e_min_scratch_buffer_size;/* v10 */ +void __iomem *e_min_scratch_buffer_size;/* v10 and v12 */ void __iomem *e_num_t_layer;/* v10 */ void __iomem *e_hier_qp_layer0;/* v10 */ void __iomem *e_hier_bit_rate_layer0;/* v10 */
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +73 -12
134 lines not on this page · raw message
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h +2 -4
@@ -19,10 +19,8 @@#define MB_WIDTH (x_size) DIV_ROUND_UP(x_size, 16)#define MB_HEIGHT (y_size) DIV_ROUND_UP(y_size, 16) -#define S5P_MFC_DEC_MV_SIZE_V6 (x, y) (MB_WIDTH(x) * \ - (((MB_HEIGHT(y)+1)/2)*2) * 64 + 128) -#define S5P_MFC_DEC_MV_SIZE_V10 (x, y) (MB_WIDTH(x) * \ - (((MB_HEIGHT(y)+1)/2)*2) * 64 + 512) +#define S5P_MFC_DEC_MV_SIZE (x, y, offset) (MB_WIDTH(x) * \ + (((MB_HEIGHT(y)+1)/2)*2) * 64 + offset)#define S5P_MFC_LCU_WIDTH (x_size) DIV_ROUND_UP(x_size, 32)#define S5P_MFC_LCU_HEIGHT (y_size) DIV_ROUND_UP(y_size, 32)
Signature · 1 line
2.17.1
Re: [Patch v2 04/15] media: s5p-mfc: Add initial support for MFCv12
Hi Smitha,
just a fast look here
[...]
drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h line 33
Quoted 4 lines
drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h new file +4
-0+/* Encoder buffer size for MFCv12 */ +#define ENC_V120_BASE_SIZE (x, y) \ + (((x + 3) * (y + 3) * 8) \ + + (((y * 64) + 2304) * (x + 7) / 8))
do we need any overflow control here?
[...]
Quoted 4 lines
#define
MFC_V7_BITBIT(2)
#defineMFC_V8_BITBIT(3)
#defineMFC_V10_BITBIT(5)drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +1
-0+#define MFC_V12_BIT BIT(7)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h void s5p_mfc_cleanup_queue(struct list_head *lh, struct vb2_queue *vq); · line 795
Quoted 10 lines
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +4
-3#define MFC_V5PLUS_BITS (MFC_V5_BIT | MFC_V6_BIT | MFC_V7_BIT | \ - MFC_V8_BIT | MFC_V10_BIT) + MFC_V8_BIT | MFC_V10_BIT | MFC_V12_BIT)#define MFC_V6PLUS_BITS (MFC_V6_BIT | MFC_V7_BIT | MFC_V8_BIT | \ - MFC_V10_BIT) -#define MFC_V7PLUS_BITS (MFC_V7_BIT | MFC_V8_BIT | MFC_V10_BIT) + MFC_V10_BIT | MFC_V12_BIT) +#define MFC_V7PLUS_BITS (MFC_V7_BIT | MFC_V8_BIT | MFC_V10_BIT | \ + MFC_V12_BIT)
why not MFC_V10PLUS_BITS ?
[...]
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c static struct s5p_mfc_fmt formats[] = { · line 149
Quoted 6 lines
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +1
-1@@ -146,7 +146,7 @@ static struct s5p_mfc_fmt formats[] = { .codec_mode = S5P_FIMV_CODEC_HEVC_DEC, .type = MFC_FMT_DEC, .num_planes = 1, - .versions = MFC_V10_BIT, + .versions = MFC_V10_BIT | MFC_V12_BIT,
we could just yse MFC_V10PLUS_BITS here
[...]
Quoted 8 lines
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +8
-0+if (IS_MFCV12 (dev)) { + lcu_width =S5P_MFC_LCU_WIDTH (ctx->img_width); + lcu_height =S5P_MFC_LCU_HEIGHT (ctx->img_height); +if (ctx->codec_mode ==S5P_FIMV_CODEC_HEVC_ENC && + ctx->is_10bit) { + ctx->luma_dpb_size = + width64 * height32 + + ALIGN(DIV_ROUND_UP(lcu_width * 32, 4),
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) · line 104
Quoted 10 lines
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +10
-0+ 16) * height32 + 128; +if (ctx->is_422) { + ctx->chroma_dpb_size = + ctx->luma_dpb_size; + }else { + ctx->chroma_dpb_size = + width64 * height32 /2 + +ALIGN (DIV_ROUND_UP (lcu_width * +32 ,4 ),16 ) * height32 /2 +128 ; + }
You don't need the brackets here.
Quoted 8 lines
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +8
-0+ }else if (ctx->codec_mode ==S5P_FIMV_CODEC_VP9_ENC && + ctx->is_10bit) { + ctx->luma_dpb_size = +ALIGN (ctx->img_width *2 ,128 ) * + height32 +64 ; + ctx->chroma_dpb_size = +ALIGN (ctx->img_width *2 ,128 ) * + height32 /2 +64 ;
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) · line 122
Quoted 10 lines
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +10
-0+ }else { + ctx->luma_dpb_size = + width64 * height32 +64 ; +if (ctx->is_422) { + ctx->chroma_dpb_size = + ctx->luma_dpb_size; + }else { + ctx->chroma_dpb_size = + width64 * height32 /2 +64 ; + }
You don't need the brackets here.
[...]
Andi
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 5/15 Documention: v4l: Documentation for VP9 CIDs.
In reply to Smitha T MurthyAdds V4l2 controls for VP9 encoder documention.
--- .../media/v4l/ext-ctrls-codec.rst | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+)
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +167 -0
@@ -2187,6 +2187,16 @@ enum v4l2_mpeg_video_vp8_profile - * - ``V4L2_MPEG_VIDEO_VP8_PROFILE_3`` - Profile 3 +VP9 Control Reference +--------------------- + +The VP9 controls include controls for encoding parameters of VP9 video +codec. + +.. _vp9-control-id: + +VP9 Control IDs + .. _v4l2-mpeg-video-vp9-profile: ``V4L2_CID_MPEG_VIDEO_VP9_PROFILE``
@@ -2253,6 +2263,163 @@ enum v4l2_mpeg_video_vp9_level - * - ``V4L2_MPEG_VIDEO_VP9_LEVEL_6_2`` - Level 6.2 +``V4L2_CID_CODEC_VP9_I_FRAME_QP`` + Quantization parameter for an I frame for VP9. Valid range: from 1 to 255. + +``V4L2_CID_CODEC_VP9_P_FRAME_QP`` + Quantization parameter for an P frame for VP9. Valid range: from 1 to 255. + +``V4L2_CID_CODEC_VP9_MAX_QP`` + Maximum quantization parameter for VP9. Valid range: from 1 to 255. + Recommended range for MFC is from 230 to 255. + +``V4L2_CID_CODEC_VP9_MIN_QP`` + Minimum quantization parameter for VP9. Valid range: from 1 to 255. + Recommended range for MFC is from 1 to 24. + +``V4L2_CID_CODEC_VP9_RC_FRAME_RATE`` + Indicates the number of evenly spaced subintervals, called ticks, within + one second. This is a 16 bit unsigned integer and has a maximum value up to + 0xffff and a minimum value of 1. + +``V4L2_CID_CODEC_VP9_GF_REFRESH_PERIOD`` + Indicates the refresh period of the golden frame for VP9 encoder. + +.. _v4l2-vp9-golden-frame-sel: + +``V4L2_CID_CODEC_VP9_GOLDEN_FRAMESEL`` + (enum) + +enum v4l2_mpeg_vp9_golden_framesel - + Selects the golden frame for encoding. Valid when NUM_OF_REF is 2. + Possible values are: + +.. raw:: latex + + \footnotesize + +.. tabularcolumns:: |p{9.0cm}|p{8.0cm}| + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - ``V4L2_CID_CODEC_VP9_GOLDEN_FRAME_USE_PREV`` + - Use the (n-2)th frame as a golden frame, current frame index being + 'n'. + * - ``V4L2_CID_CODEC_VP9_GOLDEN_FRAME_USE_REF_PERIOD`` + - Use the previous specific frame indicated by + ``V4L2_CID_CODEC_VP9_GF_REFRESH_PERIOD`` as a + golden frame. + +.. raw:: latex + + \normalsize + + +``V4L2_CID_CODEC_VP9_HIERARCHY_QP_ENABLE`` + Allows host to specify the quantization parameter values for each + temporal layer through HIERARCHICAL_QP_LAYER. This is valid only + if HIERARCHICAL_CODING_LAYER is greater than 1. Setting the control + value to 1 enables setting of the QP values for the layers. + +.. _v4l2-vp9-ref-number-of-pframes: + +``V4L2_CID_CODEC_VP9_REF_NUMBER_FOR_PFRAMES`` + (enum) + +enum v4l2_mpeg_vp9_ref_num_for_pframes - + Number of reference pictures for encoding P frames. + +.. raw:: latex + + \footnotesize + +.. tabularcolumns:: |p{9.0cm}|p{8.0cm}| + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - ``V4L2_CID_CODEC_VP9_1_REF_PFRAME`` + - Indicates one reference frame, last encoded frame will be searched. + * - ``V4L2_CID_CODEC_VP9_GOLDEN_FRAME_USE_REF_PERIOD`` + - Indicates 2 reference frames, last encoded frame and golden frame + will be searched. + +.. raw:: latex + + \normalsize + + +``V4L2_CID_CODEC_VP9_HIERARCHICAL_CODING_LAYER`` + Indicates the number of hierarchial coding layer. + In normal encoding (non-hierarchial coding), it should be zero. + VP9 has upto 3 layer of encoder. + +``V4L2_CID_CODEC_VP9_HIERARCHY_RC_ENABLE`` + Indicates enabling of bit rate for hierarchical coding layers VP9 encoder. + +``V4L2_CID_CODEC_VP9_HIER_CODING_L0_BR`` + Indicates bit rate for hierarchical coding layer 0 for VP9 encoder. + +``V4L2_CID_CODEC_VP9_HIER_CODING_L1_BR`` + Indicates bit rate for hierarchical coding layer 1 for VP9 encoder. + +``V4L2_CID_CODEC_VP9_HIER_CODING_L2_BR`` + Indicates bit rate for hierarchical coding layer 2 for VP9 encoder. + +``V4L2_CID_CODEC_VP9_HIER_CODING_L0_QP`` + Indicates quantization parameter for hierarchical coding layer 0. + Valid range: [V4L2_CID_CODEC_VP9_MIN_QP, + V4L2_CID_CODEC_VP9_MAX_QP]. + +``V4L2_CID_CODEC_VP9_HIER_CODING_L1_QP`` + Indicates quantization parameter for hierarchical coding layer 1. + Valid range: [V4L2_CID_CODEC_VP9_MIN_QP, + V4L2_CID_CODEC_VP9_MAX_QP]. + +``V4L2_CID_CODEC_VP9_HIER_CODING_L2_QP`` + Indicates quantization parameter for hierarchical coding layer 2. + Valid range: [V4L2_CID_CODEC_VP9_MIN_QP, + V4L2_CID_CODEC_VP9_MAX_QP]. + +.. _v4l2-vp9-max-partition-depth: + +``V4L2_CID_CODEC_VP9_MAX_PARTITION_DEPTH`` + (enum) + +enum v4l2_mpeg_vp9_num_partitions - + Indicate maximum coding unit depth. + +.. raw:: latex + + \footnotesize + +.. tabularcolumns:: |p{9.0cm}|p{8.0cm}| + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - ``V4L2_CID_CODEC_VP9_0_PARTITION`` + - No coding unit partition depth. + * - ``V4L2_CID_CODEC_VP9_1_PARTITION`` + - Allows one coding unit partition depth. + +.. raw:: latex + + \normalsize + + +``V4L2_CID_CODEC_VP9_DISABLE_INTRA_PU_SPLIT`` + Zero indicates enable intra NxN PU split. + One indicates disable intra NxN PU split. + +``V4L2_CID_CODEC_VP9_DISABLE_IVF_HEADER`` + Indicates IVF header generation. Zero indicates enable IVF format. + One indicates disable IVF format. + High Efficiency Video Coding (HEVC/H.265) Control Reference ===========================================================
Signature · 1 line
2.17.1
PATCH v2 6/15 media: v4l2: Add v4l2 control IDs for VP9 encoder.
In reply to Smitha T MurthyAdd V4l2 controls for VP9 encoder
--- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 44 +++++++++++++++++++++++ include/uapi/linux/v4l2-controls.h | 33 +++++++++++++++++ 2 files changed, 77 insertions(+)
drivers/media/v4l2-core/v4l2-ctrls-defs.c +44 -0
@@ -577,6 +577,21 @@ const char * const *v4l2_ctrl_get_menu(u32 id)"Cyclic" , NULL, }; +static const char *const vp9_golden_framesel[] = { +"Use previous" , +"Use refresh period" , +NULL , + }; +static const char *const vp9_ref_num_for_pframes[] = { +"1" , +"2" , +NULL , + }; +static const char *const vp9_max_partition_depth[] = { +"No CU partition depth" , +"Allow 1 CU partition depth" , +NULL , + };switch (id) {case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ :
@@ -708,6 +723,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id)return hevc_decode_mode;case V4L2_CID_STATELESS_HEVC_START_CODE :return hevc_start_code; +case V4L2_CID_CODEC_VP9_GOLDEN_FRAMESEL : +return vp9_golden_framesel; +case V4L2_CID_CODEC_VP9_REF_NUMBER_FOR_PFRAMES : +return vp9_ref_num_for_pframes; +case V4L2_CID_CODEC_VP9_MAX_PARTITION_DEPTH : +return vp9_max_partition_depth;case V4L2_CID_CAMERA_ORIENTATION :return camera_orientation;case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE :
@@ -950,6 +971,26 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_MPEG_VIDEO_VP8_PROFILE :return "VP8 Profile" ;case V4L2_CID_MPEG_VIDEO_VP9_PROFILE :return "VP9 Profile" ;case V4L2_CID_MPEG_VIDEO_VP9_LEVEL :return "VP9 Level" ; +case V4L2_CID_CODEC_VP9_I_FRAME_QP :return "VP9 I Frame QP Value" ; +case V4L2_CID_CODEC_VP9_P_FRAME_QP :return "VP9 P Frame QP Value" ; +case V4L2_CID_CODEC_VP9_MAX_QP :return "VP9 Frame QP MAX Value" ; +case V4L2_CID_CODEC_VP9_MIN_QP :return "VP9 Frame QP MIN Value" ; +case V4L2_CID_CODEC_VP9_RC_FRAME_RATE :return "VP9 Frame Rate" ; +case V4L2_CID_CODEC_VP9_GOLDEN_FRAMESEL :return "VP9 Indication of Golden Frame" ; +case V4L2_CID_CODEC_VP9_GF_REFRESH_PERIOD :return "VP9 Golden Frame Refresh Period" ; +case V4L2_CID_CODEC_VP9_HIERARCHY_QP_ENABLE :return "VP9 Hierarchical QP Enable" ; +case V4L2_CID_CODEC_VP9_REF_NUMBER_FOR_PFRAMES :return "VP9 Number of Reference Pictures" ; +case V4L2_CID_CODEC_VP9_HIERARCHICAL_CODING_LAYER :return "VP9 Num of Hierarchical Layers" ; +case V4L2_CID_CODEC_VP9_MAX_PARTITION_DEPTH :return "VP9 Maximum Coding Unit Depth" ; +case V4L2_CID_CODEC_VP9_DISABLE_INTRA_PU_SPLIT :return "VP9 Disable Intra PU Split" ; +case V4L2_CID_CODEC_VP9_HIERARCHY_RC_ENABLE :return "VP9 Hierarchical BitRate Enable" ; +case V4L2_CID_CODEC_VP9_HIER_CODING_L0_BR :return "VP9 Hierarchical Layer 0 BitRate" ; +case V4L2_CID_CODEC_VP9_HIER_CODING_L1_BR :return "VP9 Hierarchical Layer 1 BitRate" ; +case V4L2_CID_CODEC_VP9_HIER_CODING_L2_BR :return "VP9 Hierarchical Layer 2 BitRate" ; +case V4L2_CID_CODEC_VP9_HIER_CODING_L0_QP :return "VP9 Layer0 QP Value" ; +case V4L2_CID_CODEC_VP9_HIER_CODING_L1_QP :return "VP9 Layer1 QP Value" ; +case V4L2_CID_CODEC_VP9_HIER_CODING_L2_QP :return "VP9 Layer2 QP Value" ; +case V4L2_CID_CODEC_VP9_DISABLE_IVF_HEADER :return "VP9 IVF header generation" ;/* HEVC controls */ case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP :return "HEVC I-Frame QP Value" ;
@@ -1366,6 +1407,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE :case V4L2_CID_STATELESS_HEVC_DECODE_MODE :case V4L2_CID_STATELESS_HEVC_START_CODE : +case V4L2_CID_CODEC_VP9_GOLDEN_FRAMESEL : +case V4L2_CID_CODEC_VP9_REF_NUMBER_FOR_PFRAMES : +case V4L2_CID_CODEC_VP9_MAX_PARTITION_DEPTH :case V4L2_CID_STATELESS_H264_DECODE_MODE :case V4L2_CID_STATELESS_H264_START_CODE :case V4L2_CID_CAMERA_ORIENTATION :
include/uapi/linux/v4l2-controls.h +33 -0
@@ -716,6 +716,38 @@ enum v4l2_mpeg_video_vp9_level {V4L2_MPEG_VIDEO_VP9_LEVEL_6_1 =12 , V4L2_MPEG_VIDEO_VP9_LEVEL_6_2 = 13, }; +#define V4L2_CID_CODEC_VP9_RC_FRAME_RATE (V4L2_CID_CODEC_BASE+514) +#define V4L2_CID_CODEC_VP9_MIN_QP (V4L2_CID_CODEC_BASE+515) +#define V4L2_CID_CODEC_VP9_MAX_QP (V4L2_CID_CODEC_BASE+516) +#define V4L2_CID_CODEC_VP9_I_FRAME_QP (V4L2_CID_CODEC_BASE+517) +#define V4L2_CID_CODEC_VP9_P_FRAME_QP (V4L2_CID_CODEC_BASE+518) +#define V4L2_CID_CODEC_VP9_GOLDEN_FRAMESEL (V4L2_CID_CODEC_BASE+519) +enum v4l2_mpeg_vp9_golden_framesel { +V4L2_CID_CODEC_VP9_GOLDEN_FRAME_USE_PREV =0 , +V4L2_CID_CODEC_VP9_GOLDEN_FRAME_USE_REF_PERIOD =1 , +}; +#define V4L2_CID_CODEC_VP9_GF_REFRESH_PERIOD (V4L2_CID_CODEC_BASE+520) +#define V4L2_CID_CODEC_VP9_HIERARCHY_QP_ENABLE (V4L2_CID_CODEC_BASE+521) +#define V4L2_CID_CODEC_VP9_REF_NUMBER_FOR_PFRAMES (V4L2_CID_CODEC_BASE+522) +enum v4l2_mpeg_vp9_ref_num_for_pframes { +V4L2_CID_CODEC_VP9_1_REF_PFRAME =0 , +V4L2_CID_CODEC_VP9_2_REF_PFRAME =1 , +}; +#define V4L2_CID_CODEC_VP9_HIERARCHICAL_CODING_LAYER (V4L2_CID_CODEC_BASE+523) +#define V4L2_CID_CODEC_VP9_HIER_CODING_L0_BR (V4L2_CID_CODEC_BASE+524) +#define V4L2_CID_CODEC_VP9_HIER_CODING_L1_BR (V4L2_CID_CODEC_BASE+525) +#define V4L2_CID_CODEC_VP9_HIER_CODING_L2_BR (V4L2_CID_CODEC_BASE+526) +#define V4L2_CID_CODEC_VP9_HIER_CODING_L0_QP (V4L2_CID_CODEC_BASE+527) +#define V4L2_CID_CODEC_VP9_HIER_CODING_L1_QP (V4L2_CID_CODEC_BASE+528) +#define V4L2_CID_CODEC_VP9_HIER_CODING_L2_QP (V4L2_CID_CODEC_BASE+529) +#define V4L2_CID_CODEC_VP9_MAX_PARTITION_DEPTH (V4L2_CID_CODEC_BASE+530) +enum v4l2_mpeg_vp9_num_partitions { +V4L2_CID_CODEC_VP9_0_PARTITION =0 , +V4L2_CID_CODEC_VP9_1_PARTITION =1 , +}; +#define V4L2_CID_CODEC_VP9_DISABLE_INTRA_PU_SPLIT (V4L2_CID_CODEC_BASE+531) +#define V4L2_CID_CODEC_VP9_DISABLE_IVF_HEADER (V4L2_CID_CODEC_BASE+532) +#define V4L2_CID_CODEC_VP9_HIERARCHY_RC_ENABLE (V4L2_CID_CODEC_BASE+533)/* CIDs for HEVC encoding. */
@@ -826,6 +858,7 @@ enum v4l2_mpeg_video_frame_skip_mode {#define V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY (V4L2_CID_CODEC_BASE + 653)#define V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE (V4L2_CID_CODEC_BASE + 654) +/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_CODEC_CX2341X_BASE (V4L2_CTRL_CLASS_CODEC | 0x1000)#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_CODEC_CX2341X_BASE+0)
Signature · 1 line
2.17.1
PATCH v2 7/15 media: s5p-mfc: Add support for VP9 encoder.
In reply to Smitha T MurthyAdd VP9 encoder support and necessary registers, V4L2 CIDs, vp9 encoder parameters.
--- .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 8 + .../platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c | 3 + .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 27 +- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 272 ++++++++++++++++++ .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 2 + .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 121 ++++++++ 6 files changed, 432 insertions(+), 1 deletion(-)
drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h +8 -0
@@ -12,6 +12,10 @@#include <linux/sizes.h> #include "regs-mfc-v10.h" +/* MFCv12 register definitions*/ +#define S5P_FIMV_E_VP9_OPTION_V12 0xFD90 +#define S5P_FIMV_E_VP9_GOLDEN_FRAME_OPTION_V12 0xFD98 +/* MFCv12 Context buffer sizes */ #define MFC_CTX_BUF_SIZE_V12 (30 * SZ_1K)#define MFC_H264_DEC_CTX_BUF_SIZE_V12 (2 * SZ_1M)
@@ -47,4 +51,8 @@ALIGN ((((x +3 ) * (y +3 ) *32 ) \ + (((y * 128) + 2304) * (x + 3) / 4)), 256) +#define ENC_V120_VP9_ME_SIZE (x, y) \ + ((((x * 2) + 3) * ((y * 2) + 3) * 128) \ + + (((y * 256) + 2304) * (x + 1) / 2)) +#endif /*_REGS_MFC_V12_H*/
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c +3 -0
@@ -121,6 +121,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)case S5P_MFC_CODEC_HEVC_ENC : codec_type =S5P_FIMV_CODEC_HEVC_ENC ;break ; +case S5P_MFC_CODEC_VP9_ENC : + codec_type =S5P_FIMV_CODEC_VP9_ENC ; +break ;default : codec_type =S5P_FIMV_CODEC_NONE_V6 ; }
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +26 -1
@@ -57,7 +57,7 @@#define MFC_ENC_CAP_PLANE_COUNT 1#define MFC_ENC_OUT_PLANE_COUNT 2#define STUFF_BYTE 4 -#define MFC_MAX_CTRLS 128 +#define MFC_MAX_CTRLS 147#define S5P_MFC_CODEC_NONE -1#define S5P_MFC_CODEC_H264_DEC 0
@@ -77,6 +77,7 @@#define S5P_MFC_CODEC_H263_ENC 23#define S5P_MFC_CODEC_VP8_ENC 24#define S5P_MFC_CODEC_HEVC_ENC 26 +#define S5P_MFC_CODEC_VP9_ENC 27#define S5P_MFC_R2H_CMD_EMPTY 0#define S5P_MFC_R2H_CMD_SYS_INIT_RET 1
@@ -483,6 +484,29 @@ struct s5p_mfc_hevc_enc_params {u8 prepend_sps_pps_to_idr; }; +/** +* struct s5p_mfc_vp9_enc_params - encoding parameters for vp9 +*/ +struct s5p_mfc_vp9_enc_params { +u32 rc_framerate; +u8 vp9_profile; +u8 rc_min_qp; +u8 rc_max_qp; +u8 rc_frame_qp; +u8 rc_p_frame_qp; +u8 vp9_goldenframesel; +u8 vp9_gfrefreshperiod; +u8 hier_qp_enable; +u8 hier_qp_layer[3 ]; +u8 hier_rc_enable; +u32 hier_bit_layer[3 ]; +u8 num_refs_for_p; +u8 num_hier_layer; +u8 max_partition_depth; +u8 intra_pu_split_disable; +u8 ivf_header; +}; +/* * struct s5p_mfc_enc_params - general encoding parameters */
@@ -521,6 +545,7 @@ struct s5p_mfc_enc_params {struct s5p_mfc_mpeg4_enc_params mpeg4;struct s5p_mfc_vp8_enc_params vp8;struct s5p_mfc_hevc_enc_params hevc; +struct s5p_mfc_vp9_enc_params vp9; } codec; };
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +272 -0
296 lines not on this page · raw message
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h +2 -0
@@ -277,6 +277,8 @@ struct s5p_mfc_regs {void __iomem *e_hevc_lf_beta_offset_div2;/* v10 */ void __iomem *e_hevc_lf_tc_offset_div2;/* v10 */ void __iomem *e_hevc_nal_control;/* v10 */ +void __iomem *e_vp9_options;/* v12 */ +void __iomem *e_vp9_golden_frame_option;/* v12 */ };struct s5p_mfc_hw_ops {
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +121 -0
151 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 8/15 media: s5p-mfc: Add YV12 and I420 multiplanar format support
In reply to Smitha T MurthyYV12 and I420 format (3-plane) support is added. Stride information is added to all formats and planes since it is necessary for YV12/I420 which are different from width.
--- .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 2 + .../platform/samsung/s5p-mfc/regs-mfc-v7.h | 1 + .../platform/samsung/s5p-mfc/regs-mfc-v8.h | 3 + .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 4 + .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 45 ++++- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 86 +++++++-- .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 6 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c | 12 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 168 +++++++++++++++--- 9 files changed, 281 insertions(+), 46 deletions(-)
drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h +2 -0
@@ -30,6 +30,8 @@#define MFC_VERSION_V12 0xC0#define MFC_NUM_PORTS_V12 1#define S5P_FIMV_CODEC_VP9_ENC 27 +#define MFC_CHROMA_PAD_BYTES_V12 256 +#define S5P_FIMV_D_ALIGN_PLANE_SIZE_V12 256/* Encoder buffer size for MFCv12 */ #define ENC_V120_BASE_SIZE (x, y) \
drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h +1 -0
@@ -24,6 +24,7 @@#define S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7 0xfa70#define S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7 0xfa74 +#define S5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7 0xfa78#define S5P_FIMV_E_VP8_OPTIONS_V7 0xfdb0#define S5P_FIMV_E_VP8_FILTER_OPTIONS_V7 0xfdb4
drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h +3 -0
@@ -17,13 +17,16 @@#define S5P_FIMV_D_MIN_SCRATCH_BUFFER_SIZE_V8 0xf108#define S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8 0xf144#define S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8 0xf148 +#define S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8 0xf14C#define S5P_FIMV_D_MV_BUFFER_SIZE_V8 0xf150#define S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8 0xf138#define S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8 0xf13c +#define S5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8 0xf140#define S5P_FIMV_D_FIRST_PLANE_DPB_V8 0xf160#define S5P_FIMV_D_SECOND_PLANE_DPB_V8 0xf260 +#define S5P_FIMV_D_THIRD_PLANE_DPB_V8 0xf360#define S5P_FIMV_D_MV_BUFFER_V8 0xf460#define S5P_FIMV_D_NUM_MV_V8 0xf134
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +4 -0
@@ -56,6 +56,7 @@#define MFC_NO_INSTANCE_SET -1#define MFC_ENC_CAP_PLANE_COUNT 1#define MFC_ENC_OUT_PLANE_COUNT 2 +#define VB2_MAX_PLANE_COUNT 3#define STUFF_BYTE 4#define MFC_MAX_CTRLS 147
@@ -182,6 +183,7 @@ struct s5p_mfc_buf {struct {size_t luma;size_t chroma; +size_t chroma_1; } raw;size_t stream; } cookie;
@@ -682,6 +684,7 @@ struct s5p_mfc_ctx {int luma_size;int chroma_size; +int chroma_size_1;int mv_size;unsigned long consumed_stream;
@@ -747,6 +750,7 @@ struct s5p_mfc_ctx {size_t scratch_buf_size;int is_10bit;int is_422; +int stride[VB2_MAX_PLANE_COUNT ]; };/*
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +42 -3
88 lines not on this page · raw message
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +73 -13
164 lines not on this page · raw message
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h +4 -2
@@ -295,9 +295,11 @@ struct s5p_mfc_hw_ops {int (*set_enc_stream_buffer)(struct s5p_mfc_ctx *ctx,unsigned long addr,unsigned int size);void (*set_enc_frame_buffer)(struct s5p_mfc_ctx *ctx, -unsigned long y_addr,unsigned long c_addr); +unsigned long y_addr,unsigned long c_addr, +unsigned long c_1_addr);void (*get_enc_frame_buffer)(struct s5p_mfc_ctx *ctx, -unsigned long *y_addr,unsigned long *c_addr); +unsigned long *y_addr,unsigned long *c_addr, +unsigned long *c_1_addr);void (*try_run)(struct s5p_mfc_dev *dev);void (*clear_int_flags)(struct s5p_mfc_dev *dev);int (*get_dspl_y_adr)(struct s5p_mfc_dev *dev);
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c +7 -5
@@ -516,7 +516,8 @@ static int s5p_mfc_set_enc_stream_buffer_v5(struct s5p_mfc_ctx *ctx, }static void s5p_mfc_set_enc_frame_buffer_v5 (struct s5p_mfc_ctx *ctx, -unsigned long y_addr,unsigned long c_addr) +unsigned long y_addr,unsigned long c_addr, +unsigned long c_1_addr) {struct s5p_mfc_dev *dev = ctx->dev;
@@ -525,7 +526,8 @@ static void s5p_mfc_set_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx, }static void s5p_mfc_get_enc_frame_buffer_v5 (struct s5p_mfc_ctx *ctx, -unsigned long *y_addr,unsigned long *c_addr) +unsigned long *y_addr,unsigned long *c_addr, +unsigned long *c_1_addr) {struct s5p_mfc_dev *dev = ctx->dev;
@@ -1210,7 +1212,7 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)if (list_empty (&ctx->src_queue)) {/* send null frame */ s5p_mfc_set_enc_frame_buffer_v5 (ctx, dev->dma_base[BANK_R_CTX ], - dev->dma_base[BANK_R_CTX ]); + dev->dma_base[BANK_R_CTX ],0 ); src_mb =NULL ; }else { src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf,
@@ -1220,7 +1222,7 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)/* send null frame */ s5p_mfc_set_enc_frame_buffer_v5 (ctx, dev->dma_base[BANK_R_CTX ], - dev->dma_base[BANK_R_CTX ]); + dev->dma_base[BANK_R_CTX ],0 ); ctx->state =MFCINST_FINISHING ; }else { src_y_addr = vb2_dma_contig_plane_dma_addr(
@@ -1228,7 +1230,7 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) src_c_addr =vb2_dma_contig_plane_dma_addr ( &src_mb->b->vb2_buf,1 );s5p_mfc_set_enc_frame_buffer_v5 (ctx, src_y_addr, - src_c_addr); + src_c_addr,0 );if (src_mb->flags &MFC_BUF_FLAG_EOS ) ctx->state =MFCINST_FINISHING ; }
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +145 -23
302 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 9/15 media: s5p-mfc: Add support for rate controls in MFCv12
In reply to Smitha T MurthyIn MFCv12, the rc configs are changed with support for CBR loose, CBR tight and Variable Bitrate (VBR) added.
--- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 22 +++++++++++++++---- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h | 1 + 2 files changed, 19 insertions(+), 4 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +18 -4
@@ -1039,10 +1039,24 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)/* reaction coefficient */ if (p->rc_frame) { -if (p->rc_reaction_coeff <TIGHT_CBR_MAX )/* tight CBR */ -writel (1 , mfc_regs->e_rc_mode); -else /* loose CBR */ -writel (2 , mfc_regs->e_rc_mode); +if (IS_MFCV12 (dev)) { +/* loose CBR */ +if (p->rc_reaction_coeff <LOOSE_CBR_MAX ) +writel (1 , mfc_regs->e_rc_mode); +/* tight CBR */ +else if (p->rc_reaction_coeff <TIGHT_CBR_MAX ) +writel (0 , mfc_regs->e_rc_mode); +/* VBR */ +else +writel (2 , mfc_regs->e_rc_mode); + }else { +/* tight CBR */ +if (p->rc_reaction_coeff <TIGHT_CBR_MAX ) +writel (1 , mfc_regs->e_rc_mode); +/* loose CBR */ +else +writel (2 , mfc_regs->e_rc_mode); + } }/* seq header ctrl */
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h +1 -0
@@ -40,6 +40,7 @@#define ENC_H264_LEVEL_MAX 42#define ENC_MPEG4_VOP_TIME_RES_MAX ((1 << 16) - 1)#define FRAME_DELTA_H264_H263 1 +#define LOOSE_CBR_MAX 5#define TIGHT_CBR_MAX 10#define ENC_HEVC_RC_FRAME_RATE_MAX ((1 << 16) - 1)#define ENC_HEVC_QP_INDEX_MIN -12
Signature · 1 line
2.17.1
PATCH v2 10/15 media: s5p-mfc: Add support for UHD encoding.
In reply to Smitha T MurthyMFC driver had restriction on max resolution of 1080p, updated it for UHD. Added corresponding support to set recommended profile and level for H264 in UHD scenario.
--- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 9 ++++++--- .../media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +6 -3
@@ -1627,9 +1627,12 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)mfc_err ("Unsupported format by this MFC version.\n" );return -EINVAL ; } - -v4l_bound_align_image (&pix_fmt_mp->width,8 ,1920 ,1 , - &pix_fmt_mp->height,4 ,1080 ,1 ,0 ); +if (IS_MFCV12 (dev)) +v4l_bound_align_image (&pix_fmt_mp->width,8 ,3840 ,1 , + &pix_fmt_mp->height,4 ,2160 ,1 ,0 ); +else +v4l_bound_align_image (&pix_fmt_mp->width,8 ,1920 ,1 , + &pix_fmt_mp->height,4 ,1080 ,1 ,0 ); }else {mfc_err ("invalid buf type\n" );return -EINVAL ;
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +12 -0
@@ -1118,6 +1118,18 @@ static int s5p_mfc_set_enc_params_h264(struct s5p_mfc_ctx *ctx) reg |= ((p->num_b_frame &0x3 ) <<16 );writel (reg, mfc_regs->e_gop_config); +/* UHD encoding case */ +if ((ctx->img_width ==3840 ) && ctx->img_height ==2160 ) { +if (p_h264->level <51 ) { +mfc_debug (2 ,"Set Level 5.1 for UHD\n" ); + p_h264->level =51 ; + } +if (p_h264->profile !=0x2 ) { +mfc_debug (2 ,"Set High profile for UHD\n" ); + p_h264->profile =0x2 ; + } + } +/* profile & level */ reg =0 ;/** level */
Signature · 1 line
2.17.1
PATCH v2 11/15 media: s5p-mfc: Add support for DMABUF for encoder
In reply to Smitha T MurthyAdd dmabuf support for mfc encoder
--- .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 4 ++-- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 21 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +2 -2
@@ -850,7 +850,7 @@ static int s5p_mfc_open(struct file *file) q->io_modes =VB2_MMAP ; q->ops =get_dec_queue_ops (); }else if (vdev == dev->vfd_enc) { - q->io_modes =VB2_MMAP |VB2_USERPTR ; + q->io_modes =VB2_MMAP |VB2_USERPTR |VB2_DMABUF ; q->ops =get_enc_queue_ops (); }else { ret = -ENOENT ;
@@ -877,7 +877,7 @@ static int s5p_mfc_open(struct file *file) q->io_modes =VB2_MMAP ; q->ops =get_dec_queue_ops (); }else if (vdev == dev->vfd_enc) { - q->io_modes =VB2_MMAP |VB2_USERPTR ; + q->io_modes =VB2_MMAP |VB2_USERPTR |VB2_DMABUF ; q->ops =get_enc_queue_ops (); }else { ret = -ENOENT ;
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +12 -9
@@ -1704,9 +1704,10 @@ static int vidioc_reqbufs(struct file *file, void *priv,struct s5p_mfc_ctx *ctx =fh_to_ctx (priv);int ret =0 ; -/* if memory is not mmp or userptr return error */ +/* if memory is not mmp or userptr or dmabuf return error */ if ((reqbufs->memory !=V4L2_MEMORY_MMAP ) && - (reqbufs->memory !=V4L2_MEMORY_USERPTR )) + (reqbufs->memory !=V4L2_MEMORY_USERPTR ) && + (reqbufs->memory !=V4L2_MEMORY_DMABUF ))return -EINVAL ;if (reqbufs->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) {if (reqbufs->count ==0 ) {
@@ -1783,9 +1784,10 @@ static int vidioc_querybuf(struct file *file, void *priv,struct s5p_mfc_ctx *ctx =fh_to_ctx (priv);int ret =0 ; -/* if memory is not mmp or userptr return error */ +/* if memory is not mmp or userptr or dmabuf return error */ if ((buf->memory !=V4L2_MEMORY_MMAP ) && - (buf->memory !=V4L2_MEMORY_USERPTR )) + (buf->memory !=V4L2_MEMORY_USERPTR ) && + (buf->memory !=V4L2_MEMORY_DMABUF ))return -EINVAL ;if (buf->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) {if (ctx->state !=MFCINST_GOT_INST ) {
@@ -2841,11 +2843,12 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)S5P_MFC_R2H_CMD_SEQ_DONE_RET , 0); } - -if (ctx->src_bufs_cnt < ctx->pb_count) { -mfc_err ("Need minimum %d OUTPUT buffers\n" , - ctx->pb_count); -return -ENOBUFS ; +if (q->memory !=V4L2_MEMORY_DMABUF ) { +if (ctx->src_bufs_cnt < ctx->pb_count) { +mfc_err ("Need minimum %d OUTPUT buffers\n" , + ctx->pb_count); +return -ENOBUFS ; + } } }
Signature · 1 line
2.17.1
PATCH v2 13/15 media: s5p-mfc: Load firmware for each run in MFCv12.
In reply to Smitha T MurthyIn MFCv12, some section of firmware gets updated at each MFC run. Hence we need to reload original firmware for each run at the start.
--- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c +3 -2
@@ -51,8 +51,9 @@ int s5p_mfc_load_firmware(struct s5p_mfc_dev *dev)* into kernel. */ mfc_debug_enter (); -if (dev->fw_get_done) -return 0 ; +if (!IS_MFCV12 (dev)) +if (dev->fw_get_done) +return 0 ;for (i =MFC_FW_MAX_VERSIONS -1 ; i >=0 ; i--) {if (!dev->variant->fw_name[i])
Signature · 1 line
2.17.1
PATCH v2 14/15 media: s5p-mfc: DPB Count Independent of VIDIOC_REQBUF
In reply to Smitha T MurthyThis patch allows allocation of DPB buffers based on MFC requirement so codec buffers allocations has been moved after state MFCINST_HEAD_PRODUCED. It is taken care that codec buffer allocation is performed in process context from userspace IOCTL call.
--- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 17 ++--------------- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 9 ++++++++- 2 files changed, 10 insertions(+), 16 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +2 -15
@@ -1339,7 +1339,6 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)struct s5p_mfc_dev *dev = ctx->dev;struct s5p_mfc_enc_params *p = &ctx->enc_params;struct s5p_mfc_buf *dst_mb; -unsigned int enc_pb_count;if (p->seq_hdr_mode ==V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE ) {if (!list_empty (&ctx->dst_queue)) {
@@ -1361,10 +1360,8 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)set_work_bit_irqsave (ctx);s5p_mfc_hw_call (dev->mfc_ops, try_run, dev); }else { - enc_pb_count =s5p_mfc_hw_call (dev->mfc_ops, + ctx->pb_count =s5p_mfc_hw_call (dev->mfc_ops, get_enc_dpb_count, dev); -if (ctx->pb_count < enc_pb_count) - ctx->pb_count = enc_pb_count;if (FW_HAS_E_MIN_SCRATCH_BUF (dev)) { ctx->scratch_buf_size =s5p_mfc_hw_call (dev->mfc_ops, get_e_min_scratch_buf_size, dev);
@@ -1730,14 +1727,6 @@ static int vidioc_reqbufs(struct file *file, void *priv, } ctx->capture_state =QUEUE_BUFS_REQUESTED ; - ret =s5p_mfc_hw_call (ctx->dev->mfc_ops, - alloc_codec_buffers, ctx); -if (ret) { -mfc_err ("Failed to allocate encoding buffers\n" ); - reqbufs->count =0 ; - ret =vb2_reqbufs (&ctx->vq_dst, reqbufs); -return -ENOMEM ; - } }else if (reqbufs->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ) {if (reqbufs->count ==0 ) {mfc_debug (2 ,"Freeing buffers\n" );
@@ -1753,15 +1742,13 @@ static int vidioc_reqbufs(struct file *file, void *priv,return -EINVAL ; } -if (IS_MFCV6_PLUS (dev)) { +if (IS_MFCV6_PLUS (dev) && (!IS_MFCV12 (dev))) {/* Check for min encoder buffers */ if (ctx->pb_count && (reqbufs->count < ctx->pb_count)) { reqbufs->count = ctx->pb_count;mfc_debug (2 ,"Minimum %d output buffers needed\n" , ctx->pb_count); - }else { - ctx->pb_count = reqbufs->count; } }
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +8 -1
@@ -379,7 +379,6 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)default :break ; } -/* Allocate only if memory from bank 1 is necessary */ if (ctx->bank1.size >0 ) { ret =s5p_mfc_alloc_generic_buf (dev,BANK_L_CTX , &ctx->bank1);
@@ -2257,6 +2256,14 @@ static inline int s5p_mfc_run_init_enc_buffers(struct s5p_mfc_ctx *ctx)struct s5p_mfc_dev *dev = ctx->dev;int ret; + ret =s5p_mfc_hw_call (ctx->dev->mfc_ops, + alloc_codec_buffers, ctx); +if (ret) { +mfc_err ("Failed to allocate encoding buffers\n" ); +return -ENOMEM ; + } +mfc_debug (2 ,"Allocated Internal Encoding Buffers\n" ); + dev->curr_ctx = ctx->num; ret =s5p_mfc_set_enc_ref_buffer_v6 (ctx);if (ret) {
Signature · 1 line
2.17.1
PATCH v2 15/15 arm64: dts: fsd: Add MFC related DT enteries
In reply to Smitha T MurthyAdd MFC DT node and reserve memory node for MFC usage.
--- arch/arm64/boot/dts/tesla/fsd-evb.dts | 4 ++++ arch/arm64/boot/dts/tesla/fsd.dtsi | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+)
arch/arm64/boot/dts/tesla/fsd-evb.dts +4 -0
@@ -30,6 +30,10 @@ }; }; +&clock_mfc { + status = "okay"; +}; + &fin_pll { clock-frequency = <24000000>; };
arch/arm64/boot/dts/tesla/fsd.dtsi +22 -0
@@ -340,6 +340,18 @@ #clock-cells = <0>; }; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + mfc_left: region@84000000 { + compatible = "shared-dma-pool"; + no-map; + reg = <0 0x84000000 0 0x8000000>; + }; + }; + soc: soc@0 { compatible = "simple-bus"; #address-cells = <2>;
@@ -832,6 +844,16 @@ clock-names = "fin_pll", "mct"; }; + mfc: mfc@12880000 { + compatible = "samsung,fsd-mfc"; + reg = <0x0 0x12880000 0x0 0x10000>; + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "mfc"; + clocks = <&clock_mfc MFC_MFC_IPCLKPORT_ACLK>; + memory-region = <&mfc_left>; + status = "okay"; + }; + ufs: ufs@15120000 { compatible = "tesla,fsd-ufs"; reg = <0x0 0x15120000 0x0 0x200>, /* 0: HCI standard */
Signature · 1 line
2.17.1
Re: [Patch v2 15/15] arm64: dts: fsd: Add MFC related DT enteries
Quoted 14 lines · Smitha T Murthy
Add MFC DT node and reserve memory node for MFC usage.
Signed-off-by Smitha T Murthy <[email protected]>--- arch/arm64/boot/dts/tesla/fsd-evb.dts | 4 ++++ arch/arm64/boot/dts/tesla/fsd.dtsi | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+)arch/arm64/boot/dts/tesla/fsd-evb.dts +0
-0
arch/arm64/boot/dts/tesla/fsd-evb.dts line 34
Quoted 5 lines
arch/arm64/boot/dts/tesla/fsd-evb.dts +2
-0@@ -30,6 +30,10 @@ }; }; +&clock_mfc { + status = "okay";
clock node was never disabled, so there is no need to enable it.
Quoted 30 lines
arch/arm64/boot/dts/tesla/fsd-evb.dts +2
-0+}; + &fin_pll { clock-frequency = <24000000>; };arch/arm64/boot/dts/tesla/fsd.dtsi +12
-0@@ -340,6 +340,18 @@ #clock-cells = <0>; }; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + mfc_left: region@84000000 { + compatible = "shared-dma-pool"; + no-map; + reg = <0 0x84000000 0 0x8000000>; + }; + }; + soc: soc@0 { compatible = "simple-bus"; #address-cells = <2>;@@ -832,6 +844,16 @@ clock-names = "fin_pll", "mct";
arch/arm64/boot/dts/tesla/fsd.dtsi line 854
Quoted 10 lines
arch/arm64/boot/dts/tesla/fsd.dtsi +8
-0}; + mfc: mfc@12880000 { + compatible = "samsung,fsd-mfc"; + reg = <0x0 0x12880000 0x0 0x10000>; + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "mfc"; + clocks = <&clock_mfc MFC_MFC_IPCLKPORT_ACLK>; + memory-region = <&mfc_left>; + status = "okay";
Okay is by default, don't add it.
arch/arm64/boot/dts/tesla/fsd.dtsi line 859
Quoted 5 lines
arch/arm64/boot/dts/tesla/fsd.dtsi +2
-0+ }; + ufs: ufs@15120000 { compatible = "tesla,fsd-ufs"; reg = <0x0 0x15120000 0x0 0x200>, /* 0: HCI standard */
Best regards,
Krzysztof
RE: [Patch v2 15/15] arm64: dts: fsd: Add MFC related DT enteries
Quoted 38 lines
-----Original Message-----
From: Krzysztof Kozlowski [mailto:[email protected]]
Sent: Wednesday, September 7, 2022 4:56 PM
To: Smitha T Murthy <[email protected]>; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Patch v2 15/15] arm64: dts: fsd: Add MFC related DT enteriesReview
Quoted 10 lines · Smitha T Murthy
Add MFC DT node and reserve memory node for MFC usage.
Signed-off-by Smitha T Murthy <[email protected]>--- arch/arm64/boot/dts/tesla/fsd-evb.dts | 4 ++++ arch/arm64/boot/dts/tesla/fsd.dtsi | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+)(quoted diff) +0
-0
b/arch/arm64/boot/dts/tesla/fsd-evb.dtsQuoted 7 lines
index
1db6ddf03f01..17bb048f9d47100644arch/arm64/boot/dts/tesla/fsd-evb.dts +0
-0@@ -30,6 +30,10 @@ }; };
Quoted 5 lines
arch/arm64/boot/dts/tesla/fsd-evb.dts line 34
Quoted 2 lines
arch/arm64/boot/dts/tesla/fsd-evb.dts +2
-0+&clock_mfc { + status = "okay";clock node was never disabled, so there is no need to enable it.
Ok I will remove it in the next series.
Quoted 33 lines
Review
Quoted 6 lines
arch/arm64/boot/dts/tesla/fsd-evb.dts +2
-0+}; + &fin_pll { clock-frequency = <24000000>; };(quoted diff) +0
-0
b/arch/arm64/boot/dts/tesla/fsd.dtsiQuoted 26 lines
index
f35bc5a288c2..bca0ba030ee7100644arch/arm64/boot/dts/tesla/fsd.dtsi +12
-0@@ -340,6 +340,18 @@ #clock-cells = <0>; }; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + mfc_left: region@84000000 { + compatible = "shared-dma-pool"; + no-map; + reg = <0 0x84000000 0 0x8000000>; + }; + }; + soc: soc@0 { compatible = "simple-bus"; #address-cells = <2>;@@ -832,6 +844,16 @@ clock-names = "fin_pll", "mct"; };
Quoted 11 lines
arch/arm64/boot/dts/tesla/fsd.dtsi line 854
Quoted 8 lines
arch/arm64/boot/dts/tesla/fsd.dtsi +8
-0+ mfc: mfc@12880000 { + compatible = "samsung,fsd-mfc"; + reg = <0x0 0x12880000 0x0 0x10000>; + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "mfc"; + clocks = <&clock_mfc MFC_MFC_IPCLKPORT_ACLK>; + memory-region = <&mfc_left>; + status = "okay";Okay is by default, don't add it.
I will remove this in the next series.
Quoted 10 lines
arch/arm64/boot/dts/tesla/fsd.dtsi
Quoted 5 lines
arch/arm64/boot/dts/tesla/fsd.dtsi +2
-0+ }; + ufs: ufs@15120000 { compatible = "tesla,fsd-ufs"; reg = <0x0 0x15120000 0x0 0x200>, /* 0: HCI standard*/
Best regards,
Krzysztof
Thank you for the review.
Regards,
Smitha
Hi All,
I have attached the v4l2-complaince complete log (mfc encoder and decoder) along with this mail for reference.
Regards,
Smitha
Quoted 82 lines
-----Original Message-----
From: Smitha T Murthy [mailto:[email protected]]
Sent: Wednesday, September 7, 2022 12:17 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [Patch v2 00/15] Add MFC v12 support.From: aakarsh jain <[email protected]>
This patch series adds MFC v12 support. MFC v12 is used in Tesla FSD SoC.
This adds support for following:
* Add support for VP9 encoder
* Add support for YV12 and I420 format (3-plane)
* Add support for Rate Control, UHD and DMABUF for encoder
* Add support for DPB buffers allocation based on MFC requirement
* Update documentation for control id definitionsChanges since v1:
- Addressed review comments by Andrzej Hajda.
- Addressed review comments by Rob Herring.
- Addressed review comments by Krzysztof Kozlowski.
- Addressed review comments by Hans Verkuil.
- Addressed review comments by Nicolas Dufresne.
- Rebased on latest krzk/for-next tree.v4l2-complaince:
Total for s5p-mfc device/dev/video0: 45, Succeeded: 39, Failed: 6, Warnings:
0 Total for s5p-mfc device/dev/video1: 45, Succeeded: 34, Failed: 11,
Warnings: 3Smitha T Murthy (15):
dt-bindings: media: s5p-mfc: Add new DT schema for MFC
dt-bindings: media: s5p-mfc: Add mfcv12 variant
media: s5p-mfc: RenameIS_MFCV10macro
media: s5p-mfc: Add initial support for MFCv12
Documention: v4l: Documentation for VP9 CIDs.
media: v4l2: Add v4l2 control IDs for VP9 encoder.
media: s5p-mfc: Add support for VP9 encoder.
media: s5p-mfc: Add YV12 and I420 multiplanar format support
media: s5p-mfc: Add support for rate controls in MFCv12
media: s5p-mfc: Add support for UHD encoding.
media: s5p-mfc: Add support for DMABUF for encoder
media: s5p-mfc: Set context for valid case before callingtry_run
media: s5p-mfc: Load firmware for each run in MFCv12.
media: s5p-mfc: DPB Count Independent ofVIDIOC_REQBUF
arm64: dts: fsd: Add MFC related DT enteries.../devicetree/bindings/media/s5p-mfc.txt | 77 +--- .../bindings/media/samsung,s5p-mfc.yaml | 110 +++++ .../media/v4l/ext-ctrls-codec.rst | 167 +++++++ arch/arm64/boot/dts/tesla/fsd-evb.dts | 4 + arch/arm64/boot/dts/tesla/fsd.dtsi | 22 + .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 60 +++ .../platform/samsung/s5p-mfc/regs-mfc-v7.h | 1 + .../platform/samsung/s5p-mfc/regs-mfc-v8.h | 3 + .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 36 +- .../platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c | 3 + .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 54 ++- .../platform/samsung/s5p-mfc/s5p_mfc_ctrl.c | 9 +- .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 51 ++- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 410 +++++++++++++++-- .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 16 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c | 12 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 433 ++++++++++++++++-- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h | 7 +- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 44 ++ include/uapi/linux/v4l2-controls.h | 33 ++ 20 files changed, 1349 insertions(+), 203 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml create mode 100644 drivers/media/platform/samsung/s5p-mfc/regs-mfc-
Quoted 4 lines
v12.h--
2.17.1
# v4l2-compliance -d /dev/video1 v4l2-compliance 1.22.1, 64 bits, 64-bit time_t
Compliance test for s5p-mfc device /dev/video1:
Dr[ 95.014797] vidioc_g_parm:2576: Setting FPS is only possible for the output queue
[ 95.022670] s5p-mfc 12880000.mfc: Encoding not initialised
[ 95.022728] s5p-mfc 12880000.mfc: Encoding not initialised
[ 95.022812] vidioc_g_parm:2576: Setting FPS is only possible for the output queue
[ 95.022871] vidioc_try_fmt:1607: failed to try output format
[ 95.047169] s5p_mfc_queue_setup:2690: invalid state: 0
[ 95.047181] vidioc_reqbufs:1725: error in vb2_reqbufs() for E(D)
iver Info:
Driver name : s5p-mfc
Card type : s5p-mfc-enc
Bus info : platform:12880000.mfc
Driver version : 5.19.0
Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateful Encoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video1 open: OK test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
fail: v4l2-compliance.cpp(736): !ok
test for unlimited opens: FAIL
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
fail: v4l2-test-controls.cpp(473): g_ctrl returned an error (22)
test VIDIOC_G/S_CTRL: FAIL
fail: v4l2-test-controls.cpp(704): g_ext_ctrls returned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
fail: v4l2-test-controls.cpp(872): subscribe event for control 'User Controls' failed
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 128 Private Controls: 11
Format ioctls:
fail: v4l2-test-formats.cpp(282): node->codec_mask & STATEFUL_ENCODER
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
fail: v4l2-test-formats.cpp(1310): is_stateful_enc && !out->capability
test VIDIOC_G/S_PARM: FAIL
test VIDIOC_G_FBUF: OK (Not Supported)
fail: v4l2-test-formats.cpp(474): !pix_mp.width || !pix_mp.height
test VIDIOC_G_FMT: FAIL
fail: v4l2-test-formats.cpp(474): !pix_mp.width || !pix_mp.height
test VIDIOC_TRY_FMT: FAIL
warn: v4l2-test-formats.cpp(1147): S_FMT cannot handle an invalid pixelformat.
warn: v4l2-test-formats.cpp(1148): This may or may not be a problem. For more information see:
warn: v4l2-test-formats.cpp(1149): http://www.mail-archive.com/[email protected]/msg56550.html
fail: v4l2-test-formats.cpp(478): pixelformat 34363248 (H264) for buftype 9 not reported by ENUM_FMT
test VIDIOC_S_FMT: FAIL
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
fail: v4l2-test-codecs.cpp(35): node->function != MEDIA_ENT_F_PROC_VIDEO_ENCODER
test VIDIOC_(TRY_)ENCODER_CMD: FAIL
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Suppor[ 95.403655] vidioc_g_parm:2576: Setting FPS is only possible for the output queue
ted)
Buffer ioctls:
fail: v4l2-test-buffers.cpp(607): q.reqbufs(node, 1)
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
fail: v4l2-test-buffers.cpp(783): VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP support is missing or malfunctioning.
fail: v4l2-test-buffers.cpp(784): VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP support is missing, probably due to earlier failing format tests.
test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)
Total for s5p-mfc device /dev/video1: 45, Succeeded: 34, Failed: 11, Warnings: 3 #
# v4l2-compliance -d /dev/video0 v4l2-compliance 1.22.1, 64 bits, 64-bit time_t
Compliance test for s5p-mfc device /dev/video0:
Drive[ 198.767611] vidioc_g_selection:816: Can not get compose information
[ 198.768087] vidioc_g_selection:816: Can not get compose information
[ 198.768175] vidioc_g_fmt:397: Format could not be read
[ 198.768179] vidioc_g_selection:816: Can not get compose information
[ 198.768182] vidioc_g_selection:816: Can not get compose information
[ 198.768448] s5p-mfc 12880000.mfc: Decoding not initialised
[ 198.768469] s5p-mfc 12880000.mfc: Decoding not initialised
[ 198.768610] vidioc_g_fmt:397: Format could not be read
[ 198.768640] vidioc_g_selection:816: Can not get compose information
[ 198.768643] vidioc_g_selection:816: Can not get compose information
[ 198.768646] vidioc_g_selection:816: Can not get compose information
[ 198.768648] vidioc_g_selection:816: Can not get compose information
[ 198.768650] vidioc_g_selection:816: Can not get compose information
[ 198.768658] vidioc_g_selection:816: Can not get compose information
[ 198.768731] vidioc_g_selection:816: Can not get compose information
[ 198.768760] vidioc_g_selection:816: Can not get compose information
[ 198.768837] vidioc_g_selection:816: Can not get compose information
[ 198.768861] vidioc_g_selection:816: Can not get compose information
[ 198.768866] vidioc_try_fmt:429: Unsupported format for destination.
[ 198.768894] vidioc_g_selection:816: Can not get compose information
[ 198.768915] vidioc_g_selection:816: Can not get compose information
[ 198.768917] vidioc_try_fmt:429: Unsupported format for destination.
[ 198.768939] vidioc_g_selection:816: Can not get compose information
r Info:
Driver name : s5p-mfc
Card type : s5p-mfc-dec
Bus info : platform:12880000.mfc
Driver version : 5.19.0
Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateful Decoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video0 open: OK test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
fail: v4l2-compliance.cpp(736): !ok
test for unlimited opens: FAIL
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
fail: v4l2-test-controls.cpp(473): g_ctrl returned an error (22)
test VIDIOC_G/S_CTRL: FAIL
fail: v4l2-test-controls.cpp(704): g_ext_ctrls returned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
fail: v4l2-test-controls.cpp(872): subscribe event for control 'User Controls' failed
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 7 Private Controls: 2
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
fail: v4l2-test-formats.cpp(620): Video Capture Multiplanar cap set, but no Video Capture Multiplanar formats defined
test VIDIOC_G_FMT: FAIL
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
fail: v4l2-test-codecs.cpp(104): node->function != MEDIA_ENT_F_PROC_VIDEO_DECODER
test VIDIOC_(TRY_)DECODER_CMD: FAIL
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) test Requests: OK (Not Supported)
Total for s5p-mfc device /dev/video0: 45, Succeeded: 39, Failed: 6, Warnings: 0 #