14

I'm running the Qt5 application on my raspberry pi and I would like to introduce some kind of a power-saving feature.

I don't use x11 or wayland, because I don't need it, but I use gles2 (OpenGL for Embedded Systems).

I want to use tvservice --off and tvservice --preferred to toggle between turned off / turned on screen.

My problem is that when I call tvservice --preferred the display turns on but the screen is black (no application output is shown).

Question:
How can I turn it on and see the application that was running previously?

Tested:
When I restart the Qt5 application - it's being displayed correctly.

Changing foreground virtual terminal with chvt (as suggested here) does not help.

Changing framebuffer depth to different and back again with fbset -depth 16 ; fbset -depth 32 (I've seen it on some forum, cannot find which) also does not help.

Any ideas?

goldilocks
  • 60,325
  • 17
  • 117
  • 234
lewiatan
  • 733
  • 2
  • 9
  • 16

1 Answers1

31

tvservice is not the best to turn off and on the screen.

Much better way to do this (found after a day of searching) is using vcgencmd command (more on this here).

vcgencmd display_power 0 turns off the screen

vcgencmd display_power 1 turns on the screen

This allows the Qt application to be visible on the screen after turning it off and back on.

lewiatan
  • 733
  • 2
  • 9
  • 16