<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [iMX8M Plus] CMA alloc failed during gst-launch in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733254#M213518</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/109210"&gt;@malik_cisse&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I also have 2GB of DDR :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;+               /* global autoconfigured region for contiguous allocations */
+               linux,cma {
+                       compatible = "shared-dma-pool";
+                       reusable;
+                       size = &amp;lt;0 0x3c000000&amp;gt;;
+                       alloc-ranges = &amp;lt;0 0x40000000 0 0x80000000&amp;gt;;
+                       linux,cma-default;
+               };&lt;/LI-CODE&gt;&lt;P&gt;and CMA is successfully allocated :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[    0.000000] Reserved memory: created CMA memory pool at 0x000000005c000000, size 960 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Memory: 714344K/2064384K available (19584K kernel code, 1608K rwdata, 6708K rodata, 3328K init, 644K bss, 367000K reserved, 983040K cma-reserved)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Brgs,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2023 16:23:31 GMT</pubDate>
    <dc:creator>khang_letruong</dc:creator>
    <dc:date>2023-10-03T16:23:31Z</dc:date>
    <item>
      <title>[iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1611365#M202467</link>
      <description>&lt;P&gt;Hi NXP Community,&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;256MB of CMA memory has been successfully allocated in our iMX8M Plus based system with 1GB of DDR4:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;root@viperimx8mp:~# dmesg | grep -i cma
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000070000000, size 256 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Memory: 703092K/1015808K available (17920K kernel code, 1506K rwdata, 6920K rodata, 2880K init, 553K bss, 50572K reserved, 262144K cma-reserved)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;However, I am struggling with following errors while streaming the camera with gstreamer :&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;root@viperimx8mp:~# gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw, width=1920, height=1080, framerate=15/1 ! autovideos&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gst-launch.jpg" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/213649i8C5D6DCFB6820E1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="gst-launch.jpg" alt="gst-launch.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;On the debug console side :&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;root@viperimx8mp:~# [  425.307460] enter isp_mi_stop                                                
[  425.942933] enter isp_mi_stop                                                                    
[  426.134422] cma: cma_alloc: alloc failed, req-size: 1013 pages, ret: -12                         
[  426.143351] cma: cma_alloc: alloc failed, req-size: 1013 pages, ret: -12                         
[  426.152091] cma: cma_alloc: alloc failed, req-size: 1013 pages, ret: -12                         
[  426.160775] cma: cma_alloc: alloc failed, req-size: 1013 pages, ret: -12                         
[  426.171442] cma: cma_alloc: alloc failed, req-size: 64 pages, ret: -12                           
[  426.178547] cma: cma_alloc: alloc failed, req-size: 1013 pages, ret: -12                         
[  426.189008] cma: cma_alloc: alloc failed, req-size: 1013 pages, ret: -12                         
[  426.199560] cma: cma_alloc: alloc failed, req-size: 1013 pages, ret: -12                         
[  426.209896] cma: cma_alloc: alloc failed, req-size: 1013 pages, ret: -12                         
[  426.251559] enter isp_mi_stop                                                                    
[  426.381644] jxf355_set_fps : current frame length: 2252, current line length: 1280               
[  426.399852] enter isp_s_comp                                                                     
[  426.402763] enter isp_s_comp                                                                     
[  426.405644] enter isp_s_comp                                                                     
[  426.427504] enter wdr3_hw_init                                                                   
[  426.430580] wdr3 res: 1920 1080                                                                  
[  426.434753] enter isp_mi_start                                                                   &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you help if 256MB is sufficient for streaming single 1080p camera or the problem is somewhere else ?&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 05:02:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1611365#M202467</guid>
      <dc:creator>khang_letruong</dc:creator>
      <dc:date>2023-03-08T05:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: [iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1611471#M202471</link>
      <description>&lt;P&gt;Hi Khang,&lt;/P&gt;&lt;P&gt;I was facing same topic with my SoM. I found this link usefull&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.toradex.com/software/linux-resources/linux-features/contiguous-memory-allocator-cma-linux/" target="_blank"&gt;https://developer.toradex.com/software/linux-resources/linux-features/contiguous-memory-allocator-cma-linux/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I assume it is controlled in the DTS in your case and you have to slightly increase your memsize.&lt;/P&gt;&lt;P&gt;resmem: reserved-memory {&lt;BR /&gt;/* global autoconfigured region for contiguous allocations */&lt;BR /&gt;linux,cma {&lt;BR /&gt;compatible = "shared-dma-pool";&lt;BR /&gt;reusable;&lt;BR /&gt;size = &amp;lt;0 0x38000000&amp;gt;;&lt;BR /&gt;alloc-ranges = &amp;lt;0 0x40000000 0 0x80000000&amp;gt;;&lt;BR /&gt;linux,cma-default;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Holger&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 08:21:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1611471#M202471</guid>
      <dc:creator>Holger75</dc:creator>
      <dc:date>2023-03-08T08:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: [iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1612803#M202544</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/183161"&gt;@Holger75&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Thanks for sharing your experience. I temporarily solved the issue by setting the CMA size to 512MiB, which is a half of the available DDR memory in the system. I am not sure if the remain 512MiB would be sufficient for other running stuffs.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Khang&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 03:02:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1612803#M202544</guid>
      <dc:creator>khang_letruong</dc:creator>
      <dc:date>2023-03-10T03:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: [iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1732646#M213452</link>
      <description>&lt;P&gt;Hi Khang,&lt;/P&gt;&lt;P&gt;Can you please explain how you increased CMA size to 512MiB?&lt;BR /&gt;&lt;BR /&gt;I have currently 640MiB allocated and I want to increase it as can be seen here:&lt;BR /&gt;~# dmesg | grep -i cma&lt;BR /&gt;[ 0.000000] Reserved memory: created CMA memory pool at 0x000000006a000000, size 640 MiB&lt;BR /&gt;[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool&lt;BR /&gt;[ 0.000000] Memory: 1034564K/2064384K available (18560K kernel code, 1644K rwdata, 7292K rodata, 3072K init, 552K bss, 374460K reserved, 655360K cma-reserved)&lt;BR /&gt;&lt;BR /&gt;However the CMA size in the device tree does not correspond to 640MiB:&lt;BR /&gt;linux-imx/arch/arm64/boot/dts/freescale/imx8mp.dtsi&lt;/P&gt;&lt;P&gt;&lt;EM&gt;/* global autoconfigured region for contiguous allocations */&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;linux,cma {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;compatible = "shared-dma-pool";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;reusable;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;size = &amp;lt;0 0x3c000000&amp;gt;;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;alloc-ranges = &amp;lt;0 0x40000000 0 0xC0000000&amp;gt;;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;linux,cma-default;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;};&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What is the correct way to increase this?&lt;BR /&gt;Thx&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 15:34:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1732646#M213452</guid>
      <dc:creator>malik_cisse</dc:creator>
      <dc:date>2023-10-02T15:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: [iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733013#M213498</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/109210"&gt;@malik_cisse&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Below is how I define 512MiB of CMA over 1024MiB (1 GiB) of DDR memory :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;+               /* global autoconfigured region for contiguous allocations */
+               linux,cma {
+                       compatible = "shared-dma-pool";
+                       reusable;
+                       size = &amp;lt;0 0x20000000&amp;gt;;
+                       alloc-ranges = &amp;lt;0 0x40000000 0 0x40000000&amp;gt;;
+                       linux,cma-default;
+               };
+       };&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Small conversion : 0x20000000 = 536870912 B = 536870912/1024/1024=512 MiB.&lt;BR /&gt;&lt;BR /&gt;In your initial case, it seemed that the size ranged from 0 to 960MiB = 1006632960/1024/1024 = 1006632960 B =&amp;nbsp; 0x3c000000. But it resulted in 640MiB (less than expected 960MiB) because the &lt;EM&gt;alloc-range&lt;/EM&gt; was not enough or not contiguous (the first allocable region has 1024MiB in size).&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;K.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 09:15:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733013#M213498</guid>
      <dc:creator>khang_letruong</dc:creator>
      <dc:date>2023-10-03T09:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: [iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733070#M213504</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/147542"&gt;@khang_letruong&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thank you for your insight. This clarifies things to a certain extend.&lt;BR /&gt;&lt;BR /&gt;My SOM has 2GB of DDR memory and it should be possible to alloc&amp;nbsp;&lt;SPAN&gt;960MiB&amp;nbsp;to CMA (that would be less than 50% of available DDR memory).&lt;BR /&gt;&lt;BR /&gt;Would it make sense to set the alloc-range to the full 2GB DDR size (similarly to what you set in your DT) like this:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;alloc-ranges = &amp;lt;0 0x80000000 0 0x80000000&amp;gt;; ??&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;PS:&lt;BR /&gt;I have the feeling the initial alloc-range in my device tree does not even reflect my actual DDR size&lt;BR /&gt;&lt;EM&gt;alloc-ranges = &amp;lt;0 0x40000000 0 0xC0000000&amp;gt;;&lt;BR /&gt;&lt;/EM&gt;to me means that two DDR regions can be used for CMA&lt;BR /&gt;region1:&amp;nbsp;&lt;EM&gt;0 to 0x40000000&amp;nbsp;: 0x40000000 = 1073741824 Dec = 1073741824/1024/1024=1024MiB.&lt;BR /&gt;region2:&amp;nbsp; 0 to 0xC0000000 :0xC0000000 = 3221225472 Dec = 3221225472/1024/1024=3072MiB.&lt;BR /&gt;1024MiB +&amp;nbsp;3072MiB = 4096MiB&lt;BR /&gt;&lt;/EM&gt;&lt;STRONG&gt;Thus total DDR memory is 4GB &lt;/STRONG&gt;and not expected 2GB. This can be an error from my SOM provider.&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 10:39:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733070#M213504</guid>
      <dc:creator>malik_cisse</dc:creator>
      <dc:date>2023-10-03T10:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: [iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733254#M213518</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/109210"&gt;@malik_cisse&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I also have 2GB of DDR :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;+               /* global autoconfigured region for contiguous allocations */
+               linux,cma {
+                       compatible = "shared-dma-pool";
+                       reusable;
+                       size = &amp;lt;0 0x3c000000&amp;gt;;
+                       alloc-ranges = &amp;lt;0 0x40000000 0 0x80000000&amp;gt;;
+                       linux,cma-default;
+               };&lt;/LI-CODE&gt;&lt;P&gt;and CMA is successfully allocated :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[    0.000000] Reserved memory: created CMA memory pool at 0x000000005c000000, size 960 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Memory: 714344K/2064384K available (19584K kernel code, 1608K rwdata, 6708K rodata, 3328K init, 644K bss, 367000K reserved, 983040K cma-reserved)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Brgs,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 16:23:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733254#M213518</guid>
      <dc:creator>khang_letruong</dc:creator>
      <dc:date>2023-10-03T16:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: [iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733258#M213519</link>
      <description>&lt;P&gt;You must be right. I just found a mistake on my side.&lt;BR /&gt;I just found a dtsi file that overrules and includes settings in imx8mp.dtsi and that sets the 640MiB.&lt;BR /&gt;&lt;BR /&gt;&amp;amp;{/reserved-memory/linux,cma} {&lt;BR /&gt;&lt;STRONG&gt;size = &amp;lt;0 0x28000000&amp;gt;;&lt;/STRONG&gt;&lt;BR /&gt;alloc-ranges = &amp;lt;0 0x40000000 0 0x60000000&amp;gt;;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;I will now update the CMA setting here and give it a try.&lt;BR /&gt;Thank you again for the precious feedback.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 16:34:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1733258#M213519</guid>
      <dc:creator>malik_cisse</dc:creator>
      <dc:date>2023-10-03T16:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: [iMX8M Plus] CMA alloc failed during gst-launch</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1734074#M213586</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/147542"&gt;@khang_letruong&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is just to confirm that&amp;nbsp;&lt;SPAN&gt;CMA size is overwritten with other DTS. I can now change CMA also.&lt;BR /&gt;On the other side I found the root cause of my CMA memory leak:&lt;BR /&gt;&lt;EM&gt;Not freeing properly gstreamer appsink upon new pipeline stop/start cycle.&lt;/EM&gt;&lt;BR /&gt;Thank you for sharing your thoughts.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 07:29:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX8M-Plus-CMA-alloc-failed-during-gst-launch/m-p/1734074#M213586</guid>
      <dc:creator>malik_cisse</dc:creator>
      <dc:date>2023-10-05T07:29:44Z</dc:date>
    </item>
  </channel>
</rss>

