cancel
Showing results for 
Search instead for 
Did you mean: 

How do I render GFX using a GPU?

Jack li1
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

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

View solution in original post

2 REPLIES 2
Alexandre RENOUX
Principal

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
Chief III

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