public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Peres, Martin" <martin.peres@intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v3 0/3] Send a hotplug when edid changes
Date: Tue, 3 Sep 2019 17:49:31 +0200	[thread overview]
Message-ID: <20190903154931.GD2112@phenom.ffwll.local> (raw)
In-Reply-To: <ff5ad889af108e1d78be513e8705c033d16cf994.camel@intel.com>

On Tue, Sep 03, 2019 at 11:49:23AM +0000, Lisovskiy, Stanislav wrote:
> On Tue, 2019-09-03 at 11:40 +0200, Daniel Vetter wrote:
> > 
> > > > In fact I was wrong - when it worked, it was using exactly those
> > > > patches :). With clean drm-tip - it seems to work ocassionally
> > > > and it
> > > > doesn't update the actual display edid and other stuff, so even
> > > > when
> > > > displays are changed we still see the old info/edid from
> > > > userspace.
> > > > 
> > > > We always get a hpd irq when suspend/resume however it doesn't
> > > > always
> > > > result in uevent being sent. So there is a real need in those
> > > > patches.
> > > > 
> > > 
> > > Just decided to "ping" this discussion again. The issue is already
> > > some
> > > years old and still nothing is fixed. I do agree that may be
> > > something
> > > needs to be fixed/changed here in those patches, but something must
> > > be
> > > agreed at least I guess, as discussions themself do not fix bugs.
> > > Currently those patches address a particular issue which occurs, if
> > > display is changed during suspend. 
> > > On ocassional basis, userspace might not get a hotplug event at
> > > all,
> > > causing different kind of problems(like wrong mode set on display
> > > or
> > > diaply not working at all). Also some kms_chamelium hotplug tests
> > > fail
> > > because of that. 
> > 
> > I still think we'll long-term regret this if we just duct-tape more
> > stuff
> > on top, instead of giving userspace a more informative uevent. This
> > will
> > send more uevents to userspace, so maybe then userspace tries to
> > filter
> > more and be clever, which never works, and we're back to tears.
> 
> But here we actually do need a uevent as currently we don't get any at
> all, if edid changes during suspend. If userspace will try to filter
> this out - it's just stupid, however we still need to do things
> correctly.
> 
> > 
> > Anyway, on the approach itself: It's extremely i915 specific, and it
> > requires that all drivers roll out drm_edid_equal checks and not
> > forget to
> > increment the epoch counter.
> 
> > 
> > What I had in mind is that when we set the edid for a connector with
> > drm_connector_update_edid_property() or whatever, then the epoch
> > counter
> > would auto-increment if anything has changed. Similarly (long-term
> > idea at
> > least) if anything important with DP registers has changed.
> > 
> > Can't we do that, instead of this sub-optimal solution of requiring
> > all
> > drivers to roll out lots of code?
> 
> 1) We update edid in intel_dp_set_edid, which is called from
> intel_dp_detect(drm_connector_helper_funcs->detect_ctx hook) which is
> called from drm_helper_probe_detect. That one is called either from
> specific intel_encoder->hotplug hook in i915_hotplug_work_func or by
> userspace request during reprobe.
> 
> 2) Previously we were simply updating edid in intel_dp_set_edid without
> caring if it is the same or not and hotplug event was sent only once
> connection_status had changed. 
> 
> 3) drm_connector_update_edid_property is called from connector-
> >get_modes hook(lets say intel_dp_get_modes fo dp) however it simply
> uses results of
> drm_helper_probe_detect so without actual comparison it would not be
> able to detect if we really need to update epoch_counter or not.
> 
> Because as I said currently intel_dp_set_edid simply assigns it without
> checking, so that way you will get epoch_counter updated every time,
> i.e exactly what you wanted to avoid here.
> 
> So we really need someway to determine if edid had changed, instead of
> simply assigning it all the time - that is why I had to make this
> function.

update_edid is the thing which changes the userspace visible edid. We can
check there with the previous userspace visible edid, and if it's
different, increase the epoch counter. If we never call update_edid then
userspace won't see the changed edid (it might see the changed mode list
or whatever), so doing that is pretty much a requirement for correctness.

The higher levels should notice the epoch counter change (you might not
have captured all of them, there's a bunch between ioctl, poll worker and
sysfs iirc), and send out the uevent.

Why does that not work?
-Daniel

> 
> Cheers,
> 
> Stanislav
> 
> 
> > -Daniel
> > 
> > > 
> > > > > 
> > > > > > 
> > > > > > - Stanislav
> > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > > 
> > > > > > > > -Stanislav
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > Cheers, Daniel
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > -Stanislav
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > > -Daniel
> > > > > > > > > > > 
> > > > > > > > > > > > 
> > > > > > > > > > > > Stanislav Lisovskiy (3):
> > > > > > > > > > > >   drm: Add helper to compare edids.
> > > > > > > > > > > >   drm: Introduce change counter to drm_connector
> > > > > > > > > > > >   drm/i915: Send hotplug event if edid had
> > > > > > > > > > > > changed.
> > > > > > > > > > > > 
> > > > > > > > > > > >  drivers/gpu/drm/drm_connector.c              |  
> > > > > > > > > > > > 1 +
> > > > > > > > > > > >  drivers/gpu/drm/drm_edid.c                   |
> > > > > > > > > > > > 33
> > > > > > > > > > > > ++++++++++++++++++++
> > > > > > > > > > > >  drivers/gpu/drm/drm_probe_helper.c           |
> > > > > > > > > > > > 29
> > > > > > > > > > > > +++++++++++++++-
> > > > > > > > > > > > -
> > > > > > > > > > > >  drivers/gpu/drm/i915/display/intel_dp.c      |
> > > > > > > > > > > > 16
> > > > > > > > > > > > +++++++++-
> > > > > > > > > > > >  drivers/gpu/drm/i915/display/intel_hdmi.c    |
> > > > > > > > > > > > 16
> > > > > > > > > > > > ++++++++--
> > > > > > > > > > > >  drivers/gpu/drm/i915/display/intel_hotplug.c |
> > > > > > > > > > > > 21
> > > > > > > > > > > > ++++++++++
> > > > > > > > > > > > ---
> > > > > > > > > > > >  include/drm/drm_connector.h                  |  
> > > > > > > > > > > > 3 ++
> > > > > > > > > > > >  include/drm/drm_edid.h                       |  
> > > > > > > > > > > > 9
> > > > > > > > > > > > ++++++
> > > > > > > > > > > >  8 files changed, 117 insertions(+), 11
> > > > > > > > > > > > deletions(-)
> > > > > > > > > > > > 
> > > > > > > > > > > > --
> > > > > > > > > > > > 2.17.1
> > > > > > > > > > > > 
> > > > > > > > > > > 
> > > > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > 
> > > > > 
> > > > 
> > > > _______________________________________________
> > > > dri-devel mailing list
> > > > dri-devel@lists.freedesktop.org
> > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > 
> > 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-09-03 15:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06 12:55 [PATCH v3 0/3] Send a hotplug when edid changes Stanislav Lisovskiy
2019-08-06 12:55 ` [PATCH v3 1/3] drm: Add helper to compare edids Stanislav Lisovskiy
2019-08-06 12:55 ` [PATCH v3 2/3] drm: Introduce change counter to drm_connector Stanislav Lisovskiy
2019-08-06 12:55 ` [PATCH v3 3/3] drm/i915: Send hotplug event if edid had changed Stanislav Lisovskiy
2019-08-06 13:51 ` [PATCH v3 0/3] Send a hotplug when edid changes Daniel Vetter
2019-08-06 14:06   ` Lisovskiy, Stanislav
2019-08-06 17:43     ` Daniel Vetter
2019-08-07  7:43       ` Lisovskiy, Stanislav
2019-08-07 21:07         ` Daniel Vetter
2019-08-19  7:23           ` Lisovskiy, Stanislav
2019-08-19  7:35             ` Peres, Martin
2019-08-19  9:05               ` Lisovskiy, Stanislav
2019-09-03  9:17                 ` Lisovskiy, Stanislav
2019-09-03  9:40                   ` Daniel Vetter
2019-09-03 11:49                     ` Lisovskiy, Stanislav
2019-09-03 14:21                       ` Lisovskiy, Stanislav
2019-09-03 15:49                       ` Daniel Vetter [this message]
2019-09-04  8:36                         ` Lisovskiy, Stanislav
2019-09-04  9:23                           ` Daniel Vetter
2019-09-04 10:14                             ` Lisovskiy, Stanislav
2019-08-06 14:01 ` ✗ Fi.CI.CHECKPATCH: warning for Send a hotplug when edid changes (rev4) Patchwork
2019-08-06 14:21 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-07  1:43 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190903154931.GD2112@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=martin.peres@intel.com \
    --cc=stanislav.lisovskiy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox