Using Multilayer with Multibuffer

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Using Multilayer with Multibuffer

    Hello,

    I'm working on STM32F429 (2 display layer support) with RTOS (one task for gui operations and one task for touch) and using emWin with Window Manager, Multilayer (two layer), and Multibuffering with two buffer. The VRAM adresses of the two layer are on different places on external SDRAM. Both layer are using both buffer. I verified by calling the GUI_MULTIBUF_GetNumBuffersEx() function for each layer. In general the display configuration and emWin configuration (LCDConf.c) seems to be ok. The copy of the buffer happens in dependency of the VSYNC Signal and so on.

    So my question is if or what exactly I have to consider when using two layer and multibuffering? I'm asking because I got some problems.
    For example by redrawing an DTA streamed Bitmap (called by GUI_DrawStreamedBitmapAuto(), saved on external SDRAM ) used in a button widget on one layer, anyway tearing and flickering effects occurs. I'm using GUI_MULTIBUF_BeginEx() and GUI_MULTIBUF_EndEx() by drawing or WM_MULTIBUF_EnableEx() for Window Manager.

    Using one layer with Multibuffering instead of two layer, this effects doesn't occur.

    In Addition, using memory devices for drawing operation (instead of Multibuffering) this effects occur as well by using two layer. By using one layer this effects disappears again. Maybe this is an indication that the problem is not in Multibuffering, but rather anywhere else in using of two layer.
    Unfortunatelly I can't find precise description by using multilayer with multibuffer in the manual or anything else which could solve my problem.

    Maybe anyone can help me to find out the problem?

    Thx and greetz

    The post was edited 1 time, last by Manfred ().

  • Hi again everybody!

    Unfortunately I have still the same problem. But I found out that the problem could be the GUI_Clear() command.
    I will try to describe my problem. Remember that I'm using emWin with two hardware layer and multibuffering. For each layer I have overwrited the callback function. In layer 0 I want to paint a streamed Bitmap. The secound layer should be transparent. I Looks like follows:

    void Callback_DesktopWindowLayer_0(WM_MESSAGE * pMsg)
    {
    /* select Window message */
    switch(pMsg->MsgId)
    {
    /* redraw main/desktop window */
    case WM_PAINT:
    {
    /* draw background layer 0 */
    GUI_MULTIBUF_BeginEx(0);

    GUI_Clear();

    GUI_DrawStreamedBitmapAuto(m_sDataGraphicsMappedLayer_0[GRAPHICS_LAYER_0_BACKGROUND].GraphicsData.pToData,0,0);

    /* draw foreground layer 0 */
    GUI_DrawStreamedBitmapAuto(m_sDataGraphicsMappedLayer_0[GRAPHICS_LAYER_0_FOREGROUND].GraphicsData.pToData,0,0);
    GUI_MULTIBUF_EndEx(0);
    break;
    }
    }


    void GUI_SoftliQ::Callback_DesktopWindowLayer_1(WM_MESSAGE * pMsg)
    {
    /* select Window message */
    switch(pMsg->MsgId)
    {
    /* redraw main/desktop window */
    case WM_PAINT:
    {
    GUI_MULTIBUF_BeginEx(1);

    GUI_SetBkColor(GUI_TRANSPARENT);

    GUI_Clear();

    GUI_MULTIBUF_EndEx(1);
    break;
    }
    }

    After that I have created several windows with WM Window Manager which are childs from desktop layer 1. This windows are transparency and should all have the same background Image of layer 0. Only one window should be visible at the same time. Clicking on a button of the visible window the next window will be shown. In order to do this I'm using the WM_HideWindow() and WM_ShowWindow() commands. And exactly here occurs my first problem. I know I have to clear the display by switching to the next window, otherwise the content of the previous window would still be visible on the display. Therefore I'm using the GUI_Clear in the callback of desktop window layer 1. By debugging I noticed that the Window message "WM_PAINT" of each callback will be called several times by clicking on the button. Step by step I can see that first callback for redrawing of the previous window will be called. After that the desktop window layer 1 callback will be called wherby obviously the content of the display will be cleared. At last the callback of the new window makes the new window visible. Exactly this process I can see on the display. Hiding the old window and showing the next window looks like a kind of flickering effect.

    Additional I get the same issue when I'm updating/drawing widgets on the window. I have created my own widget which looks like a tachometer like example MEMDEV_AutoDev of the sample folder. My intention is to draw this tacho "live" on the display in dependency of data. Again by redrawing the widget these kind of "blinking" or flickering effects occurs.
    Does anyone maybe know where or why this problem occurs?

    My first assumption was I'm not drawing in the backgroundbuffer and because of that these single steps of drawing are visible on the display. But I have configured the multibuffer and use the WM_MULTIBUF_EnableEx() at the beginning and the GUI_MULTIBUF_BeginEx() and GUI_MULTIBUF_EndEx() on each drawing function, Meanwhile I have tried a lot of possibilities to avoid this effect. For instance using extra Memory Device on each window and widget or drawing with late clipping mode ... By the way this problem occurs only just I'm using Multilayer.

    I'm really helplessly at the moment and don't know where and how the poblem could be fixed. About any help I would be really pleased. Thx!

    King regards
    Manfred
  • Hi Manfred,

    I tried to reproduce the issue, but it is working just fine.

    I'm not sure if I set up your scenario properly. I configured emWin to use 2 layers. Layer 0 draws an image (a DTA file) over the whole screen. The second layer is transparent. In the second layer I have created two buttons and three window. Of the windows only one is visible at the same time. On button press the visible window gets hidden and the next gets visible.

    Attached is the application I used for this.

    Calling WM_MULTIBUF_Begin() and WM_MULTIBUF_End() while inside WM_PAINT is not necessary. The window manager does this automatically before entering and after leaving WM_PAINT. A call of WM_MULTIBUF_Enable(1) should be sufficient.

    Maybe you can send me your configuration files and a simple application which shows the behavior.

    Which version of emWin are you using?

    Regards,
    Sven
    Files
    • Sample.zip

      (101.2 kB, downloaded 582 times, last: )
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.