vine-users ML アーカイブ



[vine-users:053302] SMI Lynx3DM での X の不具合解消

  • From: ASAHARA Yuichi <yuasaha@xxxxxxxxxxxxxxxxx>
  • Subject: [vine-users:053302] SMI Lynx3DM での X の不具合解消
  • Date: Sun, 1 Sep 2002 22:47:38 +0900
こんにちは。浅原と申します。

Vine-Users の過去ログを検索してもみつからなかったので、とりあえずこちらに
投稿させて頂きます。すでに既出の話題でしたらごめんなさい。

私の使用マシンは、Panasonic CF-R1PCAXR (Let's NOTE Light)なのですが
インストール時の X サーバでは、Ctr+Alt+F1 といったキーコンビネーションで
コンソールに落ちることができなかったりして、いまひとつ安心して X を使え
なかったのですが、XFree86 の CVS からとってきた smi ドライバだと、
随分マシな動作をしてくれます。

元ネタは、以下のページです。
http://www.d1.dion.ne.jp/~tnaka/pc_linux/lets2.html

cat /proc/pci では以下のようなチップです。
VGA compatible controller: Silicon Motion, Inc. SM720 Lynx3DM (rev 193).

昨日、apt-get upgrade で XFree86 もアップデートされていたようですが、
smi ドライバに関しては新しくなっていないようでしたので、
もし、同じようなチップを使っていらっしゃる方は、パッチを当ててみては
如何でしょうか。
私のところでは、XFree86-4.2.0-0vl18 の srpm に以下のパッチがうまく
当たってパッケージにできています。

それでは、失礼致します。
-- 
浅原  雄一 <yuasaha@xxxxxxxxxxxxxxxxx>
diff -uNr xc/programs/Xserver/hw/xfree86/drivers/siliconmotion.orig/regsmi.h xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h
--- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion.orig/regsmi.h	Tue Nov 28 20:59:19 2000
+++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h	Fri Jan 25 21:56:09 2002
@@ -26,7 +26,7 @@
 sale, use or other dealings in this Software without prior written
 authorization from the XFree86 Project and SIlicon Motion.
 */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h,v 1.1 2000/11/28 20:59:19 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h,v 1.2 2002/01/25 21:56:09 tsi Exp $ */
 
 #ifndef _REGSMI_H
 #define _REGSMI_H
@@ -57,8 +57,8 @@
 	}
 	else
 	{
-		outb(indexPort, index);
-		return(inb(dataPort));
+		outb(pSmi->PIOBase + indexPort, index);
+		return(inb(pSmi->PIOBase + dataPort));
 	}
 }
 
@@ -72,8 +72,8 @@
 	}
 	else
 	{
-		outb(indexPort, index);
-		outb(dataPort, data);
+		outb(pSmi->PIOBase + indexPort, index);
+		outb(pSmi->PIOBase + dataPort, data);
 	}
 }
 
@@ -86,7 +86,7 @@
 	}
 	else
 	{
-		return(inb(port));
+		return(inb(pSmi->PIOBase + port));
 	}
 }
 
@@ -99,7 +99,7 @@
 	}
 	else
 	{
-		outb(port, data);
+		outb(pSmi->PIOBase + port, data);
 	}
 }
 
diff -uNr xc/programs/Xserver/hw/xfree86/drivers/siliconmotion.orig/smi.h xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h
--- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion.orig/smi.h	Thu Dec 20 21:35:38 2001
+++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h	Thu Apr  4 14:05:47 2002
@@ -26,7 +26,7 @@
 sale, use or other dealings in this Software without prior written
 authorization from the XFree86 Project and Silicon Motion.
 */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.8 2001/12/20 21:35:38 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.10 2002/04/04 14:05:47 eich Exp $ */
 
 #ifndef _SMI_H
 #define _SMI_H
@@ -88,6 +88,7 @@
 /* Driver data structure; this should contain all needed info for a mode */
 typedef struct
 {
+	Bool    modeInit;
 	CARD16	mode;
 	CARD8	SR17, SR18, SR21, SR31, SR32, SR6A, SR6B, SR81, SRA0;
 	CARD8	CR33, CR33_2, CR3A;
@@ -149,6 +150,7 @@
 	CARD8 *			DataPortBase;	/* Base of data port */
 	int			DataPortSize;	/* Size of data port */
 	CARD8 *			IOBase;		/* Base of MMIO VGA ports */
+	IOADDRESS		PIOBase;	/* Base of I/O ports */
 	unsigned char *		FBBase;		/* Base of FB */
 	CARD32			FBOffset;	/* Current visual FB starting
 						   location */
diff -uNr xc/programs/Xserver/hw/xfree86/drivers/siliconmotion.orig/smi_driver.c xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c
--- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion.orig/smi_driver.c	Fri Jan  4 21:22:34 2002
+++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c	Thu Apr  4 14:05:47 2002
@@ -26,7 +26,7 @@
 sale, use or other dealings in this Software without prior written
 authorization from The XFree86 Project or Silicon Motion.
 */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.20 2002/01/04 21:22:34 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.24 2002/04/04 14:05:47 eich Exp $ */
 
 #include "xf86Resources.h"
 #include "xf86RAC.h"
@@ -256,6 +256,7 @@
 	"xf86DestroyI2CDevRec",
 	"xf86I2CBusInit",
 	"xf86I2CDevInit",
+	"xf86I2CReadBytes",
 	"xf86I2CWriteByte",
 	NULL
 };
@@ -291,7 +292,6 @@
 	"cfbScreenInit",
 	"cfb16ScreenInit",
 	"cfb24ScreenInit",
-	"cfb24_32ScreenInit",
 	"cfb32ScreenInit",
 	"cfb16BresS",
 	"cfb24BresS",
@@ -939,6 +939,7 @@
 	vgaIOBase  = hwp->IOBase;
 	vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET;
 	vgaCRReg   = vgaIOBase + VGA_CRTC_DATA_OFFSET;
+	pSmi->PIOBase = hwp->PIOOffset;
 
 	xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit vgaCRIndex=%x, vgaIOBase=%x, "
 			"MMIOBase=%x\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase);
@@ -1564,9 +1565,9 @@
 		xf86ExecX86int10(pSmi->pVbe->pInt10);
 
 		/* Enable linear mode. */
-		outb(VGA_SEQ_INDEX, 0x18);
-		tmp = inb(VGA_SEQ_DATA);
-		outb(VGA_SEQ_DATA, tmp | 0x01);
+		outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
+		tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
+		outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x01);
 
 		/* Enable DPR/VPR registers. */
 		tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
@@ -1662,14 +1663,13 @@
 		}
 
 		/* Restore the standard VGA registers */
-		if (xf86IsPrimaryPci(pSmi->PciInfo))
-		{
-			vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL);
-		}
-		else
-		{
-			vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
-		}
+		if (xf86IsPrimaryPci(pSmi->PciInfo)) {
+		    vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_CMAP 
+				 | VGA_SR_FONTS);
+		} 
+
+		if (restore->modeInit)
+		    vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE);
 
 		if (!SMI_LYNXM_SERIES(pSmi->Chipset))
 		{
@@ -1981,12 +1981,13 @@
 
 	pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
 	
-	/* Save the chip/graphics state */
-	SMI_Save(pScrn);
-	
 	if (!pSmi->pVbe) {
 	    pSmi->pVbe = VBEInit(NULL, pEnt->index);
 	}
+
+	/* Save the chip/graphics state */
+	SMI_Save(pScrn);
+	
 	/* Zero the frame buffer, #258 */
 	memset(pSmi->FBBase, 0, pSmi->videoRAMBytes);
 
@@ -2400,6 +2401,8 @@
 		return(FALSE);
 	}
 
+	new->modeInit = TRUE;
+
 	if (pSmi->rotate)
 	{
 		pSmi->width  = pScrn->virtualY;
@@ -2412,8 +2415,8 @@
 	}
 	pSmi->Bpp    = pScrn->bitsPerPixel / 8;
 
-	outb(VGA_SEQ_INDEX, 0x17);
-	tmp = inb(VGA_SEQ_DATA);
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x17);
+	tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
 	if (pSmi->pci_burst)
 	{
 		new->SR17 = tmp | 0x20;
@@ -2423,17 +2426,17 @@
 		new->SR17 = tmp & ~0x20;
 	}
 
-	outb(VGA_SEQ_INDEX, 0x18);
-	new->SR18 = inb(VGA_SEQ_DATA) | 0x11;
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
+	new->SR18 = inb(pSmi->PIOBase + VGA_SEQ_DATA) | 0x11;
 
-	outb(VGA_SEQ_INDEX, 0x21);
-	new->SR21 = inb(VGA_SEQ_DATA) & ~0x03;
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21);
+	new->SR21 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x03;
 
-	outb(VGA_SEQ_INDEX, 0x31);
-	new->SR31 = inb(VGA_SEQ_DATA) & ~0xC0;
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x31);
+	new->SR31 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0xC0;
 
-	outb(VGA_SEQ_INDEX, 0x32);
-	new->SR32 = inb(VGA_SEQ_DATA) & ~0x07;
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x32);
+	new->SR32 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x07;
 	if (SMI_LYNXM_SERIES(pSmi->Chipset))
 	{
 		new->SR32 |= 0x04;
@@ -2539,11 +2542,10 @@
 		}
 	}
 
-
-    /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */
-    new->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66);
-    if (pSmi->Chipset == SMI_LYNX3DM) {
-        switch (pScrn->bitsPerPixel) {
+	/* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */
+	new->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66);
+	if (pSmi->Chipset == SMI_LYNX3DM) {
+	    switch (pScrn->bitsPerPixel) {
 	    case 8:
 		new->CCR66 = (new->CCR66 & 0xF3) | 0x00; /* 6 bits-RAM */
 		break;
@@ -2558,12 +2560,11 @@
 	    default:
 		LEAVE_PROC("SMI_ModeInit");
 		return(FALSE);
-        }
-    }
-    /* end CZ */
+	    }
+	}
 
-	outb(VGA_SEQ_INDEX, 0x30);
-	if (inb(VGA_SEQ_DATA) & 0x01)
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x30);
+	if (inb(pSmi->PIOBase + VGA_SEQ_DATA) & 0x01)
 	{
 		new->SR21 = 0x00;
 	}
@@ -2755,7 +2756,7 @@
 	vgaRegPtr vgaSavePtr = &hwp->SavedReg;
 	SMIRegPtr SMISavePtr = &pSmi->SavedReg;
 	Bool ret;
-
+	
 	ENTER_PROC("SMI_CloseScreen");
 
 	if (pScrn->vtSema)
@@ -2949,16 +2950,16 @@
 	vgaHWSetStdFuncs(hwp);
 
 	/* Enable linear mode */
-	outb(VGA_SEQ_INDEX, 0x18);
-	tmp = inb(VGA_SEQ_DATA);
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
+	tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
 	pSmi->SR18Value = tmp;					/* PDR#521 */
-	outb(VGA_SEQ_DATA, tmp | 0x11);
+	outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x11);
 
 	/* Enable 2D/3D Engine and Video Processor */
-	outb(VGA_SEQ_INDEX, 0x21);
-	tmp = inb(VGA_SEQ_DATA);
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21);
+	tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
 	pSmi->SR21Value = tmp;					/* PDR#521 */
-	outb(VGA_SEQ_DATA, tmp & ~0x03);
+	outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp & ~0x03);
 
 	LEAVE_PROC("SMI_EnableMmio");
 }
@@ -2974,12 +2975,12 @@
 	vgaHWSetStdFuncs(hwp);
 
 	/* Disable 2D/3D Engine and Video Processor */
-	outb(VGA_SEQ_INDEX, 0x21);
-	outb(VGA_SEQ_DATA, pSmi->SR21Value);	/* PDR#521 */
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21);
+	outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR21Value);	/* PDR#521 */
 
 	/* Disable linear mode */
-	outb(VGA_SEQ_INDEX, 0x18);
-	outb(VGA_SEQ_DATA, pSmi->SR18Value);	/* PDR#521 */
+	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
+	outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR18Value);	/* PDR#521 */
 
 	LEAVE_PROC("SMI_DisableMmio");
 }
diff -uNr xc/programs/Xserver/hw/xfree86/drivers/siliconmotion.orig/smi_video.c xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c
--- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion.orig/smi_video.c	Thu Dec 20 21:35:39 2001
+++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c	Thu Apr  4 14:05:47 2002
@@ -1,5 +1,4 @@
 /* Header:   //Mercury/Projects/archives/XFree86/4.0/smi_video.c.-arc   1.14   30 Nov 2000 16:51:40   Frido  $ */
-
 /*
 Copyright (C) 1994-1999 The XFree86 Project, Inc.  All Rights Reserved.
 Copyright (C) 2000 Silicon Motion, Inc.  All Rights Reserved.
@@ -41,7 +40,7 @@
 Date:   2.11.2001
 */
 
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.6 2001/12/20 21:35:39 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.7 2002/04/04 14:05:47 eich Exp $ */
 
 #include "smi.h"
 #include "smi_video.h"
@@ -134,7 +133,9 @@
 		BoxPtr dstBox, short vid_w, short vid_h, short drw_w, short drw_h);
 static void SMI_BlockHandler(int i, pointer blockData, pointer pTimeout,
 		pointer pReadMask);
+#if 0
 static void SMI_WaitForSync(ScrnInfoPtr pScrn);
+#endif
 /*static int SMI_SendI2C(ScrnInfoPtr pScrn, CARD8 device, char *devName,
         SMI_I2CDataPtr i2cData);*/
 
@@ -263,7 +264,7 @@
 
 
 /* fixed order! */
-static XF86AttributeRec SMI_VideoAttributes[N_ATTRS] = {
+static XF86AttributeRec SMI_VideoAttributesSAA711x[N_ATTRS] = {
     {XvSettable | XvGettable,        0, N_ENCODINGS-1, XV_ENCODING_NAME},
     {XvSettable | XvGettable,        0,           255, XV_BRIGHTNESS_NAME},
     {XvSettable | XvGettable,        0,           127, XV_CONTRAST_NAME},
@@ -273,6 +274,11 @@
     {XvSettable | XvGettable,        0,             1, XV_INTERLACED_NAME},
 };
 
+static XF86AttributeRec SMI_VideoAttributes[N_ATTRS] = {
+    {XvSettable | XvGettable,        0,           255, XV_BRIGHTNESS_NAME},
+    {XvSettable | XvGettable, 0x000000,      0xFFFFFF, XV_COLORKEY_NAME},
+};
+
 
 /**************************************************************************/
 static XF86ImageRec SMI_VideoImages[] =
@@ -616,7 +622,7 @@
 
     if (numAdaptors != 0)
     {
-      DEBUG((VERBLEV, "ScreenInit\n"));
+      DEBUG((VERBLEV, "ScreenInit %i\n",numAdaptors));
         xf86XVScreenInit(pScreen, ptrAdaptors, numAdaptors);
     }
 
@@ -651,6 +657,9 @@
 static int
 SetAttr(ScrnInfoPtr pScrn, int i, int value)
 {
+    SMIPtr pSmi = SMIPTR(pScrn);
+    SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr;
+
     if (i < XV_ENCODING || i > XV_HUE)
 	return BadMatch;
     
@@ -658,20 +667,21 @@
     value = CLAMP(value, SMI_VideoAttributes[i].min_value,
 		  SMI_VideoAttributes[i].max_value);
 
-#if 0
-    if (pPPriv->I2CDev == SAA7110) {
+    if (pPort->I2CDev.SlaveAddr == SAA7110) {
 	return SetAttrSAA7110(pScrn, i, value);
     }
-    else if (pPPriv->I2CDev == SAA7111) {
-#endif
+    else if (pPort->I2CDev.SlaveAddr == SAA7111) {
 	return SetAttrSAA7111(pScrn, i, value);
-#if 0
     }
+    else if (i == XV_BRIGHTNESS) {
+	WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (value << 24));
+    }
+#if 0
     else {
 	return XvBadAlloc;
     }
 #endif
-
+    
     return Success;
 }
 
@@ -886,38 +896,39 @@
     smiPortPtr->I2CDev.SlaveAddr = SAA7111;
     smiPortPtr->I2CDev.pI2CBus = pSmi->I2C;
 
-    if (!xf86I2CDevInit(&(smiPortPtr->I2CDev)))
-    {
-        LEAVE_PROC("SMI_SetupVideo");
-        return(NULL);
-    }
-    DEBUG((VERBLEV, "SAA7111 intialized\n"));
-
-    if (!xf86I2CWriteVec(&(smiPortPtr->I2CDev), SAA7111InitData, ENTRIES(SAA7111InitData) / 2))
+    
+    if (xf86I2CDevInit(&(smiPortPtr->I2CDev)))
     {
-        LEAVE_PROC("SMI_SetupVideo");
-        return(NULL);
-    }
-
-	REGION_INIT(pScreen, &smiPortPtr->clip, NullBox, 0);
-
-	pSmi->ptrAdaptor = ptrAdaptor;
-	pSmi->BlockHandler = pScreen->BlockHandler;
-	pScreen->BlockHandler = SMI_BlockHandler;
-
-    xvEncoding   = MAKE_ATOM(XV_ENCODING_NAME);
-    xvHue        = MAKE_ATOM(XV_HUE_NAME);
-    xvSaturation = MAKE_ATOM(XV_SATURATION_NAME);
-    xvBrightness = MAKE_ATOM(XV_BRIGHTNESS_NAME);
-    xvContrast   = MAKE_ATOM(XV_CONTRAST_NAME);
-
+	
+	if (xf86I2CWriteVec(&(smiPortPtr->I2CDev), 	SAA7111InitData, 
+			    ENTRIES(SAA7111InitData) / 2)) {
+	    xvEncoding   = MAKE_ATOM(XV_ENCODING_NAME);
+	    xvHue        = MAKE_ATOM(XV_HUE_NAME);
+	    xvSaturation = MAKE_ATOM(XV_SATURATION_NAME);
+	    xvContrast   = MAKE_ATOM(XV_CONTRAST_NAME);
+	    
+	    xvInterlaced = MAKE_ATOM(XV_INTERLACED_NAME);
+	    DEBUG((VERBLEV, "SAA7111 intialized\n"));
+    
+	} else { 
+	    xf86DestroyI2CDevRec(&(smiPortPtr->I2CDev),FALSE);
+	    smiPortPtr->I2CDev.SlaveAddr = 0;
+	}
+    } else
+	smiPortPtr->I2CDev.SlaveAddr = 0;
+	
+    REGION_INIT(pScreen, &smiPortPtr->clip, NullBox, 0);
+    
+    pSmi->ptrAdaptor = ptrAdaptor;
+    pSmi->BlockHandler = pScreen->BlockHandler;
+    pScreen->BlockHandler = SMI_BlockHandler;
+    
     xvColorKey   = MAKE_ATOM(XV_COLORKEY_NAME);
-    xvInterlaced = MAKE_ATOM(XV_INTERLACED_NAME);
-
-	SMI_ResetVideo(pScrn);
-
-	LEAVE_PROC("SMI_SetupVideo");
-	return(ptrAdaptor);
+    xvBrightness = MAKE_ATOM(XV_BRIGHTNESS_NAME);
+    
+    SMI_ResetVideo(pScrn);
+    LEAVE_PROC("SMI_SetupVideo");
+    return(ptrAdaptor);
 }
 
 
@@ -1253,9 +1264,9 @@
 
 	OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) & ~0x04);
 	WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) | 0x00200000);
-
+#if 0
 	SMI_WaitForSync(pScrn);
-
+#endif
     /* Video Window I Left and Top Boundaries */
 	WRITE_VPR(pSmi, 0x14, dstBox.x1 + (dstBox.y1 << 16));
     /* Video Window I Right and Bottom Boundaries */
@@ -1444,7 +1455,6 @@
     SMI_PortPtr pPort = (SMI_PortPtr) data;
 
 	ENTER_PROC("SMI_GetPortAttribute");
-
     if (attribute == xvEncoding)
         *value = pPort->Attribute[XV_ENCODING];
 	else if (attribute == xvBrightness)
@@ -1756,7 +1766,7 @@
 **						S U P P O R T   F U N C T I O N S					  **
 **																			  **
 \******************************************************************************/
-
+#if 0
 static void
 SMI_WaitForSync(
 	ScrnInfoPtr	pScrn
@@ -1770,6 +1780,7 @@
 
 	VerticalRetraceWait();
 }
+#endif
 
 static Bool
 RegionsEqual(
@@ -2007,9 +2018,9 @@
 	{
 		vstretch = 0;
 	}
-
+#if 0
 	SMI_WaitForSync(pScrn);
-
+#endif
 	WRITE_VPR(pSmi, 0x00, vpr00 | (1 << 3) | (1 << 20));
 	WRITE_VPR(pSmi, 0x14, (dstBox->x1) | (dstBox->y1 << 16));
 	WRITE_VPR(pSmi, 0x18, (dstBox->x2) | (dstBox->y2 << 16));
@@ -2083,7 +2094,6 @@
 	}
 
 	dev = xf86CreateI2CDevRec();
-	ErrorF("zz %x\n",dev);
 	if (dev == NULL)
 	{
 		LEAVE_PROC("SMI_SendI2C");
@@ -2130,6 +2140,7 @@
 	XF86OffscreenImagePtr offscreenImages;
 	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 	SMIPtr pSmi = SMIPTR(pScrn);
+	SMI_PortPtr pPort = (SMI_PortPtr) pSmi->ptrAdaptor->pPortPrivates[0].ptr;
 
 	ENTER_PROC("SMI_InitOffscreenImages");
 
@@ -2151,9 +2162,14 @@
 	offscreenImages->setAttribute = SMI_SetSurfaceAttribute;
 	offscreenImages->max_width = pSmi->lcdWidth;
 	offscreenImages->max_height = pSmi->lcdHeight;
-	offscreenImages->num_attributes = nElems(SMI_VideoAttributes);
-	offscreenImages->attributes = SMI_VideoAttributes;
-
+	if (!pPort->I2CDev.SlaveAddr) {
+	    offscreenImages->num_attributes = nElems(SMI_VideoAttributes);
+	    offscreenImages->attributes = SMI_VideoAttributes; 
+	} else {
+	    offscreenImages->num_attributes = 
+		nElems(SMI_VideoAttributesSAA711x);
+	    offscreenImages->attributes = SMI_VideoAttributesSAA711x; 
+	}
 	xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1);
 
 	LEAVE_PROC("SMI_InitOffscreenImages");