<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-09-27 14:58 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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, 27 Sep 2017, Daniel Vetter <<a href="mailto:daniel@ffwll.ch">daniel@ffwll.ch</a>> wrote:<br>
> On Wed, Sep 27, 2017 at 12:20:21PM +0200, Karsten Wiese wrote:<br>
>> 2017-09-27 9:18 GMT+02:00 Jani Nikula <<a href="mailto:jani.nikula@linux.intel.com">jani.nikula@linux.intel.com</a>>:<br>
>><br>
>> > On Wed, 27 Sep 2017, Karsten Wiese <<a href="mailto:fzuuzf@googlemail.com">fzuuzf@googlemail.com</a>> wrote:<br>
>> > > 2017-09-25 15:48 GMT+02:00 Jani Nikula <<a href="mailto:jani.nikula@linux.intel.com">jani.nikula@linux.intel.com</a>>:<br>
>> > ><br>
>> > >> 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>
>> > >> I guess the question is, what are you trying to achieve? What is the<br>
>> > >> problem that this solves?<br>
>> > >><br>
>> > > ​<br>
>> > > The patch enables cpu cycle less waiting for dpms flag changes.<br>
>> > ><br>
>> > > Here it lets a screen brightness ​setting daemon know which monitor to<br>
>> > > handle.  One of the attached screens gets confused if it is set just<br>
>> > > after being switched on, hence the daemon leaves it untouched until it<br>
>> > > has been active for some seconds.<br>
>> ><br>
>> > Screen brightness settings daemon?<br>
>> ><br>
>> Running on a laptop lacking an ambient light sensor employing it's webcam<br>
>> instead to measure ambient light and adjust monitors' brightnesses<br>
>> accordingly.<br>
>><br>
>><br>
>> What exactly do you mean by "if it is<br>
>> > set"? What interface are you using to change brightness?<br>
>><br>
>> The external monitor's brightness is adjusted by DDC/CI via the /dev/i2c-x<br>
>> the monitor is attached to.<br>
>>  I there a saner interface to use?<br>
><br>
> There's supposed to be a backlight property on the panel, exposed by the X<br>
> driver. If there's not, then that needs to be fixed/adjusted.<br>
<br>
</div></div>For eDP/LVDS in Intel driver yes, for external displays not. For<br>
external displays DDC/CI is currently probably the best bet.<br>
<br>
However, DDC/CI is overall not very robust. I think we have prior bug<br>
reports about it, but it's never really been very high on our list of<br>
priorities.<br>
<span class=""><br>
> There's also plans to directly link that up on the kernel side, but that's<br>
> a bit more involved due to how screwed up the backlight driver design on<br>
> linux is right now.<br>
<br>
</span>It's going to take forever and a half before DDC/CI for external<br>
displays get that treatment, if ever.<br>
<br>
It still feels wrong to add sysfs notify support for just one of our<br>
properties, for just this one use case. In particular if the reason is<br>
to workaround bugs in another interface.<br></blockquote><div><br></div><div style="font-family:courier new,monospace" class="gmail_default">​Would you accept a patch supporting​ all relevant attributes?</div><br><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 class="HOEnZb"><div class="h5"><br>
<br>
> -Daniel<br>
><br>
>><br>
>> What happens<br>
>> > when the display "gets confused"?<br>
>> ><br>
>> The monitor wrongly toggles sharpness if it receives the brightness<br>
>> adjusting​<br>
>> ​ DDC/CI soon after resuming from power saving state.<br>
>><br>
>> ><br>
>> > My first instinct is that you're proposing a new kernel ABI to solve an<br>
>> > issue you shouldn't be solving in userspace to begin with.<br>
>><br>
>> Calculating ambient light from pictures acquired via ​<br>
>> ​v4l​2 in kernel seamed wrong to me.<br>
>><br>
>> Or that<br>
>> > perhaps the userspace should be doing this in cooperation with the drm<br>
>> > master, not standalone.<br>
>> ><br>
>> Is there a way to call into the drm-master (xscreensaver/xserver​ here​<br>
>> ​) ​with the call only returning if a monitor's power state changed?<br>
>><br>
>> There is DPMSInfo, but it returns immediately rendering the daemon less<br>
>> efficient.<br>
>><br>
>><br>
>> BR,<br>
>><br>
>> Karsten<br>
>><br>
>> ><br>
>> > BR,<br>
>> > Jani.<br>
>> ><br>
>> > ><br>
>> > > Without the p​atch the daemon would have to actively read the dpms flag<br>
>> > > every once in a while.<br>
>> > ><br>
>> > ><br>
>> > >><br>
>> > >> We have zero sysfs_notify in all of drm AFAICT.<br>
>> > ><br>
>> > ><br>
>> > > Yes I noticed too and looked for some dbus signal to listen to​ but<br>
>> > didn't<br>
>> > > find any.<br>
>> > ><br>
>> > > BR,<br>
>> > > Karsten<br>
>> > ><br>
>> > >><br>
>> > >> BR,<br>
>> > >> Jani.<br>
>> > >><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<br>
>> > 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<br>
>> > >> 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,<br>
>> > >> "dpms");<br>
>> > >> > +<br>
>> > >> >       return ret;<br>
>> > >> >  }<br>
>> > >> ><br>
>> > >> > diff --git a/drivers/gpu/drm/drm_atomic_<wbr>helper.c<br>
>> > >> 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_<br>
>> > legacy_modeset_state(struct<br>
>> > >> drm_device *dev,<br>
>> > >> >               crtc = new_conn_state->crtc;<br>
>> > >> >               if ((!crtc && old_conn_state->crtc) ||<br>
>> > >> >                   (crtc && drm_atomic_crtc_needs_modeset(<br>
>> > crtc->state)))<br>
>> > >> {<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>
>> > >> Jani Nikula, Intel Open Source Technology Center<br>
>> > >><br>
>> ><br>
>> > --<br>
>> > Jani Nikula, Intel Open Source Technology Center<br>
>> ><br>
><br>
>> ______________________________<wbr>_________________<br>
>> dri-devel mailing list<br>
>> <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.<wbr>org</a><br>
>> <a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/dri-devel</a><br>
<br>
--<br>
Jani Nikula, Intel Open Source Technology Center<br>
</div></div></blockquote></div><br></div></div>