diff mbox series

[1/1] ARM: dts: imx6qdl: Add reserved memory area for CMA memory

Message ID 20240827142458.265558-1-alexander.stein@ew.tq-group.com (mailing list archive)
State New, archived
Headers show
Series [1/1] ARM: dts: imx6qdl: Add reserved memory area for CMA memory | expand

Commit Message

Alexander Stein Aug. 27, 2024, 2:24 p.m. UTC
Default CMA size is too small for HDMI output and VPU usage. Increase the
default size by providing a CMA memory area.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Smallest RAM variant has 512MiB.

 arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Fabio Estevam Aug. 27, 2024, 2:32 p.m. UTC | #1
Hi Alexander,

On Tue, Aug 27, 2024 at 11:25 AM Alexander Stein
<alexander.stein@ew.tq-group.com> wrote:
>
> Default CMA size is too small for HDMI output and VPU usage. Increase the
> default size by providing a CMA memory area.
....
> +               linux,cma {
> +                       compatible = "shared-dma-pool";
> +                       reusable;
> +                       size = <0x14000000>;

Just curious: how did you calculate that this is a suitable CMA memory
area size?
Alexander Stein Aug. 28, 2024, 6:12 a.m. UTC | #2
Am Dienstag, 27. August 2024, 16:32:10 CEST schrieb Fabio Estevam:
> Hi Alexander,
> 
> On Tue, Aug 27, 2024 at 11:25 AM Alexander Stein
> <alexander.stein@ew.tq-group.com> wrote:
> >
> > Default CMA size is too small for HDMI output and VPU usage. Increase the
> > default size by providing a CMA memory area.
> ....
> > +               linux,cma {
> > +                       compatible = "shared-dma-pool";
> > +                       reusable;
> > +                       size = <0x14000000>;
> 
> Just curious: how did you calculate that this is a suitable CMA memory
> area size?

Just after startup and a simple weston running on a 1080 HDMI output I habe
this CMA status:
> # grep Cma /proc/meminfo
> CmaTotal:         327680 kB
> CmaFree:          137764 kB

AFAIK also DMA setup is using CMA memory.

When playing (and decoding) bbb_sunflower_1080p_30fps_normal.mp4 free CMA memory
shrinks down to ~60MiB
> # grep Cma /proc/meminfo
> CmaTotal:         327680 kB
> CmaFree:           63144 kB

So, 260MiB should be enough (but just barely). But to give some spare memory
it has been increased to 320MiB.

Best regards,
Alexander
Alexander Stein Aug. 28, 2024, 7:49 a.m. UTC | #3
Am Dienstag, 27. August 2024, 16:24:58 CEST schrieb Alexander Stein:
> Default CMA size is too small for HDMI output and VPU usage. Increase the
> default size by providing a CMA memory area.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> Smallest RAM variant has 512MiB.
> 
>  arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
> index d03f7065ddfd7..8ba3ec27bee07 100644
> --- a/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
> +++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
> @@ -106,6 +106,20 @@ reg_vcc3v3_audio: regulator-vcc3v3-audio {
>  		vin-supply = <&reg_mba6_3p3v>;
>  	};
>  
> +	reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		linux,cma {
> +			compatible = "shared-dma-pool";
> +			reusable;
> +			size = <0x14000000>;
> +			alloc-ranges = <0x10000000 0x20000000>;
> +			linux,cma-default;
> +		};
> +	};
> +

Please do not merge yet.
I just noticed that this breaks mmap'ed fbdev usage. It only works when CMA
area is in HighMem.

Best regards,
Alexander

>  	sound {
>  		compatible = "fsl,imx-audio-tlv320aic32x4";
>  		pinctrl-names = "default";
>
Alexander Stein Sept. 9, 2024, 2:11 p.m. UTC | #4
Am Mittwoch, 28. August 2024, 09:49:36 CEST schrieb Alexander Stein:
> Am Dienstag, 27. August 2024, 16:24:58 CEST schrieb Alexander Stein:
> > Default CMA size is too small for HDMI output and VPU usage. Increase the
> > default size by providing a CMA memory area.
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> > Smallest RAM variant has 512MiB.
> > 
> >  arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
> > index d03f7065ddfd7..8ba3ec27bee07 100644
> > --- a/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
> > +++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
> > @@ -106,6 +106,20 @@ reg_vcc3v3_audio: regulator-vcc3v3-audio {
> >  		vin-supply = <&reg_mba6_3p3v>;
> >  	};
> >  
> > +	reserved-memory {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> > +
> > +		linux,cma {
> > +			compatible = "shared-dma-pool";
> > +			reusable;
> > +			size = <0x14000000>;
> > +			alloc-ranges = <0x10000000 0x20000000>;
> > +			linux,cma-default;
> > +		};
> > +	};
> > +
> 
> Please do not merge yet.
> I just noticed that this breaks mmap'ed fbdev usage. It only works when CMA
> area is in HighMem.

Okay, now that commit 5a498d4d06d6d ("drm/fbdev-dma: Only install deferred
I/O if necessary") has been applied, the mentioned problem is gone.
This patch can be applied if there are no concerns.

Best regards,
Alexander
Shawn Guo Oct. 8, 2024, 8:50 a.m. UTC | #5
On Tue, Aug 27, 2024 at 04:24:58PM +0200, Alexander Stein wrote:
> Default CMA size is too small for HDMI output and VPU usage. Increase the
> default size by providing a CMA memory area.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>

Changed subject prefix to "ARM: dts: imx6qdl-mba6: "

Applied, thanks!
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
index d03f7065ddfd7..8ba3ec27bee07 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-mba6.dtsi
@@ -106,6 +106,20 @@  reg_vcc3v3_audio: regulator-vcc3v3-audio {
 		vin-supply = <&reg_mba6_3p3v>;
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		linux,cma {
+			compatible = "shared-dma-pool";
+			reusable;
+			size = <0x14000000>;
+			alloc-ranges = <0x10000000 0x20000000>;
+			linux,cma-default;
+		};
+	};
+
 	sound {
 		compatible = "fsl,imx-audio-tlv320aic32x4";
 		pinctrl-names = "default";