Multiple buffering

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

  • Multiple buffering

    Hello,

    i am trying to setup my LPC1788 for using Multiple buffering, but so far I enable a second buffer, the screen shows nothing.

    Here is my LCD_X_SHOWBUFFER case:

    case LCD_X_SHOWBUFFER: {
    LCD_X_SHOWBUFFER_INFO * p;
    p = (LCD_X_SHOWBUFFER_INFO *)pData;
    //
    // Calculate address of the given buffer
    //
    BufferSize = (XSIZE * YSIZE * 16) / 8;
    Addr = VRAM_ADDR_PHYS + BufferSize * p->Index;
    //
    // Make the given buffer visible
    //

    LPC_LCD->UPBASE = Addr;

    //
    // Send a confirmation that the buffer is visible now
    //
    GUI_MULTIBUF_Confirm(p->Index);
    }
    return 0;

    I don´t understand, what I am doing wrong.
    Can you please suggest how to do this.

    Best regards,
    marsal
  • Hello Adrian,

    Thank you for your reply.
    The "CopyBuffer" function is called after creating the display driver:

    GUI_DEVICE_CreateAndLink(GUIDRV_LIN_16, COLOR_CONVERSION, 0, 0);
    // Set custom callback function for copy operation
    LCD_SetDevFunc(0, LCD_DEVFUNC_COPYBUFFER, (void (*)())_CopyBuffer);

    Here is CopyBuffer function:

    static void _CopyBuffer(int LayerIndex, int IndexSrc, int IndexDst) {
    unsigned long BufferSize, AddrSrc, AddrDst;
    // int i;
    // int BITSPERPIXEL=LCD_GetBitsPerPixelEx(i);
    //
    // Calculate the size of one frame buffer
    //
    BufferSize = (XSIZE * YSIZE * 16) / 8;
    //
    // Calculate source- and destination address
    //
    AddrSrc = /*_VRamBaseAddr*/VRAM_ADDR_PHYS + BufferSize * IndexSrc;
    AddrDst = /*_VRamBaseAddr*/VRAM_ADDR_PHYS + BufferSize * IndexDst;
    memcpy((void *)AddrDst, (void *)AddrSrc, BufferSize);
    }

    I have checked all functions and it seems everything be right, but it works not.

    Thank you,
    marsal

    The post was edited 2 times, last by marsal ().

  • Hello marsal,

    I would recommend to follow exactly the steps to implement multiple buffering as they are described in the chapter "Multiple Buffering" in the emWin documentation. Please note the requirements which are also listed there.

    Best regards,
    Adrian
  • Hello Adrian,

    I have tried to output a value from "VRAM_ADDR_PHYS" variable in the "_CopyBuffer" function:

    //---------------------------------------------------------------------------------------
    static void _CopyBuffer(int LayerIndex, int IndexSrc, int IndexDst) {
    unsigned long BufferSize, AddrSrc, AddrDst;

    BufferSize = (XSIZE * YSIZE * 16) / 8; // Calculate the size of one frame buffer

    GUI_SetColor(0x7CFC00);
    GUI_DispDecAt(VRAM_ADDR_PHYS,500,30, 10);

    AddrSrc = /*_VRamBaseAddr*/VRAM_ADDR_PHYS + BufferSize * IndexSrc;
    AddrDst = /*_VRamBaseAddr*/VRAM_ADDR_PHYS + BufferSize * IndexDst;

    memcpy((void *)AddrDst, (void *)AddrSrc, BufferSize);
    }
    //---------------------------------------------------------------------------------------

    On the screen appears only "-".

    If I print out the Buffer variable, than it appears a right Value of "768000".
    After this function is executed, the board hangs and does nothing from main function.

    Therefore I assume, that "VRAM_ADDR_PHYS" is not defined.
    How can I define the base video RAM address, that is allocated on my LPC1788 board?

    Best regards,
    marsal

    The post was edited 3 times, last by marsal ().