Jump to content

LTDC multiple layers.


Steffan

Recommended Posts

Hiho,

I finally took some time to hook up some display to the LTDC of my STM32F429-discovery. That part works like a charm now. My goal is to get to this: https://www.youtube.com/watch?v=_1mRUhAzPoo (which is currently SDL and pixmap magic only)

Anyway. I want to use multiple layers/blending/whatever to achieve the same on the display connected to the F429, but I'm not entirely sure what the current state of the LTDC in combination with two layers is in uGFX. I read this post by Tectu: https://community.ugfx.io/topic/447-support-for-stm32f469i-discovery/#comment-3637, but I'm not entirely sure if this is actually there or has to be implemented. From what I can see named functionality in gdisp_lld_control and gdisp_lld_query is yet to be implemented (by me). Also i'm not entirely sure about "adding support for multiple LTDC layers is by using the multiple displays support". What does Tectu try to say here? Do I have to make a copy of the current LTDC driver and use that as second display?

Some extra pointers in the right direction would be nice.

 

 

Link to comment
Share on other sites

Hello @Steffan and welcome to the µGFX community!

The STM32LTDC driver currently doesn't implement the switching feature as described in the post that you linked. Currently you can configure the second layer in your board file but there's no way to tell the LTDC to switch to the second layer - that is the functionality that yet has to be implemented in the existing STM32LTDC driver.
The overall goal is to use the multiple displays support to allow drawing to the two different layers individually. Then there's a configuration register somewhere in the real physical LTDC peripheral that allows swapping the currently being displayed layer (or blending the two). The goal is to add an option to gdisp_lld_control() that changes the corresponding parameter in the LTDC peripheral.
There is no need to copy the existing driver and using it twice - that would be wrong. The goal is to extend the existing driver to add that capability. You can have a look at the SSD1306 driver which uses the gdisp_lld_control() function to invert the display - that should give you an idea of how to use the gdisp_lld_control() interface.

I hope that answers your questions. Please don't hesitate to ask if you have any question.

Link to comment
Share on other sites

Thank you Tectu.

I ported the "sliding menu" to the F429+LTDC. Seems to work OK-ish. I implemented it by using a single layer and swapping the framebuffers ( one is updated, while the other is displayed). It would be nice to use the two layer feature, but I cannot get it to work properly. As soon as I enable the second/foreground layer, I get (synchronisation??) issues. I can lower the pixel clock to "solve" this issue, but then the frame rate gets unacceptably low. All this using a STM32F429-Discovery with a 800x480 display. Any known limitations with this setup?

Link to comment
Share on other sites

10 hours ago, Steffan said:

I implemented it by using a single layer and swapping the framebuffers ( one is updated, while the other is displayed).

This is somewhat ambiguous to me. Are you maintaining two dedicated framebuffers yourself and just flushing to the one active LTDC layer? The LTDC provides you with two layers and you should definitely let the LTDC handle the two framebuffers. Note that "a layer" is basically a framebuffer. Once you setup the two layers you only have to register one LTDC register to change the active layer. This is basically double buffering implemented in hardware by the LTDC.

That is one way to use the two layers of the LTDC. The other way is to use the two layers "at the same time" which is probably what you want for your sliding menu. In that case you still have to initialize the two layers and let the LTDC handle it. The difference is that you ask the LTDC to display the two layers on top of each other (properly using the alpha channel to make the lower layer "shine" through the upper layer). The way to use this from the µGFX point of view is to implement the gdisp_lld_query() commands to retrieve the two GDisplay* pointers of the two layers through gdispQuery() API. This way you can use the regular multiple displays support to draw to the two layers independently.

I hope that helps. please don't hesitate to ask if you have any other questions.
Keep in mind that I cite these LTDC behaviors/features form the top of my head. You might want to check the datasheet to seek certainty.

Link to comment
Share on other sites

I know, I know regarding the layers. The mean reason i wanted to go for the dual frame buffer for a single layer for the "background" with the menu in a second layer, is that the "background" can be updated while the menu is shown and I didn't want it to go semi-glitchy. But maybe this isn't really an issue at all. At a decent frame rate this should be hardly noticeable (i hope). I "need" the second layer to implement some transparency/alpha channel for the menu. Maybe I should look a bit into the DMA2D a bit more, maybe I can make something useful out of that. 

Regarding the timings. I checked them for the SDRAM, the timings seems to be already pretty close to the fastest possible settings.

Otherwise I guess the 800x480 is probably not really the most suitable display for this.  It's mainly a playground anyway.  I found some post from king2 on this forum, he also states 800x480 with two layers at the same time isn't going to happen. The SDRAM+F429 isn't fast enough. Time to get some F7 discovery then.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...