diff mbox

[3/3] drm/radeon/kms: fix dac detect stealing in-use encoder.

Message ID 1308032036-23115-3-git-send-email-airlied@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Airlie June 14, 2011, 6:13 a.m. UTC
From: Dave Airlie <airlied@linux.ie>

On my RS690 the VGA and TV-out share the same DAC, so when xrandr
is called, tv-out steals the encoder and tries to load detect on it,
however this causes flicker on the VGA.

This blocks this by testing if the encoder is connected to anything
and if so whether its connected to the probing connector.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/radeon/radeon_encoders.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

Comments

Alex Deucher June 14, 2011, 6:39 a.m. UTC | #1
On Tue, Jun 14, 2011 at 2:13 AM, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@linux.ie>
>
> On my RS690 the VGA and TV-out share the same DAC, so when xrandr
> is called, tv-out steals the encoder and tries to load detect on it,
> however this causes flicker on the VGA.
>
> This blocks this by testing if the encoder is connected to anything
> and if so whether its connected to the probing connector.

Could we get into a case where we fail to run load detect on both
connectors due to this check?

Alex
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 03f124d..eb07e74 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -1971,6 +1971,18 @@  radeon_atom_dac_detect(struct drm_encoder *encoder, struct drm_connector *connec
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 	uint32_t bios_0_scratch;
+	struct drm_connector *test_connector;
+
+	/*
+	 * if we are passed a connector and it doesn't match what the encoder
+	 * is connected to do, don't do load detect as it might cause flicker.
+	 */
+	 list_for_each_entry(test_connector, &dev->mode_config.connector_list, head) {
+                if ((test_connector->encoder == encoder) && (test_connector != connector)) {
+			DRM_DEBUG_KMS("load detect failed: encoder in use\n");
+			return connector_status_disconnected;
+		}
+	}
 
 	if (!atombios_dac_load_detect(encoder, connector)) {
 		DRM_DEBUG_KMS("detect returned false \n");