Re: [PATCHES] radeon KMS updates

2009-10-14 Thread Alex Deucher
And one more for to fix the active_device setup.

Alex

On Wed, Oct 14, 2009 at 12:45 AM, Alex Deucher alexdeuc...@gmail.com wrote:
 A couple more patches to fix up some issues with tv-out.

 Alex

 On Fri, Oct 9, 2009 at 6:45 PM, Alex Deucher alexdeuc...@gmail.com wrote:
 One more patch to address a possible case of systems with bad native
 mode info for lvds, but a valid edid.

 Alex

 On Fri, Oct 9, 2009 at 5:53 PM, Alex Deucher alexdeuc...@gmail.com wrote:
 Attached are some updates to radeon kms; mostly clean-ups I ran into
 while preparing for evergreen support.

 patches:
 1 - make sure lvds panels have valid native mode info.  if not, report
 lvds as disconnected
 2 - fix up crtc dpms ordering based on recommendation from bios docs
 3 - add support for AdjustDisplayPll table which is used to adjust the
 clock to meet special requirements of different encoders (e.g.,
 tv-out, DP, certain low dot clocks on tmds, etc.)
 4. clean up the crtc mode set path
 5. switch lvds to use the drm_mode struct rather than the
 radeon_native_mode struct.  Eliminates a layer of indirection.

 Patch 5 could probably use some more testing to make sure I didn't
 accidentally break lvds on any picky panels due to a typo in the
 conversion.

 Alex



From bcffdf2da5eb91e15feb03af5dc9faa77e4dc982 Mon Sep 17 00:00:00 2001
From: Alex Deucher alexdeuc...@gmail.com
Date: Wed, 14 Oct 2009 02:00:42 -0400
Subject: [PATCH] drm/radeon/kms: move active_device setup into encoder fixup()

radeon_encoder-active_device defines the active routing
between the encoder and connector.  The encoder fixup and
dpms functions need to know the active_device to function
properly.  Setting active_device in the prepare hook was
too late in some cases.

Signed-off-by: Alex Deucher alexdeuc...@gmail.com
---
 drivers/gpu/drm/radeon/radeon_encoders.c|   19 ++-
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |   17 -
 2 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 96a830a..fd365cf 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -194,6 +194,8 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
 	struct drm_device *dev = encoder-dev;
 	struct radeon_device *rdev = dev-dev_private;
 
+	/* set the active encoder to connector routing */
+	radeon_encoder_set_active_device(encoder);
 	drm_mode_set_crtcinfo(adjusted_mode, 0);
 
 	if (radeon_encoder-rmx_type != RMX_OFF)
@@ -860,16 +862,9 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode)
 	DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args;
 	int index = 0;
 	bool is_dig = false;
-	int devices;
 
 	memset(args, 0, sizeof(args));
 
-	/* on DPMS off we have no idea if active device is meaningful */
-	if (mode != DRM_MODE_DPMS_ON  !radeon_encoder-active_device)
-		devices = radeon_encoder-devices;
-	else
-		devices = radeon_encoder-active_device;
-
 	DRM_DEBUG(encoder dpms %d to mode %d, devices %08x, active_devices %08x\n,
 		  radeon_encoder-encoder_id, mode, radeon_encoder-devices,
 		  radeon_encoder-active_device);
@@ -900,18 +895,18 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode)
 		break;
 	case ENCODER_OBJECT_ID_INTERNAL_DAC1:
 	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
-		if (devices  (ATOM_DEVICE_TV_SUPPORT))
+		if (radeon_encoder-active_device  (ATOM_DEVICE_TV_SUPPORT))
 			index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl);
-		else if (devices  (ATOM_DEVICE_CV_SUPPORT))
+		else if (radeon_encoder-active_device  (ATOM_DEVICE_CV_SUPPORT))
 			index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl);
 		else
 			index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl);
 		break;
 	case ENCODER_OBJECT_ID_INTERNAL_DAC2:
 	case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
-		if (devices  (ATOM_DEVICE_TV_SUPPORT))
+		if (radeon_encoder-active_device  (ATOM_DEVICE_TV_SUPPORT))
 			index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl);
-		else if (devices  (ATOM_DEVICE_CV_SUPPORT))
+		else if (radeon_encoder-active_device  (ATOM_DEVICE_CV_SUPPORT))
 			index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl);
 		else
 			index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl);
@@ -1257,8 +1252,6 @@ static void radeon_atom_encoder_prepare(struct drm_encoder *encoder)
 {
 	radeon_atom_output_lock(encoder, true);
 	radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
-
-	radeon_encoder_set_active_device(encoder);
 }
 
 static void radeon_atom_encoder_commit(struct drm_encoder *encoder)
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 6ceb958..3a75b5b 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -107,8 +107,6 @@ static void radeon_legacy_lvds_prepare(struct drm_encoder *encoder)
 	else
 		

Re: [PATCHES] radeon KMS updates

2009-10-13 Thread Alex Deucher
A couple more patches to fix up some issues with tv-out.

Alex

On Fri, Oct 9, 2009 at 6:45 PM, Alex Deucher alexdeuc...@gmail.com wrote:
 One more patch to address a possible case of systems with bad native
 mode info for lvds, but a valid edid.

 Alex

 On Fri, Oct 9, 2009 at 5:53 PM, Alex Deucher alexdeuc...@gmail.com wrote:
 Attached are some updates to radeon kms; mostly clean-ups I ran into
 while preparing for evergreen support.

 patches:
 1 - make sure lvds panels have valid native mode info.  if not, report
 lvds as disconnected
 2 - fix up crtc dpms ordering based on recommendation from bios docs
 3 - add support for AdjustDisplayPll table which is used to adjust the
 clock to meet special requirements of different encoders (e.g.,
 tv-out, DP, certain low dot clocks on tmds, etc.)
 4. clean up the crtc mode set path
 5. switch lvds to use the drm_mode struct rather than the
 radeon_native_mode struct.  Eliminates a layer of indirection.

 Patch 5 could probably use some more testing to make sure I didn't
 accidentally break lvds on any picky panels due to a typo in the
 conversion.

 Alex


From a2b15dcfdc3735c1e16cbad3ba27618902f9cf76 Mon Sep 17 00:00:00 2001
From: Alex Deucher alexdeuc...@gmail.com
Date: Tue, 13 Oct 2009 23:57:47 -0400
Subject: [PATCH] drm/radeon/kms/atom: fix tv-out

D1MODE_INTERLEAVE_EN was getting set in some cases
in the encoder quirks function due to the changes in
5a9bcacc0a56f0d9577494e834519480018a6cc3

Signed-off-by: Alex Deucher alexdeuc...@gmail.com
---
 drivers/gpu/drm/radeon/atombios_crtc.c   |4 
 drivers/gpu/drm/radeon/radeon_encoders.c |9 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 3409aa3..f7dcb69 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -31,10 +31,6 @@
 #include atom.h
 #include atom-bits.h
 
-/* evil but including atombios.h is much worse */
-bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
-SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION *crtc_timing,
-int32_t *pixel_clock);
 static void atombios_overscan_setup(struct drm_crtc *crtc,
 struct drm_display_mode *mode,
 struct drm_display_mode *adjusted_mode)
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 10845f3..96a830a 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -204,7 +204,7 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
 	 (mode-crtc_vsync_start  (mode-crtc_vdisplay + 2)))
 		adjusted_mode-crtc_vsync_start = adjusted_mode-crtc_vdisplay + 2;
 
-	if (radeon_encoder-active_device  ATOM_DEVICE_TV_SUPPORT) {
+	if (radeon_encoder-active_device  (ATOM_DEVICE_TV_SUPPORT)) {
 		struct radeon_encoder_atom_dac *tv_dac = radeon_encoder-enc_priv;
 		if (tv_dac) {
 			if (tv_dac-tv_std == TV_STD_NTSC ||
@@ -1090,8 +1090,11 @@ atombios_apply_encoder_quirks(struct drm_encoder *encoder,
 	}
 
 	/* set scaler clears this on some chips */
-	if (ASIC_IS_AVIVO(rdev)  (mode-flags  DRM_MODE_FLAG_INTERLACE))
-		WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc-crtc_offset, AVIVO_D1MODE_INTERLEAVE_EN);
+	if (!(radeon_encoder-active_device  (ATOM_DEVICE_TV_SUPPORT))) {
+		if (ASIC_IS_AVIVO(rdev)  (mode-flags  DRM_MODE_FLAG_INTERLACE))
+			WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc-crtc_offset,
+			   AVIVO_D1MODE_INTERLEAVE_EN);
+	}
 }
 
 static void
-- 
1.5.6.3

From ca8fb7e3f062285c5b4ca22bb731cb745cc182a9 Mon Sep 17 00:00:00 2001
From: Alex Deucher alexdeuc...@gmail.com
Date: Tue, 13 Oct 2009 12:48:44 -0400
Subject: [PATCH] drm/radeon/kms: limit default tv modes to = 1024x768

fixes fdo bug 24496

Signed-off-by: Alex Deucher alexdeuc...@gmail.com
---
 drivers/gpu/drm/radeon/radeon_connectors.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 729207a..ae47f25 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -223,6 +223,11 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_conn
 	};
 
 	for (i = 0; i  17; i++) {
+		if (radeon_encoder-devices  (ATOM_DEVICE_TV_SUPPORT)) {
+			if (common_modes[i].w  1024 ||
+			common_modes[i].h  768)
+continue;
+		}
 		if (radeon_encoder-devices  (ATOM_DEVICE_LCD_SUPPORT)) {
 			if (common_modes[i].w  native_mode-hdisplay ||
 			common_modes[i].h  native_mode-vdisplay ||
-- 
1.5.6.3

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 

Re: [PATCHES] radeon KMS updates

2009-10-12 Thread Alex Deucher
On Mon, Oct 12, 2009 at 12:09 AM, Dave Airlie airl...@linux.ie wrote:

 patches:
 1 - make sure lvds panels have valid native mode info.  if not, report
 lvds as disconnected
 2 - fix up crtc dpms ordering based on recommendation from bios docs
 3 - add support for AdjustDisplayPll table which is used to adjust the
 clock to meet special requirements of different encoders (e.g.,
 tv-out, DP, certain low dot clocks on tmds, etc.)

 This patch is broken, it uses index possibly uninitialised.

 please send a follow up to fix this.

You've already provided the patch and it looks good.  Sorry about that.

Alex

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCHES] radeon KMS updates

2009-10-12 Thread Alex Deucher
On Mon, Oct 12, 2009 at 1:16 AM, Dave Airlie airl...@linux.ie wrote:
 1 - make sure lvds panels have valid native mode info.  if not, report
 lvds as disconnected
 2 - fix up crtc dpms ordering based on recommendation from bios docs
 3 - add support for AdjustDisplayPll table which is used to adjust the
 clock to meet special requirements of different encoders (e.g.,
 tv-out, DP, certain low dot clocks on tmds, etc.)
 4. clean up the crtc mode set path
 5. switch lvds to use the drm_mode struct rather than the
 radeon_native_mode struct.  Eliminates a layer of indirection.

 drm_mode structs are objects with identifiers, I think you aren't doing
 this right, use * to the mode strcut, create a native mode one using
 drm_mode_create and don't overwrite the mode id stuff.


I think this patch should do the trick.

Alex


 Dave.

  
 Patch 5 could probably use some more testing to make sure I didn't
 accidentally break lvds on any picky panels due to a typo in the
 conversion.

 Alex


From ccef8b311a1b9345cb99177a2cf2c37e5667622b Mon Sep 17 00:00:00 2001
From: Alex Deucher alexdeuc...@gmail.com
Date: Mon, 12 Oct 2009 11:25:05 -0400
Subject: [PATCH] drm/radeon/kms: properly handle mode id with native mode changes

drm modes are objects with indentifiers.  Make sure to preserve
the mode id when copying mode params.

Signed-off-by: Alex Deucher alexdeuc...@gmail.com
---
 drivers/gpu/drm/radeon/radeon_connectors.c |3 +--
 drivers/gpu/drm/radeon/radeon_encoders.c   |2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 17d5659..729207a 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -183,8 +183,7 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode
 	if (native_mode-hdisplay != 0 
 	native_mode-vdisplay != 0 
 	native_mode-clock != 0) {
-		mode = drm_mode_create(dev);
-		*mode = *native_mode;
+		mode = drm_mode_duplicate(dev, native_mode);
 		mode-type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
 		drm_mode_set_name(mode);
 
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index a9d4e0a..10845f3 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -175,11 +175,13 @@ void radeon_rmx_mode_fixup(struct drm_encoder *encoder,
 
 	if (mode-hdisplay  native_mode-hdisplay ||
 	mode-vdisplay  native_mode-vdisplay) {
+		int mode_id = adjusted_mode-base.id;
 		*adjusted_mode = *native_mode;
 		if (!ASIC_IS_AVIVO(rdev)) {
 			adjusted_mode-hdisplay = mode-hdisplay;
 			adjusted_mode-vdisplay = mode-vdisplay;
 		}
+		adjusted_mode-base.id = mode_id;
 	}
 }
 
-- 
1.5.6.3

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCHES] radeon KMS updates

2009-10-11 Thread Dave Airlie
 
 patches:
 1 - make sure lvds panels have valid native mode info.  if not, report
 lvds as disconnected
 2 - fix up crtc dpms ordering based on recommendation from bios docs
 3 - add support for AdjustDisplayPll table which is used to adjust the
 clock to meet special requirements of different encoders (e.g.,
 tv-out, DP, certain low dot clocks on tmds, etc.)

This patch is broken, it uses index possibly uninitialised.

please send a follow up to fix this.

Dave.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCHES] radeon KMS updates

2009-10-11 Thread Dave Airlie
 1 - make sure lvds panels have valid native mode info.  if not, report
 lvds as disconnected
 2 - fix up crtc dpms ordering based on recommendation from bios docs
 3 - add support for AdjustDisplayPll table which is used to adjust the
 clock to meet special requirements of different encoders (e.g.,
 tv-out, DP, certain low dot clocks on tmds, etc.)
 4. clean up the crtc mode set path
 5. switch lvds to use the drm_mode struct rather than the
 radeon_native_mode struct.  Eliminates a layer of indirection.

drm_mode structs are objects with identifiers, I think you aren't doing 
this right, use * to the mode strcut, create a native mode one using 
drm_mode_create and don't overwrite the mode id stuff.

Dave.

  
 Patch 5 could probably use some more testing to make sure I didn't
 accidentally break lvds on any picky panels due to a typo in the
 conversion.
 
 Alex
 

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCHES] radeon KMS updates

2009-10-09 Thread Alex Deucher
One more patch to address a possible case of systems with bad native
mode info for lvds, but a valid edid.

Alex

On Fri, Oct 9, 2009 at 5:53 PM, Alex Deucher alexdeuc...@gmail.com wrote:
 Attached are some updates to radeon kms; mostly clean-ups I ran into
 while preparing for evergreen support.

 patches:
 1 - make sure lvds panels have valid native mode info.  if not, report
 lvds as disconnected
 2 - fix up crtc dpms ordering based on recommendation from bios docs
 3 - add support for AdjustDisplayPll table which is used to adjust the
 clock to meet special requirements of different encoders (e.g.,
 tv-out, DP, certain low dot clocks on tmds, etc.)
 4. clean up the crtc mode set path
 5. switch lvds to use the drm_mode struct rather than the
 radeon_native_mode struct.  Eliminates a layer of indirection.

 Patch 5 could probably use some more testing to make sure I didn't
 accidentally break lvds on any picky panels due to a typo in the
 conversion.

 Alex

From 6b048a2582762c916617554cb7e68e92d8950175 Mon Sep 17 00:00:00 2001
From: Alex Deucher alexdeuc...@gmail.com
Date: Fri, 9 Oct 2009 18:41:19 -0400
Subject: [PATCH] drm/radeon/kms: also check for edid in lvds detect

In case the system has bad native mode info but
valid edid.

Signed-off-by: Alex Deucher alexdeuc...@gmail.com
---
 drivers/gpu/drm/radeon/radeon_connectors.c |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index da3a049..17d5659 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -398,8 +398,10 @@ static int radeon_lvds_mode_valid(struct drm_connector *connector,
 
 static enum drm_connector_status radeon_lvds_detect(struct drm_connector *connector)
 {
-	enum drm_connector_status ret = connector_status_disconnected;
+	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 	struct drm_encoder *encoder = radeon_best_single_encoder(connector);
+	enum drm_connector_status ret = connector_status_disconnected;
+	bool dret;
 
 	if (encoder) {
 		struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
@@ -410,6 +412,15 @@ static enum drm_connector_status radeon_lvds_detect(struct drm_connector *connec
 			ret = connector_status_connected;
 
 	}
+
+	/* check for edid as well */
+	if (radeon_connector-ddc_bus) {
+		radeon_i2c_do_lock(radeon_connector, 1);
+		dret = radeon_ddc_probe(radeon_connector);
+		radeon_i2c_do_lock(radeon_connector, 0);
+		if (dret)
+			ret = connector_status_connected;
+	}
 	/* check acpi lid status ??? */
 
 	radeon_connector_update_scratch_regs(connector, ret);
-- 
1.5.6.3

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel