in System Integration by
Hi buddy,

I  have some questions about the conceptions of dirty-rects and partial update.

The context is that, we use ogl 9.30 package , thus gui is rendered by gpu.

We did some hack job in ew gfx code to make gui rendered to our off-screen frame buffer object (openGL conception), which means we do not want to send gui frame to display directly.

After glFinish, we can get the rendered gui from the fbo color buffer. This works for a long period of time. And now we find our gpu in a poor performance, even takes 30ms+ to draw one

gui frame, I guess it is because we use  the CoreGroup_InvalidateArea for the whole screen. thus, for each update, we redraw the whole screen content.

Now the question is, if we do not invoke CoreGroup_InvalidateArea in Update(), how can we get the rendering pass correctly working. As far as I know, we can get the dirty region in root object's

_this->regions, how can I use them to reduce the draw consumptions.




1 Answer

0 votes
Best answer

Hi Arnold,

without knowing your "hack" it is difficult to provide an exact answer. 

In our Embedded Wizard Build Environments for OpenGL based targets, the update of the screen is handled within the function EwUpdate() that you will find in the file ewmain.c.

Each time the GUI has changed, the Mosaic framework accumulates the affected areas. As soon as an (partial) update is necessary, EwUpdate() is called from the main loop:

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

  /* let's redraw the dirty area of the screen. Cover the returned bitmap
     objects within a canvas, so Mosaic can draw to it. */
  if ( bitmap && canvas )
    GraphicsCanvas__AttachBitmap( canvas, (XHandle)bitmap );
    updateRect = CoreRoot__UpdateGE20( aApplication, canvas );
    GraphicsCanvas__DetachBitmap( canvas );

  /* complete the update */
  if ( bitmap )
    EwEndUpdate( aViewport, updateRect );

The updateRect contains the dirty area that was redrawn.

Does this help?

Best regards,


Embedded Wizard Website | Privacy Policy | Imprint