Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off xset screensaver and dpms (energy star) modes #247

Closed
wants to merge 1 commit into from
Closed

Turn off xset screensaver and dpms (energy star) modes #247

wants to merge 1 commit into from

Conversation

ktws
Copy link

@ktws ktws commented Sep 5, 2014

@popcornmix New rpi firmware disables omxplayer video and audio when xset screensaver turns on. Disable on omxplayer start, re-enable on exit.

I'm new to shell scripting so not exactly sure if this is the best way to do it, but it works. Feel free to reject if it's not up to scratch.

New rpi firmware disables omxplayer video and audio when xset screensaver turns on. Disable on omxplayer start, re-enable on exit.
@KenT2
Copy link

KenT2 commented Sep 5, 2014

Not sure this is a good idea. Where omxplayer is embedded in an application (e.g. Pi Presents) which needs the screensaver disabled continually this patch will re-enable it at the end of each video :-(

Disabling of screensaver should be in the script that calls omxplayer.

@VittGam
Copy link

VittGam commented Sep 5, 2014

Is it possible to have a firmware switch to disable this behaviour firmware-side? I find it useful to have the X or console screen go black in power saving mode after some minutes while I'm playing videos. I know there is already a command line switch to go black, but I like the previous behaviour of being able to wake the X screen with the mouse for some minutes while playing, to eg. see the clock or the CPU graph (I've got a 5:4 1280x1024 screen of course hehe, I hate 16:9 screens....).

Also, maybe the firmware should only turn video processing off along with the screen, and not audio too...

@popcornmix
Copy link
Owner

@ktws presumably xset only helps when running X? Do we need to use setterm to achieve the same effect when launching from console (outside of X)? And as @KenT2 says, we don't want to enable screensaver if it was originally disabled.

@VittGam HDMI audio and video share the same physical channel and so cannot be disabled independently.

I agree we want to change something, but I'm undecided on the best place to fix this.
Possibly the firmware should kill hdmi only when the blank method is requested and there are no other dispmanx layers active (omxplayer will add a dispmanx layer when playing video).

A config.txt override is probably useful if some users prefer the hdmi output not be shut down.

@ktws
Copy link
Author

ktws commented Sep 5, 2014

@KenT2 @popcornmix Knocked up the code below which querys "xset -q" to see if DPMS or screensaver are on and, if they are, set to off. Then on-exit reset to original values. Thoughts?

Just did some tests and yes, "setterm -powersave off -blank 0" is needed. You can query "sudo cat /sys/module/kernel/parameters/consoleblank" to find blanking time in seconds but I can't find a way to query the powersave state. Any suggestions where I could find this? It would then be possible to set setterm is in the same way xset is set int the code below.

ON-STARTUP:

if [ ! -z $xset_bin ]; then
  xset_status_cmd="$xset_bin -q"
  xset_status_data="$($xset_status_cmd)"

  if [[ $xset_status_data =~ "DPMS is Enabled" ]]; then
    xset_dpms_flag=1
    $xset_bin -dpms
    echo "Debug: xset DPMS disabled";
  fi

  if [[ ! $xset_status_data =~ "timeout:  0" ]]; then
    xset_screensaver_flag=1
    $xset_bin s off
    echo "Debug: xset screensaver disabled";
  fi
fi

ON-EXIT:

if [ ! -z $xset_bin ]; then
  if [ ! -z $xset_screensaver_flag ]; then
    $xset_bin s on
    echo "Debug: xset screensaver enabled";
  fi

  if [ ! -z $xset_dpms_flag ]; then
    $xset_bin +dpms
    echo "Debug: xset dpms enabled";
  fi
fi

@KenT2
Copy link

KenT2 commented Sep 6, 2014

It seems to me that to blank videos when the screensaver kicks in is the intuitively correct solution for most occasions. However I can see there is a good reason for wanting not to blank omxplayer at this time. How about then as an alternative to @ktws solution to have an omxplayer option --noscreensaver (or whatever) which will disable the blanking for omxplayer.

@popcornmix the config.txt looks good as well. I just wondered if there were other uses of dispmanx for which the user would not want to disable blanking, also if there are other non-framebuffer layers (e.g. opengles) that need to be considered. (Ignore this if I'm talking rubbish).

@cleverca22
Copy link

the proper solution is XScreenSaverSuspend as seen in https://github.com/pigoz/mplayer-svn/blob/master/libvo/x11_common.c#L1488

that will suspend the timer, and resume it later
if the screensaver was already off, it wont force it on
if omxplayer crashes and disconnects from xorg without resuming things, it automaticaly resumes

but that would require adding some x11 support to omxplayer while still being able to fall back when it cant connect

popcornmix added a commit to raspberrypi/firmware that referenced this pull request Sep 8, 2014
firmware: Add config option hdmi_blanking to allow hdmi output to be disabled when framebuffer is blanked
See: popcornmix/omxplayer#247

firmware: Keep built files out of source tree to avoid tainted builds
See: Hexxeh/rpi-update#146
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Sep 8, 2014
firmware: Add config option hdmi_blanking to allow hdmi output to be disabled when framebuffer is blanked
See: popcornmix/omxplayer#247

firmware: Keep built files out of source tree to avoid tainted builds
See: Hexxeh/rpi-update#146
@popcornmix
Copy link
Owner

Latest firmware makes the hdmi disable on framebuffer blank disabled by default.
Add hdmi_blanking=1 to enable it.

It may be enabled by default in the future when either the firmware uses info on other dispmanx layers being active (e.g. from omxplayer, GL ES, camera preview etc) to be more sure that disabling hdmi is safe, or when the host apps are correctly disabling blanking when display is active.

@ktws ktws closed this Oct 10, 2014
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this pull request Feb 27, 2017
firmware: Add config option hdmi_blanking to allow hdmi output to be disabled when framebuffer is blanked
See: popcornmix/omxplayer#247

firmware: Keep built files out of source tree to avoid tainted builds
See: Hexxeh/rpi-update#146
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants