Skip to contentSkip to conversation

drm: move a detected edid member to drm_connector from intel_connector

PATCH In review Gwan-gyeong Mun 3 participants 6 messages Mar 1, 2019 – Apr 11, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm: move a detected edid member to drm_connector from intel_connector

In order to use a detected edid on drm helper functions, it moves a detected edid member to drm_connector structure from intel_connector structure.

v2: Rebased.

---
 drivers/gpu/drm/i915/intel_connector.c |  2 +-
 drivers/gpu/drm/i915/intel_dp.c        | 17 ++++++++---------
 drivers/gpu/drm/i915/intel_drv.h       |  1 -
 drivers/gpu/drm/i915/intel_hdmi.c      |  8 ++++----
 include/drm/drm_connector.h            |  7 +++++++
 5 files changed, 20 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_connector.c +1 -1
index 848dd9e728d8..175cdbcbdc4e 100644
@@ -86,7 +86,7 @@ void intel_connector_destroy(struct drm_connector *connector)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 
-	kfree(intel_connector->detect_edid);
+	kfree(intel_connector->base.detect_edid);
 
 	intel_hdcp_cleanup(intel_connector);
 
drivers/gpu/drm/i915/intel_dp.c +8 -9
index e1a051c0fbfe..bc493656e183 100644
@@ -4479,7 +4479,7 @@ static u8 intel_dp_autotest_edid(struct intel_dp *intel_dp)
 	struct intel_connector *intel_connector = intel_dp->attached_connector;
 	struct drm_connector *connector = &intel_connector->base;
 
-	if (intel_connector->detect_edid == NULL ||
+	if (connector->detect_edid == NULL ||
 	    connector->edid_corrupt ||
 	    intel_dp->aux.i2c_defer_count > 6) {
 		/* Check EDID read for NACKs, DEFERs and corruption
@@ -4496,12 +4496,12 @@ static u8 intel_dp_autotest_edid(struct intel_dp *intel_dp)
 				      intel_dp->aux.i2c_defer_count);
 		intel_dp->compliance.test_data.edid = INTEL_DP_RESOLUTION_FAILSAFE;
 	} else {
-		struct edid *block = intel_connector->detect_edid;
+		struct edid *block = connector->detect_edid;
 
 		/* We have to write the checksum
 		 * of the last block read
 		 */
-		block += intel_connector->detect_edid->extensions;
+		block += connector->detect_edid->extensions;
 
 		if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_EDID_CHECKSUM,
 				       block->checksum) <= 0)
@@ -5355,7 +5355,7 @@ intel_dp_set_edid(struct intel_dp *intel_dp)
 
 	intel_dp_unset_edid(intel_dp);
 	edid = intel_dp_get_edid(intel_dp);
-	intel_connector->detect_edid = edid;
+	intel_connector->base.detect_edid = edid;
 
 	intel_dp->has_audio = drm_detect_monitor_audio(edid);
 	drm_dp_cec_set_edid(&intel_dp->aux, edid);
@@ -5367,8 +5367,8 @@ intel_dp_unset_edid(struct intel_dp *intel_dp)
 	struct intel_connector *intel_connector = intel_dp->attached_connector;
 
 	drm_dp_cec_unset_edid(&intel_dp->aux);
-	kfree(intel_connector->detect_edid);
-	intel_connector->detect_edid = NULL;
+	kfree(intel_connector->base.detect_edid);
+	intel_connector->base.detect_edid = NULL;
 
 	intel_dp->has_audio = false;
 }
@@ -5471,8 +5471,7 @@ intel_dp_detect(struct drm_connector *connector,
 	intel_dp->aux.i2c_defer_count = 0;
 
 	intel_dp_set_edid(intel_dp);
-	if (intel_dp_is_edp(intel_dp) ||
-	    to_intel_connector(connector)->detect_edid)
+	if (intel_dp_is_edp(intel_dp) || connector->detect_edid)
 		status = connector_status_connected;
 
 	intel_dp_check_service_irq(intel_dp);
@@ -5515,7 +5514,7 @@ static int intel_dp_get_modes(struct drm_connector *connector)
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct edid *edid;
 
-	edid = intel_connector->detect_edid;
+	edid = connector->detect_edid;
 	if (edid) {
 		int ret = intel_connector_update_modes(connector, edid);
 		if (ret)
drivers/gpu/drm/i915/intel_drv.h +0 -1
index 5412373e2f98..6f641980a877 100644
@@ -503,7 +503,6 @@ struct intel_connector {
 
 	/* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
 	struct edid *edid;
-	struct edid *detect_edid;
 
 	/* since POLL and HPD connectors may use the same HPD line keep the native
 	   state of connector->polled in case hotplug storm detection changes it */
drivers/gpu/drm/i915/intel_hdmi.c +4 -4
index cd422a7b4da0..82fd4b535c45 100644
@@ -2395,8 +2395,8 @@ intel_hdmi_unset_edid(struct drm_connector *connector)
 	intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE;
 	intel_hdmi->dp_dual_mode.max_tmds_clock = 0;
 
-	kfree(to_intel_connector(connector)->detect_edid);
-	to_intel_connector(connector)->detect_edid = NULL;
+	kfree(connector->detect_edid);
+	connector->detect_edid = NULL;
 }
 
 static void
@@ -2473,7 +2473,7 @@ intel_hdmi_set_edid(struct drm_connector *connector)
 
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS, wakeref);
 
-	to_intel_connector(connector)->detect_edid = edid;
+	connector->detect_edid = edid;
 	if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) {
 		intel_hdmi->has_audio = drm_detect_monitor_audio(edid);
 		intel_hdmi->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
@@ -2536,7 +2536,7 @@ static int intel_hdmi_get_modes(struct drm_connector *connector)
 {
 	struct edid *edid;
 
-	edid = to_intel_connector(connector)->detect_edid;
+	edid = connector->detect_edid;
 	if (edid == NULL)
 		return 0;
 
include/drm/drm_connector.h +7 -0
index c8061992d6cb..f1b4e39227e3 100644
@@ -1140,6 +1140,13 @@ struct drm_connector {
 	 */
 	bool edid_corrupt;
 
+	/**
+	 * @detect_edid: indicates a cached EDID for a detection cycle
+	 * As we may query the edid multiple times following a detect, record
+	 * the EDID found during output discovery and reuse it.
+	 */
+	struct edid *detect_edid;
+
 	/** @debugfs_entry: debugfs directory for this connector */
 	struct dentry *debugfs_entry;
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 drm: Add detection of changing of edid on between suspend and resume

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

---
 drivers/gpu/drm/drm_probe_helper.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +28 -1
index 6fd08e04b323..036a57d2b29e 100644
@@ -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);
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 2/2] drm: Add detection of changing of edid on between suspend and resume

Op 01-03-2019 om 11:01 schreef Gwan-gyeong Mun:

Quoted 39 lines

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

---
 drivers/gpu/drm/drm_probe_helper.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +3 -1
index 6fd08e04b323..036a57d2b29e 100644
@@ -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".

drivers/gpu/drm/drm_probe_helper.c EXPORT_SYMBOL(drm_kms_helper_poll_fini); · line 757

Quoted 10 lines
drivers/gpu/drm/drm_probe_helper.c +7 -0
+ *
+ * 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

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH 2/2] drm: Add detection of changing of edid on between suspend and resume

Quoted 66 lines · Maarten Lankhorst

Op 01-03-2019 om 11:01 schreef Gwan-gyeong Mun:

Quoted 53 lines

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

---
 drivers/gpu/drm/drm_probe_helper.c | 29
++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +0 -0
index 6fd08e04b323..036a57d2b29e 100644
@@ -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
Quoted 8 lines

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?

Quoted 4 lines

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.

Quoted 4 lines

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.

Quoted 2 lines

~Maarten

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm: move a detected edid member to drm_connector from intel_connector

In reply to Gwan-gyeong Mun
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm: move a detected edid member to drm_connector from intel_connector
URL : https://patchwork.freedesktop.org/series/57397/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
6c66b5f875a6 drm: move a detected edid member to drm_connector from intel_connector
-:37: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!connector->detect_edid"
#37: FILE: drivers/gpu/drm/i915/intel_dp.c:4482:
+	if (connector->detect_edid == NULL ||

total: 0 errors, 0 warnings, 1 checks, 111 lines checked 3b877e903a5d drm: Add detection of changing of edid on between suspend and resume

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✗ Fi.CI.BAT: failure for series starting with [1/2] drm: move a detected edid member to drm_connector from intel_connector

In reply to Gwan-gyeong Mun
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm: move a detected edid member to drm_connector from intel_connector
URL : https://patchwork.freedesktop.org/series/57397/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_5676 -> Patchwork_12339
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_12339 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_12339, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/57397/revisions/1/mbox/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_12339:

### IGT changes ###

#### Possible regressions ####

* igt@i915_module_load@reload-with-fault-injection:
- fi-byt-j1900: PASS -> DMESG-WARN

* igt@runner@aborted:
- fi-bsw-n3050: NOTRUN -> FAIL

Known issues
------------

Here are the changes found in Patchwork_12339 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@fork-gfx0:
- fi-icl-u2: NOTRUN -> SKIP [fdo#109315] +17

* igt@gem_exec_basic@readonly-bsd1:
- fi-icl-u2: NOTRUN -> SKIP [fdo#109276] +7

* igt@gem_exec_basic@readonly-bsd2:
- fi-pnv-d510: NOTRUN -> SKIP [fdo#109271] +76

* igt@gem_exec_parse@basic-allowed:
- fi-icl-u2: NOTRUN -> SKIP [fdo#109289] +1

* igt@i915_module_load@reload-with-fault-injection:
- fi-bsw-n3050: PASS -> DMESG-WARN [fdo#107732]

* igt@i915_selftest@live_contexts:
- fi-icl-u2: NOTRUN -> DMESG-FAIL [fdo#108569]

* igt@kms_busy@basic-flip-c:
- fi-pnv-d510: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

* igt@kms_chamelium@dp-edid-read:
- fi-icl-u2: NOTRUN -> SKIP [fdo#109316] +2

* igt@kms_chamelium@vga-hpd-fast:
- fi-icl-u2: NOTRUN -> SKIP [fdo#109309] +1

* igt@kms_force_connector_basic@prune-stale-modes:
- fi-icl-u2: NOTRUN -> SKIP [fdo#109285] +3

* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u2: NOTRUN -> FAIL [fdo#103167]

* igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
- fi-byt-clapper: PASS -> FAIL [fdo#103191] / [fdo#107362]

* igt@runner@aborted:
- fi-byt-j1900: NOTRUN -> FAIL [fdo#105602]

#### Possible fixes ####

* igt@i915_selftest@live_evict:
- fi-bsw-kefka: DMESG-WARN [fdo#107709] -> PASS

* igt@kms_busy@basic-flip-b:
- fi-gdg-551: FAIL [fdo#103182] -> PASS

* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
[fdo#107732]: https://bugs.freedesktop.org/show_bug.cgi?id=107732
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109316]: https://bugs.freedesktop.org/show_bug.cgi?id=109316

Participating hosts (44 -> 41)
------------------------------

Additional (2): fi-icl-u2 fi-pnv-d510
Missing (5): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y

Build changes
-------------

* Linux: CI_DRM_5676 -> Patchwork_12339

CI_DRM_5676: 3911a5d7d3de6d8e491868bb0cd506346131d71b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4866: 189956af183c245eb237b3be4fa22953ec93bbe0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12339: 3b877e903a5d54cc8fdb5da849978d7a18b21099 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

3b877e903a5d drm: Add detection of changing of edid on between suspend and resume 6c66b5f875a6 drm: move a detected edid member to drm_connector from intel_connector

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12339/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx