Re: [PATCH v4 6/7] ARM: dts: exynos: convert MFC device to generic reserved memory bindings

2016-05-27 Thread Javier Martinez Canillas
Hello Marek,

On 05/27/2016 07:32 AM, Marek Szyprowski wrote:
> Hello,
> 
> 
> On 2016-05-25 19:11, Javier Martinez Canillas wrote:
>> Hello Marek,
>>
>> On 05/24/2016 09:31 AM, Marek Szyprowski wrote:
>>> This patch replaces custom properties for defining reserved memory
>>> regions with generic reserved memory bindings for MFC video codec
>>> device.
>>>
>>> Signed-off-by: Marek Szyprowski 
>>> ---
>> [snip]
>>
>>> +
>>> +/ {
>>> +reserved-memory {
>>> +#address-cells = <1>;
>>> +#size-cells = <1>;
>>> +ranges;
>>> +
>>> +mfc_left: region@5100 {
>>> +compatible = "shared-dma-pool";
>>> +no-map;
>>> +reg = <0x5100 0x80>;
>>> +};
>>> +
>>> +mfc_right: region@4300 {
>>> +compatible = "shared-dma-pool";
>>> +no-map;
>>> +reg = <0x4300 0x80>;
>>> +};
>>> +};
>> I've a question probably for a follow up patch, but do you know what's a
>> sane default size for these? I needed to bump the mfc_left size from 8 MiB
>> to 16 MiB in order to decode a 480p H264 video using GStramer. So clearly
>> the default sizes are not that useful.
> 
> Right, the default size for the 'left' region can be increased. Frankly, those
> values (8MiB/0x4300+ 8MiB/0x5100) comes from my initial patches
> prepared for some demo and don't have much with any real requirements. They
> were copied (blindly...) by various developers without any deeper 
> understanding.

Yes, I've to admit that I was one of those when added the MFC regions to the
Peach Chromebooks but worked because I tested with small videos. When trying
to decode bigger videos, then had to increase the 'left' region as mentioned.

> Probably the most sane would be to use something like this:
> 
> mfc_left: region_mfc_left {
>  compatible = "shared-dma-pool";
>  no-map;
>  size = <0x100>;
>  alignment = <0x10>;
> };
> 
> mfc_right: region_mfc_right {
>  compatible = "shared-dma-pool";
>  no-map;
>  size = <0x80>;
>  alignment = <0x10>;
> };
> 
> So the region will be allocated automatically from the available memory. This 
> way
> another nice feature of the generic reserved memory regions can be used.
>

That sounds better indeed. Not requiring a certain memory offset will also have 
the
nice side effect to prevent conflicts like the one Pankaj had with his 
initramfs [0].
 
> The only platform which really requires MFC regions to be placed at certain 
> memory
> offsets is Samsung S5PV210/S5PC110 (sometimes called exynos3), where there is 
> no
> memory address interleaving and MFC device has limited memory interface, 
> which cannot
> do 2 transactions to the same physical memory bank. However S5PV210/S5PC110 
> machine
> code lost support for MFC during conversion to device tree, so it is not a 
> problem
> here.
>
> All newer platforms (Exynos4, Exynos3250, Exynos5+) use memory interleaving, 
> so the
> actual offset of memory bank has no influence on the physical memory bank.
>

I see, thanks a lot for the explanation.
 
>>> +};
>>> diff --git a/arch/arm/boot/dts/exynos4210-origen.dts 
>>> b/arch/arm/boot/dts/exynos4210-origen.dts
>>> index ad7394c..f5e4eb2 100644
>>> --- a/arch/arm/boot/dts/exynos4210-origen.dts
>>> +++ b/arch/arm/boot/dts/exynos4210-origen.dts
>>> @@ -18,6 +18,7 @@
>>>   #include "exynos4210.dtsi"
>>>   #include 
>>>   #include 
>>> +#include "exynos-mfc-reserved-memory.dtsi"
>>> / {
>>>   model = "Insignal Origen evaluation board based on Exynos4210";
>>> @@ -288,8 +289,7 @@
>>>   };
>>> &mfc {
>>> -samsung,mfc-r = <0x4300 0x80>;
>>> -samsung,mfc-l = <0x5100 0x80>;
>>> +memory-region = <&mfc_left>, <&mfc_right>;
>>>   status = "okay";
>> I wonder if shouldn't be better to include the 
>> exynos-mfc-reserved-memory.dtsi
>> on each SoC dtsi and set the memory-regions in the MFC node instead of doing
>> it on each DTS, and let DTS to just replace with its own memory regions if 
>> the
>> default sizes are not suitable for them.
> 
> I don't have strong opinion on this. Maybe it would make more sense to move 
> the
> following entry:
> 
> &mfc {
> memory-region = <&mfc_left>, <&mfc_right>;
> };
> 
> also to the exynos-mfc-reserved-memory.dtsi ? So board will just include it if
> it want to use MFC device with reserved memory regions.
>

Ok, that also sounds like a good option for me.
 
>> Reviewed-by: Javier Martinez Canillas 
>> Tested-by: Javier Martinez Canillas 
> 
> Best regards

[0]: https://lkml.org/lkml/2016/5/26/98

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 6/7] ARM: dts: exynos: convert MFC device to generic reserved memory bindings

2016-05-27 Thread Marek Szyprowski

Hello,


On 2016-05-25 19:11, Javier Martinez Canillas wrote:

Hello Marek,

On 05/24/2016 09:31 AM, Marek Szyprowski wrote:

This patch replaces custom properties for defining reserved memory
regions with generic reserved memory bindings for MFC video codec
device.

Signed-off-by: Marek Szyprowski 
---

[snip]


+
+/ {
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   mfc_left: region@5100 {
+   compatible = "shared-dma-pool";
+   no-map;
+   reg = <0x5100 0x80>;
+   };
+
+   mfc_right: region@4300 {
+   compatible = "shared-dma-pool";
+   no-map;
+   reg = <0x4300 0x80>;
+   };
+   };

I've a question probably for a follow up patch, but do you know what's a
sane default size for these? I needed to bump the mfc_left size from 8 MiB
to 16 MiB in order to decode a 480p H264 video using GStramer. So clearly
the default sizes are not that useful.


Right, the default size for the 'left' region can be increased. Frankly, 
those

values (8MiB/0x4300+ 8MiB/0x5100) comes from my initial patches
prepared for some demo and don't have much with any real requirements. They
were copied (blindly...) by various developers without any deeper 
understanding.

Probably the most sane would be to use something like this:

mfc_left: region_mfc_left {
 compatible = "shared-dma-pool";
 no-map;
 size = <0x100>;
 alignment = <0x10>;
};

mfc_right: region_mfc_right {
 compatible = "shared-dma-pool";
 no-map;
 size = <0x80>;
 alignment = <0x10>;
};

So the region will be allocated automatically from the available memory. 
This way

another nice feature of the generic reserved memory regions can be used.

The only platform which really requires MFC regions to be placed at 
certain memory
offsets is Samsung S5PV210/S5PC110 (sometimes called exynos3), where 
there is no
memory address interleaving and MFC device has limited memory interface, 
which cannot
do 2 transactions to the same physical memory bank. However 
S5PV210/S5PC110 machine
code lost support for MFC during conversion to device tree, so it is not 
a problem

here.

All newer platforms (Exynos4, Exynos3250, Exynos5+) use memory 
interleaving, so the

actual offset of memory bank has no influence on the physical memory bank.


+};
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts 
b/arch/arm/boot/dts/exynos4210-origen.dts
index ad7394c..f5e4eb2 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -18,6 +18,7 @@
  #include "exynos4210.dtsi"
  #include 
  #include 
+#include "exynos-mfc-reserved-memory.dtsi"
  
  / {

model = "Insignal Origen evaluation board based on Exynos4210";
@@ -288,8 +289,7 @@
  };
  
  &mfc {

-   samsung,mfc-r = <0x4300 0x80>;
-   samsung,mfc-l = <0x5100 0x80>;
+   memory-region = <&mfc_left>, <&mfc_right>;
status = "okay";

I wonder if shouldn't be better to include the exynos-mfc-reserved-memory.dtsi
on each SoC dtsi and set the memory-regions in the MFC node instead of doing
it on each DTS, and let DTS to just replace with its own memory regions if the
default sizes are not suitable for them.


I don't have strong opinion on this. Maybe it would make more sense to 
move the

following entry:

&mfc {
memory-region = <&mfc_left>, <&mfc_right>;
};

also to the exynos-mfc-reserved-memory.dtsi ? So board will just include 
it if

it want to use MFC device with reserved memory regions.


Reviewed-by: Javier Martinez Canillas 
Tested-by: Javier Martinez Canillas 


Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 6/7] ARM: dts: exynos: convert MFC device to generic reserved memory bindings

2016-05-25 Thread Javier Martinez Canillas
Hello Marek,

On 05/24/2016 09:31 AM, Marek Szyprowski wrote:
> This patch replaces custom properties for defining reserved memory
> regions with generic reserved memory bindings for MFC video codec
> device.
> 
> Signed-off-by: Marek Szyprowski 
> ---

[snip]

> +
> +/ {
> + reserved-memory {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + mfc_left: region@5100 {
> + compatible = "shared-dma-pool";
> + no-map;
> + reg = <0x5100 0x80>;
> + };
> +
> + mfc_right: region@4300 {
> + compatible = "shared-dma-pool";
> + no-map;
> + reg = <0x4300 0x80>;
> + };
> + };

I've a question probably for a follow up patch, but do you know what's a
sane default size for these? I needed to bump the mfc_left size from 8 MiB
to 16 MiB in order to decode a 480p H264 video using GStramer. So clearly
the default sizes are not that useful.

> +};
> diff --git a/arch/arm/boot/dts/exynos4210-origen.dts 
> b/arch/arm/boot/dts/exynos4210-origen.dts
> index ad7394c..f5e4eb2 100644
> --- a/arch/arm/boot/dts/exynos4210-origen.dts
> +++ b/arch/arm/boot/dts/exynos4210-origen.dts
> @@ -18,6 +18,7 @@
>  #include "exynos4210.dtsi"
>  #include 
>  #include 
> +#include "exynos-mfc-reserved-memory.dtsi"
>  
>  / {
>   model = "Insignal Origen evaluation board based on Exynos4210";
> @@ -288,8 +289,7 @@
>  };
>  
>  &mfc {
> - samsung,mfc-r = <0x4300 0x80>;
> - samsung,mfc-l = <0x5100 0x80>;
> + memory-region = <&mfc_left>, <&mfc_right>;
>   status = "okay";

I wonder if shouldn't be better to include the exynos-mfc-reserved-memory.dtsi
on each SoC dtsi and set the memory-regions in the MFC node instead of doing
it on each DTS, and let DTS to just replace with its own memory regions if the
default sizes are not suitable for them.

Reviewed-by: Javier Martinez Canillas 
Tested-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 6/7] ARM: dts: exynos: convert MFC device to generic reserved memory bindings

2016-05-25 Thread Krzysztof Kozlowski
On 05/24/2016 03:31 PM, Marek Szyprowski wrote:
> This patch replaces custom properties for defining reserved memory
> regions with generic reserved memory bindings for MFC video codec
> device.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi  | 27 
> ++
>  arch/arm/boot/dts/exynos4210-origen.dts|  4 ++--
>  arch/arm/boot/dts/exynos4210-smdkv310.dts  |  4 ++--
>  arch/arm/boot/dts/exynos4412-origen.dts|  4 ++--
>  arch/arm/boot/dts/exynos4412-smdk4412.dts  |  4 ++--
>  arch/arm/boot/dts/exynos5250-arndale.dts   |  4 ++--
>  arch/arm/boot/dts/exynos5250-smdk5250.dts  |  4 ++--
>  arch/arm/boot/dts/exynos5250-spring.dts|  4 ++--
>  arch/arm/boot/dts/exynos5420-arndale-octa.dts  |  4 ++--
>  arch/arm/boot/dts/exynos5420-peach-pit.dts |  4 ++--
>  arch/arm/boot/dts/exynos5420-smdk5420.dts  |  4 ++--
>  arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi |  4 ++--
>  arch/arm/boot/dts/exynos5800-peach-pi.dts  |  4 ++--
>  13 files changed, 51 insertions(+), 24 deletions(-)
>  create mode 100644 arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi
> 
> diff --git a/arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi 
> b/arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi
> new file mode 100644
> index 000..e7445c9
> --- /dev/null
> +++ b/arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi
> @@ -0,0 +1,27 @@
> +/*
> + * Samsung's Exynos SoC MFC (Video Codec) reserved memory common definition.

Reviewed-by: Krzysztof Kozlowski 

One nit - our copyright would be welcomed:
Copyright (c) 2016 Samsung Electronics Co., Ltd

However if there are no objections I will add it when applying.

Best regards,
Krzysztof

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 6/7] ARM: dts: exynos: convert MFC device to generic reserved memory bindings

2016-05-24 Thread Marek Szyprowski
This patch replaces custom properties for defining reserved memory
regions with generic reserved memory bindings for MFC video codec
device.

Signed-off-by: Marek Szyprowski 
---
 arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi  | 27 ++
 arch/arm/boot/dts/exynos4210-origen.dts|  4 ++--
 arch/arm/boot/dts/exynos4210-smdkv310.dts  |  4 ++--
 arch/arm/boot/dts/exynos4412-origen.dts|  4 ++--
 arch/arm/boot/dts/exynos4412-smdk4412.dts  |  4 ++--
 arch/arm/boot/dts/exynos5250-arndale.dts   |  4 ++--
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |  4 ++--
 arch/arm/boot/dts/exynos5250-spring.dts|  4 ++--
 arch/arm/boot/dts/exynos5420-arndale-octa.dts  |  4 ++--
 arch/arm/boot/dts/exynos5420-peach-pit.dts |  4 ++--
 arch/arm/boot/dts/exynos5420-smdk5420.dts  |  4 ++--
 arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi |  4 ++--
 arch/arm/boot/dts/exynos5800-peach-pi.dts  |  4 ++--
 13 files changed, 51 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi

diff --git a/arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi 
b/arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi
new file mode 100644
index 000..e7445c9
--- /dev/null
+++ b/arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi
@@ -0,0 +1,27 @@
+/*
+ * Samsung's Exynos SoC MFC (Video Codec) reserved memory common definition.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/ {
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   mfc_left: region@5100 {
+   compatible = "shared-dma-pool";
+   no-map;
+   reg = <0x5100 0x80>;
+   };
+
+   mfc_right: region@4300 {
+   compatible = "shared-dma-pool";
+   no-map;
+   reg = <0x4300 0x80>;
+   };
+   };
+};
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts 
b/arch/arm/boot/dts/exynos4210-origen.dts
index ad7394c..f5e4eb2 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -18,6 +18,7 @@
 #include "exynos4210.dtsi"
 #include 
 #include 
+#include "exynos-mfc-reserved-memory.dtsi"
 
 / {
model = "Insignal Origen evaluation board based on Exynos4210";
@@ -288,8 +289,7 @@
 };
 
 &mfc {
-   samsung,mfc-r = <0x4300 0x80>;
-   samsung,mfc-l = <0x5100 0x80>;
+   memory-region = <&mfc_left>, <&mfc_right>;
status = "okay";
 };
 
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts 
b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index 94ca7d3..de917f0 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -17,6 +17,7 @@
 /dts-v1/;
 #include "exynos4210.dtsi"
 #include 
+#include "exynos-mfc-reserved-memory.dtsi"
 
 / {
model = "Samsung smdkv310 evaluation board based on Exynos4210";
@@ -133,8 +134,7 @@
 };
 
 &mfc {
-   samsung,mfc-r = <0x4300 0x80>;
-   samsung,mfc-l = <0x5100 0x80>;
+   memory-region = <&mfc_left>, <&mfc_right>;
status = "okay";
 };
 
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts 
b/arch/arm/boot/dts/exynos4412-origen.dts
index 8bca699..cd363d7 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -16,6 +16,7 @@
 #include "exynos4412.dtsi"
 #include 
 #include 
+#include "exynos-mfc-reserved-memory.dtsi"
 
 / {
model = "Insignal Origen evaluation board based on Exynos4412";
@@ -466,8 +467,7 @@
 };
 
 &mfc {
-   samsung,mfc-r = <0x4300 0x80>;
-   samsung,mfc-l = <0x5100 0x80>;
+   memory-region = <&mfc_left>, <&mfc_right>;
status = "okay";
 };
 
diff --git a/arch/arm/boot/dts/exynos4412-smdk4412.dts 
b/arch/arm/boot/dts/exynos4412-smdk4412.dts
index a51069f..9b6d561 100644
--- a/arch/arm/boot/dts/exynos4412-smdk4412.dts
+++ b/arch/arm/boot/dts/exynos4412-smdk4412.dts
@@ -14,6 +14,7 @@
 
 /dts-v1/;
 #include "exynos4412.dtsi"
+#include "exynos-mfc-reserved-memory.dtsi"
 
 / {
model = "Samsung SMDK evaluation board based on Exynos4412";
@@ -112,8 +113,7 @@
 };
 
 &mfc {
-   samsung,mfc-r = <0x4300 0x80>;
-   samsung,mfc-l = <0x5100 0x80>;
+   memory-region = <&mfc_left>, <&mfc_right>;
status = "okay";
 };
 
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
b/arch/arm/boot/dts/exynos5250-arndale.dts
index 85dad29..39940f4 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include "exynos5250.dtsi"
+#include "exyn