xf86-video-ati: Branch 'atombios-support' - 7 commits

Dave Airlie airlied at kemper.freedesktop.org
Wed Dec 5 20:52:49 PST 2007


 man/radeon.man      |   27 ++++++++++++++++++
 src/atidri.c        |   26 ++++++++---------
 src/radeon.h        |   23 +++++++++------
 src/radeon_dri.c    |   26 ++++++++---------
 src/radeon_driver.c |    4 ++
 src/radeon_output.c |   76 ++++++++++++++++++++++++++++++++++++++++++++++------
 src/radeon_video.c  |   56 ++++++++++++++++++++------------------
 7 files changed, 168 insertions(+), 70 deletions(-)

New commits:
commit dbe3d2608ecc9896db9c23b3a347b50748c51e13
Merge: 48e31cd... 21ed435...
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Dec 6 14:22:03 2007 +1000

    Merge branch 'master' into atombios-support
    
    Conflicts:
    
    	src/radeon_output.c

diff --cc src/radeon_output.c
index a325add,11a2a8a..19107be
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@@ -688,15 -633,19 +688,29 @@@ void RADEONConnectorFindMonitor(ScrnInf
      RADEONOutputPrivatePtr radeon_output = output->driver_private;
  
      if (radeon_output->MonType == MT_UNKNOWN) {
 -	if (radeon_output->type == OUTPUT_STV || radeon_output->type == OUTPUT_CTV) {
 -	    if (xf86ReturnOptValBool(info->Options, OPTION_FORCE_TVOUT, FALSE)) {
 +	if (IS_AVIVO_VARIANT) {
 +	    radeon_output->MonType = avivo_display_ddc_connected(pScrn, output);
 +	    if (!radeon_output->MonType) {
 +		if (radeon_output->type == OUTPUT_LVDS)
 +		    radeon_output->MonType = MT_LCD;
 +		else if (OUTPUT_IS_TV)
 +		    radeon_output->MonType = MT_NONE;
 +		else
 +		    radeon_output->MonType = atombios_dac_detect(pScrn, output);
++	}
++    } else if (radeon_output->type == OUTPUT_STV || radeon_output->type == OUTPUT_CTV) {
++            if (xf86ReturnOptValBool(info->Options, OPTION_FORCE_TVOUT, FALSE)) {
+ 		if (radeon_output->type == OUTPUT_STV)
+ 		    radeon_output->MonType = MT_STV;
+ 		else
+ 		    radeon_output->MonType = MT_CTV;
+ 	    } else {
+ 		if (info->InternalTVOut) {
+ 		    if (radeon_output->load_detection)
+ 			radeon_output->MonType = radeon_detect_tv(pScrn);
+ 		    else
+ 			radeon_output->MonType = MT_NONE;
+ 		}
  	    }
  	} else {
  	    radeon_output->MonType = RADEONDisplayDDCConnected(pScrn, output);
@@@ -2896,9 -2786,28 +2931,28 @@@ static Bool RADEONSetupAppleConnectors(
  	info->BiosConnector[1].ConnectorType = CONNECTOR_STV;
  	info->BiosConnector[1].DACType = DAC_TVDAC;
  	info->BiosConnector[1].TMDSType = TMDS_NONE;
 -	info->BiosConnector[1].DDCType = DDC_NONE_DETECTED;
 +	info->BiosConnector[1].ddc_line = 0;
  	info->BiosConnector[1].valid = TRUE;
  	return TRUE;
+     case RADEON_MAC_IMAC_G5_ISIGHT:
+ 	info->BiosConnector[0].DDCType = DDC_MONID;
+ 	info->BiosConnector[0].DACType = DAC_NONE;
+ 	info->BiosConnector[0].TMDSType = TMDS_INT;
+ 	info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_D;
+ 	info->BiosConnector[0].valid = TRUE;
+ 
+ 	info->BiosConnector[1].DDCType = DDC_DVI;
+ 	info->BiosConnector[1].DACType = DAC_TVDAC;
+ 	info->BiosConnector[1].TMDSType = TMDS_NONE;
+ 	info->BiosConnector[1].ConnectorType = CONNECTOR_CRT;
+ 	info->BiosConnector[1].valid = TRUE;
+ 
+ 	info->BiosConnector[2].ConnectorType = CONNECTOR_STV;
+ 	info->BiosConnector[2].DACType = DAC_TVDAC;
+ 	info->BiosConnector[2].TMDSType = TMDS_NONE;
+ 	info->BiosConnector[2].DDCType = DDC_NONE_DETECTED;
+ 	info->BiosConnector[2].valid = TRUE;
+ 	return TRUE;
      default:
  	return FALSE;
      }
commit 21ed435398e4a398dd8a0a5d7c1d4cc45e916332
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Tue Dec 4 17:08:58 2007 -0500

    RADEON: add MacModel imac-g5-isight for iMac G5 iSight
    
    Thanks to Étienne Bersac for helping to figure this out.

diff --git a/man/radeon.man b/man/radeon.man
index 881612a..3c4df23 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -437,6 +437,8 @@ mini-internal        \-\- Mac Mini with integrated DVI
 .br
 mini                 \-\- mini-external alias
 .br
+imac-g5-isight       \-\- iMac G5 iSight
+.br
 The default value is
 .B undefined.
 .TP
diff --git a/src/radeon.h b/src/radeon.h
index 38d8b9f..fe491e8 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -431,18 +431,21 @@ typedef enum {
 } RADEONErrata;
 
 typedef enum {
-    RADEON_SIL_164  = 0x00000001,
-    RADEON_SIL_1178 = 0x00000002
+    RADEON_DVOCHIP_NONE,
+    RADEON_SIL_164,
+    RADEON_SIL_1178
 } RADEONExtTMDSChip;
 
 #if defined(__powerpc__)
 typedef enum {
-       RADEON_MAC_IBOOK              = 0x00000001,
-       RADEON_MAC_POWERBOOK_EXTERNAL = 0x00000002,
-       RADEON_MAC_POWERBOOK_INTERNAL = 0x00000004,
-       RADEON_MAC_POWERBOOK_VGA      = 0x00000008,
-       RADEON_MAC_MINI_EXTERNAL      = 0x00000010,
-       RADEON_MAC_MINI_INTERNAL      = 0x00000020
+    RADEON_MAC_NONE,
+    RADEON_MAC_IBOOK,
+    RADEON_MAC_POWERBOOK_EXTERNAL,
+    RADEON_MAC_POWERBOOK_INTERNAL,
+    RADEON_MAC_POWERBOOK_VGA,
+    RADEON_MAC_MINI_EXTERNAL,
+    RADEON_MAC_MINI_INTERNAL,
+    RADEON_MAC_IMAC_G5_ISIGHT
 } RADEONMacModel;
 #endif
 
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 4e5aded..11a2a8a 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -2789,6 +2789,25 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn)
 	info->BiosConnector[1].DDCType = DDC_NONE_DETECTED;
 	info->BiosConnector[1].valid = TRUE;
 	return TRUE;
+    case RADEON_MAC_IMAC_G5_ISIGHT:
+	info->BiosConnector[0].DDCType = DDC_MONID;
+	info->BiosConnector[0].DACType = DAC_NONE;
+	info->BiosConnector[0].TMDSType = TMDS_INT;
+	info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_D;
+	info->BiosConnector[0].valid = TRUE;
+
+	info->BiosConnector[1].DDCType = DDC_DVI;
+	info->BiosConnector[1].DACType = DAC_TVDAC;
+	info->BiosConnector[1].TMDSType = TMDS_NONE;
+	info->BiosConnector[1].ConnectorType = CONNECTOR_CRT;
+	info->BiosConnector[1].valid = TRUE;
+
+	info->BiosConnector[2].ConnectorType = CONNECTOR_STV;
+	info->BiosConnector[2].DACType = DAC_TVDAC;
+	info->BiosConnector[2].TMDSType = TMDS_NONE;
+	info->BiosConnector[2].DDCType = DDC_NONE_DETECTED;
+	info->BiosConnector[2].valid = TRUE;
+	return TRUE;
     default:
 	return FALSE;
     }
@@ -2974,18 +2993,21 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn)
 		    break;
 		}
 	    } else if (!strncmp(cpuline, "detected as", strlen("detected as"))) {
-                if (strstr(cpuline, "iBook")) {
-                    ret = RADEON_MAC_IBOOK;
+		if (strstr(cpuline, "iBook")) {
+		    ret = RADEON_MAC_IBOOK;
 		    break;
 		} else if (strstr(cpuline, "PowerBook")) {
 		    ret = RADEON_MAC_POWERBOOK_INTERNAL; /* internal tmds */
 		    break;
-                }
+		} else if (strstr(cpuline, "iMac G5 (iSight)")) {
+		    ret = RADEON_MAC_IMAC_G5_ISIGHT;
+		    break;
+		}
 
-                /* No known PowerMac model detected */
-                break;
-            }
-        }
+		/* No known PowerMac model detected */
+		break;
+	    }
+	}
 
 	fclose (f);
     } else
@@ -3002,7 +3024,8 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn)
 		   ret == RADEON_MAC_POWERBOOK_VGA ? "PowerBook with VGA" :
 		   ret == RADEON_MAC_IBOOK ? "iBook" :
 		   ret == RADEON_MAC_MINI_EXTERNAL ? "Mac Mini with external DVI" :
-		   "Mac Mini with integrated DVI");
+		   ret == RADEON_MAC_MINI_INTERNAL ? "Mac Mini with integrated DVI" :
+		   "iMac G5 iSight");
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "If this is not correct, try Option \"MacModel\" and "
 		   "consider reporting to the\n");
@@ -3065,6 +3088,8 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
 	    info->MacModel = RADEON_MAC_MINI_EXTERNAL;
 	else if (!strncmp("mini", optstr, strlen("mini"))) /* alias */
 	    info->MacModel = RADEON_MAC_MINI_EXTERNAL;
+	else if (!strncmp("imac-g5-isight", optstr, strlen("imac-g5-isight")))
+	    info->MacModel = RADEON_MAC_IMAC_G5_ISIGHT;
 	else {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid Mac Model: %s\n", optstr);
 	}
commit 54bfd522405d9fdfb69d3a59e111ac3d63483dbb
Author: Étienne Bersac <bersace03 at laposte.net>
Date:   Tue Dec 4 14:22:42 2007 -0500

    RADEON: fix typo

diff --git a/src/radeon.h b/src/radeon.h
index 78f756e..38d8b9f 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -441,8 +441,8 @@ typedef enum {
        RADEON_MAC_POWERBOOK_EXTERNAL = 0x00000002,
        RADEON_MAC_POWERBOOK_INTERNAL = 0x00000004,
        RADEON_MAC_POWERBOOK_VGA      = 0x00000008,
-       RADEON_MAC_MINI_EXTERNAL      = 0x00000016,
-       RADEON_MAC_MINI_INTERNAL      = 0x00000032
+       RADEON_MAC_MINI_EXTERNAL      = 0x00000010,
+       RADEON_MAC_MINI_INTERNAL      = 0x00000020
 } RADEONMacModel;
 #endif
 
commit 5022d006cfc06ca0395981526b2c2c94c6878567
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sun Dec 2 17:27:33 2007 +0100

    radeon: Further XVideo fixes.
    
    * Make sure pitch constraints are always met for DMA upload blits.
    * RGB24 is not affected by endianness.

diff --git a/src/radeon_video.c b/src/radeon_video.c
index 332f2cd..3f0209e 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -414,11 +414,11 @@ static XF86AttributeRec Attributes[NUM_DEC_ATTRIBUTES+1] =
 
 #define FOURCC_RGB24    0x00000000
 
-#define XVIMAGE_RGB24(byte_order)   \
+#define XVIMAGE_RGB24   \
         { \
                 FOURCC_RGB24, \
                 XvRGB, \
-                byte_order, \
+                LSBFirst, \
                 { 'R', 'G', 'B', 0, \
                   0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
                 24, \
@@ -473,15 +473,14 @@ static XF86ImageRec Images[NUM_IMAGES] =
 {
 #if X_BYTE_ORDER == X_BIG_ENDIAN
         XVIMAGE_RGBA32(MSBFirst),
-        XVIMAGE_RGB24(MSBFirst),
         XVIMAGE_RGBT16(MSBFirst),
         XVIMAGE_RGB16(MSBFirst),
 #else
         XVIMAGE_RGBA32(LSBFirst),
-        XVIMAGE_RGB24(LSBFirst),
         XVIMAGE_RGBT16(LSBFirst),
         XVIMAGE_RGB16(LSBFirst),
 #endif
+        XVIMAGE_RGB24,
         XVIMAGE_YUY2,
         XVIMAGE_UYVY,
         XVIMAGE_YV12,
@@ -2210,8 +2209,6 @@ RADEONCopyRGB24Data(
 	int x, y;
 	unsigned int hpass;
 
-	/* XXX Fix endian flip on R300 */
-
 	RADEONHostDataParams( pScrn, dst, dstPitch, 4, &dstPitchOff, &x, &y );
 
 	while ( (dptr = ( CARD32* )RADEONHostDataBlit( pScrn, 4, w, dstPitchOff,
@@ -2224,14 +2221,11 @@ RADEONCopyRGB24Data(
 
 		for ( i = 0 ; i < w; i++, sptr += 3 )
 		{
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-		    *dptr++ = (sptr[0] << 16) | (sptr[1] << 8) | sptr[2];
-#else
-		    *dptr++ = (sptr[2] << 16) | (sptr[1] << 8) | sptr[0];
-#endif
+		    dptr[i] = (sptr[2] << 16) | (sptr[1] << 8) | sptr[0];
 		}
 
 		src += srcPitch;
+		dptr += bufPitch / 4;
 	    }
 	}
 
@@ -2249,17 +2243,12 @@ RADEONCopyRGB24Data(
 				  & ~RADEON_NONSURF_AP0_SWP_16BPP);
 #endif
 
-	for(j=0;j<h;j++){
-	    dptr=(CARD32 *)(dst+j*dstPitch);
-	    sptr=src+j*srcPitch;
+	for (j = 0; j < h; j++) {
+	    dptr = (CARD32 *)(dst + j * dstPitch);
+	    sptr = src + j * srcPitch;
 
-	    for(i=w;i>0;i--){
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-	      *dptr++=((sptr[0])<<16)|((sptr[1])<<8)|(sptr[2]);
-#else
-	      *dptr++=((sptr[2])<<16)|((sptr[1])<<8)|(sptr[0]);
-#endif
-	      sptr+=3;
+	    for (i = 0; i < w; i++, sptr += 3) {
+		dptr[i] = (sptr[2] << 16) | (sptr[1] << 8) | sptr[0];
 	    }
 	}
 
@@ -2933,17 +2922,17 @@ RADEONPutImage(
 
    switch(id) {
    case FOURCC_RGB24:
-   	dstPitch=(width*4+0x0f)&(~0x0f);
-	srcPitch=width*3;
+	dstPitch = width * 4;
+	srcPitch = width * 3;
 	break;
    case FOURCC_RGBA32:
-   	dstPitch=(width*4+0x0f)&(~0x0f);
-	srcPitch=width*4;
+	dstPitch = width * 4;
+	srcPitch = width * 4;
 	break;
    case FOURCC_RGB16:
    case FOURCC_RGBT16:
-   	dstPitch=(width*2+0x0f)&(~0x0f);
-	srcPitch=(width*2+3)&(~0x03);
+	dstPitch = width * 2;
+	srcPitch = (width * 2 + 3) & ~3;
 	break;
    case FOURCC_YV12:
    case FOURCC_I420:
@@ -2956,11 +2945,20 @@ RADEONPutImage(
    case FOURCC_UYVY:
    case FOURCC_YUY2:
    default:
-	dstPitch = ((width << 1) + 63) & ~63;
-	srcPitch = (width << 1);
+	dstPitch = width * 2;
+	srcPitch = width * 2;
 	break;
    }
 
+#ifdef XF86DRI
+   if (info->directRenderingEnabled && info->DMAForXv) {
+       /* The upload blit only supports multiples of 64 bytes */
+       dstPitch = (dstPitch + 63) & ~63;
+   } else
+#endif
+       /* The overlay only supports multiples of 16 bytes */
+       dstPitch = (dstPitch + 15) & ~15;
+
    new_size = dstPitch * height;
    if (id == FOURCC_YV12 || id == FOURCC_I420) {
       new_size += (dstPitch >> 1) * ((height + 1) & ~1);
commit 6ed55b70b23dfdc7b41103ea59c1df2bda5e41e6
Author: Kusanagi Kouichi <slash at ma.neweb.ne.jp>
Date:   Sun Dec 2 17:18:46 2007 +0100

    radeon: Fix crash with XVideo 24bit RGB images.
    
    See https://bugs.freedesktop.org/show_bug.cgi?id=13274 .

diff --git a/src/radeon_video.c b/src/radeon_video.c
index 26857a5..332f2cd 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -2199,7 +2199,7 @@ RADEONCopyRGB24Data(
   unsigned int w
 ){
     CARD32 *dptr;
-    CARD8 *sptr = 0;
+    CARD8 *sptr;
     int i,j;
     RADEONInfoPtr info = RADEONPTR(pScrn);
 #ifdef XF86DRI
@@ -2214,7 +2214,7 @@ RADEONCopyRGB24Data(
 
 	RADEONHostDataParams( pScrn, dst, dstPitch, 4, &dstPitchOff, &x, &y );
 
-	while ( (dptr = ( CARD32* )RADEONHostDataBlit( pScrn, 4, w, dstPitch,
+	while ( (dptr = ( CARD32* )RADEONHostDataBlit( pScrn, 4, w, dstPitchOff,
 						       &bufPitch, x, &y, &h,
 						       &hpass )) )
 	{
@@ -2224,11 +2224,14 @@ RADEONCopyRGB24Data(
 
 		for ( i = 0 ; i < w; i++, sptr += 3 )
 		{
-		    *dptr++ = (sptr[0] << 24) | (sptr[1] << 16) | sptr[2];
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+		    *dptr++ = (sptr[0] << 16) | (sptr[1] << 8) | sptr[2];
+#else
+		    *dptr++ = (sptr[2] << 16) | (sptr[1] << 8) | sptr[0];
+#endif
 		}
 
-		src += hpass * srcPitch;
-		dptr += hpass * bufPitch;
+		src += srcPitch;
 	    }
 	}
 
@@ -2251,8 +2254,11 @@ RADEONCopyRGB24Data(
 	    sptr=src+j*srcPitch;
 
 	    for(i=w;i>0;i--){
-	      dptr[0]=((sptr[0])<<24)|((sptr[1])<<16)|(sptr[2]);
-	      dptr++;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+	      *dptr++=((sptr[0])<<16)|((sptr[1])<<8)|(sptr[2]);
+#else
+	      *dptr++=((sptr[2])<<16)|((sptr[1])<<8)|(sptr[0]);
+#endif
 	      sptr+=3;
 	    }
 	}
commit a697b590899bb7704ec4d7ae9a9c3cbbfcaef382
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sun Dec 2 17:11:20 2007 +0100

    Fix build against xserver master.
    
    (DE)ALLOCATE_LOCAL are gone.

diff --git a/src/atidri.c b/src/atidri.c
index bc862a8..0da1bc5 100644
--- a/src/atidri.c
+++ b/src/atidri.c
@@ -553,11 +553,11 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg,
 
 	if (nbox > 1) {
 	    /* Keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox);
+	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
 	    if (!pboxNew1) return;
-	    pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox);
+	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
 	    if (!pptNew1) {
-		DEALLOCATE_LOCAL(pboxNew1);
+		xfree(pboxNew1);
 		return;
 	    }
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -588,13 +588,13 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg,
 
 	if (nbox > 1) {
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox);
-	    pptNew2  = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox);
+	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
+	    pptNew2  = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
 	    if (!pboxNew2 || !pptNew2) {
-		DEALLOCATE_LOCAL(pptNew2);
-		DEALLOCATE_LOCAL(pboxNew2);
-		DEALLOCATE_LOCAL(pptNew1);
-		DEALLOCATE_LOCAL(pboxNew1);
+		xfree(pptNew2);
+		xfree(pboxNew2);
+		xfree(pptNew1);
+		xfree(pboxNew1);
 		return;
 	    }
 	    pboxBase = pboxNext = pbox;
@@ -665,10 +665,10 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg,
     outf(SRC_OFF_PITCH, pATI->NewHW.dst_off_pitch);
     outf(DST_OFF_PITCH, pATI->NewHW.src_off_pitch);
 
-    DEALLOCATE_LOCAL(pptNew2);
-    DEALLOCATE_LOCAL(pboxNew2);
-    DEALLOCATE_LOCAL(pptNew1);
-    DEALLOCATE_LOCAL(pboxNew1);
+    xfree(pptNew2);
+    xfree(pboxNew2);
+    xfree(pptNew1);
+    xfree(pboxNew1);
 
     ATIDRIMarkSyncInt(pScreenInfo);
 #endif
diff --git a/src/radeon_dri.c b/src/radeon_dri.c
index ed418b8..7136e4e 100644
--- a/src/radeon_dri.c
+++ b/src/radeon_dri.c
@@ -559,12 +559,12 @@ static void RADEONDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
 
 	if (nbox > 1) {
 	    /* Keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox);
+	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
 	    if (!pboxNew1) return;
 
-	    pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox);
+	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
 	    if (!pptNew1) {
-		DEALLOCATE_LOCAL(pboxNew1);
+		xfree(pboxNew1);
 		return;
 	    }
 
@@ -601,14 +601,14 @@ static void RADEONDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
 
 	if (nbox > 1) {
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox);
-	    pptNew2  = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox);
+	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
+	    pptNew2  = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
 
 	    if (!pboxNew2 || !pptNew2) {
-		DEALLOCATE_LOCAL(pptNew2);
-		DEALLOCATE_LOCAL(pboxNew2);
-		DEALLOCATE_LOCAL(pptNew1);
-		DEALLOCATE_LOCAL(pboxNew1);
+		xfree(pptNew2);
+		xfree(pboxNew2);
+		xfree(pptNew1);
+		xfree(pboxNew1);
 		return;
 	    }
 
@@ -679,10 +679,10 @@ static void RADEONDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
 
     info->dst_pitch_offset = info->frontPitchOffset;;
 
-    DEALLOCATE_LOCAL(pptNew2);
-    DEALLOCATE_LOCAL(pboxNew2);
-    DEALLOCATE_LOCAL(pptNew1);
-    DEALLOCATE_LOCAL(pboxNew1);
+    xfree(pptNew2);
+    xfree(pboxNew2);
+    xfree(pptNew1);
+    xfree(pboxNew1);
 
     info->accel->NeedToSync = TRUE;
 #endif /* USE_XAA */
commit 00b4480aa2c5d7f751e34fc964f431b90b14c8d2
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sat Dec 1 14:18:40 2007 -0500

    RADEON: add options for force TV out as detected and to set TV standard
    
    Also fix a typo in internal tv-out parsing

diff --git a/man/radeon.man b/man/radeon.man
index 41c7242..881612a 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -440,6 +440,31 @@ mini                 \-\- mini-external alias
 The default value is
 .B undefined.
 .TP
+.BI "Option \*qTVStandard\*q \*q" string \*q
+.br
+Used to specify the default TV standard if you want to use something other than
+the bios default. Valid options are:
+.br
+ntsc
+.br
+pal
+.br
+pal-m
+.br
+pal-60
+.br
+ntsc-j
+.br
+scart-pal
+.br
+The default value is
+.B undefined.
+.TP
+.BI "Option \*qForceTVOut\*q \*q" boolean \*q
+Enable this option to force TV Out to always be detected as attached.
+The default is
+.B off 
+.TP
 
 .SH SEE ALSO
 __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
diff --git a/src/radeon.h b/src/radeon.h
index f9bf343..78f756e 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -158,7 +158,9 @@ typedef enum {
     OPTION_MAC_MODEL,
 #endif
     OPTION_DEFAULT_TMDS_PLL,
-    OPTION_TVDAC_LOAD_DETECT
+    OPTION_TVDAC_LOAD_DETECT,
+    OPTION_FORCE_TVOUT,
+    OPTION_TVSTD
 } RADEONOpts;
 
 
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 0465497..3422b66 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -192,6 +192,8 @@ static const OptionInfoRec RADEONOptions[] = {
     { OPTION_MAC_MODEL,      "MacModel",         OPTV_STRING,  {0}, FALSE },
 #endif
     { OPTION_TVDAC_LOAD_DETECT, "TVDACLoadDetect", OPTV_BOOLEAN, {0}, FALSE },
+    { OPTION_FORCE_TVOUT,    "ForceTVOut",         OPTV_BOOLEAN, {0}, FALSE },
+    { OPTION_TVSTD,          "TVStandard",         OPTV_STRING,  {0}, FALSE },
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
 
@@ -1522,7 +1524,7 @@ static Bool RADEONPreInitChipType(ScrnInfoPtr pScrn)
 	    info->IsIGP = card->igp;
 	    pRADEONEnt->HasCRTC2 = !card->nocrtc2;
 	    info->HasSingleDAC = card->singledac;
-	    info->InternalTVOut = card->nointtvout;
+	    info->InternalTVOut = !card->nointtvout;
 	    break;
 	}
     }
diff --git a/src/radeon_output.c b/src/radeon_output.c
index efe093f..4e5aded 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -634,11 +634,18 @@ void RADEONConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output)
 
     if (radeon_output->MonType == MT_UNKNOWN) {
 	if (radeon_output->type == OUTPUT_STV || radeon_output->type == OUTPUT_CTV) {
-	    if (info->InternalTVOut) {
-		if (radeon_output->load_detection)
-		    radeon_output->MonType = radeon_detect_tv(pScrn);
+	    if (xf86ReturnOptValBool(info->Options, OPTION_FORCE_TVOUT, FALSE)) {
+		if (radeon_output->type == OUTPUT_STV)
+		    radeon_output->MonType = MT_STV;
 		else
-		    radeon_output->MonType = MT_NONE;
+		    radeon_output->MonType = MT_CTV;
+	    } else {
+		if (info->InternalTVOut) {
+		    if (radeon_output->load_detection)
+			radeon_output->MonType = radeon_detect_tv(pScrn);
+		    else
+			radeon_output->MonType = MT_NONE;
+		}
 	    }
 	} else {
 	    radeon_output->MonType = RADEONDisplayDDCConnected(pScrn, output);
@@ -1759,6 +1766,7 @@ radeon_create_resources(xf86OutputPtr output)
     INT32 range[2];
     int data, err;
     const char *s;
+    char *optstr;
 
     /* backlight control */
     if (radeon_output->type == OUTPUT_LVDS) {
@@ -1994,6 +2002,26 @@ radeon_create_resources(xf86OutputPtr output)
 	    s = "ntsc";
 	    break;
 	}
+
+	optstr = (char *)xf86GetOptValString(info->Options, OPTION_TVSTD);
+	if (optstr) {
+	    if (!strncmp("ntsc", optstr, strlen("ntsc")))
+		radeon_output->tvStd = TV_STD_NTSC;
+	    else if (!strncmp("pal", optstr, strlen("pal")))
+		radeon_output->tvStd = TV_STD_PAL;
+	    else if (!strncmp("pal-m", optstr, strlen("pal-m")))
+		radeon_output->tvStd = TV_STD_PAL_M;
+	    else if (!strncmp("pal-60", optstr, strlen("pal-60")))
+		radeon_output->tvStd = TV_STD_PAL_60;
+	    else if (!strncmp("ntsc-j", optstr, strlen("ntsc-j")))
+		radeon_output->tvStd = TV_STD_NTSC_J;
+	    else if (!strncmp("scart-pal", optstr, strlen("scart-pal")))
+		radeon_output->tvStd = TV_STD_SCART_PAL;
+	    else {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid TV Standard: %s\n", optstr);
+	    }
+	}
+
 	err = RRChangeOutputProperty(output->randr_output, tv_std_atom,
 				     XA_STRING, 8, PropModeReplace, strlen(s), (pointer)s,
 				     FALSE, FALSE);


More information about the xorg-commit mailing list