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.

AM335x LCD Framebuffer problem

Other Parts Discussed in Thread: DA8XX, AM3359

Hi,

When I use "dma_alloc_coherent()" allocate large than 4MB memory.

I got this error message from the linux kernel.

error source : kernel/drivers/video/da8xx-fb.c

--------------------------------------------------------------------------------------------------------------------------------------------------------------

[ 0.430572] da8xx_lcdc da8xx_lcdc.0: GLCD: Found TFC_S9700RTWV35TR_01B panel
[ 0.431640] par->vram_size = 6291456
[ 0.431640] ------------[ cut here ]------------
[ 0.431701] WARNING: at mm/page_alloc.c:2109 __alloc_pages_nodemask+0x480/0x650()
[ 0.431732] Modules linked in:
[ 0.431732] Backtrace:
[ 0.431793] [<c001803c>] (dump_backtrace+0x0/0x10c) from [<c04d61cc>] (dump_stack+0x18/0x1c)
[ 0.431793] r7:00000009 r6:0000083d r5:c0082cf8 r4:00000000
[ 0.431854] [<c04d61b4>] (dump_stack+0x0/0x1c) from [<c003beb4>] (warn_slowpath_common+0x54/0x6c)
[ 0.431884] [<c003be60>] (warn_slowpath_common+0x0/0x6c) from [<c003bef0>] (warn_slowpath_null+0x24/0x2c)
[ 0.431884] r9:c06f2558 r8:00ffffff r7:00000000 r6:c069e110 r5:c07068e8
[ 0.431915] r4:00000000
[ 0.431945] [<c003becc>] (warn_slowpath_null+0x0/0x2c) from [<c0082cf8>] (__alloc_pages_nodemask+0x480/0x650)
[ 0.431976] [<c0082878>] (__alloc_pages_nodemask+0x0/0x650) from [<c001a2c8>] (__dma_alloc+0x90/0x308)
[ 0.432006] [<c001a238>] (__dma_alloc+0x0/0x308) from [<c001a5d0>] (dma_alloc_coherent+0x5c/0x68)
[ 0.432037] [<c001a574>] (dma_alloc_coherent+0x0/0x68) from [<c04cdc5c>] (fb_probe+0x7cc/0xbec)
[ 0.432067] r7:c06bc318 r6:00002000 r5:df868e08 r4:c06d1004
[ 0.432098] [<c04cd490>] (fb_probe+0x0/0xbec) from [<c0265444>] (platform_drv_probe+0x20/0x24)
[ 0.432128] [<c0265424>] (platform_drv_probe+0x0/0x24) from [<c0263f8c>] (driver_probe_device+0xa0/0x1b0)
[ 0.432159] [<c0263eec>] (driver_probe_device+0x0/0x1b0) from [<c0264130>] (__driver_attach+0x94/0x98)
[ 0.432189] r9:00000000 r8:00000000 r7:00000000 r6:df868e3c r5:c06d0f48
[ 0.432220] r4:df868e08
[ 0.432220] [<c026409c>] (__driver_attach+0x0/0x98) from [<c0263740>] (bus_for_each_dev+0x68/0x94)
[ 0.432250] r7:00000000 r6:c026409c r5:df82ded0 r4:c06d0f48
[ 0.432281] [<c02636d8>] (bus_for_each_dev+0x0/0x94) from [<c0263ddc>] (driver_attach+0x24/0x28)
[ 0.432312] r7:00000000 r6:df95d340 r5:c06d55e8 r4:c06d0f48
[ 0.432342] [<c0263db8>] (driver_attach+0x0/0x28) from [<c0262fa8>] (bus_add_driver+0xa8/0x23c)
[ 0.432373] [<c0262f00>] (bus_add_driver+0x0/0x23c) from [<c0264794>] (driver_register+0x80/0x144)
[ 0.432403] [<c0264714>] (driver_register+0x0/0x144) from [<c02658e0>] (platform_driver_register+0x4c/0x60)
[ 0.432434] r9:00000000 r8:00000000 r7:00000013 r6:00000000 r5:c06f2b00
[ 0.432464] r4:c069acc8
[ 0.432495] [<c0265894>] (platform_driver_register+0x0/0x60) from [<c0679ae8>] (da8xx_fb_init+0x14/0x1c)
[ 0.432525] [<c0679ad4>] (da8xx_fb_init+0x0/0x1c) from [<c0008610>] (do_one_initcall+0x44/0x1a4)
[ 0.432556] [<c00085cc>] (do_one_initcall+0x0/0x1a4) from [<c0660288>] (kernel_init+0x80/0x124)
[ 0.432586] [<c0660208>] (kernel_init+0x0/0x124) from [<c003f4b4>] (do_exit+0x0/0x6ac)
[ 0.432617] r5:c0660208 r4:00000000
[ 0.432678] ---[ end trace 65f8ea860415c04f ]---
[ 0.432708] da8xx_lcdc da8xx_lcdc.0: GLCD: kmalloc for frame buffer failed
[ 0.432769] da8xx_lcdc: probe of da8xx_lcdc.0 failed with error -22

--------------------------------------------------------------------------------------------------------------------------------------------------------------

How to resolve this problem?

Please suggest

Thanks

  • Hi,

    Please tune below menuconfig option

    Symbol: FB_DA8XX_CONSISTENT_DMA_SIZE [=5]       

     Type  : intege
       Range : [1 14]
       Prompt: Consistent DMA memory size (MB)  

        Defined at drivers/video/Kconfig:2241 

     Depends on: HAS_IOMEM [=y] && FB_DA8XX [=y] && MACH_AM335XEVM [=y] 
        Location: 
          -> Device Drivers
             -> Graphics support  
               -> Support for frame buffer devices (FB [=y]) 
                 -> DA8xx/OMAP-L1xx Framebuffer support (FB_DA8XX [=y]) 

    Thanks,

    Prakash

  • Hi Prakash,

    Thanks for your reply.

    My problem through modify "FB_DA8XX_CONSISTENT_DMA_SIZE".

    I got same error message from Linux kernel.

    Regards

    Spall

  • Hi Spall,

    Did you try changing it to 8? It can take values up to 14. By the way how much memory you are requesting via dma_alloc_coherent?

    Thanks,

    Prakash

  • Hi Prakash,

    Yes, I have changing FB_DA8XX_CONSISTENT_DMA_SIZE[=8].

    Because of my project LCD resolution is 1024 x 768 x 32(bpp) x 2(dual_frame), so I need 6291456 byte. 

    Thank for your help.

    Spall

  • Hi Spall,

     

    I am facing with the same problem, when allocating more then 4MB of coherent memory for the frame buffer. Did you maybe solved the problem. My current solution is to use only 16 bits per pixel, but it would be nice to have higher dynamic. I have set even set FB_DA8XX_CONSISTENT_DMA_SIZE[=16], but without any luck.

    I'm also havim minor problem with the Blue and Red color, as they are swapped. We have double check the interconnects between AM335x and the PHY. Do you maybe have the same problem on your design.

    Thank you for your help.

     

    With kind regards,

    Dejan

     

  • Hi Dejan,

    I was resolve this problem.

    It is Linux kernel limit. AM335x Linux kernel has 1024 number pages, than the page size is 4096 bytes.

    So "dma_alloc_coherent()" can't allocating more than 4MB.

    Fellow these step, resolve this problem:

    1. Please, modify the "#define MAX_ORDER 12" in the include/linux/mmzone.h

    2. Please tune menuconfig option, FB_DA8XX_CONSISTENT_DMA_SIZE [=5] or more

    3. Rebuild your Linux kernel

    4. Rebuild your Filesystem(Android)

    Regards

    Spall

  • Hi Spall,

     

    Thank you very much for sharing that fix. Currentlly I am out of the office, but I will try it as first think in Monday mornig. Did you maybe have expiranced swapped color scheme? We have double check our schematics , considering the errata of the AM3359 processor, but we have red and blue colors swapped, while the green one is fine.

    Thank you. I will give you a feedback in Monday.

    Regards,

    Dejan

  • Take a look at AM335x silicon errata (http://www.ti.com/litv/pdf/sprz360b) , there is a weird bug in silicon. In 16-bit mode LCD out is RGB,  24-bit mode  BGR, besides pin mapping is odd.
    Regards
    Ahmet
  • Hi Spall,

    Thank you for your suggestion, which lead me to the sulution, which works for me.

    Actually, in my config file from some reason was constantlly present CONFIG_FORCE_MAX_ZONEORDER=11, which overrides "#define MAX_ORDER". Even if I had putted it in comment as follows "# CONFIG_FORCE_MAX_ZONEORDER is not set", and soon as I issued make command it has automatically set back to CONFIG_FORCE_MAX_ZONEORDER=11. Therefore, I have to update its description in Kconfig file, as foillow:

    config FORCE_MAX_ZONEORDER
     int "Maximum zone order"
     depends on ARCH_SHMOBILE || SOC_OMAPAM33XX
     range 11 64 if ARCH_SHMOBILE || SOC_OMAPAM33XX
     default "9" if SA1111
     default "11"
     help
       The kernel memory allocator divides physically contiguous memory
       blocks into "zones", where each zone is a power of two number of
       pages.  This option selects the largest power of two that the kernel
       keeps in the memory allocator.  If you need to allocate very large
       blocks of physically contiguous memory, then you may need to
       increase this value.

       This config option is actually maximum order plus one. For example,
       a value of 11 means that the largest free memory block is 2^10 pages.

     

    Ahmet, thank you for that info, but as I said, we have considered the device errata. However, now when the bits per pixel are set to 32 bits, the colors are just working fine. Just for info, we are using on LCD controller 24-bit data output.

     

    Thank you all for helping me solve this problem.

     

    Best regards,

    Dejan

  • Hi Dejan,

    made the changes you suggested and now I can allocate 8MB and get higher resolution. Have you submitted a patch? If not I can also make this and would like to have your SoB.

    Yegor

  • Hi Yegor,

    I’m glad it helped you up.

    Actually I have not uploaded any patch for this video issue. We have developed a new board using AM335X processor, with a lot of supported peripherals. Beside this, we have adapted Linux to support new MACHINE_TYPE, along other updates to support our board’s features.

    Therefore, I am interested that our kernel updates would come to the TI mainline. Would you be able to help me on this way? However, I can share my SoC patches, but in week or two time, because I have some deadlines to catch in new future.

    Best regards,

    Dejan

  • What kernel are you using? From what git repo? Have you used device tree?

    Yegor

  • I have linux-3.2-psp04.06.00.07 from LINUXEZSDK-AM335X. Do you see any options to get my patches to the mainline?

    Dejan

  • Have you read my private message? See your "Conversations".

    I've prepared the patch and just need your e-mail for SoB.


  • AM3359 24bit 1024*768 LCD  “LCD: kmalloc for frame buffer failed”?
     [    1.308959]  da8xx_lcdc.0: alias fck already exists
     [    1.314666] da8xx_lcdc da8xx_lcdc.0: GLCD: Found TFC_S9700RTWV35TR_01B panel
     [    1.323120] ------------[ cut here ]------------ [    1.328033] WARNING: at mm/page_alloc.c:2110 __alloc_pages_nodemask+0x458/0x62c()
     [    1.335906] Modules linked in:
     [    1.339141] Backtrace:
     [    1.341735] [<c001803c>] (dump_backtrace+0x0/0x10c) from [<c04d5438>] (dump_stack+0x18/0x1c)
     [    1.350646]  r7:00000009 r6:0000083e r5:c00840a0 r4:00000000
     [    1.356628] [<c04d5420>] (dump_stack+0x0/0x1c) from [<c003d284>] (warn_slowpath_common+0x54/0x6c)
     [    1.365997] [<c003d230>] (warn_slowpath_common+0x0/0x6c) from [<c003d2c0>] (warn_slowpath_null+0x24/0x2c)
     [    1.376068]  r9:c06f3ce0 r8:00000000 r7:00000000 r6:c069e110 r5:c0708028
     [    1.382965] r4:00000000 [    1.385742] [<c003d29c>] (warn_slowpath_null+0x0/0x2c) from [<c00840a0>] (__alloc_pages_nodemask+0x458/0x62c)
     [    1.396209] [<c0083c48>] (__alloc_pages_nodemask+0x0/0x62c) from [<c001a2c8>] (__dma_alloc+0x90/0x308)
     [    1.406036] [<c001a238>] (__dma_alloc+0x0/0x308) from [<c001a5d0>] (dma_alloc_coherent+0x5c/0x68)
     [    1.415374] [<c001a574>] (dma_alloc_coherent+0x0/0x68) from [<c04cd0cc>] (fb_probe+0x7a8/0xbc4)
     [    1.424530]  r7:cf9bc608 r6:007d0000 r5:cf9c1a54 r4:c06d2844
     [    1.430541] [<c04cc924>] (fb_probe+0x0/0xbc4) from [<c02648e4>] (platform_drv_probe+0x20/0x24)
     [    1.439605] [<c02648c4>] (platform_drv_probe+0x0/0x24) from [<c026342c>] (driver_probe_device+0xa0/0x1b0)
     [    1.449707] [<c026338c>] (driver_probe_device+0x0/0x1b0) from [<c0263618>] (__device_attach+0x44/0x48)
     [    1.459503]  r9:c002ff2c r8:c0714d8c r7:00000000 r6:c02635d4 r5:cf9bc608
     [    1.466400] r4:c06d2788
     [    1.469177] [<c02635d4>] (__device_attach+0x0/0x48) from [<c02628d8>] (bus_for_each_drv+0x68/0x94)
     [    1.478607]  r5:cf81dc48 r4:cf9bc608
     [    1.482391] [<c0262870>] (bus_for_each_drv+0x0/0x94) from [<c02636e4>] (device_attach+0x9c/0xc0)
     [    1.491638]  r7:c06be7f0 r6:00000000 r5:cf9bc63c r4:cf9bc608
     [    1.497650] [<c0263648>] (device_attach+0x0/0xc0) from [<c02626dc>] (bus_probe_device+0x2c/0x48)
     [    1.506896]  r7:c06be7f0 r6:00000000 r5:cf9bc610 r4:cf9bc608
     [    1.512878] [<c02626b0>] (bus_probe_device+0x0/0x48) from [<c0261554>] (device_add+0x4c4/0x590)
     [    1.522064] [<c0261090>] (device_add+0x0/0x590) from [<c0264f80>] (platform_device_add+0x100/0x19c)
     [    1.531616] [<c0264e80>] (platform_device_add+0x0/0x19c) from [<c00332dc>] (omap_device_register+0x28/0x2c)
     [    1.541870]  r7:c05c6868 r6:00000000 r5:cf9c4e00 r4:cf9bc600
     [    1.547851] [<c00332b4>] (omap_device_register+0x0/0x2c) from [<c00338b4>] (omap_device_build_ss+0x108/0x144)
     [    1.558319] [<c00337ac>] (omap_device_build_ss+0x0/0x144) from [<c0033944>] (omap_device_build+0x54/0x5c)
     [    1.568420] [<c00338f0>] (omap_device_build+0x0/0x5c) from [<c06685a0>] (am33xx_register_lcdc+0x64/0xb0)
     [    1.578399]  r4:00000000 [    1.581085] [<c066853c>] (am33xx_register_lcdc+0x0/0xb0) from [<c002f778>] (lcdc_init+0x30/0x60)
     [    1.590332]  r6:00000001 r5:00000001 r4:c06bd128
     [    1.595245] [<c002f748>] (lcdc_init+0x0/0x60) from [<c002f1f8>] (_configure_device+0x70/0xdc)
     [    1.604217] [<c002f188>] (_configure_device+0x0/0xdc) from [<c0030130>] (am335x_evm_setup+0x204/0x4ac)
     [    1.614044]  r7:00000000 r6:cf8a0820 r5:00000000 r4:c06bdac0
     [    1.620025] [<c002ff2c>] (am335x_evm_setup+0x0/0x4ac) from [<c0276794>] (at24_probe+0x45c/0x4e4)
     [    1.629272]  r6:cf8a0820 r5:cf8a0800 r4:cf9c3d40
     [    1.634185] [<c0276338>] (at24_probe+0x0/0x4e4) from [<c032c66c>] (i2c_device_probe+0xb4/0xec)
     [    1.643249] [<c032c5b8>] (i2c_device_probe+0x0/0xec) from [<c026342c>] (driver_probe_device+0xa0/0x1b0)
     [    1.653137]  r7:c06d7558 r6:cf8a0854 r5:c0714db0 r4:cf8a0820 [    1.659118] [<c026338c>] (driver_probe_device+0x0/0x1b0) from [<c02635d0>] (__driver_attach+0x94/0x98)
     [    1.668945]  r9:00000000 r8:00000000 r7:00000000 r6:cf8a0854 r5:c06d7558
     [    1.675842] r4:cf8a0820 [    1.678588] [<c026353c>] (__driver_attach+0x0/0x98) from [<c0262be0>] (bus_for_each_dev+0x68/0x94)
     [    1.688049]  r7:00000000 r6:c026353c r5:cf81dec8 r4:c06d7558
     [    1.694030] [<c0262b78>] (bus_for_each_dev+0x0/0x94) from [<c026327c>] (driver_attach+0x24/0x28)
     [    1.703277]  r7:00000000 r6:cf9c3ec0 r5:c06e3db0 r4:c06d7558
     [    1.709259] [<c0263258>] (driver_attach+0x0/0x28) from [<c0262448>] (bus_add_driver+0xa8/0x23c)
     [    1.718444] [<c02623a0>] (bus_add_driver+0x0/0x23c) from [<c0263c34>] (driver_register+0x80/0x144)
     [    1.727905] [<c0263bb4>] (driver_register+0x0/0x144) from [<c032cab0>] (i2c_register_driver+0x34/0xbc)
     [    1.737701]  r9:00000000 r8:00000000 r7:00000013 r6:00000000 r5:c06f4180
     [    1.744598] r4:c06d7530
     [    1.747375] [<c032ca7c>] (i2c_register_driver+0x0/0xbc) from [<c067b8f8>] (at24_init+0x48/0x54)
     [    1.756530]  r5:c06f4180 r4:c069ab4c
     [    1.760314] [<c067b8b0>] (at24_init+0x0/0x54) from [<c0008610>] (do_one_initcall+0x44/0x1a4)
     [    1.769195] [<c00085cc>] (do_one_initcall+0x0/0x1a4) from [<c0660288>] (kernel_init+0x80/0x124)
     [    1.778381] [<c0660208>] (kernel_init+0x0/0x124) from [<c0040884>] (do_exit+0x0/0x6ac)
     [    1.786712]  r5:c0660208 r4:00000000
     [    1.790557] ---[ end trace b4622b5c66012fd7 ]---
     [    1.795440] da8xx_lcdc da8xx_lcdc.0: GLCD: kmalloc for frame buffer failed
     [    1.802703] da8xx_lcdc: probe of da8xx_lcdc.0 failed with error -22


    AM3359 LCD 16bit RGB   24Bit BGR。
    board-am335xevm.c
    static const struct display_panel disp_panel = {
        WVGA,
        16,
        24,
        COLOR_ACTIVE,
    };
    static struct lcd_ctrl_config lcd_cfg = {
        &disp_panel,
        .ac_bias        = 255,
        .ac_bias_intrpt        = 0,
        .dma_burst_sz        = 16,
        .bpp            = 24,
        .fdd            = 0x80,
        .tft_alt_mode        = 0,
        .stn_565_mode        = 0,
        .mono_8bit_mode        = 0,
        .invert_line_clock    = 1,
        .invert_frm_clock    = 1,
        .sync_edge        = 0,
        .sync_ctrl        = 1,
        .raster_order        = 0,
    };
    am335x_evm_defconfig:FB_DA8XX_CONSISTENT_DMA_SIZE 14

    How to resolve this problem?

    Please suggest

    Thanks



  • What kernel are you using?

    Have tried this patch?

    What is your desired resolution? 800×480?

  • static const struct display_panel disp_panel = {
        WVGA,
        16,
        24,
        COLOR_ACTIVE,
    };

    to

    static const struct display_panel disp_panel = {
        WVGA,
        24,
        16,
        COLOR_ACTIVE,
    };