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.

Screen Double buffering?

I’m trying to work out how Double buffering works with respect to the DAL API.


The grlib_Demo seems, on the surface to use double buffering but when you look deeper maybe it doesn’t.


It seems to be turned on:-


    RasterDMAConfig(SOC_LCDC_0_REGS, RASTER_DOUBLE_FRAME_BUFFER,
                    RASTER_BURST_SIZE_16, RASTER_FIFO_THRESHOLD_8,
                    RASTER_BIG_ENDIAN_DISABLE);

But a few things don’t make sense to me and I don’t find any clarification in the documentation, eg:-


    /* configuring the base ceiling */
    RasterDMAFBConfig(SOC_LCDC_0_REGS,
                      (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
                      (unsigned int)((g_pucBuffer+PALETTE_OFFSET) +
                       sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET),
                      FRAME_BUFFER_0);

    RasterDMAFBConfig(SOC_LCDC_0_REGS,
                      (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
                      (unsigned int)((g_pucBuffer+PALETTE_OFFSET) +
                       sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET),
                       FRAME_BUFFER_1);


Why do both frame buffers appear to be allocated to the same buffer?


The LCDIsr is never called in this sample (a counter placed in it is never incremented), so the apparent buffer toggling it does never happens (but again there only seems to be a single buffer)

I would expect double buffering to require/need some kind of ‘buffer commit’ / ‘buffer swap+copy’ call, yet I can’t see anything of that type either in this demo, how is this done or otherwise not needed?


Why is
    CacheDataCleanBuff((unsigned int)g_pucBuffer , ((480*272*4) + 32));
So fundamental to the correct operation of the display? I was initially thinking this was the ‘buffer commit’ call, but the documentation doesn’t desceibe it that way and it obviously isn’t as without it the display to the ‘previous display’ but more like the ‘previous display’ partially corrupted with the new display (to see this effect place a while(1); at the end of OnPrimitivePaint)

  • Hi Mark,

    Please find the below comments:

    1. Your observation regarding the double buffering is correct. Even though it is configured for double buffering mode,   same buffer is configured for both  frame buffer 0 and for frame buffer 1. In this particular use case, since the content of the input buffer will not change very frequently, single buffer  is used to update the input content as well as for sending to display.

    2. Your observation regarding ISR is also correct. This example is using a wring API "RasterEndOfFrameIntEnable  (SOC_LCDC_0_REGS)" to configure the interrupts. The correct API  to configure interrupt is "RasterIntEnable(SOC_LCDC_0_REGS, RASTER_END_OF_FRAME0_INT | RASTER_END_OF_FRAME1_INT);"

      Because of the wrong Interrupt API, the interrupts are not occurring.

    3. Since single buffer is used to update image content as well as to send to LCD display, 'previous display’ will be    partially corrupted with the new display. Ideally two  image buffers should have been used to avoid this issue. In that case one buffer will be sent to display, while the other buffer will be used to updated the input image content in ping pong manner.

    Since in this example, the input content is not changed very frequently, the above issue might not be observed in the real time, but ideally two image buffers should have been used.
       
    Could you please refer the following example to refer the usage of double buffering mode "examples\evmAM335x\game". This example uses two image buffers.

    Regards,

    M.Jyothi Kiran