cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling double framebuffer on DSI displays

Osman SOYKURT
ST Employee

Hello TouchGFX Community!

This post is not a question, it's just a little tutorial on how to use double framebuffer strategy on DSI displays. We saw that this is something a lot of us want to do to improve performance, so here's how you can do it :)

Note : I'll be using the STM32F469-disco board for this tutorial. Let's get started!

1- On STM32CubeMX, select "Double Buffer" as "Framebuffer Strategy". Set 0xC0000000 and 0xC00C3000 as the two start addresses.

0693W00000QL7D3QAL.png 

2- Configuration of the LTDC on STM32CubeMX : under "Layer Settings"> "Frame Buffer">"Layer0 - Color Frame Buffer Line Length", set "832" value.

 0693W00000QL7E1QAL.png 

The reason why we put 832 and not 800 as the Color Frame Buffer Line Length is because the DMA can transfer up to 208 pixel by VSYNC so 832 pixel after 4 VSYNC.

We can put 800 but the performance would be slower because we will need to make the calculation of sending 3*208 + 176

3- In TouchGFXHAL.cpp, Add theses lines in TouchGFXHAL::setTFTFrameBuffer() function :

void TouchGFXHAL::setTFTFrameBuffer(uint16_t* address)
{
   ...
 
   __HAL_DSI_WRAPPER_DISABLE(&hdsi);
    LTDC_Layer1->CFBAR = (uint32_t)address;
    LTDC->SRCR |= LTDC_SRCR_IMR;
    currFbBase = address;
    __HAL_DSI_WRAPPER_ENABLE(&hdsi);
}

The 1st Line is to disable DSI, because we want to make modification. The second line is to set the LTDC pointer to the address of the second framebuffer.

Third line is to apply LTDC changes immediately. The forth line is to save the current framebuffer address. And the last line enables DSI again.

4- In TouchGFXHAL.cpp, remove this line from HAL_DSI_TearingEffectCallback() function :

void HAL_DSI_TearingEffectCallback(DSI_HandleTypeDef* hdsi)
{
   ...
   // Remove this line :
   HAL::getInstance()->lockDMAToFrontPorch(refreshRequested);
   //
   ...
}

This is used to set whether the DMA transfers are locked to the TFT update cycle. So in our case, it's irrelevant on double buffering.

5- That's all :)

You can find attached a simple project I've made for the STM32F469-Disco board, I hope that helps some of you ;)

/Osman

Osman SOYKURT
ST Software Developer | TouchGFX
2 REPLIES 2
MM..1
Chief III

Maybe its good to write for wich DSI mode is this optimize.

ERROR
Associate II

Hi Osman,

Do you have a similar recipe for STM32H747I-DISCO?

I have tried to repeat all steps, but no success. The only difference is the first and second addresses (0xD0000000 and 0xD0186000, tried 0xD0180000 as 2nd as well).