Message ID | 20190301100102.18064-2-gwan-gyeong.mun@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] drm: move a detected edid member to drm_connector from intel_connector | expand |
Op 01-03-2019 om 11:01 schreef Gwan-gyeong Mun: > The hotplug detection routine of drm_helper_hpd_irq_event() can detect > changing of status of connector, but it can not detect changing of edid. > > Following scenario requires detection of changing of edid. > > 1) plug display device to a connector > 2) system suspend > 3) unplug 1)'s display device and plug the other display device to a > connector > 4) system resume > > It adds edid check routine when a connector status still remains as > "connector_status_connected". > > v2: Add NULL check before comparing of EDIDs. > v3: Make it as part of existing drm_helper_hpd_irq_event() (Stan, Mika) > > Testcase: igt/kms_chamelium/hdmi-edid-change-during-hibernate > Testcase: igt/kms_chamelium/hdmi-edid-change-during-suspend > Testcase: igt/kms_chamelium/dp-edid-change-during-hibernate > Testcase: igt/kms_chamelium/dp-edid-change-during-suspend > > Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> > --- > drivers/gpu/drm/drm_probe_helper.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c > index 6fd08e04b323..036a57d2b29e 100644 > --- a/drivers/gpu/drm/drm_probe_helper.c > +++ b/drivers/gpu/drm/drm_probe_helper.c > @@ -742,7 +742,16 @@ EXPORT_SYMBOL(drm_kms_helper_poll_fini); > * panels. > * > * This helper function is useful for drivers which can't or don't track hotplug > - * interrupts for each connector. > + * interrupts for each connector. And it also supports a detection of changing > + * of edid on between suspend and resume when a connector status still remains > + * as "connector_status_connected". > + * > + * Following scenario requires detection of changing of edid. > + * 1) plug display device to a connector > + * 2) system suspend > + * 3) unplug 1)'s display device and plug the other display device to a > + connector > + * 4) system resume > * > * Drivers which support hotplug interrupts for each connector individually and > * which have a more fine-grained detect logic should bypass this code and We already have a drm_connector_update_edid_property(), so we cache edid already? Could we use that, perhaps reworking slightly how edids are updated in i915? Like drm_connector_update_property_test The current code feels like a hack. The fact we don't clear old_edid or free it, makes me worry that your current patch will either use old_edid after it'd freed, or have the old_edid leaked. ~Maarten
On Mon, 2019-03-04 at 12:45 +0100, Maarten Lankhorst wrote: > Op 01-03-2019 om 11:01 schreef Gwan-gyeong Mun: > > The hotplug detection routine of drm_helper_hpd_irq_event() can > > detect > > changing of status of connector, but it can not detect changing of > > edid. > > > > Following scenario requires detection of changing of edid. > > > > 1) plug display device to a connector > > 2) system suspend > > 3) unplug 1)'s display device and plug the other display device to > > a > > connector > > 4) system resume > > > > It adds edid check routine when a connector status still remains as > > "connector_status_connected". > > > > v2: Add NULL check before comparing of EDIDs. > > v3: Make it as part of existing drm_helper_hpd_irq_event() (Stan, > > Mika) > > > > Testcase: igt/kms_chamelium/hdmi-edid-change-during-hibernate > > Testcase: igt/kms_chamelium/hdmi-edid-change-during-suspend > > Testcase: igt/kms_chamelium/dp-edid-change-during-hibernate > > Testcase: igt/kms_chamelium/dp-edid-change-during-suspend > > > > Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> > > --- > > drivers/gpu/drm/drm_probe_helper.c | 29 > > ++++++++++++++++++++++++++++- > > 1 file changed, 28 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/drm_probe_helper.c > > b/drivers/gpu/drm/drm_probe_helper.c > > index 6fd08e04b323..036a57d2b29e 100644 > > --- a/drivers/gpu/drm/drm_probe_helper.c > > +++ b/drivers/gpu/drm/drm_probe_helper.c > > @@ -742,7 +742,16 @@ EXPORT_SYMBOL(drm_kms_helper_poll_fini); > > * panels. > > * > > * This helper function is useful for drivers which can't or don't > > track hotplug > > - * interrupts for each connector. > > + * interrupts for each connector. And it also supports a detection > > of changing > > + * of edid on between suspend and resume when a connector status > > still remains > > + * as "connector_status_connected". > > + * > > + * Following scenario requires detection of changing of edid. > > + * 1) plug display device to a connector > > + * 2) system suspend > > + * 3) unplug 1)'s display device and plug the other display > > device to a > > + connector > > + * 4) system resume > > * > > * Drivers which support hotplug interrupts for each connector > > individually and > > * which have a more fine-grained detect logic should bypass this > > code and > > We already have a drm_connector_update_edid_property(), so we cache > edid already? > > Could we use that, perhaps reworking slightly how edids are updated > in i915? > Like drm_connector_update_property_test > Ok, I'll check a cached edid propery and will revise in order to use a cached edid property. > The current code feels like a hack. The fact we don't clear old_edid > or free it, makes me worry that your current patch will either use > old_edid after it'd freed, or have the old_edid leaked. > You are right, I missed the case which you mentioned. In the next patch, I'll handle an edid propery with drm_property_blob_get() and drm_property_blob_put(). Thank you for checking. Br, G.G. > ~Maarten >
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 6fd08e04b323..036a57d2b29e 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -742,7 +742,16 @@ EXPORT_SYMBOL(drm_kms_helper_poll_fini); * panels. * * This helper function is useful for drivers which can't or don't track hotplug - * interrupts for each connector. + * interrupts for each connector. And it also supports a detection of changing + * of edid on between suspend and resume when a connector status still remains + * as "connector_status_connected". + * + * Following scenario requires detection of changing of edid. + * 1) plug display device to a connector + * 2) system suspend + * 3) unplug 1)'s display device and plug the other display device to a + connector + * 4) system resume * * Drivers which support hotplug interrupts for each connector individually and * which have a more fine-grained detect logic should bypass this code and @@ -760,6 +769,7 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) struct drm_connector *connector; struct drm_connector_list_iter conn_iter; enum drm_connector_status old_status; + struct edid *old_edid; bool changed = false; if (!dev->mode_config.poll_enabled) @@ -773,6 +783,7 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) continue; old_status = connector->status; + old_edid = connector->detect_edid; connector->status = drm_helper_probe_detect(connector, NULL, false); DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", @@ -782,6 +793,22 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) drm_get_connector_status_name(connector->status)); if (old_status != connector->status) changed = true; + + /* Check changing of edid when a connector status still remains + * as "connector_status_connected". + */ + if (old_status == connector->status && + old_status == connector_status_connected) { + if (!old_edid || !connector->detect_edid) + continue; + + if (memcmp(old_edid, connector->detect_edid, sizeof(*old_edid))) { + changed = true; + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] edid updated\n", + connector->base.id, + connector->name); + } + } } drm_connector_list_iter_end(&conn_iter); mutex_unlock(&dev->mode_config.mutex);
The hotplug detection routine of drm_helper_hpd_irq_event() can detect changing of status of connector, but it can not detect changing of edid. Following scenario requires detection of changing of edid. 1) plug display device to a connector 2) system suspend 3) unplug 1)'s display device and plug the other display device to a connector 4) system resume It adds edid check routine when a connector status still remains as "connector_status_connected". v2: Add NULL check before comparing of EDIDs. v3: Make it as part of existing drm_helper_hpd_irq_event() (Stan, Mika) Testcase: igt/kms_chamelium/hdmi-edid-change-during-hibernate Testcase: igt/kms_chamelium/hdmi-edid-change-during-suspend Testcase: igt/kms_chamelium/dp-edid-change-during-hibernate Testcase: igt/kms_chamelium/dp-edid-change-during-suspend Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> --- drivers/gpu/drm/drm_probe_helper.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)