Skip to main content
Jack li1
Associate III
July 31, 2020
Solved

How do I render GFX using a GPU?

  • July 31, 2020
  • 2 replies
  • 1175 views

I wonder whether it is feasible to use 3D GPU on stm32MP1 instead of DMA2D?

This topic has been closed for replies.
Best answer by Martin KJELDSEN

It would be possible, yes. It's not something we have attempted yet, because the MP1 is a bit out of scope for us. Granted, you could run TouchGFX on the M4. I've only done some preliminary tests, but since it's not a priority for us i haven't dedicated any time to it.

To be able to use it with the current implementation of TouchGFX, you'd have to use the current DMA interface which uses BlitOp's. Check out the BlitOp Type. It specifies a src, a dst, steps and loops, etc.

struct BlitOp
{
 uint32_t operation; ///< The operation to perform @see BlitOperations
 const uint16_t* pSrc; ///< Pointer to the source (pixels or indexes)
 const uint16_t* pClut; ///< Pointer to the source CLUT entires
 uint16_t* pDst; ///< Pointer to the destination
 uint16_t nSteps; ///< The number of pixels in a line
 uint16_t nLoops; ///< The number of lines
 uint16_t srcLoopStride; ///< The number of bytes to stride the source after every loop
 uint16_t dstLoopStride; ///< The number of bytes to stride the destination after every loop
 colortype color; ///< Color to fill
 uint16_t alpha; ///< The alpha to use
 uint16_t srcFormat; ///< The source format @see Bitmap::BitmapFormat
 uint16_t dstFormat; ///< The destination format @see Bitmap::BitmapFormat
};

For any specific features, like rotation and scaling you could create your own custom widgets and then implement the functionality in the ::draw() function hooking directly into the GPU API. But you need to come up with a mechanism that protects the framebuffer in the same way that we do for DMA2D. And this is a bit different on Linux. Not to mention that you need a new, customized HAL to run on top of Linux. I have one that runs on a Raspberry pi, but it's highly unofficial.

/Martin

2 replies

Alexandre RENOUX
Visitor II
July 31, 2020

Hello,

TouchGFX is not made for real 3D rendering. The framebuffer is only 2D.

Also, we do not have any TouchGFX example running on stm32MP1.

What you are trying to do has never been thought of, so unfortunately, we cannot help you on that.

/Alexandre

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
August 28, 2020

It would be possible, yes. It's not something we have attempted yet, because the MP1 is a bit out of scope for us. Granted, you could run TouchGFX on the M4. I've only done some preliminary tests, but since it's not a priority for us i haven't dedicated any time to it.

To be able to use it with the current implementation of TouchGFX, you'd have to use the current DMA interface which uses BlitOp's. Check out the BlitOp Type. It specifies a src, a dst, steps and loops, etc.

struct BlitOp
{
 uint32_t operation; ///< The operation to perform @see BlitOperations
 const uint16_t* pSrc; ///< Pointer to the source (pixels or indexes)
 const uint16_t* pClut; ///< Pointer to the source CLUT entires
 uint16_t* pDst; ///< Pointer to the destination
 uint16_t nSteps; ///< The number of pixels in a line
 uint16_t nLoops; ///< The number of lines
 uint16_t srcLoopStride; ///< The number of bytes to stride the source after every loop
 uint16_t dstLoopStride; ///< The number of bytes to stride the destination after every loop
 colortype color; ///< Color to fill
 uint16_t alpha; ///< The alpha to use
 uint16_t srcFormat; ///< The source format @see Bitmap::BitmapFormat
 uint16_t dstFormat; ///< The destination format @see Bitmap::BitmapFormat
};

For any specific features, like rotation and scaling you could create your own custom widgets and then implement the functionality in the ::draw() function hooking directly into the GPU API. But you need to come up with a mechanism that protects the framebuffer in the same way that we do for DMA2D. And this is a bit different on Linux. Not to mention that you need a new, customized HAL to run on top of Linux. I have one that runs on a Raspberry pi, but it's highly unofficial.

/Martin