On Tue, Sep 17, 2002 at 08:19:25PM +0200, Martijn van de Streek wrote: > The siliconmotion driver has been lacking XVideo support since the > first 4.2.* prerelease debs, while the xpert list only talks of 'getting > rid of the wait for retrace' > (http://www.xfree86.org/pipermail/xpert/2002-April/016661.html) in 4.2.
*shrug* What I ship is what's tagged xf-4_2-branch. > There's also a bug in the siliconmotion driver in "current" XFree86 > 4.2.1-pre debs: sometimes when the X server exits/gets killed/switches > back to text mode I get a screen full of garbage and a hanging machine. Well, I suggest you take this up with the Xpert list. Just for grins I've attached the output of xcvs diff -uN -r xf-4_2-branch -r HEAD xc/programs/Xserver/hw/xfree86/drivers/siliconmotion -- G. Branden Robinson | If you wish to strive for peace of Debian GNU/Linux | soul, then believe; if you wish to [EMAIL PROTECTED] | be a devotee of truth, then http://people.debian.org/~branden/ | inquire. -- Friedrich Nietzsche
Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h =================================================================== RCS file: /home/branden/packages/xfree86/cvsup/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h 28 Nov 2000 20:59:19 -0000 1.1 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h 25 Jan 2002 21:56:09 -0000 1.2 @@ -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); } } Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp =================================================================== RCS file: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp diff -N xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp 24 Jan 2001 00:06:27 -0000 1.5 @@ -0,0 +1,195 @@ +.\" Header: //Mercury/Projects/archives/XFree86/4.0/siliconmotion.cpp-arc 1.4 29 Nov 2000 14:12:56 Frido $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp,v 1.5 2001/01/24 00:06:27 dawes dead $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH siliconmotion __drivermansuffix__ "Version 4.0.2" "XFree86" +.SH NAME +siliconmotion \- Silicon Motion video driver +.SH SYNOPSIS +.B "Section \*qDevice\*q" +.br +.BI " Identifier \*q" devname \*q +.br +.B " Driver \*qsiliconmotion\*q" +.br +\ \ ... +.br +\ \ [ +.B "Option" +"optionname" ["optionvalue"]] +.br +.B EndSection +.SH DESCRIPTION +.B siliconmotion +is an XFree86 driver for Silicon Motion based video cards. The driver is fully +accelerated, and provides support for the following framebuffer depths: +8, 16, and 24. All +visual types are supported for depth 8, and TrueColor +visuals are supported for the other depths. +.SH SUPPORTED HARDWARE +The +.B siliconmotion +driver supports PCI and AGP video cards based on the following Silicon Motion chips: +.TP 12 +.B Lynx +SM910 +.TP 12 +.B LynxE +SM810 +.TP 12 +.B Lynx3D +SM820 +.TP 12 +.B LynxEM +SM710 +.TP 12 +.B LynxEM+ +SM712 +.TP 12 +.B Lynx3DM +SM720 +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. All options names are case and white space insensitive when +parsed by the server, for example, "lynxe" and "LynxE" are equivalent. +.PP +The driver auto-detects the chipset type, but the following +.B ChipSet +names may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm". +.RE + +.PP +The following Cursor +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: on. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Inverse of "HWCursor". Default: off. + +.PP +The following display +.B Options +are supported: +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Use shadow framebuffer. Default: off. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the screen CW - clockwise or CCW - counter clockwise. +Uses ShadowFB. Default: no rotation. +.TP +.BI "Option \*qVideoKey\*q \*q" integer \*q +Set the video color key. Default: a little off full blue. +.TP +.BI "Option \*qByteSwap\*q \*q" boolean \*q +Turn on byte swapping for capturing using SMI demo board. Default: off. +.TP +.BI "Option \*qUseBIOS\*q \*q" boolean \*q +Use the BIOS to set the modes. This is used for custom panel timings. +Default: on. + +.PP +The following video memory +.B Options +are supported: +.TP +.BI "Option \*qset_mclk\*q \*q" integer \*q +sets the memory clock, where +.I integer +is in kHz, and +.I integer +<= 100000. Default: probe the memory clock value, +and use it at server start. + + +.PP +The following acceleration and graphics engine +.B Options +are supported: +.TP +.B "Option \*qNoAccel\*q" +Disable acceleration. Very useful for determining if the +driver has problems with drawing and acceleration routines. This is the first +option to try if your server runs but you see graphic corruption on the screen. +Using it decreases performance, as it uses software emulation for drawing +operations the video driver can accelerate with hardware. +Default: acceleration is enabled. +.TP +.B "Option \*qfifo_aggressive\*q" +.TP +.B "Option \*qfifo_moderate\*q" +.TP +.B "Option \*qfifo_conservative\*q" +alter the settings +for the threshold at which the pixel FIFO takes over the internal +memory bus to refill itself. The smaller this threshold, the better +the acceleration performance of the card. You may try the fastest +setting +.RB ( "fifo_aggressive" ) +and move down if you encounter pixel corruption. +The optimal setting will probably depend on dot-clock and on color +depth. Note that specifying any of these options will also alter other +memory settings which may increase performance, so trying +.B "fifo_conservative" +will in most cases be a slight benefit (this uses the chip defaults). +If pixel corruption or transient streaking is observed during drawing +operations then removing any fifo options is recommended. Default: none. + +.PP +The following PCI bus +.B Options +are supported: +.TP +.BI "Option \*qpci_burst\*q \*q" boolean \*q +will enable PCI burst mode. This should work on all but a +few broken PCI chipsets, and will increase performance. Default: off. +.TP +.BI "Option \*qpci_retry\*q \*q" boolean \*q +will allow the driver to rely on PCI Retry to program the +ViRGE registers. +.B "pci_burst" +must be enabled for this to work. +This will increase performance, especially for small fills/blits, +because the driver does not have to poll the ViRGE before sending it +commands to make sure it is ready. It should work on most +recent PCI chipsets. Default: off. + +.PP +The following additional +.B Options +are supported: +.TP +.BI "Option \*qShowCache\*q \*q" boolean \*q +Enable or disable viewing offscreen cache memory. A +development debug option. Default: off. + +.SH SEE ALSO +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) + +.SH SUPPORT +For assistance with this driver, or XFree86 in general, check the XFree86 web +site at http://www.xfree86.org. A FAQ is available on the web site at +http://www.xfree86.org/FAQ/. If you find a problem with XFree86 or have a +question not answered in the FAQ please use our bug report form available on +the web site or send mail to [EMAIL PROTECTED] When reporting problems +with the driver send as much detail as possible, including chipset type, a +server output log, and operating system specifics. + +.SH AUTHORS +Kevin Brosius, +Matt Grossman, +Harald Koenig, +Sebastien Marineau, +Mark Vojkovich, +Frido Garritsen. Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h =================================================================== RCS file: /home/branden/packages/xfree86/cvsup/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v retrieving revision 1.8 retrieving revision 1.11 diff -u -u -r1.8 -r1.11 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h 20 Dec 2001 21:35:38 -0000 1.8 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h 16 Sep 2002 18:05:59 -0000 1.11 @@ -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.11 2002/09/16 18:05:59 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 */ @@ -210,8 +212,7 @@ int lcdHeight; /* LCD height */ I2CBusPtr I2C; /* Pointer into I2C module */ - xf86Int10InfoPtr pInt; /* Pointer to INT10 module */ - vbeInfoPtr pVbe; /* Pointer to VBE module */ + xf86Int10InfoPtr pInt10; /* Pointer to INT10 module */ /* Shadow frame buffer (rotation) */ Bool shadowFB; /* Flag if shadow buffer is Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c =================================================================== RCS file: /home/branden/packages/xfree86/cvsup/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v retrieving revision 1.20 retrieving revision 1.26 diff -u -u -r1.20 -r1.26 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c 4 Jan 2002 21:22:34 -0000 1.20 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c 16 Sep 2002 18:05:59 -0000 1.26 @@ -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.26 2002/09/16 18:05:59 eich Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -60,11 +60,11 @@ static void SMI_Save (ScrnInfoPtr pScrn); static void SMI_WriteMode (ScrnInfoPtr pScrn, vgaRegPtr, SMIRegPtr); static Bool SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, - char **argv); + char **argv); static int SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen); static void SMI_PrintRegs(ScrnInfoPtr); static ModeStatus SMI_ValidMode(int scrnIndex, DisplayModePtr mode, - Bool verbose, int flags); + Bool verbose, int flags); static void SMI_DisableVideo(ScrnInfoPtr pScrn); static void SMI_EnableVideo(ScrnInfoPtr pScrn); static Bool SMI_MapMem(ScrnInfoPtr pScrn); @@ -73,9 +73,9 @@ static Bool SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool SMI_SaveScreen(ScreenPtr pScreen, int mode); static void SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, - LOCO *colors, VisualPtr pVisual); + LOCO *colors, VisualPtr pVisual); static void SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagementMode, int flags); + int PowerManagementMode, int flags); static Bool SMI_ddc1(int scrnIndex); static unsigned int SMI_ddc1Read(ScrnInfoPtr pScrn); static void SMI_FreeScreen(int ScrnIndex, int flags); @@ -83,15 +83,14 @@ #define SILICONMOTION_NAME "Silicon Motion" -#define SILICONMOTION_DRIVER_NAME "siliconmotion" +#define SILICONMOTION_DRIVER_NAME "siliconmotion" #define SILICONMOTION_VERSION_NAME "1.3.1" -#define SILICONMOTION_VERSION_MAJOR 1 +#define SILICONMOTION_VERSION_MAJOR 1 #define SILICONMOTION_VERSION_MINOR 3 #define SILICONMOTION_PATCHLEVEL 1 -#define SILICONMOTION_DRIVER_VERSION ( (SILICONMOTION_VERSION_MAJOR << 24) \ - | (SILICONMOTION_VERSION_MINOR << 16) \ - | (SILICONMOTION_PATCHLEVEL) \ - ) +#define SILICONMOTION_DRIVER_VERSION ((SILICONMOTION_VERSION_MAJOR << 24) | \ + (SILICONMOTION_VERSION_MINOR << 16) | \ + (SILICONMOTION_PATCHLEVEL)) /* * This contains the functions needed by the server after loading the @@ -256,6 +255,7 @@ "xf86DestroyI2CDevRec", "xf86I2CBusInit", "xf86I2CDevInit", + "xf86I2CReadBytes", "xf86I2CWriteByte", NULL }; @@ -291,7 +291,6 @@ "cfbScreenInit", "cfb16ScreenInit", "cfb24ScreenInit", - "cfb24_32ScreenInit", "cfb32ScreenInit", "cfb16BresS", "cfb24BresS", @@ -518,7 +517,8 @@ int mclk; vgaHWPtr hwp; int vgaCRIndex, vgaCRReg, vgaIOBase; - + vbeInfoPtr pVbe = NULL; + ENTER_PROC("SMI_PreInit"); if (flags & PROBE_DETECT) @@ -859,17 +859,22 @@ LEAVE_PROC("SMI_PreInit"); return(FALSE); } + + if (xf86LoadSubModule(pScrn,"int10")) { + xf86LoaderReqSymLists(int10Symbols,NULL); + pSmi->pInt10 = xf86InitInt10(pEnt->index); + } - if (xf86LoadSubModule(pScrn, "vbe")) + if (pSmi->pInt10 && xf86LoadSubModule(pScrn, "vbe")) { - xf86LoaderReqSymLists(vbeSymbols, NULL); - pSmi->pVbe = VBEInit(NULL, pEnt->index); + xf86LoaderReqSymLists(vbeSymbols, NULL); + pVbe = VBEInit(pSmi->pInt10, pEnt->index); } pSmi->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResExclusive); -/* xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr);*/ -/* xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr);*/ +/* xf86SetOperatingState(resVgaIo, pEnt->index, ResUnusedOpr); */ +/* xf86SetOperatingState(resVgaMem, pEnt->index, ResDisableOpr); */ /* * Set the Chipset and ChipRev, allowing config file entries to @@ -939,6 +944,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); @@ -957,9 +963,9 @@ xf86LoaderReqSymLists(ddcSymbols, NULL); #if 1 /* PDR#579 */ - if (pSmi->pVbe) + if (pVbe) { - pMon = vbeDoEDID(pSmi->pVbe, NULL); + pMon = vbeDoEDID(pVbe, NULL); if (pMon != NULL) { if ( (pMon->rawData[0] == 0x00) @@ -981,8 +987,8 @@ } } #else - if ( (pSmi->pVbe) - && ((pMon = xf86PrintEDID(vbeDoEDID(pSmi->pVbe, NULL))) != NULL) + if ( (pVbe) + && ((pMon = xf86PrintEDID(vbeDoEDID(pVbe, NULL))) != NULL) ) { xf86SetDDCproperties(pScrn, pMon); @@ -998,11 +1004,10 @@ } } } - if (pSmi->pVbe) - { - vbeFree(pSmi->pVbe); - pSmi->pVbe = NULL; - } + + vbeFree(pVbe); + xf86FreeInt10(pSmi->pInt10); + pSmi->pInt10 = NULL; /* * If the driver can do gamma correction, it should call xf86SetGamma() @@ -1509,12 +1514,12 @@ pSmi->ModeStructInit = TRUE; } - if (pSmi->useBIOS && (pSmi->pVbe != NULL)) + if (pSmi->useBIOS && (pSmi->pInt10 != NULL)) { - pSmi->pVbe->pInt10->num = 0x10; - pSmi->pVbe->pInt10->ax = 0x0F00; - xf86ExecX86int10(pSmi->pVbe->pInt10); - save->mode = pSmi->pVbe->pInt10->ax & 0x007F; + pSmi->pInt10->num = 0x10; + pSmi->pInt10->ax = 0x0F00; + xf86ExecX86int10(pSmi->pInt10); + save->mode = pSmi->pInt10->ax & 0x007F; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Current mode 0x%02X.\n", save->mode); } @@ -1554,19 +1559,19 @@ /* Wait for engine to become idle */ WaitIdle(); - if (pSmi->useBIOS && (pSmi->pVbe->pInt10 != NULL) + if (pSmi->useBIOS && (pSmi->pInt10 != NULL) && (restore->mode != 0)) { - pSmi->pVbe->pInt10->num = 0x10; - pSmi->pVbe->pInt10->ax = restore->mode | 0x80; + pSmi->pInt10->num = 0x10; + pSmi->pInt10->ax = restore->mode | 0x80; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode 0x%02X\n", restore->mode); - xf86ExecX86int10(pSmi->pVbe->pInt10); + xf86ExecX86int10(pSmi->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 +1667,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 +1985,13 @@ pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + if (!pSmi->pInt10) { + pSmi->pInt10 = xf86InitInt10(pEnt->index); + } + /* Save the chip/graphics state */ SMI_Save(pScrn); - if (!pSmi->pVbe) { - pSmi->pVbe = VBEInit(NULL, pEnt->index); - } /* Zero the frame buffer, #258 */ memset(pSmi->FBBase, 0, pSmi->videoRAMBytes); @@ -2400,6 +2405,8 @@ return(FALSE); } + new->modeInit = TRUE; + if (pSmi->rotate) { pSmi->width = pScrn->virtualY; @@ -2412,8 +2419,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 +2430,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 +2546,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 +2564,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 +2760,7 @@ vgaRegPtr vgaSavePtr = &hwp->SavedReg; SMIRegPtr SMISavePtr = &pSmi->SavedReg; Bool ret; - + ENTER_PROC("SMI_CloseScreen"); if (pScrn->vtSema) @@ -2777,10 +2782,10 @@ { xfree(pSmi->DGAModes); } - if (pSmi->pVbe != NULL) + if (pSmi->pInt10 != NULL) { - vbeFree(pSmi->pVbe); - pSmi->pVbe = NULL; + xf86FreeInt10(pSmi->pInt10); + pSmi->pInt10 = NULL; } #ifdef XvExtension if (pSmi->ptrAdaptor != NULL) @@ -2949,16 +2954,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 +2979,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"); } @@ -3094,31 +3099,31 @@ } #if 1 /* PDR#735 */ - if (pSmi->pVbe->pInt10 != NULL) + if (pSmi->pInt10 != NULL) { - pSmi->pVbe->pInt10->ax = 0x4F10; + pSmi->pInt10->ax = 0x4F10; switch (PowerManagementMode) { case DPMSModeOn: - pSmi->pVbe->pInt10->bx = 0x0001; + pSmi->pInt10->bx = 0x0001; break; case DPMSModeStandby: - pSmi->pVbe->pInt10->bx = 0x0101; + pSmi->pInt10->bx = 0x0101; break; case DPMSModeSuspend: - pSmi->pVbe->pInt10->bx = 0x0201; + pSmi->pInt10->bx = 0x0201; break; case DPMSModeOff: - pSmi->pVbe->pInt10->bx = 0x0401; + pSmi->pInt10->bx = 0x0401; break; } - pSmi->pVbe->pInt10->cx = 0x0000; - pSmi->pVbe->pInt10->num = 0x10; - xf86ExecX86int10(pSmi->pVbe->pInt10); - if (pSmi->pVbe->pInt10->ax == 0x004F) + pSmi->pInt10->cx = 0x0000; + pSmi->pInt10->num = 0x10; + xf86ExecX86int10(pSmi->pInt10); + if (pSmi->pInt10->ax == 0x004F) { pSmi->CurrentDPMS = PowerManagementMode; #if 1 /* PDR#835 */ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c =================================================================== RCS file: /home/branden/packages/xfree86/cvsup/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v retrieving revision 1.6 retrieving revision 1.8 diff -u -u -r1.6 -r1.8 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c 20 Dec 2001 21:35:39 -0000 1.6 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c 16 Sep 2002 18:06:00 -0000 1.8 @@ -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. @@ -33,6 +32,7 @@ - SAA7111 support - supports attributes: XV_ENCODING, XV_BRIGHTNESS, XV_CONTRAST, XV_SATURATION, XV_HUE, XV_COLORKEY, XV_INTERLACED + XV_CAPTURE_BRIGHTNESS can be used to set brightness in the capture device - bug fixes - tries not to use acceleration functions (if USE_XAA = 0) - interlaced video for double vertical resolution @@ -41,7 +41,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.8 2002/09/16 18:06:00 eich Exp $ */ #include "smi.h" #include "smi_video.h" @@ -134,7 +134,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);*/ @@ -169,7 +171,7 @@ static Atom xvColorKey; static Atom xvEncoding; -static Atom xvBrightness, xvContrast, xvSaturation, xvHue; +static Atom xvBrightness,xvCapBrightness, xvContrast, xvSaturation, xvHue; static Atom xvInterlaced; @@ -255,6 +257,7 @@ #define XV_ENCODING_NAME "XV_ENCODING" #define XV_BRIGHTNESS_NAME "XV_BRIGHTNESS" +#define XV_CAPTURE_BRIGHTNESS_NAME "XV_CAPTURE_BRIGHTNESS" #define XV_CONTRAST_NAME "XV_CONTRAST" #define XV_SATURATION_NAME "XV_SATURATION" #define XV_HUE_NAME "XV_HUE" @@ -263,9 +266,10 @@ /* 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, 255, XV_CAPTURE_BRIGHTNESS_NAME}, {XvSettable | XvGettable, 0, 127, XV_CONTRAST_NAME}, {XvSettable | XvGettable, 0, 127, XV_SATURATION_NAME}, {XvSettable | XvGettable, -128, 127, XV_HUE_NAME}, @@ -273,6 +277,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[] = @@ -393,7 +402,7 @@ }; - +#if 0 static I2CByte SAA7110InitData[] = { /* Configuration */ @@ -418,7 +427,7 @@ 0x22, 0x40, 0x2C, 0x03, }; - +#endif static I2CByte SAA7111InitData[] = { @@ -616,7 +625,7 @@ if (numAdaptors != 0) { - DEBUG((VERBLEV, "ScreenInit\n")); + DEBUG((VERBLEV, "ScreenInit %i\n",numAdaptors)); xf86XVScreenInit(pScreen, ptrAdaptors, numAdaptors); } @@ -635,6 +644,7 @@ * Video codec controls */ +#if 0 /** * scales value value of attribute i to range min, max */ @@ -644,13 +654,16 @@ return min + (value - SMI_VideoAttributes[i].min_value) * (max - min) / (SMI_VideoAttributes[i].max_value - SMI_VideoAttributes[i].min_value); } - +#endif /** * sets video decoder attributes channel, encoding, brightness, contrast, saturation, hue */ 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,15 +671,16 @@ value = CLAMP(value, SMI_VideoAttributes[i].min_value, SMI_VideoAttributes[i].max_value); -#if 0 - if (pPPriv->I2CDev == SAA7110) { + if (i == XV_BRIGHTNESS) { + int my_value = (value <= 128? value + 128 : value - 128); + WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (my_value << 24)); + } else 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 } +#if 0 else { return XvBadAlloc; } @@ -729,12 +743,12 @@ } } } - else if (i >= XV_BRIGHTNESS && i <= XV_HUE) { + else if (i >= XV_CAPTURE_BRIGHTNESS && i <= XV_HUE) { int slave_adr = 0; switch (i) { - case XV_BRIGHTNESS: + case XV_CAPTURE_BRIGHTNESS: DEBUG((VERBLEV, "SetAttribute XV_BRIGHTNESS: %d\n", value)); slave_adr = 0x0a; break; @@ -764,8 +778,6 @@ return BadMatch; } - pPort->Attribute[i] = value; - /* debug: show registers */ { I2CByte i2c_bytes[32]; @@ -886,38 +898,40 @@ 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); + xvCapBrightness = MAKE_ATOM(XV_CAPTURE_BRIGHTNESS_NAME); + + SMI_ResetVideo(pScrn); + LEAVE_PROC("SMI_SetupVideo"); + return(ptrAdaptor); } @@ -934,6 +948,7 @@ SetAttr(pScrn, XV_ENCODING, 0); /* Encoding = pal-composite-0 */ SetAttr(pScrn, XV_BRIGHTNESS, 128); /* Brightness = 128 (CCIR level) */ + SetAttr(pScrn, XV_CAPTURE_BRIGHTNESS, 128); /* Brightness = 128 (CCIR level) */ SetAttr(pScrn, XV_CONTRAST, 71); /* Contrast = 71 (CCIR level) */ SetAttr(pScrn, XV_SATURATION, 64); /* Color saturation = 64 (CCIR level) */ SetAttr(pScrn, XV_HUE, 0); /* Hue = 0 */ @@ -1253,9 +1268,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 */ @@ -1415,6 +1430,9 @@ else if (attribute == xvBrightness) { res = SetAttr(pScrn, XV_BRIGHTNESS, value); } + else if (attribute == xvCapBrightness) { + res = SetAttr(pScrn, XV_CAPTURE_BRIGHTNESS, value); + } else if (attribute == xvContrast) { res = SetAttr(pScrn, XV_CONTRAST, value); } @@ -1444,11 +1462,12 @@ SMI_PortPtr pPort = (SMI_PortPtr) data; ENTER_PROC("SMI_GetPortAttribute"); - if (attribute == xvEncoding) *value = pPort->Attribute[XV_ENCODING]; - else if (attribute == xvBrightness) + else if (attribute == xvBrightness) *value = pPort->Attribute[XV_BRIGHTNESS]; + else if (attribute == xvCapBrightness) + *value = pPort->Attribute[XV_CAPTURE_BRIGHTNESS]; else if (attribute == xvContrast) *value = pPort->Attribute[XV_CONTRAST]; else if (attribute == xvSaturation) @@ -1756,7 +1775,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 +1789,7 @@ VerticalRetraceWait(); } +#endif static Bool RegionsEqual( @@ -2007,9 +2027,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 +2103,6 @@ } dev = xf86CreateI2CDevRec(); - ErrorF("zz %x\n",dev); if (dev == NULL) { LEAVE_PROC("SMI_SendI2C"); @@ -2130,6 +2149,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 +2171,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"); Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h =================================================================== RCS file: /home/branden/packages/xfree86/cvsup/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h 20 Dec 2001 21:35:39 -0000 1.3 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h 16 Sep 2002 18:06:01 -0000 1.4 @@ -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_video.h,v 1.3 2001/12/20 21:35:39 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.4 2002/09/16 18:06:01 eich Exp $ */ #ifndef _SMI_VIDEO_H #define _SMI_VIDEO_H @@ -56,15 +56,16 @@ * Attributes */ -#define N_ATTRS 7 +#define N_ATTRS 8 #define XV_ENCODING 0 #define XV_BRIGHTNESS 1 -#define XV_CONTRAST 2 -#define XV_SATURATION 3 -#define XV_HUE 4 -#define XV_COLORKEY 5 -#define XV_INTERLACED 6 +#define XV_CAPTURE_BRIGHTNESS 2 +#define XV_CONTRAST 3 +#define XV_SATURATION 4 +#define XV_HUE 5 +#define XV_COLORKEY 6 +#define XV_INTERLACED 7 typedef struct {
pgpgfnuEHa2wp.pgp
Description: PGP signature