This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: Running out of (video) memory

Expert 2235 points

Replies: 6

Views: 253

Part Number: AM5728

I'm running a custom board on AM5728 with SDK version 5.02  5.0.0.15 (kernel 4.14) and these KM/UM:

root@apex:~# dmesg | grep -i pvr
[ 4.774385] [drm] Initialized pvr 1.14.3699939 20110701 for 56000000.gpu on minor 1

I have set the CMA to 240MB from the device tree:

reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;

cmem_block_mem_0: cmem_block_mem@ba300000 {
compatible = "shared-dma-pool";
reg = <0x0 0xba300000 0x0 0x0f000000>;
no-map;
status = "okay";
};

.

.

.

};

cmem {

compatible = "ti,cmem"; // must be "ti,cmem"
#address-cells = <1>;
#size-cells = <0>;

status = "okay";

cmem_block_0: cmem_block@0 {
reg = <0>;
memory-region = <&cmem_block_mem_0>;
cmem-buf-pools = <1 0x0f000000>; // 1x240MB
};

.

.

.


};

I can see that it's been allocated to 240MB:

root@apex:~# cat /proc/cmem

Block 0: Pool 0: 1 bufs size 0xf000000 (0xf000000 requested)

Pool 0 busy bufs:

Pool 0 free bufs:
id 0: phys addr 0xba300000

Block 1: Pool 0: 1 bufs size 0x2000000 (0x2000000 requested)

Pool 0 busy bufs:

Pool 0 free bufs:
id 0: phys addr 0x99000000


However,  it looks like the PowerVR Tiler Memory (128MB) is still being used:

root@apex:~# ps aux | grep -i weston-simple-egl

root     1718 1.4 0.5 29044 9392 pts/0   S   12:40   0:01 weston-simple-egl -f

root     1720 1.5 0.5 29044 9324 pts/0   S   12:40   0:01 weston-simple-egl -f

root     1722 1.5 0.5 29040 9408 pts/0   S   12:40   0:01 weston-simple-egl -f

root     1726 1.6 0.5 29044 9352 pts/0   S   12:41   0:00 weston-simple-egl -f

root     1731 1.5 0.5 29044 9328 pts/0   S   12:41   0:00 weston-simple-egl -f

root     1734 1.5 0.5 29040 9340 pts/0   S  12:41   0:00 weston-simple-egl -f

 

root@apex:~# cat /sys/kernel/debug/dri/0/gem

All Objects:

   02000003: 11 ( 3) 00016f3c 0x7806b000 ( 2)   (null)   0 8294400

   02000003: 12 ( 3) 00016753 0x78854000 ( 2)   (null)   0 8294400

   02000003: 9 ( 3) 00015f6a 0x7903d000 ( 2)   (null)   0 8294400

   02000003: 10 ( 3) 00015781 0x79826000 ( 2)   (null)   0 8294400

   02000003: 7 ( 3) 00014f98 0x7a00f000 ( 2)   (null)   0 8294400

   02000003: 8 ( 3) 000147af 0x7a7f8000 ( 2)   (null)   0 8294400

   02000003: 5 ( 3) 00013fc6 0x7afe1000 ( 2)   (null)   0 8294400

   02000003: 6 ( 3) 000137dd 0x7b7ca000 ( 2)   (null)   0 8294400

   02000003: 3 ( 3) 00012ff4 0x7bfb3000 ( 2)   (null)   0 8294400

   02000003: 4 ( 3) 0001280b 0x7c79c000 ( 2)   (null)   0 8294400

   02000003: 1 ( 3) 00012022 0x7cf85000 ( 2)   (null)   0 8294400

   02000003: 2 ( 3) 00011839 0x7d76e000 ( 2)   (null)   0 8294400

   02000003: 0 ( 4) 00010fd2 0x7dfd5000 ( 1)   (null)   0 8294400

   02000003: 0 ( 4) 000107e9 0x7e7be000 ( 1)   (null)   0 8294400

   02000003: 0 ( 4) 00010000 0x7efa7000 ( 2)   (null)   0 8294400

   02000003: 0 ( 1) 00000000 0x7f790000 ( 1) f1bfa000   0 8847360

Total 16 objects, 133263360 bytes

How do I use the CMA as the buffer and not the Tiler? Ty!

6 Replies

  • Hello, Can you try adding this to your command line:

    cma=256M@0xc0000000

    Regards

    Hemant

  • In reply to Hemant Hariyani:

    HI Hemant, thanks for the suggestion.

    ~#  cat /proc/cmdline
    console=ttyS2,115200n8 omapdrm.displays=0,1 omap_wdt.nowayout=1 omap_wdt.early_enable=1 omap_wdt.timer_margin=60 loglevel=4 vt.global_cursor_default=0 cma=256M@0xc0000000 root=PARTUUID=15179c21-02 rw rootfstype=ext4 rootwait

    It looks to have failed:

    ~# dmesg | grep -i cma
    [ 0.000000] Reserved memory: created CMA memory pool at 0x0000000095800000, size 56 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp1_cma@99000000, compatible id shared-dma-pool
    [ 0.000000] OF: reserved mem: initialized node dsp2_cma@9b000000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: created CMA memory pool at 0x000000009d000000, size 32 MiB
    [ 0.000000] cma: Failed to reserve 256 MiB
    [ 0.000000] Kernel command line: jome_did=0x01 jome_hid=0x0005 console=ttyS2,115200n8 omapdrm.displays=0,1 omap_wdt.nowayout=1 omap_wdt.early_enable=1 omap_wdt.timer_margin=60 loglevel=4 vt.global_cursor_default=0 cma=256M@0xc0000000 root=PARTUUID=15179c21-02 rw rootfstype
    =ext4 rootwait
    [ 0.000000] Memory: 1625604K/2012160K available (8192K kernel code, 358K rwdata, 2660K rodata, 2048K init, 305K bss, 296444K reserved, 90112K cma-reserved, 1029120K highmem)
    [ 4.766307] omap-rproc 40800000.dsp: assigned reserved memory node dsp1_cma@99000000
    [ 4.767097] omap-rproc 41000000.dsp: assigned reserved memory node dsp2_cma@9b000000

    Please let me know what else to try!

  • In reply to Adam Lee5:

    With these change in the DTS:

    linux-ti-staging$ git diff
    diff --git a/arch/arm/boot/dts/sg3-common.dtsi b/arch/arm/boot/dts/sg3-common.dtsi
    index 75cbe2e2604c..db056b61314d 100644
    --- a/arch/arm/boot/dts/sg3-common.dtsi
    +++ b/arch/arm/boot/dts/sg3-common.dtsi
    @@ -28,7 +28,7 @@

    cmem_block_mem_0: cmem_block_mem@ba300000 {
    compatible = "shared-dma-pool";
    - reg = <0x0 0xba300000 0x0 0x00400000>;
    + reg = <0x0 0xc0000000 0x0 0x10000000>;
    no-map;
    status = "okay";
    };
    @@ -76,7 +76,7 @@
    cmem_block_0: cmem_block@0 {
    reg = <0>;
    memory-region = <&cmem_block_mem_0>;
    - cmem-buf-pools = <1 0x00400000>; // 1x4MB
    + cmem-buf-pools = <1 0x10000000>;
    };

    cmem_block_1: cmem_block@1 {

    And with no cma in bootarg:

    $ cat /proc/cmdline
    console=ttyS2,115200n8 omapdrm.displays=0,1 omap_wdt.nowayout=1 omap_wdt.early_enable=1 omap_wdt.timer_margin=60 loglevel=4 vt.global_cursor_default=0 root=PARTUUID=e8453c66-02 rw rootfstype=ext4 rootwait

    I am getting this:

    $ dmesg | grep -i cma
    [ 0.000000] Reserved memory: created CMA memory pool at 0x0000000095800000, size 56 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp1_cma@99000000, compatible id shared-dma-pool
    [ 0.000000] OF: reserved mem: initialized node dsp2_cma@9b000000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: created CMA memory pool at 0x000000009d000000, size 32 MiB
    [ 0.000000] cma: Reserved 256 MiB at 0x00000000eec00000
    [ 0.000000] Memory: 1365764K/1750016K available (8192K kernel code, 358K rwdata, 2612K rodata, 2048K init, 305K bss, 31996K reserved, 352256K cma-reserved, 766976K highmem)
    [ 3.955853] omap-rproc 40800000.dsp: assigned reserved memory node dsp1_cma@99000000
    [ 3.956408] omap-rproc 41000000.dsp: assigned reserved memory node dsp2_cma@9b000000

    $ root@apex:~# cat /proc/cmem

    Block 0: Pool 0: 1 bufs size 0x10000000 (0x10000000 requested)

    Pool 0 busy bufs:

    Pool 0 free bufs:
    id 0: phys addr 0xc0000000

    Block 1: Pool 0: 1 bufs size 0x2000000 (0x2000000 requested)

    Pool 0 busy bufs:

    Pool 0 free bufs:
    id 0: phys addr 0x99000000

    Is this making sense? I'm not sure about the address allocation at 0xeec00000.

  • In reply to Adam Lee5:

    Did that work? 

    reserved-memory {
     #address-cells = <1>;
    #size-cells = <1>;
    ranges;

    /* global autoconfigured region for contiguous allocations */
    linux,cma {
    compatible = "shared-dma-pool";
    reusable;
    size = <0x10000000>;
    alignment = <0x2000>;
    linux,cma-default;
    };

    };

    In addition to this, can you try bootargs?

    Regards

    Hemnt

  • In reply to Hemant Hariyani:

    Thanks Hemant. Let me give that a try. 

    In the meanwhile, can you also provide the difference between these two in the toolchain?

    • /usr/include/drm/omap_drm.h
    • /usr/include/omap/omap_drm.h 

    It looks like the header in the omap directory has more definitions (such as OMAP_BO_MEM_CONTIG ).

  • In reply to Hemant Hariyani:

    Hi Hemant, I think it's working better with the linux,cma node in the DTS:

    # dmesg | grep -i cma
    [ 0.000000] cma: Reserved 256 MiB at 0x00000000c0000000
    [ 0.000000] Kernel command line: console=ttyS2,115200n8 omapdrm.displays=0,1 omap_wdt.nowayout=1 omap_wdt.early_enable=1 omap_wdt.timer_margin=60 loglevel=4 vt.global_cursor_default=0 cma=256M@0xc0000000 root=PARTUUID=314776e7-02 rw rootfstype
    =ext4 rootwait
    [ 0.000000] Memory: 1780856K/2077696K available (8192K kernel code, 358K rwdata, 2612K rodata, 2048K init, 305K bss, 34696K reserved, 262144K cma-reserved, 1029120K highmem)

    Unfortunately, running more than 6 instances of weston-simple-egl is still failing as before:

    # cat /sys/kernel/debug/dri/0/gem 
    278 frames in 5 seconds: 55.599998 fps
    279 frames in 5 seconds: 55.799999 fps

    All Objects:
    02000003: 9 ( 3) 00015f6a 0x7903d000 ( 2) (null) 0 8294400
    02000003: 10 ( 3) 00015781 0x79826000 ( 2) (null) 0 8294400
    02000003: 7 ( 3) 00014f98 0x7a00f000 ( 2) (null) 0 8294400
    02000003: 8 ( 3) 000147af 0x7a7f8000 ( 2) (null) 0 8294400
    02000003: 5 ( 3) 00013fc6 0x7afe1000 ( 2) (null) 0 8294400
    02000003: 6 ( 3) 000137dd 0x7b7ca000 ( 2) (null) 0 8294400
    02000003: 3 ( 3) 00012ff4 0x7bfb3000 ( 2) (null) 0 8294400
    02000003: 4 ( 3) 0001280b 0x7c79c000 ( 2) (null) 0 8294400
    02000003: 1 ( 3) 00012022 0x7cf85000 ( 2) (null) 0 8294400
    02000003: 2 ( 3) 00011839 0x7d76e000 ( 2) (null) 0 8294400
    02000003: 0 ( 4) 00010fd2 0x7dfd5000 ( 1) (null) 0 8294400
    02000003: 0 ( 4) 000107e9 0x7e7be000 ( 1) (null) 0 8294400
    02000003: 0 ( 4) 00010000 0x7efa7000 ( 2) (null) 0 8294400
    02000003: 0 ( 1) 00000000 0x7f790000 ( 1) f1bfa000 0 8847360
    Total 14 objects, 116674560 bytes

    # weston-simple-egl -f &

    [6] 1607
    wlpvr: PVR Services Initialised
    root@apex:~# wlpvr: Creating Wayland Client surface 2 buffers for process pid=1607!
    wlpvr: Creating Wayland Client surface 2 buffers for process pid=1607!
    266 frames in 5 seconds: 53.200001 fps

    root@apex:~# 254 frames in 5 seconds: 50.799999 fps
    251 frames in 5 seconds: 50.200001 fps
    weston-simple-egl -f &247 frames in 5 seconds: 49.400002 fps

    [7] 1608
    wlpvr: PVR Services Initialised
    root@apex:~# wlpvr: Creating Wayland Client surface 2 buffers for process pid=1608!
    wlpvr: Creating Wayland Client surface 2 buffers for process pid=1608!
    [ 116.538254] omapdrm omapdrm.0: could not remap: -12 (3)
    wlpvr: ERROR: GetBuffers:739: PVRSRVMapDmaBuf failed
    wlpvr: ERROR: CreateDrawable:680: Could not get buffers!
    PVR:[ 116.552978] omapdrm omapdrm.0: could not remap: -12 (3)
    (Error): KEGLRecreateDrawable: Couldn't create a drawable [0, ]
    PVR:(Error): KEGLGetDrawableParameters: Can't recreate drawable
    [ 116.569897] omapdrm omapdrm.0: could not remap: -12 (3)

     

    Can you also please check if the CMA support in place for Tiler is available in the SDK 5.0.0.15 [1]?

     It looks like the automotive version of the SDK does not [2].

    [1] https://software-dl.ti.com/processor-sdk-linux/esd/AM57X/05_00_00_15/index_FDS.html

    [2] https://e2e.ti.com/support/processors/f/791/t/811634

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.