[PATCH] drm: Call sysfs_notify after changing drm_connector::dpms

Karsten Wiese fzuuzf at googlemail.com
Wed Sep 27 10:38:54 UTC 2017


2017-09-27 10:45 GMT+02:00 Daniel Vetter <daniel at ffwll.ch>:

> On Wed, Sep 27, 2017 at 12:29:46AM +0200, Karsten Wiese wrote:
> > 2017-09-25 15:48 GMT+02:00 Jani Nikula <jani.nikula at linux.intel.com>:
> >
> > > On Tue, 19 Sep 2017, Karsten Wiese <fzuuzf at googlemail.com> wrote:
> > > > This makes poll work for the
> > > > /sys/class/drm/cardX/connectorY/dpms attributes.
> > >
> > > I guess the question is, what are you trying to achieve? What is the
> > > problem that this solves?
> > >
> > ​
> > The patch enables cpu cycle less waiting for dpms flag changes.
> >
> > Here it lets a screen brightness ​setting daemon know which monitor to
> > handle.
> > One of the attached screens gets confused if it is set just after being
> > switched on,
> > hence the daemon leaves it untouched until it has been active for some
> > seconds.
>
> Without knowing more details, but a brightness deamon in userspace sounds
> rather wrong. The driver is supposed to take care of this and shut down
> the backlight when we disable the output for a panel.
>
> > Without the p​atch the daemon would have to actively read the dpms flag
> > every once in a while.
>
> On top of that, any uabi changes need open source userspace.
>

​Will put publishing userspace on my list, if proposed uabi change​ is
agreed upon to be accepted once userspace is open sourced.
Or if I find another way of knowing monitors' power states using cpu cycles
only if said states have changed. Anybody?

BR,
Karsten

-Daniel
>
> >
> >
> > >
> > > We have zero sysfs_notify in all of drm AFAICT.
> >
> >
> > Yes I noticed too and looked for some dbus signal to listen to​ but
> didn't
> > find any.
> >
> > BR,
> > Karsten
> >
> > >
> > > BR,
> > > Jani.
> > >
> > >
> > > >
> > > > Tested with i915 suspended by XScreenServer and
> > > > suspend to RAM.
> > > >
> > > > Signed-off-by: Karsten Wiese <fzuuzf at googlemail.com>
> > > > ---
> > > >  drivers/gpu/drm/drm_atomic.c        | 4 ++++
> > > >  drivers/gpu/drm/drm_atomic_helper.c | 6 +++++-
> > > >  2 files changed, 9 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_atomic.c
> b/drivers/gpu/drm/drm_atomic.c
> > > > index 2fd383d..b6fa87b 100644
> > > > --- a/drivers/gpu/drm/drm_atomic.c
> > > > +++ b/drivers/gpu/drm/drm_atomic.c
> > > > @@ -1880,6 +1880,10 @@ int drm_atomic_connector_commit_dpms(struct
> > > drm_atomic_state *state,
> > > >  out:
> > > >       if (ret != 0)
> > > >               connector->dpms = old_mode;
> > > > +     else
> > > > +             if (connector->dpms != old_mode)
> > > > +                     sysfs_notify(&connector->kdev->kobj, NULL,
> > > "dpms");
> > > > +
> > > >       return ret;
> > > >  }
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> > > b/drivers/gpu/drm/drm_atomic_helper.c
> > > > index 4e53aae..6198772 100644
> > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > @@ -921,12 +921,16 @@ drm_atomic_helper_update_
> legacy_modeset_state(struct
> > > drm_device *dev,
> > > >               crtc = new_conn_state->crtc;
> > > >               if ((!crtc && old_conn_state->crtc) ||
> > > >                   (crtc && drm_atomic_crtc_needs_modeset(
> crtc->state)))
> > > {
> > > > -                     int mode = DRM_MODE_DPMS_OFF;
> > > > +                     int old_mode, mode = DRM_MODE_DPMS_OFF;
> > > >
> > > >                       if (crtc && crtc->state->active)
> > > >                               mode = DRM_MODE_DPMS_ON;
> > > >
> > > > +                     old_mode = connector->dpms;
> > > >                       connector->dpms = mode;
> > > > +                     if (old_mode != mode)
> > > > +                             sysfs_notify(&connector->kdev->kobj,
> > > > +                                             NULL, "dpms");
> > > >               }
> > > >       }
> > >
> > > --
> > > Jani Nikula, Intel Open Source Technology Center
> > >
>
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20170927/1d41314d/attachment-0001.html>


More information about the dri-devel mailing list