summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-06-16 09:23:38 +0000
committerEric Anholt <anholt@freebsd.org>2004-06-16 09:23:38 +0000
commit9a58bc9adbc982680dd8df27caeb9a5819f2adad (patch)
tree410c4dcb5abdafa1bbe81fbb6115449d1599c81d
parent1f957fb7e44762197b0fc5a3b7def25c7888929a (diff)
-rw-r--r--CALLMAP2
-rw-r--r--README2
-rw-r--r--Release.txt2
-rw-r--r--man/siliconmotion.man22
-rw-r--r--src/regsmi.h67
-rw-r--r--src/smi.h8
-rw-r--r--src/smi_accel.c11
-rw-r--r--src/smi_dac.c2
-rw-r--r--src/smi_dga.c2
-rw-r--r--src/smi_driver.c368
-rw-r--r--src/smi_hwcurs.c74
-rw-r--r--src/smi_i2c.c2
-rw-r--r--src/smi_shadow.c158
-rw-r--r--src/smi_video.c380
-rw-r--r--src/smi_video.h2
15 files changed, 234 insertions, 868 deletions
diff --git a/CALLMAP b/CALLMAP
index 6410d18..b7c9043 100644
--- a/CALLMAP
+++ b/CALLMAP
@@ -19,4 +19,4 @@ ChipScreenInit
Header: \\Mercury\Projects\archives\XFree86 4.0\CALLMAP.-arc 1.1 13 Jul 2000 18:16:58 Frido $
-$XFree86$
+$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/CALLMAP,v 1.1 2000/11/28 20:59:18 dawes Exp $
diff --git a/README b/README
index 60676f6..d2f142d 100644
--- a/README
+++ b/README
@@ -73,4 +73,4 @@ Debug:
Header: //Mercury/Projects/archives/XFree86/4.0/README.-arc 1.2 14 Sep 2000 12:28:36 Frido $
-$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README,v 1.2 2000/12/05 21:18:37 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README,v 1.3 2001/02/15 18:20:33 dawes Exp $
diff --git a/Release.txt b/Release.txt
index 820d13a..204dba7 100644
--- a/Release.txt
+++ b/Release.txt
@@ -228,4 +228,4 @@ frido@siliconmotion.com.
Header: //Mercury/Projects/archives/XFree86/4.0/Release.txt-arc 1.33 13 Dec 2000 09:52:48 Frido $
-$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt,v 1.5 2001/02/15 18:20:33 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt,v 1.7 2001/12/20 21:35:37 eich Exp $
diff --git a/man/siliconmotion.man b/man/siliconmotion.man
index 4f0a20f..029b40a 100644
--- a/man/siliconmotion.man
+++ b/man/siliconmotion.man
@@ -1,5 +1,5 @@
-.\" Header: //Mercury/Projects/archives/__xservername__/4.0/siliconmotion.cpp-arc 1.4 29 Nov 2000 14:12:56 Frido $
-.\" $__xservername__: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man,v 1.2 2001/01/27 18:20:52 dawes Exp $
+.\" 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.man,v 1.4 2001/12/20 21:35:38 eich Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH siliconmotion __drivermansuffix__ __vendorversion__
@@ -21,7 +21,7 @@ siliconmotion \- Silicon Motion video driver
.B EndSection
.SH DESCRIPTION
.B siliconmotion
-is an __xservername__ driver for Silicon Motion based video cards. The driver is fully
+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
@@ -48,11 +48,8 @@ SM712
.TP 12
.B Lynx3DM
SM720
-.TP 12
-.B Cougar3DR
-SM730
.SH CONFIGURATION DETAILS
-Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+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.
@@ -64,7 +61,7 @@ names may optionally be specified in the config file
section, and will override the auto-detection:
.PP
.RS 4
-"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm", "cougar3dr".
+"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm".
.RE
.PP
@@ -185,13 +182,14 @@ Enable or disable viewing offscreen cache memory. A
development debug option. Default: off.
.SH SEE ALSO
-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
+XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
.SH SUPPORT
-For assistance with this driver, or __xservername__ in general, check the __xservername__ web
-site at http://www.x.org. If you find a problem with __xservername__ or have a
+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. When reporting problems
+the web site or send mail to XFree86@XFree86.org. When reporting problems
with the driver send as much detail as possible, including chipset type, a
server output log, and operating system specifics.
diff --git a/src/regsmi.h b/src/regsmi.h
index d2dc840..c134bed 100644
--- a/src/regsmi.h
+++ b/src/regsmi.h
@@ -26,14 +26,13 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
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
#define SMI_LYNX_SERIES(chip) ((chip & 0xF0F0) == 0x0010)
#define SMI_LYNX3D_SERIES(chip) ((chip & 0xF0F0) == 0x0020)
-#define SMI_COUGAR_SERIES(chip) ((chip & 0xF0F0) == 0x0030)
#define SMI_LYNXEM_SERIES(chip) ((chip & 0xFFF0) == 0x0710)
#define SMI_LYNXM_SERIES(chip) ((chip & 0xFF00) == 0x0700)
@@ -46,7 +45,6 @@ authorization from the XFree86 Project and SIlicon Motion.
#define SMI_LYNXEM PCI_CHIP_SMI710
#define SMI_LYNXEMplus PCI_CHIP_SMI712
#define SMI_LYNX3DM PCI_CHIP_SMI720
-#define SMI_COUGAR3DR PCI_CHIP_SMI731
/* I/O Functions */
static __inline__ CARD8
@@ -116,8 +114,6 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
#define READ_VPR(pSmi, vpr) MMIO_IN32(pSmi->VPRBase, vpr)
#define WRITE_CPR(pSmi, cpr, data) MMIO_OUT32(pSmi->CPRBase, cpr, data); DEBUG((VERBLEV, "CPR%02X = %08X\n", cpr, data))
#define READ_CPR(pSmi, cpr) MMIO_IN32(pSmi->CPRBase, cpr)
-#define WRITE_FPR(pSmi, fpr, data) MMIO_OUT32(pSmi->FPRBase, fpr, data); DEBUG((VERBLEV, "FPR%02X = %08X\n", fpr, data))
-#define READ_FPR(pSmi, fpr) MMIO_IN32(pSmi->FPRBase, fpr)
/* 2D Engine commands */
#define SMI_TRANSPARENT_SRC 0x00000100
@@ -208,65 +204,4 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
#define RGB16_555 1
#define RGB32_888 2
-/* register defines so we're not hardcoding numbers */
-
-#define FPR00 0x0000
-
-/* video window formats - I=indexed, P=packed */
-#define FPR00_FMT_8I 0x0
-#define FPR00_FMT_15P 0x1
-#define FPR00_FMT_16P 0x2
-#define FPR00_FMT_32P 0x3
-#define FPR00_FMT_24P 0x4
-#define FPR00_FMT_8P 0x5
-#define FPR00_FMT_YUV422 0x6
-#define FPR00_FMT_YUV420 0x7
-
-/* possible bit definitions for FPR00 - VWI = Video Window 1 */
-#define FPR00_VWIENABLE 0x00000008
-#define FPR00_VWITILE 0x00000010
-#define FPR00_VWIFILTER2 0x00000020
-#define FPR00_VWIFILTER4 0x00000040
-#define FPR00_VWIKEYENABLE 0x00000080
-#define FPR00_VWIGDF_SHIFT 16
-#define FPR00_VWIGDENABLE 0x00080000
-#define FPR00_VWIGDTILE 0x00100000
-
-#define FPR00_MASKBITS 0x0000FFFF
-
-#define FPR04 0x0004
-#define FPR08 0x0008
-#define FPR0C 0x000C
-#define FPR10 0x0010
-#define FPR14 0x0014
-#define FPR18 0x0018
-#define FPR1C 0x001C
-#define FPR20 0x0020
-#define FPR24 0x0024
-#define FPR58 0x0058
-#define FPR5C 0x005C
-#define FPR68 0x0068
-#define FPRB0 0x00B0
-#define FPRB4 0x00B4
-#define FPRC4 0x00C4
-#define FPRCC 0x00CC
-
-#define FPR158 0x0158
-#define FPR158_MASK_MAXBITS 0x07FF
-#define FPR158_MASK_BOUNDARY 0x0800
-#define FPR15C 0x015C
-#define FPR15C_MASK_HWCCOLORS 0x0000FFFF
-#define FPR15C_MASK_HWCADDREN 0xFFFF0000
-#define FPR15C_MASK_HWCENABLE 0x80000000
-
-/* panel sizes returned by the bios */
-
-#define PANEL_640x480 0x00
-#define PANEL_800x600 0x01
-#define PANEL_1024x768 0x02
-#define PANEL_1280x1024 0x03
-#define PANEL_1600x1200 0x04
-#define PANEL_1400x1050 0x0A
-
-
#endif /* _REGSMI_H */
diff --git a/src/smi.h b/src/smi.h
index d8fe50f..6012f76 100644
--- a/src/smi.h
+++ b/src/smi.h
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
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.12tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.13 2003/04/23 21:51:44 tsi Exp $ */
#ifndef _SMI_H
#define _SMI_H
@@ -102,7 +102,6 @@ typedef struct
DPR44;
CARD32 VPR00, VPR0C, VPR10;
CARD32 CPR00;
- CARD32 FPR00_, FPR0C_, FPR10_;
} SMIRegRec, *SMIRegPtr;
@@ -146,7 +145,6 @@ typedef struct
CARD8 * DPRBase; /* Base of DPR registers */
CARD8 * VPRBase; /* Base of VPR registers */
CARD8 * CPRBase; /* Base of CPR registers */
- CARD8 * FPRBase; /* Base of FPR registers - for 0730 chipset */
CARD8 * DataPortBase; /* Base of data port */
int DataPortSize; /* Size of data port */
CARD8 * IOBase; /* Base of MMIO VGA ports */
@@ -227,8 +225,7 @@ typedef struct
pixels */
CARD32 saveBufferSize; /* #670 - FB save buffer size */
void * pSaveBuffer; /* #670 - FB save buffer */
- CARD32 fbMapOffset; /* offset for fb mapping */
- CARD32 savedFBOffset; /* #670 - Saved FBOffset value */
+ CARD32 savedFBOffset; /* #670 - Saved FBOffset value */
CARD32 savedFBReserved; /* #670 - Saved
FBReserved value */
CARD8 * paletteBuffer; /* #920 - Palette save buffer */
@@ -354,7 +351,6 @@ Bool SMI_DGAInit(ScreenPtr pScrn);
/* smi_shadow.c */
void SMI_PointerMoved(int index, int x, int y);
void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
-void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
/* smi_video.c */
void SMI_InitVideo(ScreenPtr pScreen);
diff --git a/src/smi_accel.c b/src/smi_accel.c
index d55ad6e..3ed2260 100644
--- a/src/smi_accel.c
+++ b/src/smi_accel.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
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_accel.c,v 1.7tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.8 2003/04/23 21:51:44 tsi Exp $ */
#include "smi.h"
@@ -1096,14 +1096,7 @@ SMI_Polylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt,
if (box)
{
/* Refresh all polyline segments now. */
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- SMI_RefreshArea730(pScrn, box, pBox);
- }
- else
- {
- SMI_RefreshArea(pScrn, box, pBox);
- }
+ SMI_RefreshArea(pScrn, box, pBox);
}
/* Free the temporary buffer. */
diff --git a/src/smi_dac.c b/src/smi_dac.c
index c606712..627b892 100644
--- a/src/smi_dac.c
+++ b/src/smi_dac.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from the XFree86 Project and Silicon Motion.
*/
-/* $XFree86$ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dac.c,v 1.2 2001/11/30 12:11:59 eich Exp $ */
#include "smi.h"
diff --git a/src/smi_dga.c b/src/smi_dga.c
index 7ee542e..9f090b9 100644
--- a/src/smi_dga.c
+++ b/src/smi_dga.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
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_dga.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c,v 1.2 2001/02/15 18:20:33 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 8f94001..82c36c7 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
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.36tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.32 2003/08/23 15:03:13 dawes Exp $ */
#include "xf86Resources.h"
#include "xf86RAC.h"
@@ -120,7 +120,6 @@ static SymTabRec SMIChipsets[] =
{ PCI_CHIP_SMI710, "LynxEM" },
{ PCI_CHIP_SMI712, "LynxEM+" },
{ PCI_CHIP_SMI720, "Lynx3DM" },
- { PCI_CHIP_SMI731, "Cougar3DR" },
{ -1, NULL }
};
@@ -133,7 +132,6 @@ static PciChipsets SMIPciChipsets[] =
{ PCI_CHIP_SMI710, PCI_CHIP_SMI710, RES_SHARED_VGA },
{ PCI_CHIP_SMI712, PCI_CHIP_SMI712, RES_SHARED_VGA },
{ PCI_CHIP_SMI720, PCI_CHIP_SMI720, RES_SHARED_VGA },
- { PCI_CHIP_SMI731, PCI_CHIP_SMI731, RES_SHARED_VGA },
{ -1, -1, RES_UNDEFINED }
};
@@ -304,7 +302,7 @@ static XF86ModuleVersionInfo SMIVersRec =
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
- XORG_VERSION_CURRENT,
+ XF86_VERSION_CURRENT,
SILICONMOTION_VERSION_MAJOR,
SILICONMOTION_VERSION_MINOR,
SILICONMOTION_PATCHLEVEL,
@@ -512,7 +510,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
unsigned char config, m, n, shift;
int mclk;
vgaHWPtr hwp;
- int vgaCRIndex, vgaIOBase;
+ int vgaCRIndex, vgaCRReg, vgaIOBase;
vbeInfoPtr pVbe = NULL;
ENTER_PROC("SMI_PreInit");
@@ -787,12 +785,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
}
}
- if (pSmi->rotate)
- {
- /* Disable the RandR extension, it messes up the internal rotation stuff */
- xf86DisableRandR();
- }
-
if (xf86GetOptValInteger(pSmi->Options, OPTION_VIDEOKEY, &pSmi->videoKey))
{
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Video key set to "
@@ -942,10 +934,11 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
hwp = VGAHWPTR(pScrn);
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=%p\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase);
+ "MMIOBase=%x\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase);
/* Next go on to detect amount of installed ram */
config = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x71);
@@ -1051,14 +1044,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024;
break;
}
-
- case SMI_COUGAR3DR:
- {
- /* DANGER - Cougar3DR BIOS is broken - hardcode video ram size */
- /* per instructions from Silicon Motion engineers */
- pSmi->videoRAMKBytes = 16 * 1024;
- break;
- }
}
pSmi->videoRAMBytes = pSmi->videoRAMKBytes * 1024;
pScrn->videoRam = pSmi->videoRAMKBytes;
@@ -1083,7 +1068,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
pScrn->clock[3] = pScrn->clock[2];
}
- if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR))
+ if (pSmi->Chipset == SMI_LYNX3DM)
{
if (pScrn->clock[0] <= 0) pScrn->clock[0] = 200000;
if (pScrn->clock[1] <= 0) pScrn->clock[1] = 200000;
@@ -1328,14 +1313,7 @@ SMI_EnterVT(int scrnIndex, int flags)
box.y1 = 0;
box.x2 = pScrn->virtualY;
box.y2 = pScrn->virtualX;
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- SMI_RefreshArea730(pScrn, 1, &box);
- }
- else
- {
- SMI_RefreshArea(pScrn, 1, &box);
- }
+ SMI_RefreshArea(pScrn, 1, &box);
}
/* Reset the grapics engine */
@@ -1495,11 +1473,11 @@ SMI_Save(ScrnInfoPtr pScrn)
}
}
- /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */
- if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR)) {
- save->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66);
- }
- /* end CZ */
+ /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */
+ if (pSmi->Chipset == SMI_LYNX3DM) {
+ save->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66);
+ }
+ /* end CZ */
save->DPR10 = READ_DPR(pSmi, 0x10);
save->DPR1C = READ_DPR(pSmi, 0x1C);
@@ -1516,13 +1494,6 @@ SMI_Save(ScrnInfoPtr pScrn)
save->VPR0C = READ_VPR(pSmi, 0x0C);
save->VPR10 = READ_VPR(pSmi, 0x10);
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- save->FPR00_ = READ_FPR(pSmi, FPR00);
- save->FPR0C_ = READ_FPR(pSmi, FPR0C);
- save->FPR10_ = READ_FPR(pSmi, FPR10);
- }
-
save->CPR00 = READ_CPR(pSmi, 0x00);
if (!pSmi->ModeStructInit)
@@ -1706,11 +1677,11 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore)
}
}
- /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */
- if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR)) {
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, restore->CCR66);
- }
- /* end CZ */
+ /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */
+ if (pSmi->Chipset == SMI_LYNX3DM) {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, restore->CCR66);
+ }
+ /* end CZ */
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, 0x00);
@@ -1729,13 +1700,6 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore)
WRITE_VPR(pSmi, 0x0C, restore->VPR0C);
WRITE_VPR(pSmi, 0x10, restore->VPR10);
- if(pSmi->Chipset == SMI_COUGAR3DR)
- {
- WRITE_FPR(pSmi, FPR00, restore->FPR00_);
- WRITE_FPR(pSmi, FPR0C, restore->FPR0C_);
- WRITE_FPR(pSmi, FPR10, restore->FPR10_);
- }
-
WRITE_CPR(pSmi, 0x00, restore->CPR00);
if (xf86GetVerbosity() > 1)
@@ -1767,11 +1731,6 @@ SMI_MapMem(ScrnInfoPtr pScrn)
pSmi->MapSize = 0x10000;
break;
- case SMI_COUGAR3DR:
- memBase = pSmi->PciInfo->memBase[1];
- pSmi->MapSize = 0x200000;
- break;
-
case SMI_LYNX3D:
memBase = pSmi->PciInfo->memBase[0] + 0x680000;
pSmi->MapSize = 0x180000;
@@ -1810,16 +1769,6 @@ SMI_MapMem(ScrnInfoPtr pScrn)
pSmi->DataPortSize = 0x8000;
break;
- case SMI_COUGAR3DR:
- pSmi->DPRBase = pSmi->MapBase + 0x000000;
- pSmi->VPRBase = pSmi->MapBase + 0x000800;
- pSmi->CPRBase = pSmi->MapBase + 0x001000;
- pSmi->FPRBase = pSmi->MapBase + 0x005800;
- pSmi->IOBase = pSmi->MapBase + 0x0C0000;
- pSmi->DataPortBase = pSmi->MapBase + 0x100000;
- pSmi->DataPortSize = 0x100000;
- break;
-
case SMI_LYNX3D:
pSmi->DPRBase = pSmi->MapBase + 0x000000;
pSmi->VPRBase = pSmi->MapBase + 0x000800;
@@ -1849,32 +1798,31 @@ SMI_MapMem(ScrnInfoPtr pScrn)
break;
}
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
- "Physical MMIO at 0x%08lX\n", (unsigned long)memBase);
+ "Physical MMIO at 0x%08X\n", memBase);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
- "Logical MMIO at %p - %p\n", pSmi->MapBase,
+ "Logical MMIO at 0x%08X - 0x%08X\n", pSmi->MapBase,
pSmi->MapBase + pSmi->MapSize - 1);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
- "DPR=%p, VPR=%p, IOBase=%p\n",
- pSmi->DPRBase, pSmi->VPRBase, pSmi->IOBase);
+ "DPR=0x%08X, VPR=0x%08X, IOBase=0x%08X\n", pSmi->DPRBase,
+ pSmi->VPRBase, pSmi->IOBase);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
- "DataPort=%p - %p\n", pSmi->DataPortBase,
+ "DataPort=0x%08X - 0x%08X\n", pSmi->DataPortBase,
pSmi->DataPortBase + pSmi->DataPortSize - 1);
- pScrn->memPhysBase = pSmi->PciInfo->memBase[0];
-
/* Map the frame buffer */
- if (pSmi->Chipset == SMI_LYNX3DM)
- pSmi->fbMapOffset = 0x200000;
+ if (pSmi->Chipset == SMI_LYNX3DM)
+ {
+ pScrn->memPhysBase = pSmi->PciInfo->memBase[0] + 0x200000;
+ }
else
- pSmi->fbMapOffset = 0x0;
-
- if (pSmi->videoRAMBytes) {
- pSmi->FBBase = xf86MapPciMem(pScrn->scrnIndex,
- VIDMEM_FRAMEBUFFER,
- pSmi->PciTag,
- pScrn->memPhysBase + pSmi->fbMapOffset,
- pSmi->videoRAMBytes);
-
+ {
+ pScrn->memPhysBase = pSmi->PciInfo->memBase[0];
+ }
+ if (pSmi->videoRAMBytes)
+ {
+ pSmi->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+ pSmi->PciTag, pScrn->memPhysBase, pSmi->videoRAMBytes);
+
if (pSmi->FBBase == NULL)
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: could not "
@@ -1883,14 +1831,11 @@ SMI_MapMem(ScrnInfoPtr pScrn)
return(FALSE);
}
}
- pSmi->FBOffset = 0;
- pScrn->fbOffset = pSmi->FBOffset + pSmi->fbMapOffset;
-
+ pSmi->FBOffset = pScrn->fbOffset = 0;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
- "Physical frame buffer at 0x%08lX offset: 0x%08lX\n",
- pScrn->memPhysBase, pScrn->fbOffset);
+ "Physical frame buffer at 0x%08X\n", pScrn->memPhysBase);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
- "Logical frame buffer at %p - %p\n", pSmi->FBBase,
+ "Logical frame buffer at 0x%08X - 0x%08X\n", pSmi->FBBase,
pSmi->FBBase + pSmi->videoRAMBytes - 1);
SMI_EnableMmio(pScrn);
@@ -1914,122 +1859,44 @@ SMI_MapMem(ScrnInfoPtr pScrn)
{
pSmi->FBReserved = pSmi->videoRAMBytes - 2048;
}
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Cursor Offset: %08lX Reserved: %08lX\n",
- (unsigned long)pSmi->FBCursorOffset,
- (unsigned long)pSmi->FBReserved);
- /* panel size detection ... requires BIOS call on 730 hardware */
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- if (pSmi->pInt10 != NULL)
- {
- pSmi->pInt10->num = 0x10;
- pSmi->pInt10->ax = 0x5F00;
- pSmi->pInt10->bx = 0;
- pSmi->pInt10->cx = 0;
- pSmi->pInt10->dx = 0;
- xf86ExecX86int10(pSmi->pInt10);
- if (pSmi->pInt10->ax == 0x005F)
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Cursor Offset: %08X Reserved: %08X\n",
+ pSmi->FBCursorOffset, pSmi->FBReserved);
+
+ pSmi->lcd = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31) & 0x01;
+ if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01)
+ {
+ pSmi->lcd <<= 1;
+ }
+ switch (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x0C)
+ {
+ case 0x00:
+ pSmi->lcdWidth = 640;
+ pSmi->lcdHeight = 480;
+ break;
+
+ case 0x04:
+ pSmi->lcdWidth = 800;
+ pSmi->lcdHeight = 600;
+ break;
+
+ case 0x08:
+ if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x74) & 0x02)
{
- switch (pSmi->pInt10->cx & 0x0F)
- {
- case PANEL_640x480:
- pSmi->lcdWidth = 640;
- pSmi->lcdHeight = 480;
- break;
-
- case PANEL_800x600:
- pSmi->lcdWidth = 800;
- pSmi->lcdHeight = 600;
- break;
-
- case PANEL_1024x768:
- pSmi->lcdWidth = 1024;
- pSmi->lcdHeight = 768;
- break;
-
- case PANEL_1280x1024:
- pSmi->lcdWidth = 1280;
- pSmi->lcdHeight = 1024;
- break;
-
- case PANEL_1600x1200:
- pSmi->lcdWidth = 1600;
- pSmi->lcdHeight = 1200;
- break;
-
- case PANEL_1400x1050:
- pSmi->lcdWidth = 1400;
- pSmi->lcdHeight = 1050;
- break;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Detected panel size via BIOS: %d x %d\n",
- pSmi->lcdWidth, pSmi->lcdHeight);
+ pSmi->lcdWidth = 1024;
+ pSmi->lcdHeight = 600;
}
else
{
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS error during 730 panel detection!\n");
- pSmi->lcdWidth = pScrn->virtualX;
- pSmi->lcdHeight = pScrn->virtualY;
+ pSmi->lcdWidth = 1024;
+ pSmi->lcdHeight = 768;
}
- }
- else
- {
- /* int10 support isn't setup on the second call to this function,
- so if this is the second call, don't do detection again */
- if (pSmi->lcd == 0)
- {
- /* If we get here, int10 support is not loaded or not working */
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No BIOS support for 730 panel detection!\n");
- pSmi->lcdWidth = pScrn->virtualX;
- pSmi->lcdHeight = pScrn->virtualY;
- }
- }
+ break;
- /* Set this to indicate that we've done the detection */
- pSmi->lcd = 1;
- }
- else /* panel size detection for hardware other than 730 */
- {
- pSmi->lcd = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31) & 0x01;
-
- if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01)
- {
- pSmi->lcd <<= 1;
- }
- switch (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x0C)
- {
- case 0x00:
- pSmi->lcdWidth = 640;
- pSmi->lcdHeight = 480;
- break;
-
- case 0x04:
- pSmi->lcdWidth = 800;
- pSmi->lcdHeight = 600;
- break;
-
- case 0x08:
- if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x74) & 0x02)
- {
- pSmi->lcdWidth = 1024;
- pSmi->lcdHeight = 600;
- }
- else
- {
- pSmi->lcdWidth = 1024;
- pSmi->lcdHeight = 768;
- }
- break;
-
- case 0x0C:
- pSmi->lcdWidth = 1280;
- pSmi->lcdHeight = 1024;
- break;
- }
+ case 0x0C:
+ pSmi->lcdWidth = 1280;
+ pSmi->lcdHeight = 1024;
+ break;
}
-
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Panel Size = %dx%d\n",
(pSmi->lcd == 0) ? "OFF" : (pSmi->lcd == 1) ? "TFT" : "DSTN",
pSmi->lcdWidth, pSmi->lcdHeight);
@@ -2271,16 +2138,7 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (pSmi->shadowFB)
{
- RefreshAreaFuncPtr refreshArea;
-
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- refreshArea = SMI_RefreshArea730;
- }
- else
- {
- refreshArea = SMI_RefreshArea;
- }
+ RefreshAreaFuncPtr refreshArea = SMI_RefreshArea;
if (pSmi->rotate)
{
@@ -2384,22 +2242,14 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen)
pSmi->FBReserved -= pSmi->saveBufferSize;
pSmi->FBReserved &= ~0x15;
WRITE_VPR(pSmi, 0x0C, (pSmi->FBOffset = pSmi->FBReserved) >> 3);
- if(pSmi->Chipset == SMI_COUGAR3DR)
- {
- WRITE_FPR(pSmi, FPR0C, (pSmi->FBOffset = pSmi->FBReserved) >> 3);
- }
- pScrn->fbOffset = pSmi->FBOffset + pSmi->fbMapOffset;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Shadow: width=%d height=%d "
- "offset=0x%08lX pitch=0x%08X\n",
- pSmi->ShadowWidth, pSmi->ShadowHeight,
- (unsigned long)pSmi->FBOffset,
- pSmi->ShadowPitch);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Shadow: width=%d height=%d "
+ "offset=0x%08X pitch=0x%08X\n", pSmi->ShadowWidth,
+ pSmi->ShadowHeight, pSmi->FBOffset, pSmi->ShadowPitch);
}
else
{
pSmi->FBOffset = 0;
- pScrn->fbOffset = pSmi->FBOffset + pSmi->fbMapOffset;
}
/*
@@ -2576,18 +2426,14 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21);
new->SR21 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x03;
- if (pSmi->Chipset != SMI_COUGAR3DR)
- {
- outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x31);
- new->SR31 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0xC0;
-
- outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x32);
- new->SR32 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x07;
+ outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x31);
+ new->SR31 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0xC0;
- if (SMI_LYNXM_SERIES(pSmi->Chipset))
- {
- new->SR32 |= 0x04;
- }
+ 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;
}
new->SRA0 = new->CR33 = new->CR3A = 0x00;
@@ -2692,7 +2538,7 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/* 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) || (pSmi->Chipset == SMI_COUGAR3DR)){
+ if (pSmi->Chipset == SMI_LYNX3DM) {
switch (pScrn->bitsPerPixel) {
case 8:
new->CCR66 = (new->CCR66 & 0xF3) | 0x00; /* 6 bits-RAM */
@@ -2711,18 +2557,15 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
}
- if (pSmi->Chipset != SMI_COUGAR3DR)
+ outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x30);
+ if (inb(pSmi->PIOBase + VGA_SEQ_DATA) & 0x01)
{
- outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x30);
- if (inb(pSmi->PIOBase + VGA_SEQ_DATA) & 0x01)
- {
- new->SR21 = 0x00;
- }
+ new->SR21 = 0x00;
}
if (pSmi->MCLK > 0)
{
- SMI_CommonCalcClock(pScrn->scrnIndex, pSmi->MCLK,
+ SMI_CommonCalcClock(pScrn->scrnIndex,pSmi->MCLK,
1, 1, 31, 0, 2, pSmi->minClock,
pSmi->maxClock, &new->SR6A, &new->SR6B);
}
@@ -2801,44 +2644,37 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
new->DPR40 = 0;
new->DPR44 = 0;
- /* Set VPR registers (and FPR registers for SM731) */
+ /* Set VPR registers */
switch (pScrn->bitsPerPixel)
{
case 8:
new->VPR00 = 0x00000000;
- new->FPR00_= 0x00080000;
break;
case 16:
new->VPR00 = 0x00020000;
- new->FPR00_= 0x000A0000;
break;
case 24:
new->VPR00 = 0x00040000;
- new->FPR00_= 0x000C0000;
break;
case 32:
new->VPR00 = 0x00030000;
- new->FPR00_= 0x000B0000;
break;
}
new->VPR0C = pSmi->FBOffset >> 3;
if (pSmi->rotate)
{
- new->VPR10 = (((( pSmi->height * pSmi->Bpp) >> 3)
+ new->VPR10 = ((((min(pSmi->lcdWidth, pSmi->height) * pSmi->Bpp) >> 3)
+ 2) << 16) | ((pSmi->height * pSmi->Bpp) >> 3);
}
else
{
- new->VPR10 = ((((pSmi->width * pSmi->Bpp) >> 3)
+ new->VPR10 = ((((min(pSmi->lcdWidth, pSmi->width) * pSmi->Bpp) >> 3)
+ 2) << 16) | ((pSmi->width * pSmi->Bpp) >> 3);
}
- new->FPR0C_ = new->VPR0C;
- new->FPR10_ = new->VPR10;
-
/* Set CPR registers */
new->CPR00 = 0x00000000;
@@ -3002,7 +2838,7 @@ SMI_AdjustFrame(int scrnIndex, int x, int y, int flags)
}
Base = pSmi->FBOffset + (x + y * pScrn->virtualX) * pSmi->Bpp;
- if (SMI_LYNX3D_SERIES(pSmi->Chipset) || SMI_COUGAR_SERIES(pSmi->Chipset))
+ if (SMI_LYNX3D_SERIES(pSmi->Chipset))
{
Base = (Base + 15) & ~15;
#if 1 /* PDR#1058 */
@@ -3024,10 +2860,6 @@ SMI_AdjustFrame(int scrnIndex, int x, int y, int flags)
}
WRITE_VPR(pSmi, 0x0C, Base >> 3);
- if(pSmi->Chipset == SMI_COUGAR3DR)
- {
- WRITE_FPR(pSmi, FPR0C, Base >> 3);
- }
LEAVE_PROC("SMI_AdjustFrame");
}
@@ -3054,16 +2886,6 @@ SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors,
ENTER_PROC("SMI_LoadPalette");
- /* Enable both the CRT and LCD DAC RAM paths, so both palettes are updated */
- if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR))
- {
- CARD8 ccr66;
-
- ccr66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66);
- ccr66 &= 0x0f;
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, ccr66);
- }
-
for(i = 0; i < numColors; i++)
{
DEBUG((VERBLEV, "pal[%d] = %d %d %d\n", indicies[i],
@@ -3153,7 +2975,7 @@ SMI_DisableMmio(ScrnInfoPtr pScrn)
static void
SMI_PrintRegs(ScrnInfoPtr pScrn)
{
- unsigned char i;
+ unsigned char i, tmp;
vgaHWPtr hwp = VGAHWPTR(pScrn);
SMIPtr pSmi = SMIPTR(pScrn);
int vgaCRIndex = hwp->IOBase + VGA_CRTC_INDEX_OFFSET;
@@ -3202,34 +3024,34 @@ SMI_PrintRegs(ScrnInfoPtr pScrn)
" x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF");
for (i = 0x00; i <= 0x14; i++)
{
- (void) VGAIN8(pSmi, vgaStatus);
+ tmp = VGAIN8(pSmi, vgaStatus);
if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
if ((i & 0x3) == 0x0) xf86ErrorFVerb(VERBLEV, " ");
xf86ErrorFVerb(VERBLEV, "%02X ",
VGAIN8_INDEX(pSmi, VGA_ATTR_INDEX, VGA_ATTR_DATA_R, i));
}
- (void) VGAIN8(pSmi, vgaStatus);
+ tmp = VGAIN8(pSmi, vgaStatus);
VGAOUT8(pSmi, VGA_ATTR_INDEX, 0x20);
xf86ErrorFVerb(VERBLEV, "\n\nDPR x0 x4 x8 xC");
for (i = 0x00; i <= 0x44; i += 4)
{
if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
- xf86ErrorFVerb(VERBLEV, " %08lX", (unsigned long)READ_DPR(pSmi, i));
+ xf86ErrorFVerb(VERBLEV, " %08X", READ_DPR(pSmi, i));
}
xf86ErrorFVerb(VERBLEV, "\n\nVPR x0 x4 x8 xC");
for (i = 0x00; i <= 0x60; i += 4)
{
if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
- xf86ErrorFVerb(VERBLEV, " %08lX", (unsigned long)READ_VPR(pSmi, i));
+ xf86ErrorFVerb(VERBLEV, " %08X", READ_VPR(pSmi, i));
}
xf86ErrorFVerb(VERBLEV, "\n\nCPR x0 x4 x8 xC");
for (i = 0x00; i <= 0x18; i += 4)
{
if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i);
- xf86ErrorFVerb(VERBLEV, " %08lX", (unsigned long)READ_CPR(pSmi, i));
+ xf86ErrorFVerb(VERBLEV, " %08X", READ_CPR(pSmi, i));
}
xf86ErrorFVerb(VERBLEV, "\n\n");
diff --git a/src/smi_hwcurs.c b/src/smi_hwcurs.c
index fb89969..b2f8d69 100644
--- a/src/smi_hwcurs.c
+++ b/src/smi_hwcurs.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
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_hwcurs.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.2 2001/03/03 22:26:13 tsi Exp $ */
#include "cursorstr.h"
#include "smi.h"
@@ -211,17 +211,6 @@ SMI_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81,
tmp | ((pSmi->FBCursorOffset / 2048) >> 8));
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- CARD32 fpr15c;
-
- /* put address in upper word, and disable the cursor */
- fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCCOLORS;
- fpr15c |= (pSmi->FBCursorOffset / 2048) << 16;
- WRITE_FPR(pSmi, FPR15C, fpr15c);
- }
-
/* Copy cursor image to framebuffer storage */
memcpy(pSmi->FBBase + pSmi->FBCursorOffset, src, 1024);
@@ -240,17 +229,6 @@ SMI_ShowCursor(ScrnInfoPtr pScrn)
tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp | 0x80);
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- CARD32 fpr15c;
-
- /* turn on the top bit */
- fpr15c = READ_FPR(pSmi, FPR15C);
- fpr15c |= FPR15C_MASK_HWCENABLE;
- WRITE_FPR(pSmi, FPR15C, fpr15c);
- }
-
LEAVE_PROC("SMI_ShowCursor");
}
@@ -266,17 +244,6 @@ SMI_HideCursor(ScrnInfoPtr pScrn)
tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp & ~0x80);
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- CARD32 fpr15c;
-
- /* turn off the top bit */
- fpr15c = READ_FPR(pSmi, FPR15C);
- fpr15c &= ~FPR15C_MASK_HWCENABLE;
- WRITE_FPR(pSmi, FPR15C, fpr15c);
- }
-
LEAVE_PROC("SMI_HideCursor");
}
@@ -334,34 +301,6 @@ SMI_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8B, 0x08);
}
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- CARD32 fpr158;
-
- if (xoff >= 0)
- {
- fpr158 = (xoff & FPR158_MASK_MAXBITS)<<16;
- }
- else
- {
- fpr158 = (((-xoff) & FPR158_MASK_MAXBITS) | FPR158_MASK_BOUNDARY)<<16;
- }
-
- if (yoff >= 0)
- {
- fpr158 |= (yoff & FPR158_MASK_MAXBITS);
- }
- else
- {
- fpr158 |= (((-yoff) & FPR158_MASK_MAXBITS) | FPR158_MASK_BOUNDARY);
- }
-
- /* Program combined coordinates */
- WRITE_FPR(pSmi, FPR158, fpr158);
-
- }
-
LEAVE_PROC("SMI_SetCursorPosition");
}
@@ -387,17 +326,6 @@ SMI_SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8C, packedFG);
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8D, packedBG);
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- CARD32 fpr15c;
-
- fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCADDREN;
- fpr15c |= packedFG;
- fpr15c |= packedBG<<8;
- WRITE_FPR(pSmi, FPR15C, fpr15c);
- }
-
LEAVE_PROC("SMI_SetCursorColors");
}
diff --git a/src/smi_i2c.c b/src/smi_i2c.c
index f395df4..3a73ced 100644
--- a/src/smi_i2c.c
+++ b/src/smi_i2c.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from the XFree86 Project and Silicon Motion.
*/
-/* $XFree86$ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_i2c.c,v 1.2 2001/12/20 21:35:39 eich Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
diff --git a/src/smi_shadow.c b/src/smi_shadow.c
index 32bd1ce..5ef9ba5 100644
--- a/src/smi_shadow.c
+++ b/src/smi_shadow.c
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
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_shadow.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c,v 1.2 2000/12/05 21:18:37 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -181,162 +181,6 @@ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
LEAVE_PROC("SMI_RefreshArea");
}
-/* Custom version for the 730 series (Cougar3DR).
- This chipset has problems with large rotate-blts. */
-
-void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
-{
- SMIPtr pSmi = SMIPTR(pScrn);
- int width, height, srcX, srcY, destX, destY;
- int maxPixels, tempWidth;
-
- ENTER_PROC("SMI_RefreshArea730");
-
- /* #671 */
- if (pSmi->polyLines)
- {
- pSmi->polyLines = FALSE;
- return;
- }
-
- if (pSmi->rotate)
- {
- /* IF we need to do rotation, setup the hardware here. */
- WaitIdleEmpty();
- WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch);
- WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch);
- WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3);
- }
-
- /* #672 */
- if (pSmi->ClipTurnedOn)
- {
- WaitQueue(1);
- WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft);
- pSmi->ClipTurnedOn = FALSE;
- }
-
- /* SM731 cannot rotate-blt more than a certain number of pixels
- (based on a calculation from the Windows driver source */
- maxPixels = 1280 / pScrn->bitsPerPixel;
-
- while (num--)
- {
- /* Get coordinates of the box to refresh. */
- srcX = pbox->x1;
- srcY = pbox->y1;
- width = pbox->x2 - srcX;
- height = pbox->y2 - srcY;
-
- DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height));
-
- if ((width > 0) && (height > 0))
- {
- switch (pSmi->rotate)
- {
- case SMI_ROTATE_CW:
- /* 90 degrees CW rotation. Calculate destination
- coordinates:
-
- *---+
- | | +-----*
- | | | | destX = shadowHeight - srcY - 1
- | | --> | | destY = srcX
- | | | |
- | | +-----+
- +---+
- */
- destX = pSmi->ShadowHeight - srcY - 1;
- destY = srcX;
-
- for (tempWidth=width; tempWidth>0;)
- {
- if (width>maxPixels)
- width = maxPixels;
- WaitQueue(4);
- WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY);
- WRITE_DPR(pSmi, 0x04, (destX << 16) + destY);
- WRITE_DPR(pSmi, 0x08, (width << 16) + height);
- WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT |
- SMI_ROTATE_CW | SMI_START_ENGINE);
- destY += maxPixels;
- srcX += maxPixels;
- tempWidth -= maxPixels;
- width = tempWidth;
- }
-
- break;
-
- case SMI_ROTATE_CCW:
- /* 90 degrees CCW rotatation. Calculate destination
- coordinates:
-
- *---+
- | | +-----+
- | | | | destX = srcY
- | | --> | | destY = shadowWidth - srcX - 1
- | | | |
- | | *-----+
- +---+
- */
- destX = srcY;
- destY = pSmi->ShadowWidth - srcX - 1;
-
- for (tempWidth=width; tempWidth>0;)
- {
- if (width>maxPixels)
- width = maxPixels;
- WaitQueue(4);
- WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY);
- WRITE_DPR(pSmi, 0x04, (destX << 16) + destY);
- WRITE_DPR(pSmi, 0x08, (width << 16) + height);
- WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT |
- SMI_ROTATE_CCW | SMI_START_ENGINE);
- destY -= maxPixels;
- srcX += maxPixels;
- tempWidth -= maxPixels;
- width = tempWidth;
- }
-
- break;
-
- default:
- /* No rotation, perform a normal copy. */
- if (pScrn->bitsPerPixel == 24)
- {
- srcX *= 3;
- width *= 3;
-
- if (pSmi->Chipset == SMI_LYNX)
- {
- srcY *= 3;
- }
- }
-
- WaitQueue(4);
- WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY);
- WRITE_DPR(pSmi, 0x04, (srcX << 16) + srcY);
- WRITE_DPR(pSmi, 0x08, (width << 16) + height);
- WRITE_DPR(pSmi, 0x0C, SMI_BITBLT + SMI_START_ENGINE + 0xCC);
- break;
- }
- }
-
- pbox++;
- }
-
- if (pSmi->rotate)
- {
- /* If we did a rotation, we need to restore the hardware state here. */
- WaitIdleEmpty();
- WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride);
- WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride);
- WRITE_DPR(pSmi, 0x44, 0);
- }
-
- LEAVE_PROC("SMI_RefreshArea730");
-}
-
/******************************************************************************\
|* SMI_PointerMoved
|*=============================================================================
diff --git a/src/smi_video.c b/src/smi_video.c
index 3bc4f8b..79fb087 100644
--- a/src/smi_video.c
+++ b/src/smi_video.c
@@ -41,8 +41,7 @@ Author of changes: Corvin Zahn <zahn@zac.de>
Date: 2.11.2001
*/
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.14 2003/12/08 16:03:58 alanh Exp $ */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.13 2003/11/10 18:22:26 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.11 2003/04/23 21:51:44 tsi Exp $ */
#include "smi.h"
#include "smi_video.h"
@@ -120,9 +119,6 @@ static Bool SMI_ClipVideo(ScrnInfoPtr pScrn, BoxPtr dst,
static void SMI_DisplayVideo(ScrnInfoPtr pScrn, int id, int offset,
short width, short height, int pitch, int x1, int y1, int x2, int y2,
BoxPtr dstBox, short vid_w, short vid_h, short drw_w, short drw_h);
-static void SMI_DisplayVideo0730(ScrnInfoPtr pScrn, int id, int offset,
- short width, short height, int pitch, int x1, int y1, int x2, int y2,
- 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
@@ -134,6 +130,11 @@ static void SMI_WaitForSync(ScrnInfoPtr pScrn);
static void SMI_InitOffscreenImages(ScreenPtr pScreen);
static FBAreaPtr SMI_AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area,
int numLines);
+static void SMI_CopyData(unsigned char *src, unsigned char *dst, int srcPitch,
+ int dstPitch, int height, int width);
+static void SMI_CopyYV12Data(unsigned char *src1, unsigned char *src2,
+ unsigned char *src3, unsigned char *dst, int srcPitch1, int srcPitch2,
+ int dstPitch, int height, int width);
static int SMI_AllocSurface(ScrnInfoPtr pScrn,
int id, unsigned short width, unsigned short height,
@@ -150,11 +151,7 @@ static int SMI_SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 value);
static int SetAttr(ScrnInfoPtr pScrn, int i, int value);
static int SetAttrSAA7110(ScrnInfoPtr pScrn, int i, int value);
static int SetAttrSAA7111(ScrnInfoPtr pScrn, int i, int value);
-static void SetKeyReg(SMIPtr pSmi, int reg, int value);
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
-static Bool RegionsEqual(RegionPtr A, RegionPtr B);
-#endif
/**
* Atoms
*/
@@ -460,55 +457,6 @@ static I2CByte SAA7111InitData[] =
/**************************************************************************/
-/* To allow this ddx to work on 4_3_0 and above, we need to include this */
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
-static Bool
-RegionsEqual(
- RegionPtr A,
- RegionPtr B
-)
-{
- int *dataA, *dataB;
- int num;
-
- ENTER_PROC("RegionsEqual");
-
- num = REGION_NUM_RECTS(A);
- if (num != REGION_NUM_RECTS(B))
- {
- LEAVE_PROC("RegionsEqual");
- return(FALSE);
- }
-
- if ( (A->extents.x1 != B->extents.x1)
- || (A->extents.y1 != B->extents.y1)
- || (A->extents.x2 != B->extents.x2)
- || (A->extents.y2 != B->extents.y2)
- )
- {
- LEAVE_PROC("RegionsEqual");
- return(FALSE);
- }
-
- dataA = (int*) REGION_RECTS(A);
- dataB = (int*) REGION_RECTS(B);
-
- while (num--)
- {
- if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
- {
- return(FALSE);
- }
- dataA += 2;
- dataB += 2;
- }
-
- LEAVE_PROC("RegionsEqual");
- return(TRUE);
-}
-#endif
-
-
/**
* generates XF86VideoEncoding[i] with video norm norm, video input format
* input and video input channel channel
@@ -712,7 +660,7 @@ SetAttr(ScrnInfoPtr pScrn, int i, int value)
if (i == XV_BRIGHTNESS) {
int my_value = (value <= 128? value + 128 : value - 128);
- SetKeyReg(pSmi, 0x5C, 0xEDEDED | (my_value << 24));
+ WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (my_value << 24));
} else if (pPort->I2CDev.SlaveAddr == SAA7110) {
return SetAttrSAA7110(pScrn, i, value);
}
@@ -902,10 +850,7 @@ SMI_SetupVideo(
ptrAdaptor->pImages = SMI_VideoImages;
#if SMI_USE_CAPTURE
- if (pSmi->Chipset == SMI_COUGAR3DR)
- ptrAdaptor->PutVideo = NULL;
- else
- ptrAdaptor->PutVideo = SMI_PutVideo;
+ ptrAdaptor->PutVideo = SMI_PutVideo;
ptrAdaptor->PutStill = NULL;
ptrAdaptor->GetVideo = NULL;
ptrAdaptor->GetStill = NULL;
@@ -961,11 +906,7 @@ SMI_SetupVideo(
} else
smiPortPtr->I2CDev.SlaveAddr = 0;
-#if defined(REGION_NULL)
- REGION_NULL(pScreen, &smiPortPtr->clip);
-#else
REGION_INIT(pScreen, &smiPortPtr->clip, NullBox, 0);
-#endif
pSmi->ptrAdaptor = ptrAdaptor;
pSmi->BlockHandler = pScreen->BlockHandler;
@@ -1002,26 +943,26 @@ SMI_ResetVideo(
switch (pScrn->depth)
{
case 8:
- SetKeyReg(pSmi, FPR04, pPort->Attribute[XV_COLORKEY] & 0x00FF);
- SetKeyReg(pSmi, FPR08, 0);
+ WRITE_VPR(pSmi, 0x04, pPort->Attribute[XV_COLORKEY] & 0x00FF);
+ WRITE_VPR(pSmi, 0x08, 0);
break;
case 15:
case 16:
- SetKeyReg(pSmi, FPR04, pPort->Attribute[XV_COLORKEY] & 0xFFFF);
- SetKeyReg(pSmi, FPR08, 0);
+ WRITE_VPR(pSmi, 0x04, pPort->Attribute[XV_COLORKEY] & 0xFFFF);
+ WRITE_VPR(pSmi, 0x08, 0);
break;
default:
r = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.red) >> pScrn->offset.red;
g = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.green) >> pScrn->offset.green;
b = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.blue) >> pScrn->offset.blue;
- SetKeyReg(pSmi, FPR04, ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3));
- SetKeyReg(pSmi, FPR08, 0);
+ WRITE_VPR(pSmi, 0x04, ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3));
+ WRITE_VPR(pSmi, 0x08, 0);
break;
}
- SetKeyReg(pSmi, FPR5C, 0xEDEDED | (pPort->Attribute[XV_BRIGHTNESS] << 24));
+ WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (pPort->Attribute[XV_BRIGHTNESS] << 24));
LEAVE_PROC("SMI_ResetVideo");
}
@@ -1293,11 +1234,7 @@ SMI_PutVideo(
vid_address = (pPort->area->box.y1 * fbPitch);
DEBUG((VERBLEV, "test RegionsEqual\n"));
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
- if (!RegionsEqual(&pPort->clip, clipBoxes))
-#else
if (!REGION_EQUAL(pScrn->pScreen, &pPort->clip, clipBoxes))
-#endif
{
DEBUG((VERBLEV, "RegionCopy\n"));
REGION_COPY(pScrn->pScreen, &pPort->clip, clipBoxes);
@@ -1398,21 +1335,11 @@ SMI_StopVideo(
{
if (pPort->videoStatus & CLIENT_VIDEO_ON)
{
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- WRITE_FPR(pSmi, FPR00, READ_FPR(pSmi, 0x00) & ~(FPR00_VWIENABLE));
- }
- else
- {
- WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x01000008);
- }
+ WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x01000008);
#if SMI_USE_CAPTURE
- if (pSmi->Chipset != SMI_COUGAR3DR)
- {
- WRITE_CPR(pSmi, 0x00, READ_CPR(pSmi, 0x00) & ~0x00000001);
- WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) & ~0x00F00000);
- }
- /* #864 OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) | 0x04); */
+ WRITE_CPR(pSmi, 0x00, READ_CPR(pSmi, 0x00) & ~0x00000001);
+ WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) & ~0x00F00000);
+/* #864 OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) | 0x04); */
#endif
}
if (pPort->area != NULL)
@@ -1457,19 +1384,19 @@ SMI_SetPortAttribute(
switch (pScrn->depth)
{
case 8:
- SetKeyReg(pSmi, FPR04, value & 0x00FF);
+ WRITE_VPR(pSmi, 0x04, value & 0x00FF);
break;
case 15:
case 16:
- SetKeyReg(pSmi, FPR04, value & 0xFFFF);
+ WRITE_VPR(pSmi, 0x04, value & 0xFFFF);
break;
default:
r = (value & pScrn->mask.red) >> pScrn->offset.red;
g = (value & pScrn->mask.green) >> pScrn->offset.green;
b = (value & pScrn->mask.blue) >> pScrn->offset.blue;
- SetKeyReg(pSmi, FPR04,
+ WRITE_VPR(pSmi, 0x04,
((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3));
break;
}
@@ -1686,49 +1613,37 @@ SMI_PutImage(
offset = (pPort->area->box.y1 * fbPitch) + (top * dstPitch);
dstStart = pSmi->FBBase + offset + left;
- switch(id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- top &= ~1;
- tmp = ((top >> 1) * srcPitch2) + (left >> 2);
- offset2 += tmp;
- offset3 += tmp;
- if(id == FOURCC_I420) {
- tmp = offset2;
- offset2 = offset3;
- offset3 = tmp;
- }
- nLines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
- xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1),
- buf + offset2, buf + offset3, dstStart,
- srcPitch, srcPitch2, dstPitch, nLines, nPixels);
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- buf += (top * srcPitch) + left;
- nLines = ((y2 + 0xffff) >> 16) - top;
- xf86XVCopyPacked(buf, dstStart, srcPitch, dstPitch, nLines, nPixels);
- break;
- }
+ switch (id)
+ {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ top &= ~1;
+ tmp = ((top >> 1) * srcPitch2) + (left >> 2);
+ offset2 += tmp;
+ offset3 += tmp;
+ nLines = ((((y2 + 0xFFFF) >> 16) + 1) & ~1) - top;
+ SMI_CopyYV12Data(buf + (top * srcPitch) + (left >> 1),
+ buf + offset2, buf + offset3, dstStart, srcPitch, srcPitch2,
+ dstPitch, nLines, nPixels);
+ break;
+
+ default:
+ buf += (top * srcPitch) + left;
+ nLines = ((y2 + 0xFFFF) >> 16) - top;
+ SMI_CopyData(buf, dstStart, srcPitch, dstPitch, nLines,
+ nPixels * bpp);
+ break;
+ }
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
- if (!RegionsEqual(&pPort->clip, clipBoxes))
-#else
if (!REGION_EQUAL(pScrn->pScreen, &pPort->clip, clipBoxes))
-#endif
{
REGION_COPY(pScrn->pScreen, &pPort->clip, clipBoxes);
xf86XVFillKeyHelper(pScrn->pScreen, pPort->Attribute[XV_COLORKEY],
clipBoxes);
}
- if (pSmi->Chipset != SMI_COUGAR3DR)
- SMI_DisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2,
- &dstBox, src_w, src_h, drw_w, drw_h);
- else
- SMI_DisplayVideo0730(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2,
- &dstBox, src_w, src_h, drw_w, drw_h);
+ SMI_DisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2,
+ &dstBox, src_w, src_h, drw_w, drw_h);
pPort->videoStatus = CLIENT_VIDEO_ON;
LEAVE_PROC("SMI_PutImage");
@@ -1866,9 +1781,8 @@ SMI_ClipVideo(
INT32 height
)
{
- ScreenPtr pScreen = pScrn->pScreen;
INT32 vscale, hscale;
- BoxPtr extents = REGION_EXTENTS(pScreen, reg);
+ BoxPtr extents = REGION_EXTENTS(pScrn, reg);
int diff;
ENTER_PROC("SMI_ClipVideo");
@@ -1963,9 +1877,9 @@ SMI_ClipVideo(
)
{
RegionRec clipReg;
- REGION_INIT(pScreen, &clipReg, dst, 1);
- REGION_INTERSECT(pScreen, reg, reg, &clipReg);
- REGION_UNINIT(pScreen, &clipReg);
+ REGION_INIT(pScrn, &clipReg, dst, 1);
+ REGION_INTERSECT(pScrn, reg, reg, &clipReg);
+ REGION_UNINIT(pScrn, &clipReg);
}
DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16));
@@ -2059,90 +1973,6 @@ SMI_DisplayVideo(
}
static void
-SMI_DisplayVideo0730(
- ScrnInfoPtr pScrn,
- int id,
- int offset,
- short width,
- short height,
- int pitch,
- int x1,
- int y1,
- int x2,
- int y2,
- BoxPtr dstBox,
- short vid_w,
- short vid_h,
- short drw_w,
- short drw_h
-)
-{
- SMIPtr pSmi = SMIPTR(pScrn);
- CARD32 fpr00;
- int hstretch, vstretch;
-
- ENTER_PROC("SMI_DisplayVideo0730");
-
- fpr00 = READ_FPR(pSmi, 0x00) & ~(FPR00_MASKBITS);
-
- switch (id)
- {
- case FOURCC_YV12:
- case FOURCC_I420:
- case FOURCC_YUY2:
- fpr00 |= FPR00_FMT_YUV422;
- break;
-
- case FOURCC_RV15:
- fpr00 |= FPR00_FMT_15P;
- break;
-
- case FOURCC_RV16:
- fpr00 |= FPR00_FMT_16P;
- break;
-
- case FOURCC_RV24:
- fpr00 |= FPR00_FMT_24P;
- break;
-
- case FOURCC_RV32:
- fpr00 |= FPR00_FMT_32P;
- break;
- }
-
- /* the formulas for calculating the stretch values do not match the
- documentation, but they're the same as the ddraw driver and they work */
- if (drw_w > vid_w)
- {
- hstretch = (8192 * vid_w / drw_w);
- }
- else
- {
- hstretch = 0;
- }
-
- if (drw_h > vid_h)
- {
- vstretch = (8192 * vid_h / drw_h);
- }
- else
- {
- vstretch = 0;
- }
-
-
- WRITE_FPR(pSmi, FPR00, fpr00 | FPR00_VWIENABLE | FPR00_VWIKEYENABLE);
- WRITE_FPR(pSmi, FPR14, (dstBox->x1) | (dstBox->y1 << 16));
- WRITE_FPR(pSmi, FPR18, (dstBox->x2) | (dstBox->y2 << 16));
- WRITE_FPR(pSmi, FPR1C, offset >> 3);
- WRITE_FPR(pSmi, FPR20, (pitch >> 3) | ((pitch >> 3) << 16));
- WRITE_FPR(pSmi, FPR24, (hstretch & 0xFF00) | ((vstretch & 0xFF00)>>8));
- WRITE_FPR(pSmi, FPR68, ((hstretch & 0x00FF)<<8) | (vstretch & 0x00FF));
-
- LEAVE_PROC("SMI_DisplayVideo0730");
-}
-
-static void
SMI_BlockHandler(
int i,
pointer blockData,
@@ -2166,14 +1996,7 @@ SMI_BlockHandler(
{
if (pPort->offTime < currentTime.milliseconds)
{
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- WRITE_FPR(pSmi, FPR00, READ_FPR(pSmi, 0x00) & ~(FPR00_VWIENABLE));
- }
- else
- {
- WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008);
- }
+ WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008);
pPort->videoStatus = FREE_TIMER;
pPort->freeTime = currentTime.milliseconds + FREE_DELAY;
}
@@ -2349,6 +2172,65 @@ SMI_AllocateMemory(
return(area);
}
+static void
+SMI_CopyData(
+ unsigned char *src,
+ unsigned char *dst,
+ int srcPitch,
+ int dstPitch,
+ int height,
+ int width
+)
+{
+ ENTER_PROC("SMI_CopyData");
+
+ while (height-- > 0)
+ {
+ memcpy(dst, src, width);
+ src += srcPitch;
+ dst += dstPitch;
+ }
+
+ LEAVE_PROC("SMI_CopyData");
+}
+
+static void
+SMI_CopyYV12Data(
+ unsigned char *src1,
+ unsigned char *src2,
+ unsigned char *src3,
+ unsigned char *dst,
+ int srcPitch1,
+ int srcPitch2,
+ int dstPitch,
+ int height,
+ int width
+)
+{
+ CARD32 *pDst = (CARD32 *) dst;
+ int i, j;
+
+ ENTER_PROC("SMI_CopyYV12Data");
+
+ for (j = 0; j < height; j++)
+ {
+ for (i =0; i < width; i++)
+ {
+ pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
+ (src3[i] << 8) | (src2[i] << 24);
+ }
+ pDst += dstPitch >> 2;
+ src1 += srcPitch1;
+ if (j & 1)
+ {
+ src2 += srcPitch2;
+ src3 += srcPitch2;
+ }
+ }
+
+ LEAVE_PROC("SMI_CopyYV12Data");
+}
+
static int
SMI_AllocSurface(
ScrnInfoPtr pScrn,
@@ -2525,25 +2407,15 @@ SMI_DisplaySurface(
xf86XVFillKeyHelper(surface->pScrn->pScreen,
pPort->Attribute[XV_COLORKEY], clipBoxes);
- if (pSmi->Chipset != SMI_COUGAR3DR)
- {
- SMI_ResetVideo(surface->pScrn);
- SMI_DisplayVideo(surface->pScrn, surface->id, surface->offsets[0],
- surface->width, surface->height, surface->pitches[0], x1, y1, x2,
- y2, &dstBox, vid_w, vid_h, drw_w, drw_h);
- }
- else
- {
- SMI_ResetVideo(surface->pScrn);
- SMI_DisplayVideo0730(surface->pScrn, surface->id, surface->offsets[0],
- surface->width, surface->height, surface->pitches[0], x1, y1, x2,
- y2, &dstBox, vid_w, vid_h, drw_w, drw_h);
- }
+ SMI_ResetVideo(surface->pScrn);
+ SMI_DisplayVideo(surface->pScrn, surface->id, surface->offsets[0],
+ surface->width, surface->height, surface->pitches[0], x1, y1, x2,
+ y2, &dstBox, vid_w, vid_h, drw_w, drw_h);
ptrOffscreen->isOn = TRUE;
if (pPort->videoStatus & CLIENT_VIDEO_ON)
{
- REGION_EMPTY(surface->pScrn->pScreen, &pPort->clip);
+ REGION_EMPTY(pScrn->pScreen, &pPort->clip);
UpdateCurrentTime();
pPort->videoStatus = FREE_TIMER;
pPort->freeTime = currentTime.milliseconds + FREE_DELAY;
@@ -2565,15 +2437,7 @@ SMI_StopSurface(
if (ptrOffscreen->isOn)
{
SMIPtr pSmi = SMIPTR(surface->pScrn);
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- WRITE_FPR(pSmi, FPR00, READ_FPR(pSmi, 0x00) & ~(FPR00_VWIENABLE));
- }
- else
- {
- WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008);
- }
-
+ WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008);
ptrOffscreen->isOn = FALSE;
}
@@ -2606,20 +2470,6 @@ SMI_SetSurfaceAttribute(
return(SMI_SetPortAttribute(pScrn, attr, value,
(pointer) pSmi->ptrAdaptor->pPortPrivates[0].ptr));
}
-
-static void
-SetKeyReg(SMIPtr pSmi, int reg, int value)
-{
- if (pSmi->Chipset == SMI_COUGAR3DR)
- {
- WRITE_FPR(pSmi, reg, value);
- }
- else
- {
- WRITE_VPR(pSmi, reg, value);
- }
-}
-
#else /* SMI_USE_VIDEO */
void SMI_InitVideo(ScreenPtr pScreen) {}
#endif
diff --git a/src/smi_video.h b/src/smi_video.h
index 270e0fe..b63e4bc 100644
--- a/src/smi_video.h
+++ b/src/smi_video.h
@@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the
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.1 2000/11/28 20:59:20 dawes 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