From patchwork Tue Sep 6 19:05:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Jackson X-Patchwork-Id: 1126922 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p86J61LE032736 for ; Tue, 6 Sep 2011 19:06:21 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1974DA10A5 for ; Tue, 6 Sep 2011 12:05:59 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 11D219E7CF for ; Tue, 6 Sep 2011 12:05:49 -0700 (PDT) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p86J5nAX030573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 6 Sep 2011 15:05:49 -0400 Received: from ihatethathostname.lab.bos.redhat.com (ihatethathostname.lab.bos.redhat.com [10.16.43.238]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p86J5lW1020455 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 6 Sep 2011 15:05:49 -0400 Received: from ihatethathostname.lab.bos.redhat.com (ihatethathostname.lab.bos.redhat.com [127.0.0.1]) by ihatethathostname.lab.bos.redhat.com (8.14.5/8.14.4) with ESMTP id p86J5kxO016632 for ; Tue, 6 Sep 2011 15:05:47 -0400 Received: (from ajax@localhost) by ihatethathostname.lab.bos.redhat.com (8.14.5/8.14.5/Submit) id p86J5kYJ016631 for dri-devel@lists.freedesktop.org; Tue, 6 Sep 2011 15:05:46 -0400 From: Adam Jackson To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: Remove DRM_CONNECTOR_POLL_HPD and clarify poll logic Date: Tue, 6 Sep 2011 15:05:46 -0400 Message-Id: <1315335946-16596-1-git-send-email-ajax@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 06 Sep 2011 19:06:21 +0000 (UTC) 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 --- 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 */