[mythtv] DPMS inhibit issues in 0.28
Stuart Auchterlonie
stuarta at squashedfrog.net
Mon Apr 27 11:58:04 UTC 2015
On 26/04/15 19:34, Michael T. Dean wrote:
> On 04/26/2015 02:10 PM, Michael T. Dean wrote:
>> On 04/25/2015 11:57 AM, dennis wrote:
>>>
>>>
>>> On 04/25/2015 10:10 AM, Jim Stichnoth wrote:
>>>> On Sat, Apr 25, 2015 at 7:21 AM, dennis <deg at outlook.com
>>>> <mailto:deg at outlook.com>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm running ubuntu 14.04 but not using gnome screensaver and
>>>> using DPMS to shut the monitor off after 10 minutes of
>>>> inactivity. It appears that inhibit DPMS is no longer working in
>>>> in the latest build of 0.28, after 10 minutes of watching TV my
>>>> screen goes blank by DPMS. I have noticed some changes in the
>>>> logs when starting and stopping playback and no longer seeing
>>>> DPMS messages.
>>>>
>>>>
>>>> https://code.mythtv.org/trac/ticket/12435
>>>> https://code.mythtv.org/trac/ticket/12438
>>>>
>>>> These are being looked into, but that's the risk you take running
>>>> master. :)
>>>>
>>>
>>> Just thought I would ask before creating a ticket to report it. It
>>> didn't show up yet in a google search.
>>>
>>> I was aware of commits in this area before building, so I wasn't
>>> surprised that there was some regression here. I enjoy debugging and
>>> digging into code. I see the risk as fun, and helping to making the
>>> project better :)
>>
>> If you're compiling your own build of MythTV, just get rid of the
>> compile-time check that forces the use of the DBus screensaver control
>> and instead make it use the X11 screensaver control:
>>
>> https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythui/screensaver.cpp#L27
>>
>>
>> Until Stuart writes support for runtime checking of which screensaver
>> controller to use, if you're compiling with DBus support, you won't
>> get the X11 screensaver support (which allows use of DPMS or
>> xscreensaver), nor will you get the OS X screensaver support.
>>
>> Mike
>
> FWIW, if anyone is interested in working on a patch, the new code will
> have to be changed to do a runtime check, something like:
>
> https://github.com/MythTV/mythtv/commit/dd96b80f#diff-e68a289d9e5d8b92bd9d39461cf38ea2
>
>
> but the challenge is properly detecting whether DBus control will
> actually work. Unfortunately, the only "required" DBus methods in the
> Freedesktop specification are Inhibit and Uninhibit (
> http://people.freedesktop.org/~hadess/idle-inhibition-spec/re01.html)
> and there are none to say whether a DBus-enabled screensaver is actually
> running (and, if nothing else GNOME3/gnome-shell screen saver implements
> only the required methods, so we can't assume others will be there).
There is no way of testing if the DBus methods will work.
You fire the event off to dbus, and if there is anything listening
to that event it will then take the requested action (ie. inhibit
saver)
>
> Therefore, my recommendation would be to move the DPMS-support out of
> screensaver-x11.cpp and into a ScreenSaverDPMS helper class (which has
> the code to detect whether DPMS is enabled, as well as DisableDPMS and
> RestoreDPMS), then move the code that checks whether xscreensaver is
> active:
>
> https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythui/screensaver-x11.cpp#L40
>
Yes, screensaver-x11 needs refactoring to separate out the dpms handling
from the xscreensaver handling.
>
> into a static function in ScreenSaverX11. Then, change ScreenSaverX11
> /and/ ScreenSaverDBus to make calls to ScreenSaverDPMS in addition to
> their xscreensaver/DBus activities and the detection code would be
> something like:
>
> #if defined(USING_X11)
> #if defined(USING_DBUS)
> if (ScreenSaverX11::IsXScreenSaverRunning())
> #endif // USING_DBUS
> ScreenSaverSingleton = new ScreenSaverX11();
> #if defined(USING_DBUS)
> else
> ScreenSaverSingleton = new ScreenSaverDBus();
> #endif // USING_DBUS
> #elif CONFIG_DARWIN
>
> where the above assumes that DBus screensaver control is only valid on
> X11-based systems, which I think is correct(?).
It's not going to end up as a singleton in the future.
I can already see i'm going to have to rewrite that part
in order to control multiple methods, ie dbus + xscreensaver
or to allow fallback to the darwin version etc etc.
>
> This way, if xscreensaver is running (which is the only way the
> xscreensaver control will work), we use its control mechanism (since it
> does not and will not support DBus). Otherwise, we use DBus control.
> Since we can't know if DBus control will work, DBus control has to be
> the fallback. And, we still make DPMS calls (if DPMS is enabled on the
> server) whether we use xscreensaver or DBus to control the actual
> screensaver. However, if MythTV is compiled without DBus support, we
> will just use the xscreensaver control (which will still make DPMS calls).
It gets quite complicated, since on the modern distro's which use dbus,
dpms is tied in with the default screen save timeout, once that triggers
the screen goes to sleep.
In theory the DBus based approach should be sufficient, in practice, it
looks like this is not the case.
Regards
Stuart
>
> Mike
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
More information about the mythtv-dev
mailing list