Skip to main content
Associate
October 24, 2024
Solved

Headless TouchGFX in Windows

  • October 24, 2024
  • 3 replies
  • 984 views

Hello! First post on this forum.
I need to run automated testing of a TouchGFX application in an isolated environment.
The application takes screen snapshots and stores them to files.
It should not need a display to run if it can just render images to the display buffer and capture the result.
It runs on windows, and the framework I have uses docker containers, so it would be nice to
run headless, while still taking snapshots, in a windows build.
Is it possible to produce that kind of headless build? Would it run in a Windows Nano server container?
Best regards
/M

Best answer by LouisB

Hello @maste ,

First, welcome to TouchGFX community :).

We don't have this functionality out-of-the box, but it may be possible with few modifications :

1) In main.cpp add the line :

static_cast<touchgfx::HALSDL2 &>(hal).setWindowVisible(false, false)

 before 

 setupSimulator(argc, argv, hal);

2) Then the capture the framebuffer, you need to call :

uint16_t* fb = touchgfx::HAL::getInstance()->lockFrameBuffer()

dont forget to unlock it with unlockFrameBuffer() when you are done.

You can draw inspiration from the Lens demo where framebuffer operations are performed.

I hope it helps,

BR,

3 replies

LouisBBest answer
ST Employee
November 4, 2024

Hello @maste ,

First, welcome to TouchGFX community :).

We don't have this functionality out-of-the box, but it may be possible with few modifications :

1) In main.cpp add the line :

static_cast<touchgfx::HALSDL2 &>(hal).setWindowVisible(false, false)

 before 

 setupSimulator(argc, argv, hal);

2) Then the capture the framebuffer, you need to call :

uint16_t* fb = touchgfx::HAL::getInstance()->lockFrameBuffer()

dont forget to unlock it with unlockFrameBuffer() when you are done.

You can draw inspiration from the Lens demo where framebuffer operations are performed.

I hope it helps,

BR,

masteAuthor
Associate
November 15, 2024

I did not try myself but I got a message from the application developers, and they were
able to do it in approximately this way. I do not know any details, but it is a great relief for me
to know that this is not a showstopper. Thank you very much!

ferro
Lead
November 4, 2024
Senior
November 18, 2024

"Lens demo"
In 4.24.1, it called the "Custom Widget Example".

Thanks for the suggestion Louis.