cancel
Showing results for 
Search instead for 
Did you mean: 

Headless TouchGFX in Windows

maste
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions
LouisB
ST Employee

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,

Louis BOUDO
ST Software Developer | TouchGFX

View solution in original post

4 REPLIES 4
LouisB
ST Employee

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,

Louis BOUDO
ST Software Developer | TouchGFX
ferro
Senior III

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!

Marc_LM
Associate III

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

Thanks for the suggestion Louis.