<div dir="ltr"><div class="gmail_extra">2017-09-25 15:48 GMT+02:00 Jani Nikula <span dir="ltr"><<a href="mailto:jani.nikula@linux.intel.com" target="_blank">jani.nikula@linux.intel.com</a>></span>:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, 19 Sep 2017, Karsten Wiese <<a href="mailto:fzuuzf@googlemail.com">fzuuzf@googlemail.com</a>> wrote:<br>
> This makes poll work for the<br>
> /sys/class/drm/cardX/<wbr>connectorY/dpms attributes.<br>
<br>
</span>I guess the question is, what are you trying to achieve? What is the<br>
problem that this solves?<br></blockquote><div><div style="font-family:courier new,monospace" class="gmail_default">​</div><div style="font-family:courier new,monospace" class="gmail_default">The patch enables cpu cycle less waiting for dpms flag changes.<br></div><div style="font-family:courier new,monospace" class="gmail_default"><br></div><div style="font-family:courier new,monospace" class="gmail_default">Here it lets a screen brightness ​setting daemon know which monitor to handle.</div><div style="font-family:courier new,monospace" class="gmail_default">One of the attached screens gets confused if it is set just after being switched on,</div><div style="font-family:courier new,monospace" class="gmail_default">hence the daemon leaves it untouched until it has been active for some seconds.<br></div><div style="font-family:courier new,monospace" class="gmail_default"><br></div><div style="font-family:courier new,monospace" class="gmail_default">Without the p​atch the daemon would have to actively read the dpms flag every once in a while.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
We have zero sysfs_notify in all of drm AFAICT. </blockquote><div><br></div><div style="font-family:courier new,monospace" class="gmail_default">Yes I noticed too and looked for some dbus signal to listen to​ but didn't find any.</div><div style="font-family:courier new,monospace" class="gmail_default"><br></div><div style="font-family:courier new,monospace" class="gmail_default">BR,</div><div style="font-family:courier new,monospace" class="gmail_default">Karsten<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
BR,<br>
Jani.<br>
<div><div class="h5"><br>
<br>
><br>
> Tested with i915 suspended by XScreenServer and<br>
> suspend to RAM.<br>
><br>
> Signed-off-by: Karsten Wiese <<a href="mailto:fzuuzf@googlemail.com">fzuuzf@googlemail.com</a>><br>
> ---<br>
>  drivers/gpu/drm/drm_atomic.c        | 4 ++++<br>
>  drivers/gpu/drm/drm_atomic_<wbr>helper.c | 6 +++++-<br>
>  2 files changed, 9 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c<br>
> index 2fd383d..b6fa87b 100644<br>
> --- a/drivers/gpu/drm/drm_atomic.c<br>
> +++ b/drivers/gpu/drm/drm_atomic.c<br>
> @@ -1880,6 +1880,10 @@ int drm_atomic_connector_commit_<wbr>dpms(struct drm_atomic_state *state,<br>
>  out:<br>
>       if (ret != 0)<br>
>               connector->dpms = old_mode;<br>
> +     else<br>
> +             if (connector->dpms != old_mode)<br>
> +                     sysfs_notify(&connector->kdev-<wbr>>kobj, NULL, "dpms");<br>
> +<br>
>       return ret;<br>
>  }<br>
><br>
> diff --git a/drivers/gpu/drm/drm_atomic_<wbr>helper.c b/drivers/gpu/drm/drm_atomic_<wbr>helper.c<br>
> index 4e53aae..6198772 100644<br>
> --- a/drivers/gpu/drm/drm_atomic_<wbr>helper.c<br>
> +++ b/drivers/gpu/drm/drm_atomic_<wbr>helper.c<br>
> @@ -921,12 +921,16 @@ drm_atomic_helper_update_<wbr>legacy_modeset_state(struct drm_device *dev,<br>
>               crtc = new_conn_state->crtc;<br>
>               if ((!crtc && old_conn_state->crtc) ||<br>
>                   (crtc && drm_atomic_crtc_needs_modeset(<wbr>crtc->state))) {<br>
> -                     int mode = DRM_MODE_DPMS_OFF;<br>
> +                     int old_mode, mode = DRM_MODE_DPMS_OFF;<br>
><br>
>                       if (crtc && crtc->state->active)<br>
>                               mode = DRM_MODE_DPMS_ON;<br>
><br>
> +                     old_mode = connector->dpms;<br>
>                       connector->dpms = mode;<br>
> +                     if (old_mode != mode)<br>
> +                             sysfs_notify(&connector->kdev-<wbr>>kobj,<br>
> +                                             NULL, "dpms");<br>
>               }<br>
>       }<br>
<br>
--<br>
</div></div>Jani Nikula, Intel Open Source Technology Center<br>
</blockquote></div><br></div></div>