Группа :: Система/X11
Пакет: xorg-x11
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: xorg-x11-6.8.2-tdfx_ddc2.patch
Скачать
Скачать
--- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c~ 18 Mar 2005 13:12:12 -0000 1.1.1.7
+++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c 25 Aug 2005 17:08:50 -0000
@@ -138,6 +138,8 @@
static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagermentMode, int flags);
+static xf86MonPtr doTDFXDDC(ScrnInfoPtr pScrn);
+
DriverRec TDFX = {
TDFX_VERSION,
TDFX_DRIVER_NAME,
@@ -214,6 +216,13 @@
static const char *ddcSymbols[] = {
"xf86PrintEDID",
"xf86SetDDCproperties",
+ "xf86DoEDID_DDC2",
+ NULL
+};
+
+static const char *i2cSymbols[] = {
+ "xf86CreateI2CBusRec",
+ "xf86I2CBusInit",
NULL
};
@@ -674,6 +683,7 @@
{
TDFXPtr pTDFX;
ClockRangePtr clockRanges;
+ xf86MonPtr pMon;
int i;
MessageType from;
int flags24;
@@ -975,32 +985,6 @@
availableMem = pScrn->videoRam - 4096 -
(((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12);
- i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
- pScrn->display->modes, clockRanges,
- 0, 320, 2048, 16*pScrn->bitsPerPixel,
- 200, 2047,
- pScrn->display->virtualX, pScrn->display->virtualY,
- availableMem, LOOKUP_BEST_REFRESH);
-
- if (i==-1) {
- TDFXFreeRec(pScrn);
- return FALSE;
- }
-
- xf86PruneDriverModes(pScrn);
-
- if (!i || !pScrn->modes) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
- TDFXFreeRec(pScrn);
- return FALSE;
- }
-
- xf86SetCrtcForModes(pScrn, 0);
-
- pScrn->currentMode = pScrn->modes;
-
- xf86PrintModes(pScrn);
-
xf86SetDpi(pScrn, 0, 0);
if (!xf86LoadSubModule(pScrn, "fb")) {
@@ -1043,19 +1027,29 @@
xf86LoaderReqSymLists(ramdacSymbols, NULL);
}
-#if USE_INT10
-#if !defined(__powerpc__)
- /* Load DDC if needed */
- /* This gives us DDC1 - we should be able to get DDC2B using i2c */
+ /* Load DDC and I2C for monitor ID */
+ if (!xf86LoadSubModule(pScrn, "i2c")) {
+ TDFXFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86LoaderReqSymLists(i2cSymbols, NULL);
+
if (!xf86LoadSubModule(pScrn, "ddc")) {
TDFXFreeRec(pScrn);
return FALSE;
}
xf86LoaderReqSymLists(ddcSymbols, NULL);
+ /* try to read read DDC2 data */
+ pMon = doTDFXDDC(pScrn);
+ if (pMon != NULL) {
+ xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon));
+ } else {
+ /* try to use vbe if we didn't find anything */
+#if USE_INT10
+#if !defined(__powerpc__)
/* Initialize DDC1 if possible */
if (xf86LoadSubModule(pScrn, "vbe")) {
- xf86MonPtr pMon;
vbeInfoPtr pVbe = VBEInit(NULL,pTDFX->pEnt->index);
xf86LoaderReqSymLists(vbeSymbols, NULL);
@@ -1065,11 +1059,38 @@
}
#endif
#endif
+ }
if (xf86ReturnOptValBool(pTDFX->Options, OPTION_USE_PIO, FALSE)) {
pTDFX->usePIO=TRUE;
}
+ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
+ pScrn->display->modes, clockRanges,
+ 0, 320, 2048, 16*pScrn->bitsPerPixel,
+ 200, 2047,
+ pScrn->display->virtualX, pScrn->display->virtualY,
+ availableMem, LOOKUP_BEST_REFRESH);
+
+ if (i==-1) {
+ TDFXFreeRec(pScrn);
+ return FALSE;
+ }
+
+ xf86PruneDriverModes(pScrn);
+
+ if (!i || !pScrn->modes) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
+ TDFXFreeRec(pScrn);
+ return FALSE;
+ }
+
+ xf86SetCrtcForModes(pScrn, 0);
+
+ pScrn->currentMode = pScrn->modes;
+
+ xf86PrintModes(pScrn);
+
#if X_BYTE_ORDER == X_BIG_ENDIAN
pTDFX->ModeReg.miscinit0 = pTDFX->readLong(pTDFX, MISCINIT0);
pTDFX->SavedReg.miscinit0 = pTDFX->ModeReg.miscinit0;
@@ -2521,3 +2542,69 @@
dacmode|=state;
pTDFX->writeLong(pTDFX, DACMODE, dacmode);
}
+
+void
+TDFXPutBits(I2CBusPtr b, int scl, int sda)
+{
+ TDFXPtr pTDFX;
+ CARD32 reg;
+
+ pTDFX = b->DriverPrivate.ptr;
+ reg = pTDFX->readLong(pTDFX, VIDSERIALPARALLELPORT);
+ reg = (reg & ~(VSP_SDA0_OUT | VSP_SCL0_OUT)) |
+ (scl ? VSP_SCL0_OUT : 0) |
+ (sda ? VSP_SDA0_OUT : 0);
+ pTDFX->writeLong(pTDFX, VIDSERIALPARALLELPORT, reg);
+}
+
+void
+TDFXGetBits(I2CBusPtr b, int *scl, int *sda)
+{
+ TDFXPtr pTDFX;
+ CARD32 reg;
+
+ pTDFX = b->DriverPrivate.ptr;
+ reg = pTDFX->readLong(pTDFX, VIDSERIALPARALLELPORT);
+ *sda = (reg & VSP_SDA0_IN) ? 1 : 0;
+ *scl = (reg & VSP_SCL0_IN) ? 1 : 0;
+}
+
+static xf86MonPtr
+doTDFXDDC(ScrnInfoPtr pScrn)
+{
+ TDFXPtr pTDFX;
+ I2CBusPtr pI2CBus;
+ xf86MonPtr pMon = NULL;
+ CARD32 reg;
+
+ pTDFX = TDFXPTR(pScrn);
+
+ if (!(pI2CBus = xf86CreateI2CBusRec()))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to allocate I2C Bus record.\n");
+ return NULL;
+ }
+
+ /* Fill in generic structure fields */
+ pI2CBus->BusName = "DDC";
+ pI2CBus->scrnIndex = pScrn->scrnIndex;
+ pI2CBus->I2CPutBits = TDFXPutBits;
+ pI2CBus->I2CGetBits = TDFXGetBits;
+
+ pI2CBus->DriverPrivate.ptr = pTDFX;
+
+ reg = pTDFX->readLong(pTDFX, VIDSERIALPARALLELPORT);
+ pTDFX->writeLong(pTDFX, VIDSERIALPARALLELPORT, reg | VSP_ENABLE_IIC0);
+
+ if (xf86I2CBusInit(pI2CBus))
+ {
+ pMon = xf86DoEDID_DDC2(pScrn->scrnIndex, pI2CBus);
+ if (pMon == NULL)
+ xf86Msg(X_WARNING, "No DDC2 capable monitor found\n");
+ xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE);
+ }
+ pTDFX->writeLong(pTDFX, VIDSERIALPARALLELPORT, reg);
+
+ return pMon;
+}
+
--- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h~ 5 Mar 2004 14:29:02 -0000 1.1.1.5
+++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h 25 Aug 2005 17:08:52 -0000
@@ -384,4 +384,28 @@
#define SST_POWERDOWN_DAC BIT(8)
+/* VIDSERIALPARALELPORT */
+#define VSP_TVOUT_RESET 0x80000000 /* 0 forces TVout reset */
+#define VSP_GPIO2_IN 0x40000000
+#define VSP_GPIO1_OUT 0x20000000
+#define VSP_VMI_RESET_N 0x10000000 /* 0 forces a VMI reset */
+#define VSP_SDA1_IN 0x08000000 /* i2c bus on the feature connector */
+#define VSP_SCL1_IN 0x04000000
+#define VSP_SDA1_OUT 0x02000000
+#define VSP_SCL1_OUT 0x01000000
+#define VSP_ENABLE_IIC1 0x00800000 /* 1 enables I2C bus 1 */
+#define VSP_SDA0_IN 0x00400000 /* i2c bus on the monitor connector */
+#define VSP_SCL0_IN 0x00200000
+#define VSP_SDA0_OUT 0x00100000
+#define VSP_SCL0_OUT 0x00080000
+#define VSP_ENABLE_IIC0 0x00040000 /* 1 enables I2C bus 0 */
+#define VSP_VMI_ADDRESS 0x0003c000 /* mask */
+#define VSP_VMI_DATA 0x00003fc0 /* mask */
+#define VSP_VMI_DISABLE 0x00000020 /* 0 enables VMI output */
+#define VSP_VMI_RDY_N 0x00000010
+#define VSP_RW_N 0x00000008
+#define VSP_DS_N 0x00000004
+#define VSP_CS_N 0x00000002
+#define VSP_HOST_ENABLE 0x00000001 /* 1 enables VMI host control*/
+
#endif