132 views
in System Integration by

About Row-Level Partial Refresh


Our project environment:
display deriver ic: ST7568S
Embedded Wizard: version<11>, PlatformPackage<Generic.Software.LumA44>, ScreenSize<128,160> OutputFileNameExtension<c>set 

EW_BSP_DISPLAY_UPDATE_SCRATCHPAD

Scratch-pad Buffer

 


In this case, our DDIC is  based on Row-Level Partial Refresh.
That means that we have to reflash the Frame Buffer with entire row, not individual pixels.
Sometimes, the variable "updateRect"( return from CoreRoot__GetUpdateRegion ) is not expected values with entire row.

Is there any solution to solve this problem?

 

Thank you,

Charles

 

static void EwUpdate( XViewport* aViewport, CoreRoot aApplication )
{
  XBitmap*       bitmap;
  GraphicsCanvas canvas     = EwNewObject( GraphicsCanvas, 0 );
  XRect          updateRect = {{ 0, 0 }, { 0, 0 }};
  updateRect.

  if ( !canvas )
    return;

  if ( DisplayInfo.UpdateMode == EW_BSP_DISPLAY_UPDATE_NORMAL )
  {
    bitmap = EwBeginUpdate( aViewport );

    /* redraw the dirty area of the screen */
    if ( bitmap  )
    {
      GraphicsCanvas__AttachBitmap( canvas, (XHandle)bitmap );
      updateRect = CoreRoot__UpdateGE20( aApplication, canvas );
      GraphicsCanvas__DetachBitmap( canvas );
      EwEndUpdate( aViewport, updateRect );
    }
  }
  else
  {
    int regions = CoreRoot__BeginUpdate( aApplication );

    while ( regions-- )
    {
      /* get rectangular area of the update region for scratch-pad buffer */
      if ( DisplayInfo.UpdateMode == EW_BSP_DISPLAY_UPDATE_SCRATCHPAD )
        updateRect = CoreRoot__GetUpdateRegion( aApplication, regions );

      /* iterate through all update areas */
      while ( EwBspDisplayGetUpdateArea( &updateRect ))
      {
        /* update the current subarea */
        bitmap = EwBeginUpdateArea( aViewport, updateRect );
        GraphicsCanvas__AttachBitmap( canvas, (XHandle)bitmap );
        CoreRoot__UpdateCanvas( aApplication, canvas, updateRect.Point1 );
        GraphicsCanvas__DetachBitmap( canvas );
        EwEndUpdate( aViewport, updateRect );
      }

      if ( DisplayInfo.UpdateMode != EW_BSP_DISPLAY_UPDATE_SCRATCHPAD )
        break;
    }
    CoreRoot__EndUpdate( aApplication );
  }
}

 

 

 

 

1 Answer

0 votes
by

Hello,

originally, the scratch-pad buffer approach is designed to update one region after the other with a configurable size of the scratch-pad buffer.

In your case, when the display requires the update of complete lines, you can try the following:

First, iterate through the regions and accumulate the updateRect. So you know the entire area that has to be redrawn. Then, adjust the updateRect so that it covers the full display width. Finally, you can update the display with the inner while loop.

Let me know if it works...

Best regards,
Manfred.

by

Hi Support,
 

Here is the updated code after my modifications.
I have added four lines to enforce changing the variable "updateRect" to the full width and height(128,160).

    while ( regions-- )
    {
      /* get rectangular area of the update region for scratch-pad buffer */
      if ( DisplayInfo.UpdateMode == EW_BSP_DISPLAY_UPDATE_SCRATCHPAD )
        updateRect = CoreRoot__GetUpdateRegion( aApplication, regions );

      updateRect.Point1.X = 0;
      updateRect.Point1.Y = 0;
      updateRect.Point2.X = 128;
      updateRect.Point2.Y = 160;
      
      /* iterate through all update areas */
      while ( EwBspDisplayGetUpdateArea( &updateRect ))
      {
        /* update the current subarea */
        bitmap = EwBeginUpdateArea( aViewport, updateRect );
        GraphicsCanvas__AttachBitmap( canvas, (XHandle)bitmap );
        CoreRoot__UpdateCanvas( aApplication, canvas, updateRect.Point1 );
        GraphicsCanvas__DetachBitmap( canvas );
        EwEndUpdate( aViewport, updateRect );
      }

      if ( DisplayInfo.UpdateMode != EW_BSP_DISPLAY_UPDATE_SCRATCHPAD )
        break;
    }

 




After making the modifications, I noticed some issues with the display.

Picture:   
Left is the screen after for update with (updateRect = <Point1<0,0> Point2<120,160>>)
Right is the screen after a update with(updateRect = <Point1<0,129> Point2<120,160>>)


Is my modifications correct?

 

 

Best Regards,
Charles.

 

by

Hi Charles,

maybe you can try this modified code:

static void EwUpdate( XViewport* aViewport, CoreRoot aApplication )
{
  XBitmap*       bitmap;
  GraphicsCanvas canvas     = EwNewObject( GraphicsCanvas, 0 );
  XRect          updateRect = {{ 0, 0 }, { 0, 0 }};

  if ( !canvas )
    return;

  if ( DisplayInfo.UpdateMode == EW_BSP_DISPLAY_UPDATE_NORMAL )
  {
    bitmap = EwBeginUpdate( aViewport );

    /* redraw the dirty area of the screen */
    if ( bitmap  )
    {
      GraphicsCanvas__AttachBitmap( canvas, (XHandle)bitmap );
      updateRect = CoreRoot__UpdateGE20( aApplication, canvas );
      GraphicsCanvas__DetachBitmap( canvas );
      EwEndUpdate( aViewport, updateRect );
    }
  }
  else
  {
    int regions = CoreRoot__BeginUpdate( aApplication );

    while ( regions-- )
    {
      /* accumulate all rectangular areas of the update region */
      if ( DisplayInfo.UpdateMode == EW_BSP_DISPLAY_UPDATE_SCRATCHPAD )
        updateRect = EwUnionRect( updateRect, CoreRoot__GetUpdateRegion( aApplication, regions ));

      /* ensure that always complete display rows are updated */
      updateRect.Point1.X = 0;
      updateRect.Point2.X = 128;
    }
    
    if ( !EwIsRectEmpty( updateRect ))
    {  
      /* iterate through all update areas */
      while ( EwBspDisplayGetUpdateArea( &updateRect ))
      {
        /* update the current subarea */
        bitmap = EwBeginUpdateArea( aViewport, updateRect );
        GraphicsCanvas__AttachBitmap( canvas, (XHandle)bitmap );
        CoreRoot__UpdateCanvas( aApplication, canvas, updateRect.Point1 );
        GraphicsCanvas__DetachBitmap( canvas );
        EwEndUpdate( aViewport, updateRect );
      }

      if ( DisplayInfo.UpdateMode != EW_BSP_DISPLAY_UPDATE_SCRATCHPAD )
        break;
    }
    CoreRoot__EndUpdate( aApplication );
  }
}

I did not test this code - but at least you can get the idea:

First, iterate through the regions and accumulate the updateRect. So you know the entire area that has to be redrawn. Then, adjust the updateRect so that it covers the full display width. Finally, you can update the display with the inner while loop.

Let me know if it works...

Best regards,

Manfred.

by

Hi Manfred, 

First, I remove two lines code in your solution, because they were causing a compiler error.I suspect that they were unnecessary, right?

Then, I tried this solution you provided, but is still has some issues.


After testing, we have two possible scenarios.
Please take a look and let me know if my guess is correct.

1. Even after we modified the updateRect, it still only updates the original range.

2. It do not initialize the frame buffer in each update, causing to use the content from other range.

How can we fix this issue?

Thanks,

Best regards,

Charles.

 

 

by
Hi Charles,

as mentioned I did not test the code snippet. Maybe you can share your current version so that we have the same view on the code.

There is no need to initialize the scratch-pad buffer - it will be updated with the proper GUI content.

Btw: Maybe you can share also your ew_bsp_display.c file, that makes the transfer to the display.

Best regards,

Manfred

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...