[PATCH] drm: Ignore forced connectors in the periodic poll

Simon Farnsworth simon.farnsworth at onelan.co.uk
Wed Jul 18 10:33:59 PDT 2012


If a connector has had its state forced by the user, there's no point
polling for changes; the force state overrides the detected state.

Simply skip the connector if it's been forced, and don't bother setting up
the periodic poll if the only connectors that need it are forced.

Signed-off-by: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
---

This code needs quite a bit of rework, but this removes a pain point on
motherboards with LVDS or eDP provided as an option that we're not using,
and wired so that they appear to be connected.

Without this patch, we can force the unused connector off, but then every
time we enter the output poll helper (due to HPD interrupt, or polling for
VGA connect on Radeon), we spend time and effort checking for a state
change, both kernel-side (where we see it go from disconnected to
connected), and then in userspace, where our software blindly reconfigures
everything on a connector state change.

Really, though, it would be better if output_poll_execute simply queued fake
HPD events for outputs that need polling, and someone reworked the code so
that HPD was handled per-connector instead of as a "poll all the connectors
on any HPD and on a regular basis if connectors need polling". An exercise
for another day (or a keen volunteer).

 drivers/gpu/drm/drm_crtc_helper.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 3252e70..83f7fa4 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -933,6 +933,11 @@ 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 connector has been forced, don't poll it -
+		   assume the user knew what they were doing */
+		if (connector->force)
+			continue;
+
 		/* if this is HPD or polled don't check it -
 		   TV out for instance */
 		if (!connector->polled)
@@ -988,7 +993,7 @@ void drm_kms_helper_poll_enable(struct drm_device *dev)
 		return;
 
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-		if (connector->polled)
+		if (connector->polled && !connector->forced)
 			poll = true;
 	}
 
-- 
1.7.10.4



More information about the dri-devel mailing list