[PATCH] drm: Remove DRM_CONNECTOR_POLL_HPD and clarify poll logic

Adam Jackson ajax at redhat.com
Tue Sep 6 12:05:46 PDT 2011


This was just confusing.  ->polled just means which directions you want
to poll for changes, regardless of whether you can get HPD interrupts
for them.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---

Kind of an RFC patch, and I've not tested it yet, but it certainly makes
more sense to read this way.

 drivers/gpu/drm/drm_crtc_helper.c           |   13 ++++++++-----
 drivers/gpu/drm/i915/intel_crt.c            |    4 +---
 drivers/gpu/drm/i915/intel_dp.c             |    2 --
 drivers/gpu/drm/i915/intel_hdmi.c           |    1 -
 drivers/gpu/drm/i915/intel_tv.c             |    4 ++--
 drivers/gpu/drm/nouveau/nouveau_connector.c |    4 +---
 drivers/gpu/drm/radeon/radeon_connectors.c  |    6 ++----
 include/drm/drm_crtc.h                      |    2 --
 8 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index f88a9b2..a036b29 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -877,20 +877,23 @@ static void output_poll_execute(struct work_struct *work)
 	mutex_lock(&dev->mode_config.mutex);
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
 
-		/* if this is HPD or polled don't check it -
+		/* if this is HPD, or otherwise non-polled, don't check it -
 		   TV out for instance */
 		if (!connector->polled)
 			continue;
 
-		else if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT))
-			repoll = true;
+		repoll = true;
 
 		old_status = connector->status;
 		/* if we are connected and don't want to poll for disconnect
 		   skip it */
 		if (old_status == connector_status_connected &&
-		    !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT) &&
-		    !(connector->polled & DRM_CONNECTOR_POLL_HPD))
+		    !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT))
+			continue;
+
+		/* and vice versa */
+		if (old_status == connector_status_disconnected &&
+		    !(connector->polled & DRM_CONNECTOR_POLL_CONNECT))
 			continue;
 
 		connector->status = connector->funcs->detect(connector, false);
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 0979d88..ed0b5e8 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -583,9 +583,7 @@ void intel_crt_init(struct drm_device *dev)
 
 	drm_sysfs_connector_add(connector);
 
-	if (I915_HAS_HOTPLUG(dev))
-		connector->polled = DRM_CONNECTOR_POLL_HPD;
-	else
+	if (!I915_HAS_HOTPLUG(dev))
 		connector->polled = DRM_CONNECTOR_POLL_CONNECT;
 
 	/*
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 44fef5e..0160417 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1984,8 +1984,6 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 	drm_connector_init(dev, connector, &intel_dp_connector_funcs, type);
 	drm_connector_helper_add(connector, &intel_dp_connector_helper_funcs);
 
-	connector->polled = DRM_CONNECTOR_POLL_HPD;
-
 	if (output_reg == DP_B || output_reg == PCH_DP_B)
 		intel_encoder->clone_mask = (1 << INTEL_DP_B_CLONE_BIT);
 	else if (output_reg == DP_C || output_reg == PCH_DP_C)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 226ba83..aa73c6f 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -508,7 +508,6 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
 
 	intel_encoder->type = INTEL_OUTPUT_HDMI;
 
-	connector->polled = DRM_CONNECTOR_POLL_HPD;
 	connector->interlace_allowed = 0;
 	connector->doublescan_allowed = 0;
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 210d570..0a3369d 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1246,7 +1246,7 @@ intel_tv_detect_type (struct intel_tv *intel_tv,
 	int type;
 
 	/* Disable TV interrupts around load detect or we'll recurse */
-	if (connector->polled & DRM_CONNECTOR_POLL_HPD) {
+	if (connector->polled == 0) {
 		spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 		i915_disable_pipestat(dev_priv, 0,
 				      PIPE_HOTPLUG_INTERRUPT_ENABLE |
@@ -1309,7 +1309,7 @@ intel_tv_detect_type (struct intel_tv *intel_tv,
 	I915_WRITE(TV_CTL, save_tv_ctl);
 
 	/* Restore interrupt config */
-	if (connector->polled & DRM_CONNECTOR_POLL_HPD) {
+	if (connector->polled == 0) {
 		spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 		i915_enable_pipestat(dev_priv, 0,
 				     PIPE_HOTPLUG_INTERRUPT_ENABLE |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 939d4df..994a1aca 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -890,9 +890,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
 				DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF);
 
 		if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS) {
-			if (dev_priv->card_type >= NV_50)
-				connector->polled = DRM_CONNECTOR_POLL_HPD;
-			else
+			if (dev_priv->card_type < NV_50)
 				connector->polled = DRM_CONNECTOR_POLL_CONNECT;
 		}
 		break;
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 4f0c1ec..9278137 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1763,8 +1763,7 @@ radeon_add_atom_connector(struct drm_device *dev,
 	if (radeon_connector->hpd.hpd == RADEON_HPD_NONE) {
 		if (i2c_bus->valid)
 			connector->polled = DRM_CONNECTOR_POLL_CONNECT;
-	} else
-		connector->polled = DRM_CONNECTOR_POLL_HPD;
+	}
 
 	connector->display_info.subpixel_order = subpixel_order;
 	drm_sysfs_connector_add(connector);
@@ -1923,8 +1922,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
 	if (radeon_connector->hpd.hpd == RADEON_HPD_NONE) {
 		if (i2c_bus->valid)
 			connector->polled = DRM_CONNECTOR_POLL_CONNECT;
-	} else
-		connector->polled = DRM_CONNECTOR_POLL_HPD;
+	}
 	connector->display_info.subpixel_order = subpixel_order;
 	drm_sysfs_connector_add(connector);
 	if (connector_type == DRM_MODE_CONNECTOR_LVDS) {
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 44335e5..cf0ceeb 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -458,8 +458,6 @@ enum drm_connector_force {
 };
 
 /* should we poll this connector for connects and disconnects */
-/* hot plug detectable */
-#define DRM_CONNECTOR_POLL_HPD (1 << 0)
 /* poll for connections */
 #define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
 /* can cleanly poll for disconnections without flickering the screen */
-- 
1.7.6



More information about the dri-devel mailing list