diff options
author | Alex Deucher <alex@botch2.(none)> | 2007-11-30 16:40:28 -0500 |
---|---|---|
committer | Alex Deucher <alex@botch2.(none)> | 2007-11-30 16:40:28 -0500 |
commit | af0196f7bf0d1d5d211391149c18935d64ed2b06 (patch) | |
tree | 5d88a8945a06894658dcfeca18f7e1f98b8447cf /src | |
parent | d9858a2b3744b99003cfb9f31b743a2d31b322e9 (diff) | |
parent | 0175b79987ef4d7b0ce8238c3bdde989e504516a (diff) |
Merge branch 'master' of ssh://agd5f@git.freedesktop.org/git/xorg/driver/xf86-video-ati into atombios-support
merge master and fix conflicts
Diffstat (limited to 'src')
-rw-r--r-- | src/radeon.h | 16 | ||||
-rw-r--r-- | src/radeon_crtc.c | 4 | ||||
-rw-r--r-- | src/radeon_driver.c | 18 | ||||
-rw-r--r-- | src/radeon_output.c | 158 | ||||
-rw-r--r-- | src/radeon_render.c | 4 |
5 files changed, 158 insertions, 42 deletions
diff --git a/src/radeon.h b/src/radeon.h index b814b10a..586a1fc9 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -542,12 +542,19 @@ typedef enum { CHIP_ERRATA_PLL_DELAY = 0x00000004 } RADEONErrata; +typedef enum { + RADEON_SIL_164 = 0x00000001, + RADEON_SIL_1178 = 0x00000002 +} RADEONExtTMDSChip; + #if defined(__powerpc__) typedef enum { - RADEON_MAC_IBOOK = 0x00000001, - RADEON_MAC_POWERBOOK_DL = 0x00000002, - RADEON_MAC_POWERBOOK = 0x00000004, - RADEON_MAC_MINI = 0x00000008 + 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 } RADEONMacModel; #endif @@ -943,6 +950,7 @@ typedef struct { #if defined(__powerpc__) RADEONMacModel MacModel; #endif + RADEONExtTMDSChip ext_tmds_chip; atomBiosHandlePtr atomBIOS; unsigned long FbFreeStart, FbFreeSize; diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index 57fad399..e2883522 100644 --- a/src/radeon_crtc.c +++ b/src/radeon_crtc.c @@ -783,8 +783,8 @@ RADEONInitBIOSRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) RADEONInfoPtr info = RADEONPTR(pScrn); /* tell the bios not to muck with the hardware on events */ - save->bios_4_scratch = 0; - save->bios_5_scratch = 0xff00; + save->bios_4_scratch = 0x4; /* 0x4 needed for backlight */ + save->bios_5_scratch = (info->SavedReg.bios_5_scratch & 0xff) | 0xff00; /* bits 0-3 keep backlight level */ save->bios_6_scratch = info->SavedReg.bios_6_scratch | 0x40000000; } diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 507b700b..73e192ac 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -4309,10 +4309,13 @@ void RADEONRestoreBIOSRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + CARD32 bios_5_scratch = INREG(RADEON_BIOS_5_SCRATCH); CARD32 bios_6_scratch = INREG(RADEON_BIOS_6_SCRATCH); OUTREG(RADEON_BIOS_4_SCRATCH, restore->bios_4_scratch); - OUTREG(RADEON_BIOS_5_SCRATCH, restore->bios_5_scratch); + bios_5_scratch &= 0xF; + bios_5_scratch |= (restore->bios_5_scratch & ~0xF); + OUTREG(RADEON_BIOS_5_SCRATCH, bios_5_scratch); if (restore->bios_6_scratch & 0x40000000) bios_6_scratch |= 0x40000000; else @@ -4968,9 +4971,9 @@ void RADEONChangeSurfaces(ScrnInfoPtr pScrn) retvalue = drmCommandWrite(info->drmFD, DRM_RADEON_SURF_FREE, &drmsurffree, sizeof(drmsurffree)); - if ((info->ChipFamily != CHIP_FAMILY_RV100) || - (info->ChipFamily != CHIP_FAMILY_RS100) || - (info->ChipFamily != CHIP_FAMILY_RS200)) { + if (!((info->ChipFamily == CHIP_FAMILY_RV100) || + (info->ChipFamily == CHIP_FAMILY_RS100) || + (info->ChipFamily == CHIP_FAMILY_RS200))) { drmsurffree.address = info->depthOffset; retvalue = drmCommandWrite(info->drmFD, DRM_RADEON_SURF_FREE, &drmsurffree, sizeof(drmsurffree)); @@ -5025,9 +5028,10 @@ void RADEONChangeSurfaces(ScrnInfoPtr pScrn) } /* rv100 and probably the derivative igps don't have depth tiling on all the time? */ - if (info->have3DWindows && ((info->ChipFamily != CHIP_FAMILY_RV100) || - (info->ChipFamily != CHIP_FAMILY_RS100) || - (info->ChipFamily != CHIP_FAMILY_RS200))) { + if (info->have3DWindows && + (!((info->ChipFamily == CHIP_FAMILY_RV100) || + (info->ChipFamily == CHIP_FAMILY_RS100) || + (info->ChipFamily == CHIP_FAMILY_RS200)))) { drmRadeonSurfaceAlloc drmsurfalloc; drmsurfalloc.size = depthBufferSize; drmsurfalloc.address = info->depthOffset; diff --git a/src/radeon_output.c b/src/radeon_output.c index d8ded6d0..a325addb 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -217,22 +217,33 @@ RADEONRestoreDVOChip(ScrnInfoPtr pScrn, xf86OutputPtr output) (CARD32)~(RADEON_GPIO_A_0 | RADEON_GPIO_A_1)); if (!RADEONInitExtTMDSInfoFromBIOS(output)) { - /* do mac stuff here */ -#if defined(__powerpc__) if (radeon_output->DVOChip) { - switch(info->MacModel) { - case RADEON_MAC_POWERBOOK_DL: + switch(info->ext_tmds_chip) { + case RADEON_SIL_164: RADEONDVOWriteByte(radeon_output->DVOChip, 0x08, 0x30); RADEONDVOWriteByte(radeon_output->DVOChip, 0x09, 0x00); RADEONDVOWriteByte(radeon_output->DVOChip, 0x0a, 0x90); RADEONDVOWriteByte(radeon_output->DVOChip, 0x0c, 0x89); RADEONDVOWriteByte(radeon_output->DVOChip, 0x08, 0x3b); break; +#if 0 + /* needs work see bug 10418 */ + case RADEON_SIL_1178: + RADEONDVOWriteByte(radeon_output->DVOChip, 0x0f, 0x44); + RADEONDVOWriteByte(radeon_output->DVOChip, 0x0f, 0x4c); + RADEONDVOWriteByte(radeon_output->DVOChip, 0x0e, 0x01); + RADEONDVOWriteByte(radeon_output->DVOChip, 0x0a, 0x80); + RADEONDVOWriteByte(radeon_output->DVOChip, 0x09, 0x30); + RADEONDVOWriteByte(radeon_output->DVOChip, 0x0c, 0xc9); + RADEONDVOWriteByte(radeon_output->DVOChip, 0x0d, 0x70); + RADEONDVOWriteByte(radeon_output->DVOChip, 0x08, 0x32); + RADEONDVOWriteByte(radeon_output->DVOChip, 0x08, 0x33); + break; +#endif default: break; } } -#endif } } @@ -1741,11 +1752,13 @@ radeon_detect(xf86OutputPtr output) /* default to unknown for flaky chips/connectors * so we can get something on the screen */ - if (((radeon_output->type == OUTPUT_VGA || radeon_output->type == OUTPUT_DVI_I) && - radeon_output->DACType == DAC_TVDAC)) { + if ((radeon_output->type == OUTPUT_VGA || radeon_output->type == OUTPUT_DVI_I) && + (radeon_output->DACType == DAC_TVDAC) && + (info->ChipFamily == CHIP_FAMILY_RS400)) { radeon_output->MonType = MT_CRT; return XF86OutputStatusUnknown; - } else if (info->IsIGP && radeon_output->type == OUTPUT_DVI_D) { + } else if ((info->ChipFamily == CHIP_FAMILY_RS400) && + radeon_output->type == OUTPUT_DVI_D) { radeon_output->MonType = MT_DFP; /* MT_LCD ??? */ return XF86OutputStatusUnknown; } @@ -2802,7 +2815,7 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn) info->BiosConnector[2].ddc_line = 0; info->BiosConnector[2].valid = TRUE; return TRUE; - case RADEON_MAC_POWERBOOK_DL: + case RADEON_MAC_POWERBOOK_EXTERNAL: info->BiosConnector[0].ddc_line = RADEON_GPIO_DVI_DDC; info->BiosConnector[0].DACType = DAC_NONE; info->BiosConnector[0].TMDSType = TMDS_NONE; @@ -2821,7 +2834,8 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn) info->BiosConnector[2].ddc_line = 0; info->BiosConnector[2].valid = TRUE; return TRUE; - case RADEON_MAC_POWERBOOK: + + case RADEON_MAC_POWERBOOK_INTERNAL: info->BiosConnector[0].ddc_line = RADEON_GPIO_DVI_DDC; info->BiosConnector[0].DACType = DAC_NONE; info->BiosConnector[0].TMDSType = TMDS_NONE; @@ -2840,7 +2854,26 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn) info->BiosConnector[2].ddc_line = 0; info->BiosConnector[2].valid = TRUE; return TRUE; - case RADEON_MAC_MINI: + case RADEON_MAC_POWERBOOK_VGA: + info->BiosConnector[0].ddc_line = RADEON_GPIO_DVI_DDC; + info->BiosConnector[0].DACType = DAC_NONE; + info->BiosConnector[0].TMDSType = TMDS_NONE; + info->BiosConnector[0].ConnectorType = CONNECTOR_CRT; + info->BiosConnector[0].valid = TRUE; + + info->BiosConnector[1].ddc_line = RADEON_GPIO_VGA_DDC; + info->BiosConnector[1].DACType = DAC_PRIMARY; + info->BiosConnector[1].TMDSType = TMDS_INT; + info->BiosConnector[1].ConnectorType = CONNECTOR_DVI_I; + 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].ddc_line = 0; + info->BiosConnector[2].valid = TRUE; + return TRUE; + case RADEON_MAC_MINI_EXTERNAL: info->BiosConnector[0].ddc_line = RADEON_GPIO_CRT2_DDC; info->BiosConnector[0].DACType = DAC_TVDAC; info->BiosConnector[0].TMDSType = TMDS_EXT; @@ -2853,6 +2886,19 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn) info->BiosConnector[1].ddc_line = 0; info->BiosConnector[1].valid = TRUE; return TRUE; + case RADEON_MAC_MINI_INTERNAL: + info->BiosConnector[0].ddc_line = RADEON_GPIO_CRT2_DDC; + info->BiosConnector[0].DACType = DAC_TVDAC; + info->BiosConnector[0].TMDSType = TMDS_INT; + info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_I; + info->BiosConnector[0].valid = TRUE; + + info->BiosConnector[1].ConnectorType = CONNECTOR_STV; + info->BiosConnector[1].DACType = DAC_TVDAC; + info->BiosConnector[1].TMDSType = TMDS_NONE; + info->BiosConnector[1].ddc_line = 0; + info->BiosConnector[1].valid = TRUE; + return TRUE; default: return FALSE; } @@ -2975,11 +3021,19 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_I; info->BiosConnector[0].valid = TRUE; +#if defined(__powerpc__) + info->BiosConnector[1].ddc_line = RADEON_GPIO_VGA_DDC; + info->BiosConnector[1].DACType = DAC_PRIMARY; + info->BiosConnector[1].TMDSType = TMDS_EXT; + info->BiosConnector[1].ConnectorType = CONNECTOR_DVI_I; + info->BiosConnector[1].valid = TRUE; +#else info->BiosConnector[1].ddc_line = RADEON_GPIO_VGA_DDC; info->BiosConnector[1].DACType = DAC_PRIMARY; info->BiosConnector[1].TMDSType = TMDS_EXT; info->BiosConnector[1].ConnectorType = CONNECTOR_VGA; info->BiosConnector[1].valid = TRUE; +#endif } } @@ -3008,25 +3062,63 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) * in /proc/cpuinfo (on Linux) */ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn) { + RADEONInfoPtr info = RADEONPTR(pScrn); RADEONMacModel ret = 0; #ifdef __linux__ char cpuline[50]; /* 50 should be sufficient for our purposes */ FILE *f = fopen ("/proc/cpuinfo", "r"); + /* Some macs (minis and powerbooks) use internal tmds, others use external tmds + * and not just for dual-link TMDS, it shows up with single-link as well. + * Unforunately, there doesn't seem to be any good way to figure it out. + */ + + /* + * PowerBook5,[1-5]: external tmds, single-link + * PowerBook5,[789]: external tmds, dual-link + * PowerBook5,6: external tmds, single-link or dual-link + * need to add another option to specify the external tmds chip + * or find out what's used and add it. + */ + + if (f != NULL) { while (fgets(cpuline, sizeof cpuline, f)) { if (!strncmp(cpuline, "machine", strlen ("machine"))) { - if (strstr(cpuline, "PowerBook5,6") || - strstr(cpuline, "PowerBook5,7") || + if (strstr(cpuline, "PowerBook5,1") || + strstr(cpuline, "PowerBook5,2") || + strstr(cpuline, "PowerBook5,3") || + strstr(cpuline, "PowerBook5,4") || + strstr(cpuline, "PowerBook5,5")) { + ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* single link */ + info->ext_tmds_chip = RADEON_SIL_164; /* works on 5,2 */ + break; + } + + if (strstr(cpuline, "PowerBook5,6")) { + ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* dual or single link */ + break; + } + + if (strstr(cpuline, "PowerBook5,7") || strstr(cpuline, "PowerBook5,8") || strstr(cpuline, "PowerBook5,9")) { - ret = RADEON_MAC_POWERBOOK_DL; + ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* dual link */ + info->ext_tmds_chip = RADEON_SIL_1178; /* guess */ break; } - if (strstr(cpuline, "PowerMac10,1") || - strstr(cpuline, "PowerMac10,2")) { - ret = RADEON_MAC_MINI; + if (strstr(cpuline, "PowerBook3,3")) { + ret = RADEON_MAC_POWERBOOK_VGA; /* vga rather than dvi */ + break; + } + + if (strstr(cpuline, "PowerMac10,1")) { + ret = RADEON_MAC_MINI_INTERNAL; /* internal tmds */ + break; + } + if (strstr(cpuline, "PowerMac10,2")) { + ret = RADEON_MAC_MINI_EXTERNAL; /* external tmds */ break; } } else if (!strncmp(cpuline, "detected as", strlen("detected as"))) { @@ -3034,7 +3126,7 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn) ret = RADEON_MAC_IBOOK; break; } else if (strstr(cpuline, "PowerBook")) { - ret = RADEON_MAC_POWERBOOK_DL; + ret = RADEON_MAC_POWERBOOK_INTERNAL; /* internal tmds */ break; } @@ -3053,10 +3145,12 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn) if (ret) { xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Detected %s.\n", - ret == RADEON_MAC_POWERBOOK_DL ? "PowerBook with dual link DVI" : - ret == RADEON_MAC_POWERBOOK ? "PowerBook with single link DVI" : + ret == RADEON_MAC_POWERBOOK_EXTERNAL ? "PowerBook with external DVI" : + ret == RADEON_MAC_POWERBOOK_INTERNAL ? "PowerBook with integrated DVI" : + ret == RADEON_MAC_POWERBOOK_VGA ? "PowerBook with VGA" : ret == RADEON_MAC_IBOOK ? "iBook" : - "Mac Mini"); + ret == RADEON_MAC_MINI_EXTERNAL ? "Mac Mini with external DVI" : + "Mac Mini with integrated DVI"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "If this is not correct, try Option \"MacModel\" and " "consider reporting to the\n"); @@ -3103,12 +3197,22 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) if (optstr) { if (!strncmp("ibook", optstr, strlen("ibook"))) info->MacModel = RADEON_MAC_IBOOK; - else if (!strncmp("powerbook-duallink", optstr, strlen("powerbook-duallink"))) - info->MacModel = RADEON_MAC_POWERBOOK_DL; - else if (!strncmp("powerbook", optstr, strlen("powerbook"))) - info->MacModel = RADEON_MAC_POWERBOOK; - else if (!strncmp("mini", optstr, strlen("mini"))) - info->MacModel = RADEON_MAC_MINI; + else if (!strncmp("powerbook-duallink", optstr, strlen("powerbook-duallink"))) /* alias */ + info->MacModel = RADEON_MAC_POWERBOOK_EXTERNAL; + else if (!strncmp("powerbook-external", optstr, strlen("powerbook-external"))) + info->MacModel = RADEON_MAC_POWERBOOK_EXTERNAL; + else if (!strncmp("powerbook-internal", optstr, strlen("powerbook-internal"))) + info->MacModel = RADEON_MAC_POWERBOOK_INTERNAL; + else if (!strncmp("powerbook-vga", optstr, strlen("powerbook-vga"))) + info->MacModel = RADEON_MAC_POWERBOOK_VGA; + else if (!strncmp("powerbook", optstr, strlen("powerbook"))) /* alias */ + info->MacModel = RADEON_MAC_POWERBOOK_INTERNAL; + else if (!strncmp("mini-internal", optstr, strlen("mini-internal"))) + info->MacModel = RADEON_MAC_MINI_INTERNAL; + else if (!strncmp("mini-external", optstr, strlen("mini-external"))) + info->MacModel = RADEON_MAC_MINI_EXTERNAL; + else if (!strncmp("mini", optstr, strlen("mini"))) /* alias */ + info->MacModel = RADEON_MAC_MINI_EXTERNAL; else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid Mac Model: %s\n", optstr); } diff --git a/src/radeon_render.c b/src/radeon_render.c index 5074fe1f..490dec11 100644 --- a/src/radeon_render.c +++ b/src/radeon_render.c @@ -392,7 +392,7 @@ static Bool FUNC_NAME(R100SetupTexture)( #endif ACCEL_PREAMBLE(); - if ((width > 2048) || (height > 2048)) + if ((width > 2047) || (height > 2047)) return FALSE; txformat = RadeonGetTextureFormat(format); @@ -424,7 +424,7 @@ static Bool FUNC_NAME(R100SetupTexture)( txformat |= ATILog2(width) << RADEON_TXFORMAT_WIDTH_SHIFT; txformat |= ATILog2(height) << RADEON_TXFORMAT_HEIGHT_SHIFT; } else { - tex_size = ((height - 1) << 16) | (width - 1); + tex_size = (height << 16) | width; txformat |= RADEON_TXFORMAT_NON_POWER2; } |