diff options
-rw-r--r-- | man/radeon.man | 27 | ||||
-rw-r--r-- | src/atidri.c | 26 | ||||
-rw-r--r-- | src/radeon.h | 23 | ||||
-rw-r--r-- | src/radeon_dri.c | 26 | ||||
-rw-r--r-- | src/radeon_driver.c | 4 | ||||
-rw-r--r-- | src/radeon_output.c | 76 | ||||
-rw-r--r-- | src/radeon_video.c | 56 |
7 files changed, 168 insertions, 70 deletions
diff --git a/man/radeon.man b/man/radeon.man index 41c72429..3c4df233 100644 --- a/man/radeon.man +++ b/man/radeon.man @@ -437,9 +437,36 @@ 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 +.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/atidri.c b/src/atidri.c index bc862a89..0da1bc59 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.h b/src/radeon.h index 76dcec71..2870ef54 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; @@ -544,18 +546,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 = 0x00000016, - RADEON_MAC_MINI_INTERNAL = 0x00000032 + 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_dri.c b/src/radeon_dri.c index ed418b8c..7136e4e0 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 */ diff --git a/src/radeon_driver.c b/src/radeon_driver.c index ba4c1115..7a469ed4 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 } }; @@ -1703,7 +1705,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 a325addb..19107be5 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -697,6 +697,20 @@ void RADEONConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output) 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); @@ -1828,6 +1842,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) { @@ -2048,6 +2063,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); @@ -2899,6 +2934,25 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn) 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; } @@ -3122,18 +3176,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 @@ -3150,7 +3207,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"); @@ -3213,6 +3271,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); } diff --git a/src/radeon_video.c b/src/radeon_video.c index 26857a56..3f0209ed 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, @@ -2199,7 +2198,7 @@ RADEONCopyRGB24Data( unsigned int w ){ CARD32 *dptr; - CARD8 *sptr = 0; + CARD8 *sptr; int i,j; RADEONInfoPtr info = RADEONPTR(pScrn); #ifdef XF86DRI @@ -2210,11 +2209,9 @@ 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, dstPitch, + while ( (dptr = ( CARD32* )RADEONHostDataBlit( pScrn, 4, w, dstPitchOff, &bufPitch, x, &y, &h, &hpass )) ) { @@ -2224,11 +2221,11 @@ RADEONCopyRGB24Data( for ( i = 0 ; i < w; i++, sptr += 3 ) { - *dptr++ = (sptr[0] << 24) | (sptr[1] << 16) | sptr[2]; + dptr[i] = (sptr[2] << 16) | (sptr[1] << 8) | sptr[0]; } - src += hpass * srcPitch; - dptr += hpass * bufPitch; + src += srcPitch; + dptr += bufPitch / 4; } } @@ -2246,14 +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--){ - dptr[0]=((sptr[0])<<24)|((sptr[1])<<16)|(sptr[2]); - dptr++; - sptr+=3; + for (i = 0; i < w; i++, sptr += 3) { + dptr[i] = (sptr[2] << 16) | (sptr[1] << 8) | sptr[0]; } } @@ -2927,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: @@ -2950,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); |