Bounding Unicorns

How To Disable DPMS in Linux

You would think that xset -dpms would in fact disable DPMS, as advertised, but you'd be wrong.

It is also necessary to disable the screen saver setting via xset. Apparently even without a screen saver program running, X itself tries to activate the screen saver, and it doing so turns off the monitor.

So, the following is an xset q report on a new installation:

% xset q
...
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
...
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Enabled
  Monitor is On

After 10 minutes, DPMS kicks in, computer turns off video output, and xset q reports:

% xset q
...
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
...
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Enabled
  Monitor is Off

Now, running xset -dpms disables DPMS, but 10 minutes later the video output is still turned off. xset q reports:

% xset q
...
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
...
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Disabled

Note that the monitor on/off status is no longer displayed when DPMS is shown as being disabled, but the computer nonetheless turns off monitor output even though DPMS is supposedly off.

The hint for this was given here.

To verify that the culprit is the screen saver, enable dpms and set the screen saver timeout to 10 seconds:

% xset s 10
% xset dpms 600 600 600

If you issue these commands but do not force the monitor to be on (via xset dpms force on), xset q will report the monitor as being on while the computer physically produces no output. After turning the monitor on via

% xset dpms force on

... and waiting 10 seconds, we get:

% xset q            
...
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  10    cycle:  600
...
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Enabled
  Monitor is Off

Now, whatever "prefer blanking" means, the timeout for monitor off is clearly set to 600 seconds, yet after 10 seconds of inactivity the monitor is turned off by something. The something, in this case, is the internal screen saver logic of X.

To defeat it, you could run:

% xset s 0
% xset -dpms

Now xset q should report:

% xset q
...
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  0    cycle:  600
...
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Disabled

With screen saver timeout set to 0 and DPMS set to disabled, the computer should now provide video output indefinitely.

Sources: 1, 2.

Permanent Setup

To disable DPMS by default, place the following in /etc/X11/xorg.conf.d/no-dpms.conf:

Section "ServerFlags" Option "StandbyTime" "0" Option "SuspendTime" "0" Option "OffTime" "0" Option "BlankTime" "0" EndSection

Curiously, setting BlankTime to 0 alone sets all 3 of the DPMS timeouts to zero also, i.e. on my system the following configuration is sufficient:

Section "ServerFlags" Option "BlankTime" "0" EndSection

You can verify this with xset q:

% xset q
...
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  0    cycle:  600
...
DPMS (Energy Star):
  Standby: 0    Suspend: 0    Off: 0
  DPMS is Enabled
  Monitor is On

Source: here

The referenced wiki page suggests also setting DPMS option to false in the monitor section, as follows:

Section "Monitor"
    Identifier "LVDS0"
    Option "DPMS" "false"
EndSection

Section "ServerFlags"
    Option "StandbyTime" "0"
    Option "SuspendTime" "0"
    Option "OffTime" "0"
    Option "BlankTime" "0"
EndSection

Section "ServerLayout"
    Identifier "ServerLayout0"
EndSection

This didn't actually disable DPMS for me, as indicated by xset q. X log indicated that the monitor section was ignored. I suspect the monitor identifier also needs to be set correctly based on the particular outputs existing in the system.

As noted here, there is no way to lock the power management settings. The X server has a default that is set in the configuration file, xset can modify these settings at any time, and the settings can further be modified at any time by:

  • A screen saver,
  • A desktop environment component (xfce-power-manager is given as an example),
  • A media player (some turn screen savers off for the duration of video playback, this could reset or alter settings mentioned earlier),
  • A web browser, maybe (they get their tentacles in more and more operating system features).

power/control

Before figuring out that the screen saver functionality of X was the culprit in turning off video output, I did some spelunking in DRM to see if perhaps there was a driver setting responsible for the bizzarre behavior shown above. Under /sys/devices, under the DRM device (e.g. /sys/devices/pci0000:00/0000:00:02.0/drm on my system), there are various power/control files, e.g. /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1/power/control. These presumably control the kernel's automatic power management, and are operated by writing either on or auto into them.

Some relevant resources for setting all of the power/control interfaces to on: 1, 2.

There are also autosuspend files in the card device tree. These were enabled by default to do something as per this note.

Ultimately, the kernel's power management is not a factor. The monitor output is turned on by screen saver logic of X server, which sits way above the kernel, and when X turns off monitor output, it doesn't matter whether the kernel puts the card in power saving mode or not - there is still no video output.