All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] drm: move a detected edid member to drm_connector from intel_connector
@ 2018-09-06 20:28 Gwan-gyeong Mun
  2018-09-06 20:28 ` [PATCH v3 2/2] drm: Add detection of changing of edid on between suspend and resume Gwan-gyeong Mun
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gwan-gyeong Mun @ 2018-09-06 20:28 UTC (permalink / raw)
  To: dri-devel; +Cc: airlied, intel-gfx

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.

Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c   | 18 +++++++++---------
 drivers/gpu/drm/i915/intel_drv.h  |  1 -
 drivers/gpu/drm/i915/intel_hdmi.c | 10 +++++-----
 include/drm/drm_connector.h       |  7 +++++++
 4 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 436c22de33b6..c117f552f7d2 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4157,7 +4157,7 @@ static uint8_t 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
@@ -4174,12 +4174,12 @@ static uint8_t 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)
@@ -4993,7 +4993,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);
@@ -5005,8 +5005,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;
 }
@@ -5099,7 +5099,7 @@ intel_dp_long_pulse(struct intel_connector *connector,
 	intel_dp->aux.i2c_defer_count = 0;
 
 	intel_dp_set_edid(intel_dp);
-	if (intel_dp_is_edp(intel_dp) || connector->detect_edid)
+	if (intel_dp_is_edp(intel_dp) || connector->base.detect_edid)
 		status = connector_status_connected;
 	intel_dp->detect_done = true;
 
@@ -5183,7 +5183,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)
@@ -5245,7 +5245,7 @@ intel_dp_connector_destroy(struct drm_connector *connector)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 
-	kfree(intel_connector->detect_edid);
+	kfree(connector->detect_edid);
 
 	if (!IS_ERR_OR_NULL(intel_connector->edid))
 		kfree(intel_connector->edid);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f5731215210a..19edd7ec4138 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -400,7 +400,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 */
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index a2dab0b6bde6..0bedfc0ade49 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1815,8 +1815,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
@@ -1892,7 +1892,7 @@ intel_hdmi_set_edid(struct drm_connector *connector)
 
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
 
-	to_intel_connector(connector)->detect_edid = edid;
+	connector->detect_edid = edid;
 	if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) {
 		intel_hdmi->rgb_quant_range_selectable =
 			drm_rgb_quant_range_selectable(edid);
@@ -1957,7 +1957,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;
 
@@ -2078,7 +2078,7 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
 {
 	if (intel_attached_hdmi(connector)->cec_notifier)
 		cec_notifier_put(intel_attached_hdmi(connector)->cec_notifier);
-	kfree(to_intel_connector(connector)->detect_edid);
+	kfree(connector->detect_edid);
 	drm_connector_cleanup(connector);
 	kfree(connector);
 }
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 97ea41dc678f..8c32bf7cb470 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1014,6 +1014,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;
 
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] drm: Add detection of changing of edid on between suspend and resume
  2018-09-06 20:28 [PATCH v3 1/2] drm: move a detected edid member to drm_connector from intel_connector Gwan-gyeong Mun
@ 2018-09-06 20:28 ` Gwan-gyeong Mun
  2018-09-06 20:38 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/2] drm: move a detected edid member to drm_connector from intel_connector Patchwork
  2018-09-06 20:57 ` ✗ Fi.CI.BAT: failure " Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Gwan-gyeong Mun @ 2018-09-06 20:28 UTC (permalink / raw)
  To: dri-devel; +Cc: airlied, intel-gfx

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 a1bb157bfdfa..2705a5a0e4d6 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);
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/2] drm: move a detected edid member to drm_connector from intel_connector
  2018-09-06 20:28 [PATCH v3 1/2] drm: move a detected edid member to drm_connector from intel_connector Gwan-gyeong Mun
  2018-09-06 20:28 ` [PATCH v3 2/2] drm: Add detection of changing of edid on between suspend and resume Gwan-gyeong Mun
@ 2018-09-06 20:38 ` Patchwork
  2018-09-06 20:57 ` ✗ Fi.CI.BAT: failure " Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-09-06 20:38 UTC (permalink / raw)
  To: Gwan-gyeong Mun; +Cc: intel-gfx

== Series Details ==

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

== Summary ==

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

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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* ✗ Fi.CI.BAT: failure for series starting with [v3,1/2] drm: move a detected edid member to drm_connector from intel_connector
  2018-09-06 20:28 [PATCH v3 1/2] drm: move a detected edid member to drm_connector from intel_connector Gwan-gyeong Mun
  2018-09-06 20:28 ` [PATCH v3 2/2] drm: Add detection of changing of edid on between suspend and resume Gwan-gyeong Mun
  2018-09-06 20:38 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/2] drm: move a detected edid member to drm_connector from intel_connector Patchwork
@ 2018-09-06 20:57 ` Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-09-06 20:57 UTC (permalink / raw)
  To: Gwan-gyeong Mun; +Cc: intel-gfx

== Series Details ==

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

== Summary ==

= CI Bug Log - changes from CI_DRM_4782 -> Patchwork_10115 =

== Summary - FAILURE ==

  Serious unknown changes coming with Patchwork_10115 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_10115, 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/49298/revisions/1/mbox/

== Possible new issues ==

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

  === IGT changes ===

    ==== Possible regressions ====

    igt@drv_module_reload@basic-reload-inject:
      fi-byt-j1900:       NOTRUN -> DMESG-WARN
      fi-bsw-n3050:       PASS -> DMESG-WARN

    igt@pm_rpm@module-reload:
      fi-bsw-kefka:       PASS -> DMESG-FAIL
      fi-kbl-7567u:       PASS -> DMESG-FAIL

    
    ==== Warnings ====

    igt@pm_rpm@module-reload:
      fi-bsw-n3050:       PASS -> SKIP

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_module_reload@basic-reload:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         PASS -> FAIL (fdo#104008)

    
    ==== Possible fixes ====

    igt@amdgpu/amd_cs_nop@sync-fork-gfx0:
      fi-kbl-8809g:       DMESG-WARN (fdo#107762) -> PASS

    igt@kms_psr@primary_page_flip:
      fi-kbl-7560u:       FAIL (fdo#107336) -> PASS

    
    ==== Warnings ====

    igt@amdgpu/amd_prime@amd-to-i915:
      fi-kbl-8809g:       DMESG-FAIL (fdo#107762) -> FAIL (fdo#107341)

    
  fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
  fdo#107336 https://bugs.freedesktop.org/show_bug.cgi?id=107336
  fdo#107341 https://bugs.freedesktop.org/show_bug.cgi?id=107341
  fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
  fdo#107762 https://bugs.freedesktop.org/show_bug.cgi?id=107762


== Participating hosts (52 -> 49) ==

  Additional (2): fi-byt-j1900 fi-gdg-551 
  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * Linux: CI_DRM_4782 -> Patchwork_10115

  CI_DRM_4782: 60edf94611d2374821fbe2a824cebcb425ce7b0d @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4632: 94b4e204473a7d9f49e536c8877a4a5636e0d1b2 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_10115: ebb1db8278d84b299202c5e21bae590a9e823cd4 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

ebb1db8278d8 drm: Add detection of changing of edid on between suspend and resume
365867be9e30 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_10115/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-06 20:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06 20:28 [PATCH v3 1/2] drm: move a detected edid member to drm_connector from intel_connector Gwan-gyeong Mun
2018-09-06 20:28 ` [PATCH v3 2/2] drm: Add detection of changing of edid on between suspend and resume Gwan-gyeong Mun
2018-09-06 20:38 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/2] drm: move a detected edid member to drm_connector from intel_connector Patchwork
2018-09-06 20:57 ` ✗ Fi.CI.BAT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.