534 views
in System Integration by

Hello Embedded Wizard team.

We are using Embedded Wizard on a custom board we created ourselves to generate a measurement graph using TextView and Views::StrokePath.
The platforms are as follows

STM32MP1 - OpenGL - DRM
- STM32MP157
- OpenGL 2.0 ES
- LCD 640x480 dot

I would like to capture this composited screen and output it to a png file.
Is there a solution to get the screen data in this case?

I checked the Ask site and found a way to get the frame buffer, but this method does not seem to work when using the OpenGL-subsystem, as the frame buffer cannot be obtained.

Framebuffer dump data

1 Answer

+1 vote
by
Hello,

there are no possibilities to access the resulting framebuffer via OpenGL You can try to hook into the memory that is managed by DRM, but tI'm not aware of a recommended way to access that.

Best regards,

Manfred.
by

Hi Paul.

Thanks for your reply.
I understand that there is no recommended way to get the frame buffer.

I am trying to find another way to get the image data,
I have confirmed that I can get the image data using the glReadPixels function.
Here is an example of a modified DumpFramebuffer function in the sample program.
Is this method inappropriate?

static void DumpFramebuffer( XBitmap* aBitmap )
{
  if ( !aBitmap )
    return;

  /* lock the entire bitmap for read operation */
  EwPrint("Lock bitmap with size %d x %d\n", aBitmap->FrameSize.X, aBitmap->FrameSize.Y );

  glReadPixels(0, 0, aBitmap->FrameSize.X, aBitmap->FrameSize.Y, GL_RGB, GL_UNSIGNED_BYTE, &pngbuff);

  write_png_file(CAPFILE, aBitmap->FrameSize.X, aBitmap->FrameSize.Y, pngbuff);
  EwPrint("%s file write\n",CAPFILE );  //


}

Also, some popups are not reflected in the image data and the data seems to be inverted in the X direction.

Any advice would be appreciated.

 

Best regards

S.Onodera

by

Hello,

from our experience with glReadPixels() the function was really slow and therefore of little use at the runtime of a GUI application. To create a simple snapshot of the framebuffer content from time to time it is possibly appropriate. However, we did not test this application case further.

Also, some popups are not reflected in the image data and the data seems to be inverted in the X direction.

Possibly, the glFlush() invocation could help to force outstanding drawing operations to be written into the framebuffer bevor you invoke glReadPixels(). Then you will eventually need to post process the received data (e.g. mirror the contents, etc.).

Best regards

Paul Banach

by
Hi Paul and Manfred

As you point out, the process is very slow, taking about 400ms to retrieve the image.
However, the purpose is to snapshot the data, so we will continue to use this method if there is no alternative.

The data flipping was done by reordering the data after it was received, and for the popups, adjusting the glFlush() call and the timing of the execution worked well.

Thanks for the guidance.

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...