<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-09-27 9:18 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">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>
</span>Screen brightness settings daemon? <br></blockquote><div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">Running on a laptop lacking an ambient light sensor employing it's webcam instead to measure ambient light and adjust monitors' brightnesses accordingly.</div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><br></div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> What exactly do you mean by "if it is<br>
set"? What interface are you using to change brightness?</blockquote><div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">The external monitor's brightness is adjusted <span class="gmail-st">by DDC/CI via the /dev/i2c-x the monitor is attached to.</span></div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><span class="gmail-st"> I there a saner interface to use?<br></span></div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><span class="gmail-st"><br></span></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> What happens<br>
when the display "gets confused"?<br></blockquote><div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">The monitor wrongly toggles sharpness if it receives the brightness adjusting</div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"> <span class="gmail-st">DDC/CI soon after resuming from power saving state.<br></span></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<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.</blockquote><div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">Calculating ambient light from pictures acquired via </div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">v4l2 in kernel seamed wrong to me.</div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Or that<br>
perhaps the userspace should be doing this in cooperation with the drm<br>
master, not standalone.<br></blockquote><div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">Is there a way to call into the drm-master (xscreensaver/xserver here</div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">) with the call only returning if a monitor's power state changed?</div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><br></div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">There is DPMSInfo, but it returns immediately rendering the daemon less efficient.</div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><br></div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><br></div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">BR,</div><div style="font-family:courier new,monospace;display:inline" class="gmail_default"><br></div><div style="font-family:courier new,monospace;display:inline" class="gmail_default">Karsten<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
BR,<br>
Jani.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
><br>
> Without the patch 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 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 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_<wbr>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(<wbr>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>
</div></div></blockquote></div><br></div></div>