All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/radeon/kms: avoid executing dac detection table on r4xx + rv515.
@ 2010-05-05  1:03 Dave Airlie
  0 siblings, 0 replies; only message in thread
From: Dave Airlie @ 2010-05-05  1:03 UTC (permalink / raw)
  To: dri-devel

From: Dave Airlie <airlied@redhat.com>

The DAC Load detection table is meant to take a parameter selecting the DAC
to do load detection on. However on certain BIOS revisions it accept no
parameters and load detects both DACs, with the result that load detecting on
the second DAC causes flicker on the first, which isn't really acceptable.

This also makes us report disconnected instead of unknown for the case where
we have no DAC detection.

We should code up a workaround function for these chips to workaround this
case.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/radeon/atom.c            |   15 +++++++++++++--
 drivers/gpu/drm/radeon/atom.h            |    2 ++
 drivers/gpu/drm/radeon/radeon_encoders.c |   15 +++++++++++----
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 1d56983..c1c669a 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -1330,12 +1330,13 @@ bool atom_parse_data_header(struct atom_context *ctx, int index,
 	return true;
 }
 
-bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev,
-			   uint8_t * crev)
+bool atom_parse_cmd_header_stack(struct atom_context *ctx, int index, uint8_t *frev,
+				 uint8_t *crev, uint8_t *ps_size, uint8_t *ws_size)
 {
 	int offset = index * 2 + 4;
 	int idx = CU16(ctx->cmd_table + offset);
 	u16 *mct = (u16 *)(ctx->bios + ctx->cmd_table + 4);
+	u16 table_attrib = CU16(idx + 4);
 
 	if (!mct[index])
 		return false;
@@ -1344,9 +1345,19 @@ bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev,
 		*frev = CU8(idx + 2);
 	if (crev)
 		*crev = CU8(idx + 3);
+	if (ps_size)
+		*ps_size = (table_attrib & 0xe00) >> 8;
+	if (ws_size)
+		*ws_size = (table_attrib & 0xff);
 	return true;
 }
 
+bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t *rev,
+			   uint8_t *crev)
+{
+	return atom_parse_cmd_header_stack(ctx, index, rev, crev, NULL, NULL);
+}
+
 int atom_allocate_fb_scratch(struct atom_context *ctx)
 {
 	int index = GetIndexIntoMasterTable(DATA, VRAM_UsageByFirmware);
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h
index cd1b64a..ca21357 100644
--- a/drivers/gpu/drm/radeon/atom.h
+++ b/drivers/gpu/drm/radeon/atom.h
@@ -147,6 +147,8 @@ bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size,
 			    uint8_t *frev, uint8_t *crev, uint16_t *data_start);
 bool atom_parse_cmd_header(struct atom_context *ctx, int index,
 			   uint8_t *frev, uint8_t *crev);
+bool atom_parse_cmd_header_stack(struct atom_context *ctx, int index, uint8_t *rev,
+				 uint8_t *crev, uint8_t *ps_size, uint8_t *ws_size);
 int atom_allocate_fb_scratch(struct atom_context *ctx);
 #include "atom-types.h"
 #include "atombios.h"
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 30293be..f2ea756 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -1406,13 +1406,20 @@ atombios_dac_load_detect(struct drm_encoder *encoder, struct drm_connector *conn
 				       ATOM_DEVICE_CRT_SUPPORT)) {
 		DAC_LOAD_DETECTION_PS_ALLOCATION args;
 		int index = GetIndexIntoMasterTable(COMMAND, DAC_LoadDetection);
-		uint8_t frev, crev;
+		uint8_t frev, crev, ps_size;
 
 		memset(&args, 0, sizeof(args));
 
-		if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))
+		if (!atom_parse_cmd_header_stack(rdev->mode_info.atom_context, index, &frev, &crev, &ps_size, NULL))
 			return false;
 
+		/* r4xx and some early rv5xx probe all DACs, this can cause distrubances in the force,
+		   also on other DACs.  - we can detect these tables as they have a 0 sized param stack */
+		if (ps_size == 0) {
+			DRM_DEBUG("DAC load detection isn't properly supported on this GPU\n");
+			return false;
+		}
+
 		args.sDacload.ucMisc = 0;
 
 		if ((radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_DAC1) ||
@@ -1452,8 +1459,8 @@ radeon_atom_dac_detect(struct drm_encoder *encoder, struct drm_connector *connec
 	uint32_t bios_0_scratch;
 
 	if (!atombios_dac_load_detect(encoder, connector)) {
-		DRM_DEBUG("detect returned false \n");
-		return connector_status_unknown;
+		DRM_DEBUG("dac detect returned false\n");
+		return connector_status_disconnected;
 	}
 
 	if (rdev->family >= CHIP_R600)
-- 
1.7.0.1


------------------------------------------------------------------------------
--

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-05  1:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-05  1:03 [PATCH 1/3] drm/radeon/kms: avoid executing dac detection table on r4xx + rv515 Dave Airlie

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.