From nobody@FreeBSD.org  Mon Nov  7 20:38:43 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 17A7716A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  7 Nov 2005 20:38:43 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 979AA43D48
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  7 Nov 2005 20:38:42 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id jA7KcgLJ017928
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 7 Nov 2005 20:38:42 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id jA7KcgRs017925;
	Mon, 7 Nov 2005 20:38:42 GMT
	(envelope-from nobody)
Message-Id: <200511072038.jA7KcgRs017925@www.freebsd.org>
Date: Mon, 7 Nov 2005 20:38:42 GMT
From: "John O'Brien" <john@boardom.ca>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Apple Cinema Display - Xorg - ATI causes unrecoverable sleep mode
X-Send-Pr-Version: www-2.3

>Number:         88623
>Category:       ports
>Synopsis:       Apple Cinema Display - Xorg - ATI causes unrecoverable sleep mode
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-x11
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 07 20:40:21 GMT 2005
>Closed-Date:    Fri Nov 11 22:39:11 GMT 2005
>Last-Modified:  Fri Nov 11 22:39:11 GMT 2005
>Originator:     John O'Brien
>Release:        FreeBSD 6.0-RC1 FreeBSD 6.0-RC1 #0
>Organization:
>Environment:
FreeBSD fbsd6.jobe.lab 6.0-RC1 FreeBSD 6.0-RC1 #0: Thu Oct 20 10:55:31 EDT 2005     root@fbsd6.jobe.lab:/usr/obj/usr/src/sys/FBSD6  i386      
>Description:
When attempting to start X (xorg-server 6.8.2_6) with a Apple Cinema Display 20", it is immediately put into Sleep mode... This is only fixed by restarting the computer. The detailed explanation is as follows:

              - First, a weird one (somebody with some DDC HW spec ?): The monitor
switches to power managed state after the DDC probing done by radeonfb
or X.org. After tweaking around, it seems that our DDC code will leave
the clock and data lines "asserted" to low state. (The DDC GPIO
registers containing 0x00030000). Just "releasing" them (writing 0) and
suddently, the monitor comes back... (and we read 0x00000300 in there).
So I wonder if there is something wrong in our i2c DDC code...

http://lists.freedesktop.org/pipermail/xorg/2005-March/006641.html

This has apparently been merged into Xorg 6.9/7.0 as seen from this link.
http://cvs.freedesktop.org/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c?r1=1.48&r2=1.49

It is a quick two line fix that corrects the problem.
>How-To-Repeat:
Startx using a new Apple Display.
>Fix:
              http://cvs.freedesktop.org/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c?r1=1.48&r2=1.49
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->x11 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Nov 7 20:44:55 GMT 2005 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88623 

From: Dejan Lesjak <dejan.lesjak@ijs.si>
To: bug-followup@freebsd.org,
 john@boardom.ca
Cc:  
Subject: Re: ports/88623: Apple Cinema Display - Xorg - ATI causes unrecoverable sleep mode
Date: Tue, 8 Nov 2005 01:51:12 +0100

 --Boundary-00=_Ba/bDYJzOuxfmZw
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 The following patch for x11-servers/xorg-server port should do then. Can you 
 please confirm that?
 
 --Boundary-00=_Ba/bDYJzOuxfmZw
 Content-Type: text/plain;
   charset="us-ascii";
   name="xorg-server-applecinema.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="xorg-server-applecinema.patch"
 
 Index: files/patch-radeon_driver.c
 ===================================================================
 RCS file: /usr/local/repos/freebsd/ports/x11-servers/xorg-server/files/patch-radeon_driver.c,v
 retrieving revision 1.3
 diff -u -r1.3 patch-radeon_driver.c
 --- files/patch-radeon_driver.c	22 Jun 2005 23:12:58 -0000	1.3
 +++ files/patch-radeon_driver.c	8 Nov 2005 00:19:18 -0000
 @@ -1,6 +1,16 @@
 ---- programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c.orig	Thu Feb 17 13:15:22 2005
 -+++ programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c	Thu Feb 17 13:21:09 2005
 -@@ -2501,6 +2501,7 @@
 +--- programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c.orig	Tue Nov  8 01:15:59 2005
 ++++ programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c	Tue Nov  8 01:15:37 2005
 +@@ -938,6 +938,9 @@ static RADEONMonitorType RADEONDisplayDD
 + 	MonType = MT_NONE;
 +     }
 + 
 ++    OUTREG(info->DDCReg, INREG(info->DDCReg) &
 ++	   ~(RADEON_GPIO_EN_0 | RADEON_GPIO_EN_1));
 ++
 +     if (*MonInfo) {
 + 	if ((*MonInfo)->rawData[0x14] & 0x80) {
 + 	    /* Note some laptops have a DVI output that uses internal TMDS,
 +@@ -2284,6 +2287,7 @@ static Bool RADEONPreInitConfig(ScrnInfo
       case PCI_CHIP_RV370_5464:
           info->IsMobility = TRUE;
       case PCI_CHIP_RV370_5B60:
 @@ -8,7 +18,7 @@
       case PCI_CHIP_RV370_5B64:
       case PCI_CHIP_RV370_5B65:
           info->ChipFamily = CHIP_FAMILY_RV380;
 -@@ -7159,7 +7159,6 @@
 +@@ -7159,7 +7163,6 @@ void RADEONAdjustFrame(int scrnIndex, in
   	RADEONDoAdjustFrame(pScrn, x, y, FALSE);
       }
   
 
 --Boundary-00=_Ba/bDYJzOuxfmZw--

From: John O'Brien <john@boardom.ca>
To: Dejan Lesjak <dejan.lesjak@ijs.si>
Cc: bug-followup@freebsd.org
Subject: Re: ports/88623: Apple Cinema Display - Xorg - ATI causes unrecoverable sleep mode
Date: Mon, 7 Nov 2005 20:17:41 -0500

 I've applied it on my system and it works perfectly.
 
 J
 
 
 On 11/7/05, Dejan Lesjak <dejan.lesjak@ijs.si> wrote:
 > The following patch for x11-servers/xorg-server port should do then. Can =
 you
 > please confirm that?
 >
 >
 >

From: Dejan Lesjak <dejan.lesjak@ijs.si>
To: John O'Brien <john@boardom.ca>
Cc: bug-followup@freebsd.org
Subject: Re: ports/88623: Apple Cinema Display - Xorg - ATI causes unrecoverable sleep mode
Date: Wed, 9 Nov 2005 02:10:34 +0100

 Thanks for report, the solution and testing!
 I'll just check if it doesn't break something on other platforms/versions and 
 commit it to port.
Responsible-Changed-From-To: x11->freebsd-x11 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Fri Nov 11 20:24:18 GMT 2005 
Responsible-Changed-Why:  
Canonicalize assignment. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88623 
State-Changed-From-To: open->closed 
State-Changed-By: lesi 
State-Changed-When: Fri Nov 11 22:38:43 GMT 2005 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88623 
>Unformatted:
