summaryrefslogtreecommitdiff
path: root/driver/xf86-video-openchrome/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-11-24 16:54:56 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-11-24 16:54:56 +0000
commit649d67fad9d3d59eeb8014ff1cff11512f23b2f1 (patch)
treee0e3de34ca3fa1d0e8ce0916fb2e43faa4abd850 /driver/xf86-video-openchrome/src
parenta71c1145bc499c45693d2d00c3e67ce0850f66d1 (diff)
Update to xf86-video-openchrome 0.2.904.
Tested by myself and kevlo@ on V800 and V855 chipsets.
Diffstat (limited to 'driver/xf86-video-openchrome/src')
-rw-r--r--driver/xf86-video-openchrome/src/Makefile.in4
-rw-r--r--driver/xf86-video-openchrome/src/openchrome.man235
-rw-r--r--driver/xf86-video-openchrome/src/svnversion.h1
-rw-r--r--driver/xf86-video-openchrome/src/via.h6
-rw-r--r--driver/xf86-video-openchrome/src/via_accel.c71
-rw-r--r--driver/xf86-video-openchrome/src/via_bandwidth.c7
-rw-r--r--driver/xf86-video-openchrome/src/via_bios.h11
-rw-r--r--driver/xf86-video-openchrome/src/via_ch7xxx.c1
-rw-r--r--driver/xf86-video-openchrome/src/via_crtc.c8
-rw-r--r--driver/xf86-video-openchrome/src/via_cursor.c229
-rw-r--r--driver/xf86-video-openchrome/src/via_display.c61
-rw-r--r--driver/xf86-video-openchrome/src/via_dri.c14
-rw-r--r--driver/xf86-video-openchrome/src/via_driver.c597
-rw-r--r--driver/xf86-video-openchrome/src/via_driver.h21
-rw-r--r--driver/xf86-video-openchrome/src/via_drm.h270
-rw-r--r--driver/xf86-video-openchrome/src/via_id.c16
-rw-r--r--driver/xf86-video-openchrome/src/via_id.h2
-rw-r--r--driver/xf86-video-openchrome/src/via_lvds.c147
-rw-r--r--driver/xf86-video-openchrome/src/via_mode.c214
-rw-r--r--driver/xf86-video-openchrome/src/via_mode.h104
-rw-r--r--driver/xf86-video-openchrome/src/via_panel.c25
-rw-r--r--driver/xf86-video-openchrome/src/via_shadow.c191
-rw-r--r--driver/xf86-video-openchrome/src/via_swov.c55
-rw-r--r--driver/xf86-video-openchrome/src/via_vbe.c6
-rw-r--r--driver/xf86-video-openchrome/src/via_video.c27
-rw-r--r--driver/xf86-video-openchrome/src/via_vt162x.c56
-rw-r--r--driver/xf86-video-openchrome/src/via_vt162x.h38
-rw-r--r--driver/xf86-video-openchrome/src/via_xvmc.c5
28 files changed, 1321 insertions, 1101 deletions
diff --git a/driver/xf86-video-openchrome/src/Makefile.in b/driver/xf86-video-openchrome/src/Makefile.in
index c3d5f5904..ea853d683 100644
--- a/driver/xf86-video-openchrome/src/Makefile.in
+++ b/driver/xf86-video-openchrome/src/Makefile.in
@@ -168,6 +168,8 @@ EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
+HAVE_XEXTPROTO_71_FALSE = @HAVE_XEXTPROTO_71_FALSE@
+HAVE_XEXTPROTO_71_TRUE = @HAVE_XEXTPROTO_71_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -200,6 +202,8 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
+XEXT_CFLAGS = @XEXT_CFLAGS@
+XEXT_LIBS = @XEXT_LIBS@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_LIBS = @XORG_LIBS@
XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@
diff --git a/driver/xf86-video-openchrome/src/openchrome.man b/driver/xf86-video-openchrome/src/openchrome.man
deleted file mode 100644
index 1204ae3cf..000000000
--- a/driver/xf86-video-openchrome/src/openchrome.man
+++ /dev/null
@@ -1,235 +0,0 @@
-.\" Shorthand for double quote that works everywhere,
-.\" also within other double quotes:
-.ds q \N'34'
-.TH OPENCHROME __drivermansuffix__ __vendorversion__
-.SH NAME
-openchrome \- video driver for VIA Unichromes
-.SH SYNOPSIS
-.nf
-.B "Section \*qDevice\*q"
-.BI " Identifier \*q" string \*q
-.B " Driver \*qopenchrome\*q"
-\ \ ...
-.B EndSection
-.fi
-
-.SH DESCRIPTION
-.B openchrome
-is an __xservername__ driver for VIA chipsets that have an integrated
-Unichrome graphics engine.
-.PP
-The
-.B openchrome
-driver supports the following chipsets: CLE266, KM400/KN400, CN400, CN700,
-K8M800/K8N800, PM800/PN800, P4M800Pro, VN800, PM880, K8M890/K8N890,
-CN896, VN896, and P4M900.
-The driver includes 2D acceleration and Xv video overlay extensions.
-Flat panel, TV, and VGA outputs are supported, depending on the hardware
-configuration.
-.PP
-3D direct rendering is available using experimental drivers from Mesa
-(www.mesa3d.org). There is also an XvMC client library for hardware
-acceleration of MPEG1/MPEG2 decoding (not available on the KM/N400)
-that uses the Direct Rendering Infrastructure (DRI).
-The XvMC client library implements a non-standard
-"VLD" extension to the XvMC standard. The current Direct Rendering
-Manager (DRM) kernel module is available at dri.sourceforge.net.
-.PP
-The driver supports free modes for Unichrome Pros (K8M800/K8N800, PM800/PN800,
-and CN400). For plain Unichromes (CLE266, KM400/KN400), it currently supports
-only a limited number of dotclocks, so if you are using X modelines you
-must make sure that the dotclock is one of those supported. Supported
-dotclocks on plain Unichromes are currently (in MHz): 25.2, 25.312,
-26.591, 31.5, 31.704, 32.663, 33.750, 35.5, 36.0, 39.822, 40.0, 41.164,
-46.981, 49.5, 50.0, 56.3, 57.284, 64.995, 65.0, 65.028, 74.480,
-75.0, 78.8, 81.613, 94.5, 108.0, 108.28, 122.0, 122.726, 135.0,
-148.5, 155.8, 157.5, 161.793, 162.0, 175.5, 189.0, 202.5, 204.8,
-218.3, 229.5. On top of this, bandwidth restrictions apply for both
-Unichromes and Unichrome Pros.
-.PP
-.SH CONFIGURATION DETAILS
-Please refer to __xconfigfile__(__filemansuffix__) for general configuration
-details. This section only covers configuration details specific to this
-driver.
-.PP
-The following driver
-.B options
-are supported:
-.TP
-.BI "Option \*qAccelMethod\*q \*q" string \*q
-The driver supports "XAA" and "EXA" acceleration methods. The default
-method is XAA, since EXA is still experimental. Contrary to XAA, EXA
-implements acceleration for screen uploads and downlads (if DRI is
-enabled) and for the Render/Composite extension.
-.TP
-.BI "Option \*qActiveDevice\*q \*q" string \*q
-Specifies the active device combination. Any string containing "CRT",
-"LCD", "DFP", "TV" should be possible. "CRT" represents anything that
-is connected to the VGA port, "LCD" and "DFP" are for laptop panels
-(not TFT screens attached to the VGA port), "TV" is self-explanatory.
-The default is to use what is detected. The driver is currently unable
-to use LCD and TV simultaneously, and will favour the LCD.
-.TP
-.BI "Option \*qAGPMem\*q \*q" integer \*q
-Sets the amount of AGP memory that is allocated at X server startup.
-The allocated memory will be "integer" kB. This AGP memory is used for
-the AGP command buffer (if the option "EnableAGPDMA" is set to "true"), for
-DRI textures, and for the EXA scratch area. The driver will allocate at
-least one system page of AGP memory, or \-\- if the AGP command buffer is
-used \-\- at least 2 MB plus one system page. If there is no room for the
-EXA scratch area in AGP space, it will be allocated from VRAM. If there is
-no room for DRI textures, they will be allocated from the DRI part of
-VRAM (see the option "MaxDRIMem"). The default amount of AGP is
-32768 kB. Note that the AGP aperture set in the BIOS must be able
-to accomodate the amount of AGP memory specified here. Otherwise no
-AGP memory will be available. It is safe to set a very large AGP
-aperture in the BIOS.
-.TP
-.BI "Option \*qCenter\*q \*q" boolean \*q
-Enables image centering on DVI displays. The default is disabled.
-.TP
-.BI "Option \*qDisableIRQ\*q \*q" boolean \*q
-Disables the vertical blank IRQ. This is a workaround for some mainboards
-that have problems with IRQs coming from the Unichrome engine. With IRQs
-disabled, DRI clients have no way to synchronize their drawing to Vblank.
-(IRQ is disabled by default on the KM400 and K8M800 chipsets.)
-.TP
-.BI "Option \*qDisableVQ\*q \*q" boolean \*q
-Disables the use of the virtual command queue. The queue is enabled
-by default.
-.TP
-.BI "Option \*qEnableAGPDMA\*q \*q" boolean \*q
-Enables the AGP DMA functionality in DRM. This requires that DRI is enabled
-and will force 2D and 3D acceleration to use AGP DMA. The XvMC DRI
-client will also make use of this on the CLE266 to consume much less CPU.
-(This option is enabled by default, except on the K8M890 and P4M900.)
-.TP
-.BI "Option \*qExaNoComposite\*q \*q" boolean \*q
-If EXA is enabled (using the option "AccelMethod"), this option enables
-acceleration of compositing. Since EXA, and in particular its composite
-acceleration, is still experimental, this is a way to disable a misbehaving
-composite acceleration.
-.TP
-.BI "Option \*qExaScratchSize\*q \*q" integer \*q
-Sets the size of the EXA scratch area to "integer" kB. This area is
-used by EXA as a last place to look for available space for pixmaps.
-Too little space will slow compositing down. This option should be set
-to the size of the largest pixmap used. If you have a screen width of
-over 1024 pixels and use 24 bpp, set this to 8192. Otherwise you can
-leave this at the default 4096. The space will be allocated from AGP
-memory if available, otherwise from VRAM.
-.TP
-.BI "Option \*qLCDDualEdge\*q \*q" boolean \*q
-Enables the use of dual-edge mode to set the LCD. The default is disabled.
-.TP
-.BI "Option \*qMaxDRIMem\*q \*q" integer \*q
-Sets the maximum amount of VRAM memory allocated for DRI clients to
-"integer" kB. Normally DRI clients get half the available VRAM size,
-but in some cases it may make sense to limit this amount. For example,
-if you are using a composite manager and you want to give as much memory
-as possible to the EXA pixmap storage area.
-.TP
-.BI "Option \*qMigrationHeuristic\*q \*q" string \*q
-Sets the heuristic for EXA pixmap migration. This is an EXA core
-option, and on Xorg server versions after 1.1.0 this defaults to
-"smart". The openchrome driver performs best with "greedy", so you
-should really add this option to your configuration file. The third
-possibility is "always", which might become more useful in the future.
-.TP
-.BI "Option \*qNoAccel\*q \*q" boolean \*q
-Disables the use of hardware acceleration. Acceleration is enabled
-by default.
-.TP
-.BI "Option \*qNoAGPFor2D\*q \*q" boolean \*q
-Disables the use of AGP DMA for 2D acceleration, even when AGP DMA is
-enabled. The default is enabled.
-.TP
-.BI "Option \*qNoXVDMA\*q \*q" boolean \*q
-If DRI is enabled, Xv normally uses PCI DMA to transfer video images
-from system to frame-buffer memory. This is somewhat slower than
-direct copies due to the limitations of the PCI bus, but on the other
-hand it decreases CPU usage significantly, particularly on computers
-with fast processors. Some video players are buggy and will display
-rendering artifacts when PCI DMA is used. If you experience this,
-or don't want your PCI bus to be stressed with Xv images, set this
-option to "true". This option has no effect when DRI is not enabled.
-.TP
-.BI "Option \*qPanelSize\*q \*q" string \*q
-Specifies the size (width x height) of the LCD panel attached to the
-system. The sizes 640x480, 800x600, 1024x768, 1280x1024, and 1400x1050
-are supported.
-.TP
-.BI "Option \*qRotate\*q \*q" string \*q
-Rotates the display either clockwise ("CW") or counterclockwise ("CCW").
-Rotation is only supported unaccelerated.
-.TP
-.BI "Option \*qShadowFB\*q \*q" boolean \*q
-Enables the use of a shadow frame buffer. This is required when
-rotating the display, but otherwise defaults to disabled.
-.TP
-.BI "Option \*qSWCursor\*q \*q" boolean \*q
-Enables the use of a software cursor. The default is disabled:
-the hardware cursor is used.
-.TP
-.BI "Option \*qTVDeflicker\*q \*q" integer \*q
-Specifies the deflicker setting for TV output. Valid values are "0", "1",
-and "2". Here 0 means no deflicker, 1 means 1:1:1 deflicker, and 2 means
-1:2:1 deflicker.
-.TP
-.BI "Option \*qTVDotCrawl\*q \*q" boolean \*q
-Enables dot-crawl suppression. The default is disabled.
-.TP
-.BI "Option \*qTVOutput\*q \*q" string \*q
-Specifies which TV output to use. The driver supports "S-Video",
-"Composite", "SC", "RGB", and "YCbCr" outputs. Note that on some
-EPIA boards the composite-video port is shared with audio-out and
-is selected via a jumper.
-.TP
-.BI "Option \*qTVType\*q \*q" string \*q
-Specifies TV output format. The driver currently supports "NTSC" and
-"PAL" timings only.
-.TP
-.BI "Option \*qVBEModes\*q \*q" boolean \*q
-Enables the use of VBE BIOS calls for setting the display mode. This mimics
-the behaviour of the vesa driver but still provides acceleration and
-other features. This option may be used if your hardware works with
-the vesa driver but not with the openchrome driver. It may not work
-on 64-bit systems. Using "VBEModes" may speed up driver acceleration
-significantly due to a more aggressive hardware setting, particularly
-on systems with low memory bandwidth. Your refresh rate may be limited
-to 60 Hz on some systems.
-.TP
-.BI "Option \*qVBESaveRestore\*q \*q" boolean \*q
-Enables the use of VBE BIOS calls for saving and restoring the display state
-when the X server is launched. This can be extremely slow on some hardware,
-and the system may appear to have locked for 10 seconds or so. The default
-is to use the driver builtin function. This option only works if option
-"VBEModes" is enabled.
-.TP
-.BI "Option \*qVideoRAM\*q \*q" integer \*q
-Overrides the VideoRAM autodetection. This should never be needed.
-.PP
-.SH "TV ENCODERS"
-Unichromes tend to be paired with several different TV encoders.
-.TP
-.BI "VIA Technologies VT1621"
-Still untested, as no combination with a Unichrome is known or available.
-Supports the following normal modes: "640x480" and "800x600". Use
-"640x480Over" and "800x600Over" for vertical overscan. These modes
-are made available by the driver; modelines provided in __xconfigfile__
-will be ignored.
-.TP
-.BI "VIA Technologies VT1622, VT1622A, VT1623"
-Supports the following modes: "640x480", "800x600", "1024x768",
-"848x480", "720x480" (NTSC only) and "720x576" (PAL only). Use
-"640x480Over", "800x600Over", "1024x768Over", "848x480Over",
-"720x480Over" (NTSC) and "720x576Over" (PAL) for vertical overscan.
-The modes "720x480Noscale" (NTSC) and "720x576Noscale" (PAL) (available
-on VT1622 only) provide cleaner TV output (unscaled with only minimal
-overscan). These modes are made available by the driver; modelines
-provided in __xconfigfile__ will be ignored.
-
-.SH "SEE ALSO"
-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
-.SH AUTHORS
-Authors include: ...
diff --git a/driver/xf86-video-openchrome/src/svnversion.h b/driver/xf86-video-openchrome/src/svnversion.h
new file mode 100644
index 000000000..5a7f5acaa
--- /dev/null
+++ b/driver/xf86-video-openchrome/src/svnversion.h
@@ -0,0 +1 @@
+#define BUILDCOMMENT "(openchrome 0.2.904 release)"
diff --git a/driver/xf86-video-openchrome/src/via.h b/driver/xf86-video-openchrome/src/via.h
index ee176503b..c961e1a51 100644
--- a/driver/xf86-video-openchrome/src/via.h
+++ b/driver/xf86-video-openchrome/src/via.h
@@ -327,6 +327,12 @@
#define VIDEO_FIFO_PRETHRESHOLD_VT3336 250
#define VIDEO_EXPIRE_NUM_VT3336 31
+/* Those values are only valid for IGA1 */
+#define VIDEO_FIFO_DEPTH_VT3409 400
+#define VIDEO_FIFO_THRESHOLD_VT3409 320
+#define VIDEO_FIFO_PRETHRESHOLD_VT3409 230
+#define VIDEO_EXPIRE_NUM_VT3409 160
+
/* ALPHA_V3_FIFO_CONTROL 0x278
* IA2 has 32 level FIFO for packet mode video format
* 32 level FIFO for planar mode video YV12. with extension reg 230 bit 21 enable
diff --git a/driver/xf86-video-openchrome/src/via_accel.c b/driver/xf86-video-openchrome/src/via_accel.c
index ce0a96396..b3c825de0 100644
--- a/driver/xf86-video-openchrome/src/via_accel.c
+++ b/driver/xf86-video-openchrome/src/via_accel.c
@@ -195,6 +195,7 @@ viaFlushPCI(ViaCommandBuffer * buf)
*/
switch (pVia->Chipset) {
case VIA_VX800:
+ case VIA_VX855:
while ((VIAGETREG(VIA_REG_STATUS) &
(VIA_CMD_RGTR_BUSY_H5 | VIA_2D_ENG_BUSY_H5))
&& (loop++ < MAXLOOP)) ;
@@ -471,7 +472,7 @@ viaInitialize2DEngine(ScrnInfoPtr pScrn)
VIASETREG(i, 0x0);
}
- if (pVia->Chipset == VIA_VX800) {
+ if (pVia->Chipset == VIA_VX800 || pVia->Chipset == VIA_VX855) {
for (i = 0x44; i < 0x5c; i += 4) {
VIASETREG(i, 0x0);
}
@@ -480,6 +481,7 @@ viaInitialize2DEngine(ScrnInfoPtr pScrn)
/* Make the VIA_REG() macro magic work */
switch (pVia->Chipset) {
case VIA_VX800:
+ case VIA_VX855:
pVia->TwodRegs = via_2d_regs_m1;
break;
default:
@@ -527,6 +529,7 @@ viaAccelSync(ScrnInfoPtr pScrn)
switch (pVia->Chipset) {
case VIA_VX800:
+ case VIA_VX855:
while ((VIAGETREG(VIA_REG_STATUS) &
(VIA_CMD_RGTR_BUSY_H5 | VIA_2D_ENG_BUSY_H5 | VIA_3D_ENG_BUSY_H5))
&& (loop++ < MAXLOOP)) ;
@@ -587,7 +590,7 @@ viaPitchHelper(VIAPtr pVia, unsigned dstPitch, unsigned srcPitch)
unsigned val = (dstPitch >> 3) << 16 | (srcPitch >> 3);
RING_VARS;
- if (pVia->Chipset != VIA_VX800) {
+ if (pVia->Chipset != VIA_VX800 && pVia->Chipset != VIA_VX855) {
val |= VIA_PITCH_ENABLE;
}
OUT_RING_H1(VIA_REG(pVia, PITCH), val);
@@ -1289,17 +1292,23 @@ viaInitXAA(ScreenPtr pScreen)
* test with x11perf -shmput500!
*/
- if (pVia->Chipset != VIA_K8M800 &&
- pVia->Chipset != VIA_K8M890 &&
- pVia->Chipset != VIA_P4M900 &&
- pVia->Chipset != VIA_VX800)
- xaaptr->ImageWriteFlags |= NO_GXCOPY;
+ switch (pVia->Chipset) {
+ case VIA_K8M800:
+ case VIA_K8M890:
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ break;
+ default:
+ xaaptr->ImageWriteFlags |= NO_GXCOPY;
+ break;
+ }
xaaptr->SetupForImageWrite = viaSetupForImageWrite;
xaaptr->SubsequentImageWriteRect = viaSubsequentImageWriteRect;
xaaptr->ImageWriteBase = pVia->BltBase;
- if (pVia->Chipset == VIA_VX800)
+ if (pVia->Chipset == VIA_VX800 || pVia->Chipset == VIA_VX855)
xaaptr->ImageWriteRange = VIA_MMIO_BLTSIZE;
else
xaaptr->ImageWriteRange = (64 * 1024);
@@ -2015,7 +2024,8 @@ viaExaUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
dstPitch = 8;
if (dstPitch * h > pVia->exaScratchSize * 1024) {
ErrorF("EXA UploadToScratch Failed %u %u %u %u\n",
- dstPitch, h, dstPitch * h, pVia->exaScratchSize * 1024);
+ (unsigned int)dstPitch, h, (unsigned int)(dstPitch * h),
+ pVia->exaScratchSize * 1024);
return FALSE;
}
@@ -2354,8 +2364,28 @@ viaInitAccel(ScreenPtr pScreen)
VIAPtr pVia = VIAPTR(pScrn);
BoxRec AvailFBArea;
int maxY;
+ Bool ret;
Bool nPOTSupported;
+
+ /* HW Limitation are described here:
+ *
+ * 1. H2/H5/H6 2D source and destination:
+ * Pitch: (1 << 14) - 1 = 16383
+ * Dimension: (1 << 12) = 4096
+ * X, Y position: (1 << 12) - 1 = 4095.
+ *
+ * 2. H2 3D engine Render target:
+ * Pitch: (1 << 14) - 1 = 16383
+ * Clip Rectangle: 0 - 2047
+ *
+ * 3. H5/H6 3D engine Render target:
+ * Pitch: ((1 << 10) - 1)*32 = 32736
+ * Clip Rectangle: Color Window, 12bits. As Spec saied: 0 - 2048
+ * Scissor is the same as color window.
+ * */
+
+
pVia->VQStart = 0;
if (((pVia->FBFreeEnd - pVia->FBFreeStart) >= VIA_VQ_SIZE)
&& pVia->VQEnable) {
@@ -2425,6 +2455,10 @@ viaInitAccel(ScreenPtr pScreen)
return TRUE;
}
+ /*
+ * Finally, we set up the memory space available to the pixmap
+ * cache.
+ */
AvailFBArea.x1 = 0;
AvailFBArea.y1 = 0;
AvailFBArea.x2 = pScrn->displayWidth;
@@ -2447,10 +2481,25 @@ viaInitAccel(ScreenPtr pScreen)
if (maxY > 4 * pScrn->virtualY)
maxY = 4 * pScrn->virtualY;
+ /* Non-rotate */
+ AvailFBArea.y2 = maxY;
pVia->FBFreeStart = (maxY + 1) * pVia->Bpl;
- AvailFBArea.y2 = maxY;
- xf86InitFBManager(pScreen, &AvailFBArea);
+ /*
+ * Initialization of the XFree86 framebuffer manager is done via
+ * Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)
+ * FullBox represents the area of the framebuffer that the manager
+ * is allowed to manage. This is typically a box with a width
+ * of pScrn->displayWidth and a height of as many lines as can be fit
+ * within the total video memory
+ */
+ ret = xf86InitFBManager(pScreen, &AvailFBArea);
+ if (ret != TRUE) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VIAInitAccel xf86InitFBManager init failed\n");
+ }
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Frame Buffer From (%d,%d) To (%d,%d)\n",
+ AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2));
VIAInitLinear(pScreen);
pVia->driSize = (pVia->FBFreeEnd - pVia->FBFreeStart - pVia->Bpl);
diff --git a/driver/xf86-video-openchrome/src/via_bandwidth.c b/driver/xf86-video-openchrome/src/via_bandwidth.c
index b0fd2400f..fd02a6620 100644
--- a/driver/xf86-video-openchrome/src/via_bandwidth.c
+++ b/driver/xf86-video-openchrome/src/via_bandwidth.c
@@ -244,6 +244,11 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode)
hwp->writeSeq(hwp, 0x18, 0x26); /* 152/4 = 38 */
hwp->writeSeq(hwp, 0x22, 0x10); /* 64/4 = 16 */
break;
+ case VIA_VX855:
+ hwp->writeSeq(hwp, 0x16, 0x50); /* 320/4 = 80 */
+ hwp->writeSeq(hwp, 0x17, 0xC7); /* 400/2-1 = 199 */
+ hwp->writeSeq(hwp, 0x18, 0x50); /* 320/4 = 80 */
+ hwp->writeSeq(hwp, 0x22, 0x28); /* 160/4 = 40 */
default:
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaSetPrimaryFIFO: "
"Chipset %d not implemented\n", pVia->Chipset);
@@ -412,6 +417,8 @@ ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode)
else
ViaCrtcMask(hwp, 0x94, 0x20, 0x7F);
break;
+ case VIA_VX855:
+ break;
default:
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaSetSecondaryFIFO: "
"Chipset %d not implemented\n", pVia->Chipset);
diff --git a/driver/xf86-video-openchrome/src/via_bios.h b/driver/xf86-video-openchrome/src/via_bios.h
index 62fdf48eb..06809b992 100644
--- a/driver/xf86-video-openchrome/src/via_bios.h
+++ b/driver/xf86-video-openchrome/src/via_bios.h
@@ -42,6 +42,7 @@
#define VIA_PANEL10X6 13
#define VIA_PANEL14X9 14
#define VIA_PANEL1280X720 15
+#define VIA_PANEL12X9 16
#define VIA_PANEL_INVALID 255
#define TVTYPE_NONE 0x00
@@ -98,6 +99,13 @@
#define VIA_DI_12BIT 0x00
#define VIA_DI_24BIT 0x01
+/* Digital Port */
+#define VIA_DI_PORT_NONE 0x0
+#define VIA_DI_PORT_DVP0 0x1
+#define VIA_DI_PORT_DVP1 0x2
+#define VIA_DI_PORT_DFPLOW 0x4
+#define VIA_DI_PORT_DFPHIGH 0x8
+
typedef struct ViaPanelMode {
int Width ;
int Height ;
@@ -159,8 +167,6 @@ typedef struct _VIABIOSINFO {
Bool SetDVI;
/* LCD Simultaneous Expand Mode HWCursor Y Scale */
Bool scaleY;
- int panelX;
- int panelY;
int resY;
/* DFP */
@@ -187,6 +193,7 @@ typedef struct _VIABIOSINFO {
int TVDeflicker;
CARD8 TVRegs[0xFF];
int TVNumRegs;
+ int TVDIPort;
/* TV Callbacks */
void (*TVSave) (ScrnInfoPtr pScrn);
diff --git a/driver/xf86-video-openchrome/src/via_ch7xxx.c b/driver/xf86-video-openchrome/src/via_ch7xxx.c
index 64e3e1f31..4407828dd 100644
--- a/driver/xf86-video-openchrome/src/via_ch7xxx.c
+++ b/driver/xf86-video-openchrome/src/via_ch7xxx.c
@@ -33,6 +33,7 @@
#include "via_vgahw.h"
#include "via_ch7xxx.h"
#include "via_id.h"
+#include <unistd.h>
#ifdef HAVE_DEBUG
/*
diff --git a/driver/xf86-video-openchrome/src/via_crtc.c b/driver/xf86-video-openchrome/src/via_crtc.c
index d0f19e5ce..4e2be975a 100644
--- a/driver/xf86-video-openchrome/src/via_crtc.c
+++ b/driver/xf86-video-openchrome/src/via_crtc.c
@@ -173,6 +173,7 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
case VIA_CX700:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
break;
default:
ViaSeqMask(hwp, 0x16, 0x08, 0xBF);
@@ -276,6 +277,7 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
case VIA_CX700:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
break;
default:
/* some leftovers */
@@ -302,7 +304,8 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
temp += 0x03;
temp &= ~0x03;
}
- hwp->writeSeq(hwp, 0x1C, (temp >> 1) & 0xFF);
+
+ hwp->writeSeq(hwp, 0x1C, ((temp >> 1)+1) & 0xFF);
ViaSeqMask(hwp, 0x1D, temp >> 9, 0x03);
switch (pVia->ChipId) {
@@ -310,6 +313,7 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
case VIA_CX700:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
break;
default:
/* some leftovers */
@@ -429,6 +433,7 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
case VIA_CX700:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
break;
default:
ViaSeqMask(hwp, 0x16, 0x08, 0xBF);
@@ -512,6 +517,7 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
case VIA_CX700:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
break;
default:
/* some leftovers */
diff --git a/driver/xf86-video-openchrome/src/via_cursor.c b/driver/xf86-video-openchrome/src/via_cursor.c
index 83ba655e2..9333a185f 100644
--- a/driver/xf86-video-openchrome/src/via_cursor.c
+++ b/driver/xf86-video-openchrome/src/via_cursor.c
@@ -76,7 +76,7 @@ viaHWCursorInit(ScreenPtr pScreen)
pVia->CursorARGBSupported = TRUE;
pVia->CursorMaxWidth = 64;
pVia->CursorMaxHeight = 64;
- pVia->CursorSize = pVia->CursorMaxWidth * (pVia->CursorMaxHeight + 1) * 4;
+ pVia->CursorSize = pVia->CursorMaxWidth * (pVia->CursorMaxHeight + 1) << 2;
break;
}
@@ -97,6 +97,7 @@ viaHWCursorInit(ScreenPtr pScreen)
case VIA_P4M890:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
pVia->CursorRegControl = VIA_REG_HI_CONTROL0;
pVia->CursorRegBase = VIA_REG_HI_BASE0;
@@ -164,6 +165,7 @@ viaHWCursorInit(ScreenPtr pScreen)
case VIA_P4M890:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
VIASETREG(VIA_REG_PRIM_HI_INVTCOLOR, 0x00FFFFFF);
VIASETREG(VIA_REG_V327_HI_INVTCOLOR, 0x00FFFFFF);
@@ -222,18 +224,19 @@ viaCursorStore(ScrnInfoPtr pScrn)
case VIA_P4M890:
case VIA_P4M900:
case VIA_VX800:
- if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ case VIA_VX855:
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
pVia->CursorPrimHiInvtColor = VIAGETREG(VIA_REG_PRIM_HI_INVTCOLOR);
pVia->CursorV327HiInvtColor = VIAGETREG(VIA_REG_V327_HI_INVTCOLOR);
- }
- if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ }
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
/* TODO add saves here */
- }
- pVia->CursorFifo = VIAGETREG(pVia->CursorRegFifo);
- break;
- default:
- /* TODO add saves here */
- break;
+ }
+ pVia->CursorFifo = VIAGETREG(pVia->CursorRegFifo);
+ break;
+ default:
+ /* TODO add saves here */
+ break;
}
}
@@ -261,21 +264,22 @@ viaCursorRestore(ScrnInfoPtr pScrn)
case VIA_P4M890:
case VIA_P4M900:
case VIA_VX800:
- if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ case VIA_VX855:
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
VIASETREG(VIA_REG_PRIM_HI_INVTCOLOR, pVia->CursorPrimHiInvtColor);
VIASETREG(VIA_REG_V327_HI_INVTCOLOR, pVia->CursorV327HiInvtColor);
- }
- if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
- /* TODO add real restores here */
+ }
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ /* TODO add real restores here */
VIASETREG(VIA_REG_HI_INVTCOLOR, 0X00FFFFFF);
VIASETREG(VIA_REG_ALPHA_PREFIFO, 0xE0000);
- }
- VIASETREG(pVia->CursorRegFifo, pVia->CursorFifo);
- break;
- default:
- /* TODO add real restores here */
- VIASETREG(VIA_REG_ALPHA_PREFIFO, 0xE0000);
- VIASETREG(pVia->CursorRegFifo, 0xE0F0000);
+ }
+ VIASETREG(pVia->CursorRegFifo, pVia->CursorFifo);
+ break;
+ default:
+ /* TODO add real restores here */
+ VIASETREG(VIA_REG_ALPHA_PREFIFO, 0xE0000);
+ VIASETREG(pVia->CursorRegFifo, 0xE0F0000);
}
}
@@ -287,22 +291,39 @@ void
viaShowCursor(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- CARD32 temp;
- CARD32 control = pVia->CursorRegControl;
-
- temp =
- (1 << 30) |
- (1 << 29) |
- (1 << 28) |
- (1 << 26) |
- (1 << 25) |
- (1 << 2) |
- (1 << 0);
-
- if (pVia->CursorPipe)
- temp |= (1 << 31);
- VIASETREG(control, temp);
+ switch(pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_P4M890:
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ VIASETREG(VIA_REG_HI_CONTROL0, 0x36000005);
+ }
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ VIASETREG(VIA_REG_HI_CONTROL1, 0xb6000005);
+ }
+ break;
+
+ default:
+ /*temp = 0x76000005;
+ temp =
+ (1 << 30) |
+ (1 << 29) |
+ (1 << 28) |
+ (1 << 26) |
+ (1 << 25) |
+ (1 << 2) |
+ (1 << 0);
+ */
+
+ /* Duoview */
+ if (pVia->CursorPipe)
+ VIASETREG(VIA_REG_ALPHA_CONTROL, 0xF6000005);
+ else
+ VIASETREG(VIA_REG_ALPHA_CONTROL, 0x76000005);
+ }
}
void
@@ -310,20 +331,33 @@ viaHideCursor(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
CARD32 temp;
- CARD32 control = pVia->CursorRegControl;
- temp = VIAGETREG(control);
- VIASETREG(control, temp & 0xFFFFFFFE);
+ switch(pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_P4M890:
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ temp = VIAGETREG(VIA_REG_HI_CONTROL0);
+ VIASETREG(VIA_REG_HI_CONTROL0, temp & 0xFFFFFFFA);
+ }
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ temp = VIAGETREG(VIA_REG_HI_CONTROL1);
+ VIASETREG(VIA_REG_HI_CONTROL1, temp & 0xFFFFFFFA);
+ }
+ break;
+
+ default:
+ temp = VIAGETREG(VIA_REG_ALPHA_CONTROL);
+ VIASETREG(VIA_REG_ALPHA_CONTROL, temp & 0xFFFFFFFA);
+ }
}
static void
viaSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
VIAPtr pVia = VIAPTR(pScrn);
- CARD32 temp;
- CARD32 control = pVia->CursorRegControl;
- CARD32 offset = pVia->CursorRegOffset;
- CARD32 pos = pVia->CursorRegPos;
unsigned xoff, yoff;
if (x < 0) {
@@ -340,13 +374,27 @@ viaSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
yoff = 0;
}
- temp = VIAGETREG(control);
- VIASETREG(control, temp & 0xFFFFFFFE);
-
- VIASETREG(pos, ((x << 16) | (y & 0x07ff)));
- VIASETREG(offset, ((xoff << 16) | (yoff & 0x07ff)));
+ switch(pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_P4M890:
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ VIASETREG(VIA_REG_HI_POS0, ((x << 16) | (y & 0x07ff)));
+ VIASETREG(VIA_REG_HI_OFFSET0, ((xoff << 16) | (yoff & 0x07ff)));
+ }
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ VIASETREG(VIA_REG_HI_POS1, ((x << 16) | (y & 0x07ff)));
+ VIASETREG(VIA_REG_HI_OFFSET1, ((xoff << 16) | (yoff & 0x07ff)));
+ }
+ break;
+
+ default:
+ VIASETREG(VIA_REG_ALPHA_POS, ((x << 16) | (y & 0x07ff)));
+ VIASETREG(VIA_REG_ALPHA_OFFSET, ((xoff << 16) | (yoff & 0x07ff)));
+ }
- VIASETREG(control, temp);
}
static Bool
@@ -379,36 +427,48 @@ static void
viaLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *s)
{
VIAPtr pVia = VIAPTR(pScrn);
- CARD32 control = pVia->CursorRegControl;
CARD32 temp;
CARD32 *dst;
- CARD8 *src;
CARD8 chunk;
int i, j;
- temp = VIAGETREG(control);
- VIASETREG(control, temp & 0xFFFFFFFE);
-
pVia->CursorARGB = FALSE;
dst = (CARD32*)(pVia->cursorMap);
- src = (CARD8*)s;
if (pVia->CursorARGBSupported) {
#define ARGB_PER_CHUNK (8 * sizeof (chunk) / 2)
for (i = 0; i < (pVia->CursorMaxWidth * pVia->CursorMaxHeight / ARGB_PER_CHUNK); i++) {
- chunk = *s++;
- for (j = 0; j < ARGB_PER_CHUNK; j++, chunk >>= 2)
+ chunk = *s++;
+ for (j = 0; j < ARGB_PER_CHUNK; j++, chunk >>= 2)
*dst++ = mono_cursor_color[chunk & 3];
}
pVia->CursorFG = mono_cursor_color[3];
pVia->CursorBG = mono_cursor_color[2];
- } else {
- memcpy(dst, src, pVia->CursorSize);
- }
-
- VIASETREG(control, temp);
+ } else {
+ memcpy(dst, (CARD8*)s, pVia->CursorSize);
+ }
+ switch(pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_P4M890:
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ temp = VIAGETREG(VIA_REG_HI_CONTROL0);
+ VIASETREG(VIA_REG_HI_CONTROL0, temp & 0xFFFFFFFE);
+ }
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ temp = VIAGETREG(VIA_REG_HI_CONTROL1);
+ VIASETREG(VIA_REG_HI_CONTROL1, temp & 0xFFFFFFFE);
+ }
+ break;
+
+ default:
+ temp = VIAGETREG(VIA_REG_ALPHA_CONTROL);
+ VIASETREG(VIA_REG_ALPHA_CONTROL, temp);
+ }
}
static void
@@ -441,50 +501,51 @@ viaSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
pVia->CursorFG = fg;
pVia->CursorBG = bg;
- VIASETREG(control, temp);
+ switch(pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_P4M890:
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ temp = VIAGETREG(VIA_REG_HI_CONTROL0);
+ VIASETREG(VIA_REG_HI_CONTROL0, temp & 0xFFFFFFFE);
+ }
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ temp = VIAGETREG(VIA_REG_HI_CONTROL1);
+ VIASETREG(VIA_REG_HI_CONTROL1, temp & 0xFFFFFFFE);
+ }
+ break;
+ default:
+ VIASETREG(control, temp);
+ }
}
static void
viaLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
{
VIAPtr pVia = VIAPTR(pScrn);
- CARD32 control = pVia->CursorRegControl;
int x, y, w, h;
- CARD32 *image;
- CARD32 *dst;
- CARD32 *src;
- CARD32 temp;
-
- temp = VIAGETREG(control);
- VIASETREG(control, temp & 0xFFFFFFFE);
+ CARD32 *image = (CARD32*)pCurs->bits->argb;
+ CARD32 *dst = (CARD32*)pVia->cursorMap;
pVia->CursorARGB = TRUE;
- dst = (CARD32*)pVia->cursorMap;
- image = pCurs->bits->argb;
-
w = pCurs->bits->width;
- if (w > pVia->CursorMaxWidth)
- w = pVia->CursorMaxWidth;
-
h = pCurs->bits->height;
- if (h > pVia->CursorMaxHeight)
- h = pVia->CursorMaxHeight;
for (y = 0; y < h; y++) {
- src = image;
- image += pCurs->bits->width;
-
for (x = 0; x < w; x++)
- *dst++ = *src++;
+ *dst++ = *image++;
+ /* pad to the right with transparent */
for (; x < pVia->CursorMaxHeight; x++)
*dst++ = 0;
}
+ /* pad below with transparent */
for (; y < pVia->CursorMaxHeight; y++)
for (x = 0; x < pVia->CursorMaxWidth; x++)
*dst++ = 0;
- VIASETREG(control, temp);
}
diff --git a/driver/xf86-video-openchrome/src/via_display.c b/driver/xf86-video-openchrome/src/via_display.c
index be26bebb8..0e833287f 100644
--- a/driver/xf86-video-openchrome/src/via_display.c
+++ b/driver/xf86-video-openchrome/src/via_display.c
@@ -111,6 +111,38 @@ ViaDisplayDisableCRT(ScrnInfoPtr pScrn)
ViaCrtcMask(hwp, 0x36, 0x30, 0x30);
}
+void
+ViaDisplayEnableDVO(ScrnInfoPtr pScrn, int port)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDisplayEnableDVO, port: %d\n", port));
+ switch (port) {
+ case VIA_DI_PORT_DVP0:
+ ViaSeqMask(hwp, 0x1E, 0xC0, 0xC0);
+ break;
+ case VIA_DI_PORT_DVP1:
+ ViaSeqMask(hwp, 0x1E, 0x30, 0x30);
+ break;
+ }
+}
+
+void
+ViaDisplayDisableDVO(ScrnInfoPtr pScrn, int port)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDisplayDisableDVO, port: %d\n", port));
+ switch (port) {
+ case VIA_DI_PORT_DVP0:
+ ViaSeqMask(hwp, 0x1E, 0x00, 0xC0);
+ break;
+ case VIA_DI_PORT_DVP1:
+ ViaSeqMask(hwp, 0x1E, 0x00, 0x30);
+ break;
+ }
+}
+
/*
* Sets the primary or secondary display stream on CRT.
*/
@@ -143,3 +175,32 @@ ViaDisplaySetStreamOnDFP(ScrnInfoPtr pScrn, Bool primary)
ViaCrtcMask(hwp, 0x99, 0x10, 0x10);
}
+void
+ViaDisplaySetStreamOnDVO(ScrnInfoPtr pScrn, int port, Bool primary)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ int regNum;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDisplaySetStreamOnDVO, port: %d\n", port));
+
+ switch (port) {
+ case VIA_DI_PORT_DVP0:
+ regNum = 0x96;
+ break;
+ case VIA_DI_PORT_DVP1:
+ regNum = 0x9B;
+ break;
+ case VIA_DI_PORT_DFPLOW:
+ regNum = 0x97;
+ break;
+ case VIA_DI_PORT_DFPHIGH:
+ regNum = 0x99;
+ break;
+ }
+
+ if (primary)
+ ViaCrtcMask(hwp, regNum, 0x00, 0x10);
+ else
+ ViaCrtcMask(hwp, regNum, 0x10, 0x10);
+}
+
diff --git a/driver/xf86-video-openchrome/src/via_dri.c b/driver/xf86-video-openchrome/src/via_dri.c
index 87b1933af..ee9a38a25 100644
--- a/driver/xf86-video-openchrome/src/via_dri.c
+++ b/driver/xf86-video-openchrome/src/via_dri.c
@@ -592,6 +592,7 @@ VIADRIScreenInit(ScreenPtr pScreen)
case VIA_K8M890:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
pDRIInfo->clientDriverName = "swrast";
break;
default:
@@ -890,10 +891,17 @@ VIADRIKernelInit(ScreenPtr pScreen, VIAPtr pVia)
drmInfo.sarea_priv_offset = sizeof(OPENCHROMEDRISAREARec);
drmInfo.fb_offset = pVia->frameBufferHandle;
drmInfo.mmio_offset = pVia->registerHandle;
- if (pVia->IsPCI)
+
+ if (pVia->IsPCI) {
drmInfo.agpAddr = (CARD32) NULL;
- else
- drmInfo.agpAddr = (CARD32) pVia->agpAddr;
+ } else {
+ /*For AMD64*/
+#ifndef __x86_64__
+ drmInfo.agpAddr = (CARD32)pVia->agpAddr;
+#else
+ drmInfo.agpAddr = (CARD64)pVia->agpAddr;
+#endif
+ }
if ((drmCommandWrite(pVia->drmFD, DRM_VIA_MAP_INIT, &drmInfo,
sizeof(drm_via_init_t))) < 0)
diff --git a/driver/xf86-video-openchrome/src/via_driver.c b/driver/xf86-video-openchrome/src/via_driver.c
index a3c276454..fa90f70dd 100644
--- a/driver/xf86-video-openchrome/src/via_driver.c
+++ b/driver/xf86-video-openchrome/src/via_driver.c
@@ -29,12 +29,15 @@
#include "config.h"
#endif
-#include "xf86RAC.h"
#include "shadowfb.h"
#include "globals.h"
+#ifdef HAVE_XEXTPROTO_71
+#include <X11/extensions/dpmsconst.h>
+#else
#define DPMS_SERVER
#include <X11/extensions/dpms.h>
+#endif
#include "svnversion.h"
@@ -42,12 +45,19 @@
#include "via_video.h"
#include "via.h"
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+#include "xf86RAC.h"
+#endif
+
#ifdef OPENCHROMEDRI
#include "dri.h"
#endif
#include "via_vgahw.h"
#include "via_id.h"
+/* RandR support */
+#include "xf86RandR12.h"
+
/* Prototypes. */
static void VIAIdentify(int flags);
@@ -112,6 +122,10 @@ static void VIAUnmapMem(ScrnInfoPtr pScrn);
static void VIALoadRgbLut(ScrnInfoPtr pScrn, int numColors, int *indices,
LOCO *colors, VisualPtr pVisual);
+/* RandR */
+static Bool VIADriverFunc(ScrnInfoPtr pScrnInfo, xorgDriverFuncOp op, pointer data);
+
+
#ifdef XSERVER_LIBPCIACCESS
#define VIA_DEVICE_MATCH(d,i) \
@@ -128,6 +142,7 @@ static const struct pci_id_match via_device_match[] = {
VIA_DEVICE_MATCH (PCI_CHIP_VT3324, 0 ),
VIA_DEVICE_MATCH (PCI_CHIP_VT3327, 0 ),
VIA_DEVICE_MATCH (PCI_CHIP_VT3353, 0 ),
+ VIA_DEVICE_MATCH (PCI_CHIP_VT3409, 0 ),
{ 0, 0, 0 },
};
@@ -158,28 +173,30 @@ static SymTabRec VIAChipsets[] = {
{VIA_KM400, "KM400/KN400"},
{VIA_K8M800, "K8M800/K8N800"},
{VIA_PM800, "PM800/PM880/CN400"},
- {VIA_VM800, "P4M800Pro/VN800/CN700"},
+ {VIA_VM800, "VM800/P4M800Pro/VN800/CN700"},
{VIA_K8M890, "K8M890/K8N890"},
{VIA_P4M900, "P4M900/VN896/CN896"},
{VIA_CX700, "CX700/VX700"},
{VIA_P4M890, "P4M890"},
{VIA_VX800, "VX800"},
+ {VIA_VX855, "VX855"},
{-1, NULL }
};
/* Mapping a PCI device ID to a chipset family identifier. */
static PciChipsets VIAPciChipsets[] = {
- {VIA_CLE266, PCI_CHIP_CLE3122, RES_SHARED_VGA},
- {VIA_KM400, PCI_CHIP_VT3205, RES_SHARED_VGA},
- {VIA_K8M800, PCI_CHIP_VT3204, RES_SHARED_VGA},
- {VIA_PM800, PCI_CHIP_VT3259, RES_SHARED_VGA},
- {VIA_VM800, PCI_CHIP_VT3314, RES_SHARED_VGA},
- {VIA_K8M890, PCI_CHIP_VT3336, RES_SHARED_VGA},
- {VIA_P4M900, PCI_CHIP_VT3364, RES_SHARED_VGA},
- {VIA_CX700, PCI_CHIP_VT3324, RES_SHARED_VGA},
- {VIA_P4M890, PCI_CHIP_VT3327, RES_SHARED_VGA},
- {VIA_VX800, PCI_CHIP_VT3353, RES_SHARED_VGA},
- {-1, -1, RES_UNDEFINED}
+ {VIA_CLE266, PCI_CHIP_CLE3122, VIA_RES_SHARED},
+ {VIA_KM400, PCI_CHIP_VT3205, VIA_RES_SHARED},
+ {VIA_K8M800, PCI_CHIP_VT3204, VIA_RES_SHARED},
+ {VIA_PM800, PCI_CHIP_VT3259, VIA_RES_SHARED},
+ {VIA_VM800, PCI_CHIP_VT3314, VIA_RES_SHARED},
+ {VIA_K8M890, PCI_CHIP_VT3336, VIA_RES_SHARED},
+ {VIA_P4M900, PCI_CHIP_VT3364, VIA_RES_SHARED},
+ {VIA_CX700, PCI_CHIP_VT3324, VIA_RES_SHARED},
+ {VIA_P4M890, PCI_CHIP_VT3327, VIA_RES_SHARED},
+ {VIA_VX800, PCI_CHIP_VT3353, VIA_RES_SHARED},
+ {VIA_VX855, PCI_CHIP_VT3409, VIA_RES_SHARED},
+ {-1, -1, VIA_RES_UNDEF}
};
int gVIAEntityIndex = -1;
@@ -208,6 +225,7 @@ typedef enum
OPTION_TVDOTCRAWL,
OPTION_TVTYPE,
OPTION_TVOUTPUT,
+ OPTION_TVDIPORT,
OPTION_DISABLEVQ,
OPTION_DISABLEIRQ,
OPTION_TVDEFLICKER,
@@ -217,7 +235,8 @@ typedef enum
OPTION_VBE_SAVERESTORE,
OPTION_MAX_DRIMEM,
OPTION_AGPMEM,
- OPTION_DISABLE_XV_BW_CHECK
+ OPTION_DISABLE_XV_BW_CHECK,
+ OPTION_MODE_SWITCH_METHOD
} VIAOpts;
@@ -246,6 +265,7 @@ static OptionInfoRec VIAOptions[] = {
{OPTION_TVDEFLICKER, "TVDeflicker", OPTV_INTEGER, {0}, FALSE},
{OPTION_TVTYPE, "TVType", OPTV_ANYSTR, {0}, FALSE},
{OPTION_TVOUTPUT, "TVOutput", OPTV_ANYSTR, {0}, FALSE},
+ {OPTION_TVDIPORT, "TVPort", OPTV_ANYSTR, {0}, FALSE},
{OPTION_DISABLEVQ, "DisableVQ", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_DISABLEIRQ, "DisableIRQ", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_AGP_DMA, "EnableAGPDMA", OPTV_BOOLEAN, {0}, FALSE},
@@ -253,190 +273,14 @@ static OptionInfoRec VIAOptions[] = {
{OPTION_XV_DMA, "NoXVDMA", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_VBE_SAVERESTORE, "VbeSaveRestore", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_DISABLE_XV_BW_CHECK, "DisableXvBWCheck", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_MODE_SWITCH_METHOD, "ModeSwitchMethod", OPTV_ANYSTR, {0}, FALSE},
{OPTION_MAX_DRIMEM, "MaxDRIMem", OPTV_INTEGER, {0}, FALSE},
{OPTION_AGPMEM, "AGPMem", OPTV_INTEGER, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
-static const char *vgaHWSymbols[] = {
- "vgaHWGetHWRec",
- "vgaHWSetMmioFuncs",
- "vgaHWSetStdFuncs",
- "vgaHWGetIOBase",
- "vgaHWSave",
- "vgaHWProtect",
- "vgaHWRestore",
- "vgaHWMapMem",
- "vgaHWUnmapMem",
- "vgaHWInit",
- "vgaHWSaveScreen",
- "vgaHWLock",
- "vgaHWUnlock",
- "vgaHWFreeHWRec",
- "vgaHWGetIndex", /* Through VGAHWPTR() */
- NULL
-};
-
-static const char *ramdacSymbols[] = {
- "xf86InitCursor",
- "xf86CreateCursorInfoRec",
- "xf86DestroyCursorInfoRec",
- NULL
-};
-
-static const char *vbeSymbols[] = {
- "vbeDoEDID",
- "VBEDPMSSet",
- "VBEExtendedInit",
- "vbeFree",
- "VBEGetVBEInfo",
- "VBEGetVBEMode",
- "VBEGetModePool",
- "VBEInit",
- "VBEPrintModes",
- "VBESaveRestore",
- "VBESetDisplayStart",
- "VBESetGetLogicalScanlineLength",
- "VBESetLogicalScanline",
- "VBESetModeNames",
- "VBESetModeParameters",
- "VBESetVBEMode",
- "VBEValidateModes",
- "xf86ExecX86int10",
- "xf86Int10AllocPages",
- "xf86Int10FreePages",
- NULL
-};
-
-static const char *ddcSymbols[] = {
- "xf86PrintEDID",
- "xf86DoEDID_DDC2",
- "xf86SetDDCproperties",
- NULL
-};
-
-static const char *i2cSymbols[] = {
- "xf86CreateI2CBusRec",
- "xf86I2CBusInit",
- "xf86CreateI2CDevRec",
- "xf86I2CDevInit",
- "xf86I2CWriteRead",
- "xf86I2CProbeAddress",
- "xf86DestroyI2CDevRec",
- "xf86I2CReadByte",
- "xf86I2CWriteByte",
- NULL
-};
-
-static const char *xaaSymbols[] = {
-#ifdef X_HAVE_XAAGETROP
- "XAAGetCopyROP",
- "XAAGetCopyROP_PM",
- "XAAGetPatternROP",
-#else
- "XAACopyROP",
- "XAACopyROP_PM",
- "XAAPatternROP",
-#endif
- "XAACreateInfoRec",
- "XAADestroyInfoRec",
- "XAAInit",
- "XAAFillSolidRects",
- NULL
-};
-
-static const char *exaSymbols[] = {
- "exaGetVersion",
- "exaDriverInit",
- "exaDriverFini",
- "exaOffscreenAlloc",
- "exaOffscreenFree",
- "exaGetPixmapPitch",
- "exaGetPixmapOffset",
- "exaWaitSync",
- "exaDriverAlloc",
- NULL
-};
-
-static const char *shadowSymbols[] = {
- "ShadowFBInit",
- NULL
-};
-
-#ifdef USE_FB
-static const char *fbSymbols[] = {
- "fbScreenInit",
- "fbPictureInit",
- NULL
-};
-#else
-static const char *cfbSymbols[] = {
- "cfbScreenInit",
- "cfb16ScreenInit",
- "cfb24ScreenInit",
- "cfb24_32ScreenInit",
- "cfb32ScreenInit",
- "cfb16BresS",
- "cfb24BresS",
- NULL
-};
-#endif
-
#ifdef XFree86LOADER
-#ifdef OPENCHROMEDRI
-static const char *drmSymbols[] = {
- "drmAddBufs",
- "drmAddMap",
- "drmAgpAcquire",
- "drmAgpAlloc",
- "drmAgpBase",
- "drmAgpBind",
- "drmAgpDeviceId",
- "drmAgpEnable",
- "drmAgpFree",
- "drmAgpGetMode",
- "drmAgpRelease",
- "drmAgpVendorId",
- "drmCtlInstHandler",
- "drmCtlUninstHandler",
- "drmCommandNone",
- "drmCommandWrite",
- "drmCommandWriteRead",
- "drmFreeVersion",
- "drmGetInterruptFromBusID",
- "drmGetLibVersion",
- "drmGetVersion",
- "drmMap",
- "drmMapBufs",
- "drmUnmap",
- "drmUnmapBufs",
- "drmAgpUnbind",
- "drmRmMap",
- "drmCreateContext",
- "drmAuthMagic",
- "drmDestroyContext",
- "drmSetContextFlags",
- NULL
-};
-
-static const char *driSymbols[] = {
- "DRICloseScreen",
- "DRICreateInfoRec",
- "DRIDestroyInfoRec",
- "DRIFinishScreenInit",
- "DRIGetSAREAPrivate",
- "DRILock",
- "DRIQueryVersion",
- "DRIScreenInit",
- "DRIUnlock",
- "DRIOpenConnection",
- "DRICloseConnection",
- "GlxSetVisualConfigs",
- NULL
-};
-#endif
-
static MODULESETUPPROTO(VIASetup);
static XF86ModuleVersionInfo VIAVersRec = {
@@ -472,24 +316,6 @@ VIASetup(pointer module, pointer opts, int *errmaj, int *errmin)
0
#endif
);
- LoaderRefSymLists(vgaHWSymbols,
-#ifdef USE_FB
- fbSymbols,
-#else
- cfbSymbols,
-#endif
- ramdacSymbols,
- xaaSymbols,
- exaSymbols,
- shadowSymbols,
- vbeSymbols,
- i2cSymbols,
- ddcSymbols,
-#ifdef OPENCHROMEDRI
- drmSymbols,
- driSymbols,
-#endif
- NULL);
return (pointer) 1;
} else {
@@ -826,7 +652,6 @@ VIAProbeDDC(ScrnInfoPtr pScrn, int index)
vbeInfoPtr pVbe;
if (xf86LoadSubModule(pScrn, "vbe")) {
- xf86LoaderReqSymLists(vbeSymbols, NULL);
pVbe = VBEInit(NULL, index);
ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
vbeFree(pVbe);
@@ -837,6 +662,7 @@ static Bool
VIASetupDefaultOptions(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASetupDefaultOptions\n"));
@@ -866,27 +692,37 @@ VIASetupDefaultOptions(ScrnInfoPtr pScrn)
pVia->swov.maxHInterp = 600;
pVia->useLegacyVBE = TRUE;
- pVia->UseLegacyModeSwitch = TRUE;
-
+ pVia->UseLegacyModeSwitch = FALSE;
+ pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP1;
+
switch (pVia->Chipset) {
+ case VIA_CLE266:
+ pVia->UseLegacyModeSwitch = TRUE;
+ pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
case VIA_KM400:
/* IRQ is not broken on KM400A, but testing (pVia->ChipRev < 0x80)
* is not enough to make sure we have an older, broken KM400. */
pVia->DRIIrqEnable = FALSE;
+
+ /* The KM400 not working properly with new mode switch (See Ticket #301) */
+ pVia->UseLegacyModeSwitch = TRUE;
+ pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
break;
case VIA_K8M800:
pVia->DRIIrqEnable = FALSE;
+ pVia->UseLegacyModeSwitch = TRUE;
break;
case VIA_PM800:
pVia->VideoEngine = VIDEO_ENGINE_CME;
+ pVia->UseLegacyModeSwitch = TRUE;
break;
case VIA_VM800:
+ pVia->UseLegacyModeSwitch = TRUE;
break;
case VIA_K8M890:
pVia->VideoEngine = VIDEO_ENGINE_CME;
pVia->agpEnable = FALSE;
pVia->dmaXV = FALSE;
- pVia->UseLegacyModeSwitch = FALSE;
break;
case VIA_P4M900:
pVia->VideoEngine = VIDEO_ENGINE_CME;
@@ -894,24 +730,22 @@ VIASetupDefaultOptions(ScrnInfoPtr pScrn)
pVia->useLegacyVBE = FALSE;
/* FIXME: this needs to be tested */
pVia->dmaXV = FALSE;
- pVia->UseLegacyModeSwitch = FALSE;
+ pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
break;
case VIA_CX700:
pVia->VideoEngine = VIDEO_ENGINE_CME;
pVia->swov.maxWInterp = 1920;
pVia->swov.maxHInterp = 1080;
- pVia->UseLegacyModeSwitch = FALSE;
break;
case VIA_P4M890:
pVia->VideoEngine = VIDEO_ENGINE_CME;
pVia->dmaXV = FALSE;
- pVia->UseLegacyModeSwitch = FALSE;
break;
case VIA_VX800:
+ case VIA_VX855:
pVia->VideoEngine = VIDEO_ENGINE_CME;
/* pVia->agpEnable = FALSE;
pVia->dmaXV = FALSE;*/
- pVia->UseLegacyModeSwitch = FALSE;
break;
}
@@ -931,7 +765,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
#ifndef USE_FB
char *mod = NULL;
- const char *reqSym = NULL;
#endif
vgaHWPtr hwp;
int i, bMemSize = 0;
@@ -952,7 +785,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
if (!xf86LoadSubModule(pScrn, "vgahw"))
return FALSE;
- xf86LoaderReqSymLists(vgaHWSymbols, NULL);
if (!vgaHWGetHWRec(pScrn))
return FALSE;
@@ -973,11 +805,13 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
pVia->IsSecondary = FALSE;
pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+#ifndef XSERVER_LIBPCIACCESS
if (pEnt->resources) {
xfree(pEnt);
VIAFreeRec(pScrn);
return FALSE;
}
+#endif
pVia->EntityIndex = pEnt->index;
@@ -1096,7 +930,9 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->rgbBits = 6;
pVia->PciInfo = xf86GetPciInfoForEntity(pEnt->index);
+#ifndef XSERVER_LIBPCIACCESS
xf86RegisterResources(pEnt->index, NULL, ResNone);
+#endif
#if 0
xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr);
@@ -1180,6 +1016,7 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
case VIA_P4M900:
case VIA_CX700:
case VIA_VX800:
+ case VIA_VX855:
#ifdef XSERVER_LIBPCIACCESS
pci_device_cfg_read_u8(vgaDevice, &videoRam, 0xA1);
#else
@@ -1230,44 +1067,86 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Setting amount of VideoRAM to %d kB\n", pScrn->videoRam);
- from = (xf86GetOptValBool(VIAOptions, OPTION_SHADOW_FB, &pVia->shadowFB)
- ? X_CONFIG : X_DEFAULT);
- xf86DrvMsg(pScrn->scrnIndex, from, "Shadow framebuffer is %s.\n",
- pVia->shadowFB ? "enabled" : "disabled");
-
- /* Use hardware acceleration, unless on shadow framebuffer. */
- from = (xf86GetOptValBool(VIAOptions, OPTION_NOACCEL, &pVia->NoAccel)
- ? X_CONFIG : X_DEFAULT);
- if (!pVia->NoAccel && pVia->shadowFB) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Acceleration is "
- "not supported when using shadow framebuffer.\n");
- pVia->NoAccel = TRUE;
- from = X_DEFAULT;
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_MODE_SWITCH_METHOD))) {
+ if (!xf86NameCmp(s, "legacy")) {
+ if (pVia->UseLegacyModeSwitch) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Already using \"legacy\" as ModeSwitchMethod, "
+ "did not force anything.\n");
+ }
+ else {
+ pVia->UseLegacyModeSwitch = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Forced ModeSwitchMethod to \"legacy\".\n");
+ }
+ }
+ else if (!xf86NameCmp(s, "new")) {
+ if (pVia->UseLegacyModeSwitch) {
+ pVia->UseLegacyModeSwitch = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Forced ModeSwitchMethod to \"new\".\n");
+ }
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Already using \"new\" as ModeSwitchMethod, "
+ "did not force anything.\n");
+ }
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
+ "value for Option \"ModeSwitchMethod\".\n", s);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid options are \"legacy\" or \"new\".\n");
+ }
}
- xf86DrvMsg(pScrn->scrnIndex, from, "Hardware acceleration is %s.\n",
- !pVia->NoAccel ? "enabled" : "disabled");
/* When rotating, switch shadow framebuffer on and acceleration off. */
if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATE))) {
if (!xf86NameCmp(s, "CW")) {
pVia->shadowFB = TRUE;
pVia->NoAccel = TRUE;
- pVia->rotate = 1;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_270;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
"clockwise -- acceleration is disabled.\n");
} else if (!xf86NameCmp(s, "CCW")) {
pVia->shadowFB = TRUE;
pVia->NoAccel = TRUE;
- pVia->rotate = -1;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_90;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
"counterclockwise -- acceleration is disabled.\n");
+ } else if (!xf86NameCmp(s, "UD")) {
+ pVia->shadowFB = TRUE;
+ pVia->NoAccel = TRUE;
+ pVia->RandRRotation = TRUE;
+ pVia->rotate = RR_Rotate_180;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
+ "upside-down -- acceleration is disabled.\n");
} else {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
"value for Option \"Rotate\".\n", s);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Valid options are \"CW\" or \"CCW\".\n");
+ "Valid options are \"CW\", \"CCW\" or \"UD\".\n");
}
}
+
+ from = (xf86GetOptValBool(VIAOptions, OPTION_SHADOW_FB, &pVia->shadowFB)
+ ? X_CONFIG : X_DEFAULT);
+ xf86DrvMsg(pScrn->scrnIndex, from, "Shadow framebuffer is %s.\n",
+ pVia->shadowFB ? "enabled" : "disabled");
+
+ /* Use hardware acceleration, unless on shadow framebuffer. */
+ from = (xf86GetOptValBool(VIAOptions, OPTION_NOACCEL, &pVia->NoAccel)
+ ? X_CONFIG : X_DEFAULT);
+ if (!pVia->NoAccel && pVia->shadowFB) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Acceleration is "
+ "not supported when using shadow framebuffer.\n");
+ pVia->NoAccel = TRUE;
+ from = X_DEFAULT;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "Hardware acceleration is %s.\n",
+ !pVia->NoAccel ? "enabled" : "disabled");
+
if (!pVia->NoAccel) {
from = X_DEFAULT;
if ((s = (char *)xf86GetOptValString(VIAOptions, OPTION_ACCELMETHOD))) {
@@ -1535,6 +1414,30 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
"No default TV output signal type is set.\n");
}
+ /* TV DI Port */
+ if ((s = xf86GetOptValString(VIAOptions, OPTION_TVDIPORT))) {
+ if (!xf86NameCmp(s, "DVP0")) {
+ pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Port is DVP0.\n");
+ } else if (!xf86NameCmp(s, "DVP1")) {
+ pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP1;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Port is DVP1.\n");
+ } else if (!xf86NameCmp(s, "DFPHigh")) {
+ pBIOSInfo->TVDIPort = VIA_DI_PORT_DFPHIGH;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Port is DFPHigh.\n");
+ } else if (!xf86NameCmp(s, "DFPLow")) {
+ pBIOSInfo->TVDIPort = VIA_DI_PORT_DFPLOW;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "TV Output Port is DFPLow.\n");
+ }
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
+ "No default TV output port is set.\n");
+ }
+
VIAVidHWDiffInit(pScrn);
/* maybe throw in some more sanity checks here */
@@ -1624,7 +1527,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
VIAFreeRec(pScrn);
return FALSE;
} else {
- xf86LoaderReqSymLists(i2cSymbols, NULL);
ViaI2CInit(pScrn);
}
@@ -1632,7 +1534,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
VIAFreeRec(pScrn);
return FALSE;
} else {
- xf86LoaderReqSymLists(ddcSymbols, NULL);
if (pVia->pI2CBus1) {
pVia->DDC1 = xf86DoEDID_DDC2(pScrn->scrnIndex, pVia->pI2CBus1);
@@ -1674,7 +1575,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
/* VBE doesn't properly initialise int10 itself. */
if (xf86LoadSubModule(pScrn, "int10")
&& xf86LoadSubModule(pScrn, "vbe")) {
- xf86LoaderReqSymLists(vbeSymbols, NULL);
pVia->pVbe = VBEExtendedInit(NULL, pVia->EntityIndex,
SET_BIOS_SCRATCH |
RESTORE_BIOS_SCRATCH);
@@ -1773,22 +1673,18 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- xf86LoaderReqSymLists(fbSymbols, NULL);
#else
/* Load bpp-specific modules. */
switch (pScrn->bitsPerPixel) {
case 8:
mod = "cfb";
- reqSym = "cfbScreenInit";
break;
case 16:
mod = "cfb16";
- reqSym = "cfb16ScreenInit";
break;
case 32:
mod = "cfb32";
- reqSym = "cfb32ScreenInit";
break;
}
@@ -1797,7 +1693,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- xf86LoaderReqSymbols(reqSym, NULL);
#endif
if (!pVia->NoAccel) {
@@ -1814,13 +1709,11 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
VIAFreeRec(pScrn);
return FALSE;
}
- xf86LoaderReqSymLists(exaSymbols, NULL);
}
if (!xf86LoadSubModule(pScrn, "xaa")) {
VIAFreeRec(pScrn);
return FALSE;
}
- xf86LoaderReqSymLists(xaaSymbols, NULL);
}
if (pVia->hwcursor) {
@@ -1828,7 +1721,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
VIAFreeRec(pScrn);
return FALSE;
}
- xf86LoaderReqSymLists(ramdacSymbols, NULL);
}
if (pVia->shadowFB) {
@@ -1836,7 +1728,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
VIAFreeRec(pScrn);
return FALSE;
}
- xf86LoaderReqSymLists(shadowSymbols, NULL);
}
VIAUnmapMem(pScrn);
@@ -1926,8 +1817,16 @@ VIALeaveVT(int scrnIndex, int flags)
viaAccelSync(pScrn);
/* A soft reset helps to avoid a 3D hang on VT switch. */
- if (pVia->Chipset != VIA_K8M890 && pVia->Chipset != VIA_P4M900 && pVia->Chipset != VIA_VX800)
- hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40);
+ switch (pVia->Chipset) {
+ case VIA_K8M890:
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ break;
+ default:
+ hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40);
+ break;
+ }
#ifdef OPENCHROMEDRI
if (pVia->directRenderingEnabled) {
@@ -2018,11 +1917,15 @@ VIASave(ScrnInfoPtr pScrn)
vgaHWProtect(pScrn, TRUE);
- if (xf86IsPrimaryPci(pVia->PciInfo))
+ if (xf86IsPrimaryPci(pVia->PciInfo)) {
vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL);
- else
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Primary Adapter! saving VGA_SR_ALL !!\n"));
+ } else {
vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE);
-
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Non-Primary Adapter! saving VGA_SR_MODE only !!\n"));
+ }
/* Unlock and save extended registers. */
hwp->writeSeq(hwp, 0x10, 0x01);
@@ -2052,22 +1955,30 @@ VIASave(ScrnInfoPtr pScrn)
Regs->SR2E = hwp->readSeq(hwp, 0x2E);
+ /*=* Save VCK, LCDCK and ECK *=*/
+ /* Primary Display (VCK) (description for Chipset >= K8M800): */
Regs->SR44 = hwp->readSeq(hwp, 0x44);
Regs->SR45 = hwp->readSeq(hwp, 0x45);
Regs->SR46 = hwp->readSeq(hwp, 0x46);
+
+ /* ECK Clock Synthesizer (description for Chipset >= K8M800): */
Regs->SR47 = hwp->readSeq(hwp, 0x47);
+ Regs->SR48 = hwp->readSeq(hwp, 0x48);
+ Regs->SR49 = hwp->readSeq(hwp, 0x49);
switch (pVia->Chipset) {
case VIA_CLE266:
case VIA_KM400:
break;
default:
+ /* Secondary Display (LCDCK): */
Regs->SR4A = hwp->readSeq(hwp, 0x4A);
Regs->SR4B = hwp->readSeq(hwp, 0x4B);
Regs->SR4C = hwp->readSeq(hwp, 0x4C);
break;
}
-
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Non-Primary Adapter! saving VGA_SR_MODE only !!\n"));
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Crtc...\n"));
Regs->CR13 = hwp->readCrtc(hwp, 0x13);
@@ -2103,8 +2014,13 @@ VIASave(ScrnInfoPtr pScrn)
}
/* Save TMDS status */
- if ((pVia->Chipset == VIA_CX700) || (pVia->Chipset == VIA_VX800))
- Regs->CRD2 = hwp->readCrtc(hwp, 0xD2);
+ switch (pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_VX800:
+ case VIA_VX855:
+ Regs->CRD2 = hwp->readCrtc(hwp, 0xD2);
+ break;
+ }
vgaHWProtect(pScrn, FALSE);
}
@@ -2129,10 +2045,15 @@ VIARestore(ScrnInfoPtr pScrn)
/* Unlock extended registers. */
hwp->writeSeq(hwp, 0x10, 0x01);
+ /*=* CR6A, CR6B, CR6C must be reset before restore
+ standard vga regs, or system will be hang. *=*/
+ /*=* TODO Check is reset IGA2 channel before disable IGA2 channel
+ is neccesery or it may cause some line garbage. *=*/
hwp->writeCrtc(hwp, 0x6A, 0x00);
hwp->writeCrtc(hwp, 0x6B, 0x00);
hwp->writeCrtc(hwp, 0x6C, 0x00);
-
+
+ /* Gamma must disable before restore pallette */
ViaGammaDisable(pScrn);
if (pBIOSInfo->TVI2CDev)
@@ -2170,17 +2091,24 @@ VIARestore(ScrnInfoPtr pScrn)
hwp->writeSeq(hwp, 0x2B, Regs->SR2B);
hwp->writeSeq(hwp, 0x2E, Regs->SR2E);
-
+
+ /*=* restore VCK, LCDCK and ECK *=*/
+ /* Primary Display (VCK): */
hwp->writeSeq(hwp, 0x44, Regs->SR44);
hwp->writeSeq(hwp, 0x45, Regs->SR45);
hwp->writeSeq(hwp, 0x46, Regs->SR46);
+
+ /* ECK Clock Synthesizer: */
hwp->writeSeq(hwp, 0x47, Regs->SR47);
+ hwp->writeSeq(hwp, 0x48, Regs->SR48);
+ hwp->writeSeq(hwp, 0x49, Regs->SR49);
switch (pVia->Chipset) {
case VIA_CLE266:
case VIA_KM400:
break;
default:
+ /* Secondary Display (LCDCK): */
hwp->writeSeq(hwp, 0x4A, Regs->SR4A);
hwp->writeSeq(hwp, 0x4B, Regs->SR4B);
hwp->writeSeq(hwp, 0x4C, Regs->SR4C);
@@ -2191,11 +2119,19 @@ VIARestore(ScrnInfoPtr pScrn)
ViaSeqMask(hwp, 0x40, 0x06, 0x06);
ViaSeqMask(hwp, 0x40, 0x00, 0x06);
+ /* Integrated LVDS Mode Select */
hwp->writeCrtc(hwp, 0x13, Regs->CR13);
+
+ /*=* Restore CRTC controller extended regs: *=*/
+ /* Mode Control */
hwp->writeCrtc(hwp, 0x32, Regs->CR32);
+ /* HSYNCH Adjuster */
hwp->writeCrtc(hwp, 0x33, Regs->CR33);
+ /* Starting Address Overflow */
hwp->writeCrtc(hwp, 0x34, Regs->CR34);
+ /* Extended Overflow */
hwp->writeCrtc(hwp, 0x35, Regs->CR35);
+ /*Power Management 3 (Monitor Control) */
hwp->writeCrtc(hwp, 0x36, Regs->CR36);
hwp->writeCrtc(hwp, 0x48, Regs->CR48);
@@ -2206,11 +2142,12 @@ VIARestore(ScrnInfoPtr pScrn)
hwp->writeCrtc(hwp, i + 0x50, Regs->CRTCRegs[i]);
if (pVia->Chipset != VIA_CLE266 && pVia->Chipset != VIA_KM400) {
-
+ /* Scaling Initial values */
hwp->writeCrtc(hwp, 0xA0, Regs->CRA0);
hwp->writeCrtc(hwp, 0xA1, Regs->CRA1);
hwp->writeCrtc(hwp, 0xA2, Regs->CRA2);
+ /* LVDS Channels Functions Selection */
hwp->writeCrtc(hwp, 0x97, Regs->CR97);
hwp->writeCrtc(hwp, 0x99, Regs->CR99);
hwp->writeCrtc(hwp, 0x9B, Regs->CR9B);
@@ -2219,8 +2156,14 @@ VIARestore(ScrnInfoPtr pScrn)
}
/* Restore TMDS status */
- if ((pVia->Chipset == VIA_CX700) || (pVia->Chipset == VIA_VX800))
- hwp->writeCrtc(hwp, 0xD2, Regs->CRD2);
+ switch (pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_VX800:
+ case VIA_VX855:
+ /* LVDS Control Register */
+ hwp->writeCrtc(hwp, 0xD2, Regs->CRD2);
+ break;
+ }
if (pBIOSInfo->Panel->IsActive)
ViaLCDPower(pScrn, TRUE);
@@ -2245,6 +2188,7 @@ ViaMMIOEnable(ScrnInfoPtr pScrn)
case VIA_CX700:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
ViaSeqMask(hwp, 0x1A, 0x08, 0x08);
break;
default:
@@ -2267,6 +2211,7 @@ ViaMMIODisable(ScrnInfoPtr pScrn)
case VIA_CX700:
case VIA_P4M900:
case VIA_VX800:
+ case VIA_VX855:
ViaSeqMask(hwp, 0x1A, 0x00, 0x08);
break;
default:
@@ -2564,7 +2509,7 @@ VIALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
int i, index;
int SR1A, SR1B, CR67, CR6A;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIALoadPalette\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIALoadPalette: numColors: %d\n", numColors));
if (pScrn->bitsPerPixel != 8) {
@@ -2768,6 +2713,11 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (pVia->shadowFB)
ViaShadowFBInit(pScrn, pScreen);
+
+ if (pVia->RandRRotation)
+ {
+ pScrn->DriverFunc = VIADriverFunc;
+ }
if (!miCreateDefColormap(pScreen))
return FALSE;
@@ -2872,14 +2822,14 @@ VIAInternalScreenInit(int scrnIndex, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
VIAPtr pVia = VIAPTR(pScrn);
- int width, height, displayWidth;
+ int width, height, displayWidth, shadowHeight;
unsigned char *FBStart;
xf86DrvMsg(scrnIndex, X_INFO, "VIAInternalScreenInit\n");
displayWidth = pScrn->displayWidth;
- if (pVia->rotate) {
+ if ((pVia->rotate==RR_Rotate_90) || (pVia->rotate==RR_Rotate_270)) {
height = pScrn->virtualX;
width = pScrn->virtualY;
} else {
@@ -2887,9 +2837,14 @@ VIAInternalScreenInit(int scrnIndex, ScreenPtr pScreen)
height = pScrn->virtualY;
}
+ if (pVia->RandRRotation)
+ shadowHeight = max(width, height);
+ else
+ shadowHeight = height;
+
if (pVia->shadowFB) {
pVia->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
- pVia->ShadowPtr = xalloc(pVia->ShadowPitch * height);
+ pVia->ShadowPtr = xalloc(pVia->ShadowPitch * shadowHeight);
displayWidth = pVia->ShadowPitch / (pScrn->bitsPerPixel >> 3);
FBStart = pVia->ShadowPtr;
} else {
@@ -2918,6 +2873,7 @@ VIAInternalScreenInit(int scrnIndex, ScreenPtr pScreen)
return FALSE;
}
#endif
+ return TRUE;
}
static Bool
@@ -2956,13 +2912,19 @@ VIAWriteMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
* to detect when the display is using the secondary head.
* TODO: This should be enabled for other chipsets as well.
*/
- if ((pVia->Chipset == VIA_P4M900 || pVia->Chipset == VIA_VX800) && pVia->pBIOSInfo->Panel->IsActive) {
- /*
- * Since we are using virtual, we need to adjust
- * the offset to match the framebuffer alignment.
- */
- if (pScrn->displayWidth != mode->CrtcHDisplay)
- ViaSecondCRTCHorizontalOffset(pScrn);
+ if (pVia->pBIOSInfo->Panel->IsActive) {
+ switch (pVia->Chipset) {
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ /*
+ * Since we are using virtual, we need to adjust
+ * the offset to match the framebuffer alignment.
+ */
+ if (pScrn->displayWidth != mode->CrtcHDisplay)
+ ViaSecondCRTCHorizontalOffset(pScrn);
+ break;
+ }
}
}
@@ -2996,9 +2958,16 @@ VIACloseScreen(int scrnIndex, ScreenPtr pScreen)
viaAccelSync(pScrn);
/* A soft reset avoids a 3D hang after X restart. */
- if (pVia->Chipset != VIA_K8M890 && pVia->Chipset != VIA_P4M900 &&
- pVia->Chipset != VIA_VX800)
- hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40);
+ switch (pVia->Chipset) {
+ case VIA_K8M890:
+ case VIA_P4M900:
+ case VIA_VX800:
+ case VIA_VX855:
+ break;
+ default :
+ hwp->writeSeq(hwp, 0x1A, pVia->SavedReg.SR1A | 0x40);
+ break;
+ }
if (!pVia->IsSecondary) {
/* Turn off all video activities. */
@@ -3068,7 +3037,7 @@ VIAAdjustFrame(int scrnIndex, int x, int y, int flags)
VIAPtr pVia = VIAPTR(pScrn);
CARD32 Base;
- DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAAdjustFrame\n"));
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "VIAAdjustFrame %dx%d\n", x, y));
if (pVia->pVbe) {
ViaVbeAdjustFrame(scrnIndex, x, y, flags);
@@ -3090,6 +3059,80 @@ VIAAdjustFrame(int scrnIndex, int x, int y, int flags)
VIAVidAdjustFrame(pScrn, x, y);
}
+
+static Bool
+VIARandRGetInfo(ScrnInfoPtr pScrn, Rotation *rotations)
+{
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIARandRGetInfo\n");
+
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ /* to report what ability we can support. */
+ if(pVia->RandRRotation)
+ *rotations = RR_Rotate_0 | RR_Rotate_90 |RR_Rotate_180 | RR_Rotate_270;
+ else
+ *rotations = RR_Rotate_0;
+
+ return TRUE;
+}
+
+static Bool
+VIARandRSetConfig(ScrnInfoPtr pScrn, xorgRRConfig *config)
+{
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIARandRSetConfig\n");
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ switch(config->rotation) {
+ case RR_Rotate_0:
+ pVia->rotate = RR_Rotate_0;
+ break;
+
+ case RR_Rotate_90:
+ pVia->rotate = RR_Rotate_90;
+ break;
+
+ case RR_Rotate_180:
+ pVia->rotate = RR_Rotate_180;
+ break;
+
+ case RR_Rotate_270:
+ pVia->rotate = RR_Rotate_270;
+ break;
+
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Unexpected rotation in VIARandRSetConfig\n");
+ pVia->rotate = RR_Rotate_0;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * The driverFunc. xorgDriverFuncOp specifies the action driver should
+ * perform. If requested option is not supported function should return
+ * FALSE. pointer can be used to pass arguments to the function or
+ * to return data to the caller.
+ */
+
+static Bool
+VIADriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer data)
+{
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIADriverFunc Operation: %d\n", op));
+
+ switch(op) {
+ case RR_GET_INFO:
+ return VIARandRGetInfo(pScrn, (Rotation*)data);
+ case RR_SET_CONFIG:
+ return VIARandRSetConfig(pScrn, (xorgRRConfig*)data);
+ default:
+ return FALSE;
+ }
+ return FALSE;
+}
+
+
+
static Bool
VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
diff --git a/driver/xf86-video-openchrome/src/via_driver.h b/driver/xf86-video-openchrome/src/via_driver.h
index 3f5d88395..3b0282959 100644
--- a/driver/xf86-video-openchrome/src/via_driver.h
+++ b/driver/xf86-video-openchrome/src/via_driver.h
@@ -36,7 +36,11 @@
#include "vgaHW.h"
#include "xf86.h"
+
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
#include "xf86Resources.h"
+#endif
+
#include "xf86Pci.h"
#include "xf86PciInfo.h"
#include "xf86_OSproc.h"
@@ -100,11 +104,19 @@
#define DRIVER_NAME "openchrome"
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
-#define PATCHLEVEL 903
+#define PATCHLEVEL 904
#define VIA_VERSION ((VERSION_MAJOR<<24) | (VERSION_MINOR<<16) | PATCHLEVEL)
#define VIA_VQ_SIZE (256 * 1024)
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+#define VIA_RES_SHARED RES_SHARED_VGA
+#define VIA_RES_UNDEF RES_UNDEFINED
+#else
+#define VIA_RES_SHARED NULL
+#define VIA_RES_UNDEF NULL
+#endif
+
typedef struct {
CARD8 SR08, SR0A, SR0F;
@@ -114,7 +126,7 @@ typedef struct {
CARD8 SR1F, SR20, SR21, SR22,SR23,SR24,SR25,SR26;
CARD8 SR27, SR28, SR29, SR2A,SR2B,SR2C,SR2D,SR2E;
CARD8 SR2F, SR30, SR31, SR32,SR33,SR34,SR40,SR41;
- CARD8 SR42, SR43, SR44, SR45,SR46,SR47;
+ CARD8 SR42, SR43, SR44, SR45,SR46,SR47,SR48,SR49;
CARD8 SR4A, SR4B, SR4C;
/* extended CRTC registers */
@@ -229,7 +241,7 @@ typedef struct _VIA {
Bool hwcursor;
Bool NoAccel;
Bool shadowFB;
- int rotate;
+ Rotation rotate;
Bool vbeSR;
int agpMem;
@@ -295,6 +307,9 @@ typedef struct _VIA {
char * dBounce;
#endif
+ /* Rotation */
+ Bool RandRRotation;
+
/* BIOS Info Ptr */
VIABIOSInfoPtr pBIOSInfo;
struct ViaCardIdStruct* Id;
diff --git a/driver/xf86-video-openchrome/src/via_drm.h b/driver/xf86-video-openchrome/src/via_drm.h
deleted file mode 100644
index 9d85a1e84..000000000
--- a/driver/xf86-video-openchrome/src/via_drm.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
- * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#ifndef _VIA_DRM_H_
-#define _VIA_DRM_H_
-
-/* WARNING: These defines must be the same as what the Xserver uses.
- * if you change them, you must change the defines in the Xserver.
- */
-
-#ifndef _VIA_DEFINES_
-#define _VIA_DEFINES_
-
-#if !defined(__KERNEL__) && !defined(_KERNEL)
-#include "via_drmclient.h"
-#endif
-
-#define VIA_NR_SAREA_CLIPRECTS 8
-#define VIA_NR_XVMC_PORTS 10
-#define VIA_NR_XVMC_LOCKS 5
-#define VIA_MAX_CACHELINE_SIZE 64
-#define XVMCLOCKPTR(saPriv,lockNo) \
- ((volatile drm_hw_lock_t *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
- (VIA_MAX_CACHELINE_SIZE - 1)) & \
- ~(VIA_MAX_CACHELINE_SIZE - 1)) + \
- VIA_MAX_CACHELINE_SIZE*(lockNo)))
-
-/* Each region is a minimum of 64k, and there are at most 64 of them.
- */
-#define VIA_NR_TEX_REGIONS 64
-#define VIA_LOG_MIN_TEX_REGION_SIZE 16
-#endif
-
-#define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */
-#define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */
-#define VIA_UPLOAD_CTX 0x4
-#define VIA_UPLOAD_BUFFERS 0x8
-#define VIA_UPLOAD_TEX0 0x10
-#define VIA_UPLOAD_TEX1 0x20
-#define VIA_UPLOAD_CLIPRECTS 0x40
-#define VIA_UPLOAD_ALL 0xff
-
-/* VIA specific ioctls */
-#define DRM_VIA_ALLOCMEM 0x00
-#define DRM_VIA_FREEMEM 0x01
-#define DRM_VIA_AGP_INIT 0x02
-#define DRM_VIA_FB_INIT 0x03
-#define DRM_VIA_MAP_INIT 0x04
-#define DRM_VIA_DEC_FUTEX 0x05
-#define NOT_USED
-#define DRM_VIA_DMA_INIT 0x07
-#define DRM_VIA_CMDBUFFER 0x08
-#define DRM_VIA_FLUSH 0x09
-#define DRM_VIA_PCICMD 0x0a
-#define DRM_VIA_CMDBUF_SIZE 0x0b
-#define NOT_USED
-#define DRM_VIA_WAIT_IRQ 0x0d
-#define DRM_VIA_DMA_BLIT 0x0e
-#define DRM_VIA_BLIT_SYNC 0x0f
-
-#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
-#define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t)
-#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t)
-#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t)
-#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t)
-#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t)
-#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t)
-#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t)
-#define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH)
-#define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t)
-#define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \
- drm_via_cmdbuf_size_t)
-#define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t)
-#define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t)
-#define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t)
-
-/* Indices into buf.Setup where various bits of state are mirrored per
- * context and per buffer. These can be fired at the card as a unit,
- * or in a piecewise fashion as required.
- */
-
-#define VIA_TEX_SETUP_SIZE 8
-
-/* Flags for clear ioctl
- */
-#define VIA_FRONT 0x1
-#define VIA_BACK 0x2
-#define VIA_DEPTH 0x4
-#define VIA_STENCIL 0x8
-
-#define VIA_MEM_VIDEO 0 /* matches drm constant */
-#define VIA_MEM_AGP 1 /* matches drm constant */
-#define VIA_MEM_SYSTEM 2
-#define VIA_MEM_MIXED 3
-#define VIA_MEM_UNKNOWN 4
-
-typedef struct {
- uint32_t offset;
- uint32_t size;
-} drm_via_agp_t;
-
-typedef struct {
- uint32_t offset;
- uint32_t size;
-} drm_via_fb_t;
-
-typedef struct {
- uint32_t context;
- uint32_t type;
- uint32_t size;
- unsigned long index;
- unsigned long offset;
-} drm_via_mem_t;
-
-typedef struct _drm_via_init {
- enum {
- VIA_INIT_MAP = 0x01,
- VIA_CLEANUP_MAP = 0x02
- } func;
-
- unsigned long sarea_priv_offset;
- unsigned long fb_offset;
- unsigned long mmio_offset;
- unsigned long agpAddr;
-} drm_via_init_t;
-
-typedef struct _drm_via_futex {
- enum {
- VIA_FUTEX_WAIT = 0x00,
- VIA_FUTEX_WAKE = 0X01
- } func;
- uint32_t ms;
- uint32_t lock;
- uint32_t val;
-} drm_via_futex_t;
-
-typedef struct _drm_via_dma_init {
- enum {
- VIA_INIT_DMA = 0x01,
- VIA_CLEANUP_DMA = 0x02,
- VIA_DMA_INITIALIZED = 0x03
- } func;
-
- unsigned long offset;
- unsigned long size;
- unsigned long reg_pause_addr;
-} drm_via_dma_init_t;
-
-typedef struct _drm_via_cmdbuffer {
- char __user *buf;
- unsigned long size;
-} drm_via_cmdbuffer_t;
-
-/* Warning: If you change the SAREA structure you must change the Xserver
- * structure as well */
-
-typedef struct _drm_via_tex_region {
- unsigned char next, prev; /* indices to form a circular LRU */
- unsigned char inUse; /* owned by a client, or free? */
- int age; /* tracked by clients to update local LRU's */
-} drm_via_tex_region_t;
-
-typedef struct _drm_via_sarea {
- unsigned int dirty;
- unsigned int nbox;
- drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS];
- drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
- int texAge; /* last time texture was uploaded */
- int ctxOwner; /* last context to upload state */
- int vertexPrim;
-
- /*
- * Below is for XvMC.
- * We want the lock integers alone on, and aligned to, a cache line.
- * Therefore this somewhat strange construct.
- */
-
- char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)];
-
- unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS];
- unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS];
- unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */
-
- /* Used by the 3d driver only at this point, for pageflipping:
- */
-
- unsigned int pfCurrentOffset;
-} drm_via_sarea_t;
-
-typedef struct _drm_via_cmdbuf_size {
- enum {
- VIA_CMDBUF_SPACE = 0x01,
- VIA_CMDBUF_LAG = 0x02
- } func;
- int wait;
- uint32_t size;
-} drm_via_cmdbuf_size_t;
-
-typedef enum {
- VIA_IRQ_ABSOLUTE = 0x0,
- VIA_IRQ_RELATIVE = 0x1,
- VIA_IRQ_SIGNAL = 0x10000000,
- VIA_IRQ_FORCE_SEQUENCE = 0x20000000
-} via_irq_seq_type_t;
-
-#define VIA_IRQ_FLAGS_MASK 0xF0000000
-
-enum drm_via_irqs{drm_via_irq_hqv0 = 0,
- drm_via_irq_hqv1,
- drm_via_irq_dma0_dd,
- drm_via_irq_dma0_td,
- drm_via_irq_dma1_dd,
- drm_via_irq_dma1_td,
- drm_via_irq_num};
-
-struct drm_via_wait_irq_request{
- unsigned irq;
- via_irq_seq_type_t type;
- uint32_t sequence;
- uint32_t signal;
-};
-
-typedef union drm_via_irqwait {
- struct drm_via_wait_irq_request request;
- struct drm_wait_vblank_reply reply;
-} drm_via_irqwait_t;
-
-typedef struct drm_via_blitsync {
- uint32_t sync_handle;
- unsigned engine;
-} drm_via_blitsync_t;
-
-typedef struct drm_via_dmablit {
- uint32_t num_lines;
- uint32_t line_length;
-
- uint32_t fb_addr;
- uint32_t fb_stride;
-
- unsigned char *mem_addr;
- uint32_t mem_stride;
-
- int bounce_buffer;
- int to_fb;
-
- drm_via_blitsync_t sync;
-} drm_via_dmablit_t;
-
-
-#endif /* _VIA_DRM_H_ */
diff --git a/driver/xf86-video-openchrome/src/via_id.c b/driver/xf86-video-openchrome/src/via_id.c
index 027094f35..c961ee162 100644
--- a/driver/xf86-video-openchrome/src/via_id.c
+++ b/driver/xf86-video-openchrome/src/via_id.c
@@ -92,6 +92,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
{"Shuttle FX21", VIA_K8M800, 0x1297, 0x3052, VIA_DEVICE_CRT},
{"Shuttle FX83", VIA_K8M800, 0x1297, 0xF683, VIA_DEVICE_CRT | VIA_DEVICE_TV},
{"Sharp Actius AL27", VIA_K8M800, 0x13BD, 0x1044, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
+ {"Sharp PC-AE30J", VIA_K8M800, 0x13BD, 0x104B, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Giga-byte GA-K8VM800M", VIA_K8M800, 0x1458, 0xD000, VIA_DEVICE_CRT},
{"MSI K8M Neo-V", VIA_K8M800, 0x1462, 0x0320, VIA_DEVICE_CRT},
{"MSI K8MM-V", VIA_K8M800, 0x1462, 0x7142, VIA_DEVICE_CRT},
@@ -134,6 +135,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
/*** P4M800Pro, VN800, CN700 ***/
{"Clevo/RoverBook Partner E419L", VIA_VM800, 0x1019, 0x0F75, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
+ {"Haier A60-440256080BD", VIA_VM800, 0x1019, 0x0F79, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"PCChips P23G", VIA_VM800, 0x1019, 0x1623, VIA_DEVICE_CRT},
{"ECS P4M800PRO-M", VIA_VM800, 0x1019, 0x2122, VIA_DEVICE_CRT},
{"ECS C7VCM", VIA_VM800, 0x1019, 0xAA2D, VIA_DEVICE_CRT},
@@ -154,6 +156,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
{"Clevo M5xxS", VIA_VM800, 0x1558, 0x5406, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Biostar P4M80-M4 / P4VMA-M", VIA_VM800, 0x1565, 0x1202, VIA_DEVICE_CRT},
{"Biostar P4M800 Pro-M7", VIA_VM800, 0x1565, 0x1206, VIA_DEVICE_CRT},
+ {"Packard Bell Lima (ASUS MBP5VDZ-NVM)", VIA_VM800, 0x1631, 0xE018, VIA_DEVICE_CRT},
{"Fujitsu/Siemens Amilo Pro V2030", VIA_VM800, 0x1734, 0x109B, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Fujitsu/Siemens Amilo Pro V2035", VIA_VM800, 0x1734, 0x10AE, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Fujitsu/Siemens Amilo Pro V2055", VIA_VM800, 0x1734, 0x10CA, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
@@ -185,6 +188,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
{"MSI VR321", VIA_P4M900, 0x1462, 0x3355, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"MSI P4M900M / P4M900M2-F/L", VIA_P4M900, 0x1462, 0x7255, VIA_DEVICE_CRT},
{"MSI P4M900M3-L", VIA_P4M900, 0x1462, 0x7387, VIA_DEVICE_CRT},
+ {"Twinhead H12V", VIA_P4M900, 0x14FF, 0xA00F, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Everex NC1501/NC1503", VIA_P4M900, 0x1509, 0x1E30, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Clevo M660SE", VIA_P4M900, 0x1558, 0x0664, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Clevo M660SR", VIA_P4M900, 0x1558, 0x0669, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
@@ -207,6 +211,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
/*** P4M890, VN890 ***/
{"PCChips P29G", VIA_P4M890, 0x1019, 0x1629, VIA_DEVICE_CRT},
+ {"ECS P4M890T-M v2.0", VIA_P4M890, 0x1019, 0x2171, VIA_DEVICE_CRT},
{"PCChips ????", VIA_P4M890, 0x1019, 0x2174, VIA_DEVICE_CRT},
{"Asustek P5V-VM ULTRA", VIA_P4M890, 0x1043, 0x81B5, VIA_DEVICE_CRT},
{"Asustek P5V-VM DH", VIA_P4M890, 0x1043, 0x81CE, VIA_DEVICE_CRT},
@@ -219,8 +224,13 @@ static struct ViaCardIdStruct ViaCardId[] = {
/*** VX800 ***/
{"VIA Epia M700", VIA_VX800, 0x1106, 0x1122, VIA_DEVICE_CRT},
+ {"VIA OpenBook", VIA_VX800, 0x1170, 0x0311, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, /* VIA OpenBook eNote VBE8910 */
{"Samsung NC20", VIA_VX800, 0x144d, 0xc04e, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Quanta DreamBook Light IL1", VIA_VX800, 0x152d, 0x0771, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
+ {"Lenovo S12", VIA_VX800, 0x17aa, 0x388c, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
+
+ /*** VX855 ***/
+ {"VIA VT8562C", VIA_VX855, 0x1106, 0x5122, VIA_DEVICE_CRT},
/* keep this */
{NULL, VIA_UNKNOWN, 0x0000, 0x0000, VIA_DEVICE_NONE}
@@ -264,15 +274,15 @@ ViaCheckCardId(ScrnInfoPtr pScrn)
if ((Id->Chip == pVia->Chipset) &&
(Id->Vendor == SUBVENDOR_ID(pVia->PciInfo)) &&
(Id->Device == SUBSYS_ID(pVia->PciInfo))) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected %s.\n", Id->String);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected %s. Card-Ids (%4X|%4X)\n", Id->String, SUBVENDOR_ID(pVia->PciInfo), SUBSYS_ID(pVia->PciInfo));
pVia->Id = Id;
return;
}
}
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Unknown Card-Ids (%4X|%4X|%4X); please report to openchrome-users@openchrome.org\n",
- DEVICE_ID(pVia->PciInfo), SUBVENDOR_ID(pVia->PciInfo), SUBSYS_ID(pVia->PciInfo));
+ "Unknown Card-Ids (%4X|%4X|%4X), Chipset: %s; please report to openchrome-users@openchrome.org\n",
+ DEVICE_ID(pVia->PciInfo), SUBVENDOR_ID(pVia->PciInfo), SUBSYS_ID(pVia->PciInfo), pScrn->chipset);
pVia->Id = NULL;
}
diff --git a/driver/xf86-video-openchrome/src/via_id.h b/driver/xf86-video-openchrome/src/via_id.h
index 168e8a92e..d941cf2e5 100644
--- a/driver/xf86-video-openchrome/src/via_id.h
+++ b/driver/xf86-video-openchrome/src/via_id.h
@@ -38,6 +38,7 @@ enum VIACHIPTAGS {
VIA_CX700,
VIA_P4M890,
VIA_VX800,
+ VIA_VX855,
VIA_LAST
};
@@ -54,6 +55,7 @@ enum VIACHIPTAGS {
#define PCI_CHIP_VT3324 0x3157 /* CX700 */
#define PCI_CHIP_VT3327 0x3343 /* P4M890 */
#define PCI_CHIP_VT3353 0x1122 /* VX800 */
+#define PCI_CHIP_VT3409 0x5122 /* VX855/VX875 */
/* There is some conflicting information about the two major revisions of
* the CLE266, often labelled Ax and Cx. The dividing line seems to be
diff --git a/driver/xf86-video-openchrome/src/via_lvds.c b/driver/xf86-video-openchrome/src/via_lvds.c
index 9a783cc99..90c089ac7 100644
--- a/driver/xf86-video-openchrome/src/via_lvds.c
+++ b/driver/xf86-video-openchrome/src/via_lvds.c
@@ -35,10 +35,121 @@
#include "via_driver.h"
#include "via_vgahw.h"
#include "via_id.h"
+#include <unistd.h>
+/*
+ 1. Formula:
+ 2^13 X 0.0698uSec [1/14.318MHz] = 8192 X 0.0698uSec =572.1uSec
+ Timer = Counter x 572 uSec
+ 2. Note:
+ 0.0698 uSec is too small to compute for hardware. So we multify a
+ reference value(2^13) to make it big enough to compute for hardware.
+ 3. Note:
+ The meaning of the TD0~TD3 are count of the clock.
+ TD(sec) = (sec)/(per clock) x (count of clocks)
+*/
+
+#define TD0 200
+#define TD1 25
+#define TD2 0
+#define TD3 25
static void
-ViaLVDSPowerFirstSequence(ScrnInfoPtr pScrn, Bool on)
+ViaLVDSSoftwarePowerFirstSequence(ScrnInfoPtr pScrn, Bool on)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaLVDSSoftwarePowerFirstSequence: %d\n", on));
+ if (on) {
+
+ /* Software control power sequence ON*/
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) & 0x7F);
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) | 0x01);
+ usleep(TD0);
+
+ /* VDD ON*/
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) | 0x10);
+ usleep(TD1);
+
+ /* DATA ON */
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) | 0x08);
+ usleep(TD2);
+
+ /* VEE ON (unused on vt3353)*/
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) | 0x04);
+ usleep(TD3);
+
+ /* Back-Light ON */
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) | 0x02);
+ } else {
+ /* Back-Light OFF */
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) & 0xFD);
+ usleep(TD3);
+
+ /* VEE OFF (unused on vt3353)*/
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) & 0xFB);
+ usleep(TD2);
+
+ /* DATA OFF */
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) & 0xF7);
+ usleep(TD1);
+
+ /* VDD OFF */
+ hwp->writeCrtc(hwp, 0x91, hwp->readCrtc(hwp, 0x91) & 0xEF);
+ }
+}
+
+static void
+ViaLVDSSoftwarePowerSecondSequence(ScrnInfoPtr pScrn, Bool on)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaLVDSSoftwarePowerSecondSequence: %d\n", on));
+ if (on) {
+ /* Secondary power hardware power sequence enable 0:off 1: on */
+ hwp->writeCrtc(hwp, 0xD4, hwp->readCrtc(hwp, 0xD4) & 0xFD);
+
+ /* Software control power sequence ON */
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) | 0x01);
+ usleep(TD0);
+
+ /* VDD ON*/
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) | 0x10);
+ usleep(TD1);
+
+ /* DATA ON */
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) | 0x08);
+ usleep(TD2);
+
+ /* VEE ON (unused on vt3353)*/
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) | 0x04);
+ usleep(TD3);
+
+ /* Back-Light ON */
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) | 0x02);
+ } else {
+ /* Back-Light OFF */
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) & 0xFD);
+ usleep(TD3);
+
+ /* VEE OFF */
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) & 0xFB);
+ /* Delay TD2 msec. */
+ usleep(TD2);
+
+ /* DATA OFF */
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) & 0xF7);
+ /* Delay TD1 msec. */
+ usleep(TD1);
+
+ /* VDD OFF */
+ hwp->writeCrtc(hwp, 0xD3, hwp->readCrtc(hwp, 0xD3) & 0xEF);
+ }
+}
+
+
+static void
+ViaLVDSHardwarePowerFirstSequence(ScrnInfoPtr pScrn, Bool on)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -59,7 +170,7 @@ ViaLVDSPowerFirstSequence(ScrnInfoPtr pScrn, Bool on)
}
static void
-ViaLVDSPowerSecondSequence(ScrnInfoPtr pScrn, Bool on)
+ViaLVDSHardwarePowerSecondSequence(ScrnInfoPtr pScrn, Bool on)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -83,15 +194,10 @@ static void
ViaLVDSDFPPower(ScrnInfoPtr pScrn, Bool on)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
- if (on) {
- /* Turn DFP High/Low pad on. */
- hwp->writeSeq(hwp, 0x2A, hwp->readSeq(hwp, 0x2A) | 0x0F);
- } else {
- /* Turn DFP High/Low pad off. */
- hwp->writeSeq(hwp, 0x2A, hwp->readSeq(hwp, 0x2A) & 0xF0);
-
- }
+ /* Switch DFP High/Low pads on or off for channels active at EnterVT(). */
+ ViaSeqMask(hwp, 0x2A, on ? pVia->SavedReg.SR2A : 0, 0x0F);
}
static void
@@ -114,9 +220,24 @@ ViaLVDSPowerChannel(ScrnInfoPtr pScrn, Bool on)
void
ViaLVDSPower(ScrnInfoPtr pScrn, Bool on)
{
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaLVDSPower\n"));
- ViaLVDSPowerFirstSequence(pScrn, on);
- ViaLVDSPowerSecondSequence(pScrn, on);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaLVDSPower %d\n", on));
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ /*
+ * VX800, CX700 have HW issue, so we'd better use SW power sequence
+ * Fix Ticket #308
+ */
+ switch (pVia->Chipset) {
+ case VIA_VX800:
+ case VIA_CX700:
+ ViaLVDSSoftwarePowerFirstSequence(pScrn, on);
+ ViaLVDSSoftwarePowerSecondSequence(pScrn, on);
+ break;
+ default:
+ ViaLVDSHardwarePowerFirstSequence(pScrn, on);
+ ViaLVDSHardwarePowerSecondSequence(pScrn, on);
+ }
+
ViaLVDSDFPPower(pScrn, on);
ViaLVDSPowerChannel(pScrn, on);
}
diff --git a/driver/xf86-video-openchrome/src/via_mode.c b/driver/xf86-video-openchrome/src/via_mode.c
index 1d8c9566c..7b845623c 100644
--- a/driver/xf86-video-openchrome/src/via_mode.c
+++ b/driver/xf86-video-openchrome/src/via_mode.c
@@ -39,6 +39,7 @@
#include "via_driver.h"
#include "via_vgahw.h"
#include "via_id.h"
+#include <unistd.h>
/*
* Modetable nonsense.
@@ -250,6 +251,10 @@ ViaTVSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
if (pBIOSInfo->TVModeCrtc)
pBIOSInfo->TVModeCrtc(pScrn, mode);
+
+ /* TV reset. */
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x1D, 0x00);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x1D, 0x80);
}
void
@@ -299,7 +304,7 @@ ViaDFPDetect(ScrnInfoPtr pScrn)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDFPDetect\n"));
VIAPtr pVia = VIAPTR(pScrn);
- VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+
xf86MonPtr monPtr = NULL;
if (pVia->pI2CBus2)
@@ -371,17 +376,20 @@ ViaOutputsDetect(ScrnInfoPtr pScrn)
}
}
- if ((pVia->Chipset == VIA_CX700) || (pVia->Chipset == VIA_VX800)) {
-
- if (ViaDFPDetect(pScrn)) {
- pBIOSInfo->DfpPresent = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "DFP is connected.\n");
- } else {
- pBIOSInfo->DfpPresent = FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "DFP is disconnected.\n");
- }
+ switch (pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_VX800:
+ case VIA_VX855:
+ if (ViaDFPDetect(pScrn)) {
+ pBIOSInfo->DfpPresent = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "DFP is connected.\n");
+ } else {
+ pBIOSInfo->DfpPresent = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "DFP is disconnected.\n");
+ }
+ break;
}
}
@@ -491,6 +499,8 @@ ViaOutputsSelect(ScrnInfoPtr pScrn)
pBIOSInfo->CrtPresent = TRUE;
pBIOSInfo->CrtActive = TRUE;
}
+ if (pBIOSInfo->TVActive)
+ pBIOSInfo->FirstCRTC->IsActive = TRUE ;
}
if (!pVia->UseLegacyModeSwitch) {
if (pBIOSInfo->CrtActive)
@@ -499,8 +509,14 @@ ViaOutputsSelect(ScrnInfoPtr pScrn)
pBIOSInfo->FirstCRTC->IsActive = TRUE ;
if (pBIOSInfo->Panel->IsActive) {
pVia->pBIOSInfo->SecondCRTC->IsActive = TRUE ;
- if (pVia->Chipset == VIA_P4M900 || pVia->Chipset == VIA_CX700 || pVia->Chipset == VIA_VX800 )
- pVia->pBIOSInfo->Lvds->IsActive = TRUE ;
+ switch (pVia->Chipset) {
+ case VIA_P4M900:
+ case VIA_CX700:
+ case VIA_VX800:
+ case VIA_VX855:
+ pVia->pBIOSInfo->Lvds->IsActive = TRUE ;
+ break;
+ }
}
}
@@ -536,13 +552,14 @@ VIAGetPanelSize(ScrnInfoPtr pScrn)
int height = 0;
Bool ret;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSize\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSize (UseLegacyModeSwitch)\n"));
ret = ViaPanelGetSizeFromDDCv1(pScrn, &width, &height);
if (!ret)
ret = ViaPanelGetSizeFromDDCv2(pScrn, &width);
if (ret) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID returned resolution %d x %d \n", width, height));
switch (width) {
case 640:
pBIOSInfo->Panel->NativeModeIndex = VIA_PANEL6X4;
@@ -571,6 +588,7 @@ VIAGetPanelSize(ScrnInfoPtr pScrn)
}
} else {
pBIOSInfo->Panel->NativeModeIndex = hwp->readCrtc(hwp, 0x3F) >> 4;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Unable to get information from EDID. Resolution from Scratchpad: %d \n", pBIOSInfo->Panel->NativeModeIndex));
if (pBIOSInfo->Panel->NativeModeIndex == 0) {
/* VIA_PANEL6X4 == 0, but that value equals unset */
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to "
@@ -665,13 +683,6 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
}
- if ((mode->PrivSize != sizeof(struct ViaModePriv))
- || (mode->Private != (void *)&ViaPanelPrivate)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "ViaPanelGetIndex: Mode not supported by Panel.\n");
- return FALSE;
- }
-
if (!ViaGetResolutionIndex(pScrn, mode)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel does not support this"
" resolution: %s\n", mode->name);
@@ -681,8 +692,8 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
for (i = 0; ViaResolutionTable[i].Index != VIA_RES_INVALID; i++) {
if (ViaResolutionTable[i].PanelIndex
== pBIOSInfo->Panel->NativeModeIndex) {
- pBIOSInfo->panelX = ViaResolutionTable[i].X;
- pBIOSInfo->panelY = ViaResolutionTable[i].Y;
+ pBIOSInfo->Panel->NativeMode->Width = ViaResolutionTable[i].X;
+ pBIOSInfo->Panel->NativeMode->Height = ViaResolutionTable[i].Y;
break;
}
}
@@ -693,8 +704,8 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
return FALSE;
}
- if ((pBIOSInfo->panelX != mode->CrtcHDisplay)
- || (pBIOSInfo->panelY != mode->CrtcVDisplay)) {
+ if ((pBIOSInfo->Panel->NativeMode->Width != mode->CrtcHDisplay)
+ || (pBIOSInfo->Panel->NativeMode->Height != mode->CrtcVDisplay)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Non-native"
" resolutions are broken.\n");
return FALSE;
@@ -719,7 +730,7 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
pBIOSInfo->PanelIndex = i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex:"
"index: %d (%dx%d)\n", pBIOSInfo->PanelIndex,
- pBIOSInfo->panelX, pBIOSInfo->panelY));
+ pBIOSInfo->Panel->NativeMode->Width, pBIOSInfo->Panel->NativeMode->Height));
return TRUE;
}
@@ -832,7 +843,7 @@ ViaGetMemoryBandwidth(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetMemoryBandwidth\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaGetMemoryBandwidth. Memory type: %d\n", pVia->MemClk));
switch (pVia->MemClk) {
case VIA_MEM_SDR66:
@@ -873,7 +884,7 @@ ViaValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
if (pVia->pVbe)
return MODE_OK;
- DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "ViaValidMode: Validating %s (%d)\n",
+ DEBUG(xf86DrvMsg(scrnIndex, X_INFO, "ViaValidMode: Validating %s (Clock: %d)\n",
mode->name, mode->Clock));
if (mode->Flags & V_INTERLACE)
@@ -968,22 +979,47 @@ ViaSetUseExternalClock(vgaHWPtr hwp)
*
*/
static void
-ViaSetPrimaryDotclock(ScrnInfoPtr pScrn, CARD32 clock)
+ViaSetDotclock(ScrnInfoPtr pScrn, CARD32 clock, int base, int probase)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO,
- "ViaSetPrimaryDotclock to 0x%06x\n", (unsigned)clock));
+ "ViaSetDotclock to 0x%06x\n", (unsigned)clock));
if ((pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400)) {
- hwp->writeSeq(hwp, 0x46, clock >> 8);
- hwp->writeSeq(hwp, 0x47, clock & 0xFF);
+ hwp->writeSeq(hwp, base, clock >> 8);
+ hwp->writeSeq(hwp, base+1, clock & 0xFF);
} else { /* unichrome pro */
- hwp->writeSeq(hwp, 0x44, clock >> 16);
- hwp->writeSeq(hwp, 0x45, (clock >> 8) & 0xFF);
- hwp->writeSeq(hwp, 0x46, clock & 0xFF);
+ union pllparams pll;
+ int dtz, dr, dn, dm;
+ pll.packed = clock;
+ dtz = pll.params.dtz;
+ dr = pll.params.dr;
+ dn = pll.params.dn;
+ dm = pll.params.dm;
+
+ /* The VX855 does not modify dm/dn, but earlier chipsets do. */
+ if (pVia->Chipset != VIA_VX855) {
+ dm -= 2;
+ dn -= 2;
+ }
+
+ hwp->writeSeq(hwp, probase, dm & 0xff);
+ hwp->writeSeq(hwp, probase+1, ((dm >> 8) & 0x03) | (dr << 2) | ((dtz & 1) << 7));
+ hwp->writeSeq(hwp, probase+2, (dn & 0x7f) | ((dtz & 2) << 6));
}
+}
+
+/*
+ *
+ */
+static void
+ViaSetPrimaryDotclock(ScrnInfoPtr pScrn, CARD32 clock)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ ViaSetDotclock(pScrn, clock, 0x46, 0x44);
ViaSeqMask(hwp, 0x40, 0x02, 0x02);
ViaSeqMask(hwp, 0x40, 0x00, 0x02);
@@ -996,25 +1032,24 @@ static void
ViaSetSecondaryDotclock(ScrnInfoPtr pScrn, CARD32 clock)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAPtr pVia = VIAPTR(pScrn);
- DEBUG(xf86DrvMsg(hwp->pScrn->scrnIndex, X_INFO,
- "ViaSetSecondaryDotclock to 0x%06x\n", (unsigned)clock));
-
- if ((pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400)) {
- hwp->writeSeq(hwp, 0x44, clock >> 8);
- hwp->writeSeq(hwp, 0x45, clock & 0xFF);
- } else { /* unichrome pro */
- hwp->writeSeq(hwp, 0x4A, clock >> 16);
- hwp->writeSeq(hwp, 0x4B, (clock >> 8) & 0xFF);
- hwp->writeSeq(hwp, 0x4C, clock & 0xFF);
- }
+ ViaSetDotclock(pScrn, clock, 0x44, 0x4A);
ViaSeqMask(hwp, 0x40, 0x04, 0x04);
ViaSeqMask(hwp, 0x40, 0x00, 0x04);
}
/*
+ *
+ */
+static void
+ViaSetECKDotclock(ScrnInfoPtr pScrn, CARD32 clock)
+{
+ /* Does the non-pro chip have an ECK clock ? */
+ ViaSetDotclock(pScrn, clock, 0, 0x47);
+}
+
+/*
* Broken, only does native mode decently. I (Luc) personally broke this.
*/
static void
@@ -1065,8 +1100,8 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
ViaVgahwWrite(hwp, 0x300 + port, offset, 0x301 + port, data);
}
- if ((mode->CrtcHDisplay != pBIOSInfo->panelX)
- || (mode->CrtcVDisplay != pBIOSInfo->panelY)) {
+ if ((mode->CrtcHDisplay != pBIOSInfo->Panel->NativeMode->Width)
+ || (mode->CrtcVDisplay != pBIOSInfo->Panel->NativeMode->Height)) {
VIALCDModeEntryPtr Main;
VIALCDMPatchEntryPtr Patch1, Patch2;
int numPatch1, numPatch2;
@@ -1162,7 +1197,7 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
for (i = 0; i < numPatch2; i++, Patch2++) {
if (Patch2->Mode == modeNum) {
if (!pBIOSInfo->Center
- && (mode->CrtcHDisplay == pBIOSInfo->panelX))
+ && (mode->CrtcHDisplay == pBIOSInfo->Panel->NativeMode->Width))
pBIOSInfo->scaleY = FALSE;
for (j = 0; j < Patch2->numEntry; j++) {
@@ -1247,7 +1282,7 @@ VIASetLCDMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
static CARD32
ViaComputeDotClock(unsigned clock)
{
- double fvco, fout, fref, err, minErr;
+ double fout, fref, err, minErr;
CARD32 dr, dn, dm, maxdm, maxdn;
CARD32 factual, best;
@@ -1281,15 +1316,16 @@ ViaComputeProDotClock(unsigned clock)
{
double fvco, fout, fref, err, minErr;
CARD32 dr = 0, dn, dm, maxdm, maxdn;
- CARD32 factual, bestClock;
-
+ CARD32 factual;
+ union pllparams bestClock;
+
fref = 14.318e6;
fout = (double)clock * 1.e3;
factual = ~0;
- maxdm = factual / 14318000U - 2;
+ maxdm = factual / 14318000U;
minErr = 1.e10;
- bestClock = 0U;
+ bestClock.packed = 0U;
do {
fvco = fout * (1 << dr);
@@ -1300,30 +1336,31 @@ ViaComputeProDotClock(unsigned clock)
}
if (clock < 30000)
- maxdn = 6;
+ maxdn = 8;
else if (clock < 45000)
- maxdn = 5;
+ maxdn = 7;
else if (clock < 170000)
- maxdn = 4;
+ maxdn = 6;
else
- maxdn = 3;
+ maxdn = 5;
- for (dn = 0; dn < maxdn; ++dn) {
- for (dm = 0; dm < maxdm; ++dm) {
- factual = 14318000U * (dm + 2);
- factual /= (dn + 2) << dr;
+ for (dn = 2; dn < maxdn; ++dn) {
+ for (dm = 2; dm < maxdm; ++dm) {
+ factual = 14318000U * dm;
+ factual /= dn << dr;
if ((err = fabs((double)factual / fout - 1.)) < 0.005) {
if (err < minErr) {
minErr = err;
- bestClock = ((dm & 0xff) << 16) |
- (((1 << 7) | (dr << 2) | ((dm & 0x300) >> 8)) << 8)
- | (dn & 0x7f);
+ bestClock.params.dtz = 1;
+ bestClock.params.dr = dr;
+ bestClock.params.dn = dn;
+ bestClock.params.dm = dm;
}
}
}
}
- return bestClock;
+ return bestClock.packed;
}
/*
@@ -1348,12 +1385,13 @@ ViaModeDotClockTranslate(ScrnInfoPtr pScrn, DisplayModePtr mode)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"ViaComputeDotClock %d : %04x : %04x\n",
- mode->Clock, best1, best2));
+ mode->Clock, (unsigned int)best1, (unsigned int)best2));
+
return best2;
} else {
for (i = 0; ViaDotClocks[i].DotClock; i++)
if (ViaDotClocks[i].DotClock == mode->Clock)
- return ViaDotClocks[i].UniChromePro;
+ return ViaDotClocks[i].UniChromePro.packed;
return ViaComputeProDotClock(mode->Clock);
}
@@ -1370,7 +1408,7 @@ ViaModePrimaryLegacy(ScrnInfoPtr pScrn, DisplayModePtr mode)
VIAPtr pVia = VIAPTR(pScrn);
VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModePrimary\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModePrimaryLegacy\n"));
DEBUG(ViaPrintMode(pScrn, mode));
/* Turn off Screen */
@@ -1449,7 +1487,7 @@ ViaModeSecondaryLegacy(ScrnInfoPtr pScrn, DisplayModePtr mode)
VIAPtr pVia = VIAPTR(pScrn);
VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeSecondary\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeSecondaryLegacy\n"));
DEBUG(ViaPrintMode(pScrn, mode));
/* Turn off Screen */
@@ -1557,15 +1595,16 @@ ViaDFPPower(ScrnInfoPtr pScrn, Bool On)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDFPPower: Off.\n");
#endif
vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAPtr pVia = VIAPTR(pScrn);
- VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
/* Display Channel Select */
ViaCrtcMask(hwp, 0xD2, 0x30, 0x30);
- /* Power on TMDS */
- ViaCrtcMask(hwp, 0xD2, 0x00, 0x08);
-
+ if (On)
+ /* Power on TMDS */
+ ViaCrtcMask(hwp, 0xD2, 0x00, 0x08);
+ else
+ /* Power off TMDS */
+ ViaCrtcMask(hwp, 0xD2, 0x08, 0x08);
}
@@ -1584,6 +1623,20 @@ ViaModeFirstCRTC(ScrnInfoPtr pScrn, DisplayModePtr mode)
pBIOSInfo->Clock = ViaModeDotClockTranslate(pScrn, mode);
pBIOSInfo->ClockExternal = FALSE;
+ /* Enable MMIO & PCI burst (1 wait state) */
+ switch (pVia->Chipset) {
+ case VIA_CLE266:
+ case VIA_KM400:
+ case VIA_K8M800:
+ case VIA_PM800:
+ case VIA_VM800:
+ ViaSeqMask(hwp, 0x1A, 0x06, 0x06);
+ break;
+ default:
+ ViaSeqMask(hwp, 0x1A, 0x0C, 0x0C);
+ break;
+ }
+
ViaSetPrimaryFIFO(pScrn, mode);
ViaSetPrimaryDotclock(pScrn, pBIOSInfo->Clock);
@@ -1668,6 +1721,13 @@ ViaModeSet(ScrnInfoPtr pScrn, DisplayModePtr mode)
ViaDisplaySetStreamOnDFP(pScrn, TRUE);
ViaDFPPower(pScrn, TRUE);
}
+
+ if (pBIOSInfo->TVActive) {
+ /* TV on FirstCrtc */
+ ViaDisplaySetStreamOnDVO(pScrn, pBIOSInfo->TVDIPort, TRUE);
+ ViaDisplayEnableDVO(pScrn, pBIOSInfo->TVDIPort);
+ ViaTVSetMode(pScrn, mode);
+ }
ViaModeFirstCRTC(pScrn, mode);
} else {
diff --git a/driver/xf86-video-openchrome/src/via_mode.h b/driver/xf86-video-openchrome/src/via_mode.h
index 2d197f86a..826df7fce 100644
--- a/driver/xf86-video-openchrome/src/via_mode.h
+++ b/driver/xf86-video-openchrome/src/via_mode.h
@@ -35,7 +35,16 @@
#define VIA_BW_DDR400 498000000 /* > 1920x1080@60Hz@32bpp */
#define VIA_BW_DDR667 922000000
-
+union pllparams {
+ struct {
+ CARD32 dtz : 2;
+ CARD32 dr : 3;
+ CARD32 dn : 7;
+ CARD32 dm :10;
+ } params;
+ CARD32 packed;
+};
+
/*
* simple lookup table for dotclocks
*
@@ -43,51 +52,52 @@
static struct ViaDotClock {
int DotClock;
CARD16 UniChrome;
- CARD32 UniChromePro;
+ union pllparams UniChromePro;
} ViaDotClocks[] = {
- { 25200, 0x513C, 0xa79004 },
- { 25312, 0xC763, 0xc49005 },
- { 26591, 0x471A, 0xce9005 },
- { 31500, 0xC558, 0xae9003 },
- { 31704, 0x471F, 0xaf9002 },
- { 32663, 0xC449, 0x479000 },
- { 33750, 0x4721, 0x959002 },
- { 35500, 0x5877, 0x759001 },
- { 36000, 0x5879, 0x9f9002 },
- { 39822, 0xC459, 0x578c02 },
- { 40000, 0x515F, 0x848c04 },
- { 41164, 0x4417, 0x2c8c00 },
- { 46981, 0x5069, 0x678c02 },
- { 49500, 0xC353, 0xa48c04 },
- { 50000, 0xC354, 0x368c00 },
- { 56300, 0x4F76, 0x3d8c00 },
- { 57284, 0x4E70, 0x3e8c00 },
- { 64995, 0x0D3B, 0x6b8c01 },
- { 65000, 0x0D3B, 0x6b8c01 }, /* Slightly unstable on PM800 */
- { 65028, 0x866D, 0x6b8c01 },
- { 74480, 0x156E, 0x288800 },
- { 75000, 0x156E, 0x288800 },
- { 78800, 0x442C, 0x2a8800 },
- { 81135, 0x0622, 0x428801 },
- { 81613, 0x4539, 0x708803 },
- { 94500, 0x4542, 0x4d8801 },
- { 108000, 0x0B53, 0x778802 },
- { 108280, 0x4879, 0x778802 },
- { 122000, 0x0D6F, 0x428800 },
- { 122726, 0x073C, 0x878802 },
- { 135000, 0x0742, 0x6f8801 },
- { 148500, 0x0853, 0x518800 },
- { 155800, 0x0857, 0x558402 },
- { 157500, 0x422C, 0x2a8400 },
- { 161793, 0x4571, 0x6f8403 },
- { 162000, 0x0A71, 0x6f8403 },
- { 175500, 0x4231, 0x2f8400 },
- { 189000, 0x0542, 0x4d8401 },
- { 202500, 0x0763, 0x6F8402 },
- { 204800, 0x0764, 0x548401 },
- { 218300, 0x043D, 0x3b8400 },
- { 229500, 0x0660, 0x3e8400 }, /* Not tested on Pro */
- { 0, 0, 0 }
+ { 25200, 0x513C, /* 0xa79004 */ { 1, 4, 6, 169 } },
+ { 25312, 0xC763, /* 0xc49005 */ { 1, 4, 7, 198 } },
+ { 26591, 0x471A, /* 0xce9005 */ { 1, 4, 7, 208 } },
+ { 31500, 0xC558, /* 0xae9003 */ { 1, 4, 5, 176 } },
+ { 31704, 0x471F, /* 0xaf9002 */ { 1, 4, 4, 177 } },
+ { 32663, 0xC449, /* 0x479000 */ { 1, 4, 2, 73 } },
+ { 33750, 0x4721, /* 0x959002 */ { 1, 4, 4, 151 } },
+ { 35500, 0x5877, /* 0x759001 */ { 1, 4, 3, 119 } },
+ { 36000, 0x5879, /* 0x9f9002 */ { 1, 4, 4, 161 } },
+ { 39822, 0xC459, /* 0x578c02 */ { 1, 3, 4, 89 } },
+ { 40000, 0x515F, /* 0x848c04 */ { 1, 3, 6, 134 } },
+ { 41164, 0x4417, /* 0x2c8c00 */ { 1, 3, 2, 46 } },
+ { 46981, 0x5069, /* 0x678c02 */ { 1, 3, 4, 105 } },
+ { 49500, 0xC353, /* 0xa48c04 */ { 3, 3, 5, 138 } },
+ { 50000, 0xC354, /* 0x368c00 */ { 1, 3, 2, 56 } },
+ { 56300, 0x4F76, /* 0x3d8c00 */ { 1, 3, 2, 63 } },
+ { 57275, 0, /* 0x3e8c00 */ { 1, 3, 5, 157 } }, /* For XO 1.5 no need for a unichrome clock */
+ { 57284, 0x4E70, /* 0x3e8c00 */ { 1, 3, 2, 64 } },
+ { 64995, 0x0D3B, /* 0x6b8c01 */ { 1, 3, 3, 109 } },
+ { 65000, 0x0D3B, /* 0x6b8c01 */ { 1, 3, 3, 109 } }, /* Slightly unstable on PM800 */
+ { 65028, 0x866D, /* 0x6b8c01 */ { 1, 3, 3, 109 } },
+ { 74480, 0x156E, /* 0x288800 */ { 1, 2, 2, 42 } },
+ { 75000, 0x156E, /* 0x288800 */ { 1, 2, 2, 42 } },
+ { 78800, 0x442C, /* 0x2a8800 */ { 1, 2, 2, 44 } },
+ { 81135, 0x0622, /* 0x428801 */ { 1, 2, 3, 68 } },
+ { 81613, 0x4539, /* 0x708803 */ { 1, 2, 5, 114 } },
+ { 94500, 0x4542, /* 0x4d8801 */ { 1, 2, 3, 79 } },
+ { 108000, 0x0B53, /* 0x778802 */ { 1, 2, 4, 121 } },
+ { 108280, 0x4879, /* 0x778802 */ { 1, 2, 4, 121 } },
+ { 122000, 0x0D6F, /* 0x428800 */ { 1, 2, 2, 68 } },
+ { 122726, 0x073C, /* 0x878802 */ { 1, 2, 4, 137 } },
+ { 135000, 0x0742, /* 0x6f8801 */ { 1, 2, 3, 113 } },
+ { 148500, 0x0853, /* 0x518800 */ { 1, 2, 2, 83 } },
+ { 155800, 0x0857, /* 0x558402 */ { 1, 1, 4, 87 } },
+ { 157500, 0x422C, /* 0x2a8400 */ { 1, 1, 2, 44 } },
+ { 161793, 0x4571, /* 0x6f8403 */ { 1, 1, 5, 113 } },
+ { 162000, 0x0A71, /* 0x6f8403 */ { 1, 1, 5, 113 } },
+ { 175500, 0x4231, /* 0x2f8400 */ { 1, 1, 2, 49 } },
+ { 189000, 0x0542, /* 0x4d8401 */ { 1, 1, 3, 79 } },
+ { 202500, 0x0763, /* 0x6F8402 */ { 1, 1, 4, 113 } },
+ { 204800, 0x0764, /* 0x548401 */ { 1, 1, 3, 86 } },
+ { 218300, 0x043D, /* 0x3b8400 */ { 1, 1, 2, 61 } },
+ { 229500, 0x0660, /* 0x3e8400 */ { 1, 1, 2, 64 } }, /* Not tested on Pro } */
+ { 0, 0, { 0, 0, 0, 0 } }
};
/*
@@ -126,6 +136,8 @@ static DisplayModeRec ViaPanelModes[] = {
{ MODEPREFIX("1152x864"), 81613, 1152, 1216, 1336, 1520, 0, 864, 864, 867, 895, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX },
{ MODEPREFIX("1280x768"), 81135, 1280, 1328, 1440, 1688, 0, 768, 770, 776, 802, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX },
{ MODEPREFIX("1280x720"), 74600, 1280, 1341, 1474, 1688, 0, 720, 721, 724, 746, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX },
+ { MODEPREFIX("1280x800"), 83500, 1280, 1352, 1480, 1680, 0, 800, 803, 809, 831, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX },
+ { MODEPREFIX("1200x900"), 57275, 1200, 1208, 1216, 1240, 0, 900, 905, 908, 912, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX },
{ MODEPREFIX("1280x960"), 108280, 1280, 1376, 1488, 1800, 0, 960, 960, 963, 1000, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX },
{ MODEPREFIX("1280x1024"), 108280, 1280, 1328, 1440, 1688, 0, 1024, 1024, 1027, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX },
{ MODEPREFIX("1360x768"), 85500, 1360, 1392, 1712, 1744, 0, 768, 783, 791, 807, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX },
@@ -159,6 +171,7 @@ static DisplayModeRec ViaPanelModes[] = {
#define VIA_RES_1280X720 19
#define VIA_RES_1920X1080 20
#define VIA_RES_1366X768 22
+#define VIA_RES_1200X900 23
#define VIA_RES_INVALID 0xFF
/*
@@ -190,6 +203,7 @@ static struct {
{VIA_RES_856X480, VIA_PANEL_INVALID, 856, 480},
{VIA_RES_1024X576, VIA_PANEL_INVALID, 1024, 576},
{VIA_RES_800X480, VIA_PANEL8X4, 800, 480},
+ {VIA_RES_1200X900, VIA_PANEL12X9, 1200, 900},
{VIA_RES_INVALID, VIA_PANEL_INVALID, 0, 0}
};
diff --git a/driver/xf86-video-openchrome/src/via_panel.c b/driver/xf86-video-openchrome/src/via_panel.c
index 34ecdeb2b..322cda170 100644
--- a/driver/xf86-video-openchrome/src/via_panel.c
+++ b/driver/xf86-video-openchrome/src/via_panel.c
@@ -45,16 +45,20 @@ static ViaPanelModeRec ViaPanelNativeModes[] = {
{1280, 768},
{1280, 1024},
{1400, 1050},
- {1600, 1200},
- {1280, 800},
- {800, 480},
- {1366, 768},
- {1360, 768},
+ {1600, 1200}, /* 0x6 Resolution 1440x900 */
+ {1280, 800}, /* 0x7 Resolution 1280x800 (Samsung NC20) */
+ {800, 480}, /* 0x8 For Quanta 800x480 */
+ {1024, 600}, /* 0x9 Resolution 1024x600 (for HP 2133) */
+ {1366, 768}, /* 0xA Resolution 1366x768 */
{1920, 1080},
{1920, 1200},
- {1024, 600},
- {1440, 900},
- {1280, 720}
+ {1280, 1024}, /* 0xD Need to be fixed to 1920x1200 */
+ {1440, 900}, /* 0xE Need to be fixed to 640x240 */
+ {1280, 720}, /* 0xF 480x640 */
+ {1200, 900}, /* 0x10 For Panasonic 1280x768 18bit Dual-Channel Panel */
+ {1360, 768}, /* 0x11 Resolution 1360X768 */
+ {1024, 768}, /* 0x12 Resolution 1024x768 */
+ {800, 480} /* 0x13 General 8x4 panel use this setting */
};
static int
@@ -63,6 +67,7 @@ ViaPanelLookUpModeIndex(int width, int height)
int i, index = VIA_PANEL_INVALID;
int length = sizeof(ViaPanelNativeModes) / sizeof(ViaPanelModeRec);
+
for (i = 0; i < length; i++) {
if (ViaPanelNativeModes[i].Width == width
&& ViaPanelNativeModes[i].Height == height) {
@@ -283,10 +288,13 @@ ViaPanelPreInit(ScrnInfoPtr pScrn)
*/
if (ret) {
panel->NativeModeIndex = ViaPanelLookUpModeIndex(width, height);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelLookUpModeIndex, Width %d, Height %d, NativeModeIndex%d\n", width, height, panel->NativeModeIndex));
if (panel->NativeModeIndex != VIA_PANEL_INVALID) {
panel->NativeMode->Width = width;
panel->NativeMode->Height = height;
}
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Unable to get panel size from EDID. Return code: %d\n", ret);
}
}
@@ -378,6 +386,7 @@ ViaPanelGetSizeFromEDID(ScrnInfoPtr pScrn, xf86MonPtr pMon,
Bool
ViaPanelGetSizeFromDDCv1(ScrnInfoPtr pScrn, int *width, int *height)
+
{
VIAPtr pVia = VIAPTR(pScrn);
xf86MonPtr pMon;
diff --git a/driver/xf86-video-openchrome/src/via_shadow.c b/driver/xf86-video-openchrome/src/via_shadow.c
index 56ba22483..ca416c105 100644
--- a/driver/xf86-video-openchrome/src/via_shadow.c
+++ b/driver/xf86-video-openchrome/src/via_shadow.c
@@ -31,6 +31,9 @@
#include "shadowfb.h"
#include "servermd.h"
+/* RandR support */
+#include "xf86RandR12.h"
+
static void
VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
@@ -59,6 +62,85 @@ VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
}
}
+void
+VIARefreshArea_UD(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ int width, height, Bpp, FBPitch;
+ unsigned char *src, *dst;
+ int i;
+
+ Bpp = pScrn->bitsPerPixel >> 3;
+ FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel);
+
+ while (num--) {
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+ dst = pVia->FBBase + ((pScrn->virtualY - 1 - pbox->y1) * FBPitch) + ((pScrn->virtualX - 1 - pbox->x1) * Bpp);
+ src = pVia->ShadowPtr + (pbox->y1 * pVia->ShadowPitch) +
+ (pbox->x1 * Bpp);
+
+
+ switch(pScrn->bitsPerPixel) {
+ case 8:
+ while (height--) {
+ for(i=0; i<width; i++) {
+ *(dst-i)=*(src+i);
+ }
+ dst -= FBPitch;
+ src += pVia->ShadowPitch;
+ }
+ break;
+ case 16:
+ while (height--) {
+ /* TODO Faster method - need test
+ for(i=0; i<width*2; i=i+2) {
+ *(CARD16 *)(dst-i)=*(CARD16 *)(src+i);
+ }
+ */
+ for(i=0; i<width; i++) {
+ *(CARD16 *)(dst-i*2)=*(CARD16 *)(src+i*2);
+ }
+ dst -= FBPitch;
+ src += pVia->ShadowPitch;
+ }
+ break;
+ case 24:
+ while (height--) {
+ /* TODO Faster method - need test
+ for(i=0; i<width*3; i=i+3) {
+ *(CARD16 *)(dst-i)=*(CARD16 *)(src+i);
+ *(dst-i+2)=*(src+i+2);
+ }
+ */
+ for(i=0; i<width*3; i=i+3) {
+ *(dst-i)=*(src+i);
+ *(dst-i+1)=*(src+i+1);
+ *(dst-i+2)=*(src+i+2);
+ }
+ dst -= FBPitch;
+ src += pVia->ShadowPitch;
+ }
+ break;
+ case 32:
+ while (height--) {
+ /* TODO Faster method - need test
+ for(i=0; i<width*4; i=i+4) {
+ *(CARD32 *)(dst-i)=*(CARD32 *)(src+i);
+ }
+ */
+ for(i=0; i<width; i++) {
+ *(CARD32 *)(dst-i*4)=*(CARD32 *)(src+i*4);
+ }
+ dst -= FBPitch;
+ src += pVia->ShadowPitch;
+ }
+ break;
+ }
+ pbox++;
+ }
+}
+
static void
VIAPointerMoved(int index, int x, int y)
{
@@ -66,12 +148,15 @@ VIAPointerMoved(int index, int x, int y)
VIAPtr pVia = VIAPTR(pScrn);
int newX, newY;
- if (pVia->rotate == 1) {
+ if (pVia->rotate == RR_Rotate_90) {
newX = pScrn->pScreen->height - y - 1;
newY = x;
- } else {
+ } else if (pVia->rotate == RR_Rotate_270) {
newX = y;
newY = pScrn->pScreen->width - x - 1;
+ } else {
+ newX = pScrn->pScreen->width - x - 1;
+ newY = pScrn->pScreen->height - y - 1;
}
(*pVia->PointerMoved) (index, newX, newY);
@@ -81,12 +166,29 @@ static void
VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
VIAPtr pVia = VIAPTR(pScrn);
- int count, width, height, y1, y2, dstPitch, srcPitch;
+ int count, width, height, y1, y2, dstPitch, srcPitch, tmpRot;
CARD8 *dstPtr, *srcPtr, *src;
CARD32 *dst;
+ if (pVia->rotate == RR_Rotate_0)
+ {
+ VIARefreshArea(pScrn, num, pbox);
+ return;
+ }
+
+ if (pVia->rotate == RR_Rotate_180) {
+ VIARefreshArea_UD(pScrn, num, pbox);
+ return;
+ }
+
+ if (pVia->rotate == RR_Rotate_90) {
+ tmpRot=1;
+ } else {
+ tmpRot=-1;
+ }
+
dstPitch = pScrn->displayWidth;
- srcPitch = -pVia->rotate * pVia->ShadowPitch;
+ srcPitch = -tmpRot*pVia->ShadowPitch;
while (num--) {
width = pbox->x2 - pbox->x1;
@@ -94,7 +196,7 @@ VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
y2 = (pbox->y2 + 3) & ~3;
height = (y2 - y1) >> 2; /* in dwords */
- if (pVia->rotate == 1) {
+ if (pVia->rotate == RR_Rotate_90) {
dstPtr = (pVia->FBBase
+ (pbox->x1 * dstPitch) + pScrn->virtualX - y2);
srcPtr = pVia->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1;
@@ -116,7 +218,7 @@ VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
src += srcPitch * 4;
}
- srcPtr += pVia->rotate;
+ srcPtr += tmpRot;
dstPtr += dstPitch;
}
@@ -128,12 +230,29 @@ static void
VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
VIAPtr pVia = VIAPTR(pScrn);
- int count, width, height, y1, y2, dstPitch, srcPitch;
+ int count, width, height, y1, y2, dstPitch, srcPitch, tmpRot;
CARD16 *dstPtr, *srcPtr, *src;
CARD32 *dst;
+ if (pVia->rotate == RR_Rotate_0)
+ {
+ VIARefreshArea(pScrn, num, pbox);
+ return;
+ }
+
+ if (pVia->rotate == RR_Rotate_180) {
+ VIARefreshArea_UD(pScrn, num, pbox);
+ return;
+ }
+
+ if (pVia->rotate == RR_Rotate_90) {
+ tmpRot=1;
+ } else {
+ tmpRot=-1;
+ }
+
dstPitch = pScrn->displayWidth;
- srcPitch = -pVia->rotate * pVia->ShadowPitch >> 1;
+ srcPitch = -tmpRot*pVia->ShadowPitch >> 1;
while (num--) {
width = pbox->x2 - pbox->x1;
@@ -141,7 +260,7 @@ VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
y2 = (pbox->y2 + 1) & ~1;
height = (y2 - y1) >> 1; /* in dwords */
- if (pVia->rotate == 1) {
+ if (pVia->rotate == RR_Rotate_90) {
dstPtr = ((CARD16*) pVia->FBBase
+ (pbox->x1 * dstPitch) + pScrn->virtualX - y2);
srcPtr = ((CARD16*) pVia->ShadowPtr
@@ -163,7 +282,7 @@ VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
src += srcPitch * 2;
}
- srcPtr += pVia->rotate;
+ srcPtr += tmpRot;
dstPtr += dstPitch;
}
@@ -177,12 +296,30 @@ void
VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
VIAPtr pVia = VIAPTR(pScrn);
- int count, width, height, y1, y2, dstPitch, srcPitch;
+ int count, width, height, y1, y2, dstPitch, srcPitch, tmpRot;
CARD8 *dstPtr, *srcPtr, *src;
CARD32 *dst;
+ if (pVia->rotate == RR_Rotate_0)
+ {
+ VIARefreshArea(pScrn, num, pbox);
+ return;
+ }
+
+
+ if (pVia->rotate == RR_Rotate_180) {
+ VIARefreshArea_UD(pScrn, num, pbox);
+ return;
+ }
+
+ if (pVia->rotate == RR_Rotate_90) {
+ tmpRot=1;
+ } else {
+ tmpRot=-1;
+ }
+
dstPitch = BitmapBytePad(pScrn->displayWidth * 24);
- srcPitch = -pVia->rotate * pVia->ShadowPitch;
+ srcPitch = -tmpRot * pVia->ShadowPitch;
while (num--) {
width = pbox->x2 - pbox->x1;
@@ -190,7 +327,7 @@ VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
y2 = (pbox->y2 + 3) & ~3;
height = (y2 - y1) >> 2; /* blocks of 3 dwords */
- if (pVia->rotate == 1) {
+ if (pVia->rotate == RR_Rotate_90) {
dstPtr = (pVia->FBBase
+ (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3));
srcPtr = pVia->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3);
@@ -217,7 +354,7 @@ VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
src += srcPitch * 4;
}
- srcPtr += pVia->rotate * 3;
+ srcPtr += tmpRot * 3;
dstPtr += dstPitch;
}
@@ -230,17 +367,33 @@ static void
VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
VIAPtr pVia = VIAPTR(pScrn);
- int count, width, height, dstPitch, srcPitch;
+ int count, width, height, dstPitch, srcPitch, tmpRot;
CARD32 *dstPtr, *srcPtr, *src, *dst;
+ if (pVia->rotate == RR_Rotate_0)
+ {
+ VIARefreshArea(pScrn, num, pbox);
+ return;
+ }
+
+ if (pVia->rotate == RR_Rotate_180) {
+ VIARefreshArea_UD(pScrn, num, pbox);
+ return;
+ }
+
+ if (pVia->rotate == RR_Rotate_90) {
+ tmpRot=1;
+ } else {
+ tmpRot=-1;
+ }
dstPitch = pScrn->displayWidth;
- srcPitch = -pVia->rotate * pVia->ShadowPitch >> 2;
+ srcPitch = -tmpRot * pVia->ShadowPitch >> 2;
while (num--) {
width = pbox->x2 - pbox->x1;
height = pbox->y2 - pbox->y1;
- if (pVia->rotate == 1) {
+ if (pVia->rotate == RR_Rotate_90) {
dstPtr = ((CARD32*) pVia->FBBase
+ (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2);
srcPtr = ((CARD32*) pVia->ShadowPtr
@@ -262,7 +415,7 @@ VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
src += srcPitch;
}
- srcPtr += pVia->rotate;
+ srcPtr += tmpRot;
dstPtr += dstPitch;
}
@@ -276,7 +429,7 @@ ViaShadowFBInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
VIAPtr pVia = VIAPTR(pScrn);
RefreshAreaFuncPtr refreshArea = VIARefreshArea;
- if (pVia->rotate) {
+ if ((pVia->rotate)||(pVia->RandRRotation==TRUE)) {
if (!pVia->PointerMoved) {
pVia->PointerMoved = pScrn->PointerMoved;
pScrn->PointerMoved = VIAPointerMoved;
diff --git a/driver/xf86-video-openchrome/src/via_swov.c b/driver/xf86-video-openchrome/src/via_swov.c
index 52428f9ba..119bbba1c 100644
--- a/driver/xf86-video-openchrome/src/via_swov.c
+++ b/driver/xf86-video-openchrome/src/via_swov.c
@@ -46,6 +46,7 @@
#include "via_id.h"
#include <math.h>
+#include <unistd.h>
/*
* Warning: this file contains revision checks which are CLE266-specific.
@@ -282,6 +283,7 @@ VIAVidHWDiffInit(ScrnInfoPtr pScrn)
HWDiff->dwNeedV1Prefetch = VID_HWDIFF_FALSE;
break;
case VIA_VX800:
+ case VIA_VX855:
HWDiff->dwThreeHQVBuffer = VID_HWDIFF_TRUE;
HWDiff->dwHQVFetchByteUnit = VID_HWDIFF_TRUE;
HWDiff->dwSupportTwoColorKey = VID_HWDIFF_TRUE;
@@ -784,6 +786,7 @@ viaCalculateVideoColor(VIAPtr pVia, int hue, int saturation,
case PCI_CHIP_VT3324:
case PCI_CHIP_VT3327:
case PCI_CHIP_VT3353:
+ case PCI_CHIP_VT3409:
model = 0;
break;
case PCI_CHIP_CLE3122:
@@ -922,6 +925,7 @@ viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness,
case PCI_CHIP_VT3324:
case PCI_CHIP_VT3364:
case PCI_CHIP_VT3353:
+ case PCI_CHIP_VT3409:
case PCI_CHIP_CLE3122:
VIDOutD(V1_ColorSpaceReg_2, col2);
VIDOutD(V1_ColorSpaceReg_1, col1);
@@ -951,6 +955,7 @@ ViaInitVideoStatusFlag(VIAPtr pVia)
case PCI_CHIP_VT3324:
case PCI_CHIP_VT3364:
case PCI_CHIP_VT3353:
+ case PCI_CHIP_VT3409:
return (VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE
| VIDEO_ACTIVE | VIDEO_SHOW);
case PCI_CHIP_CLE3122:
@@ -990,6 +995,8 @@ ViaSetVidCtl(VIAPtr pVia, unsigned int videoFlag)
case PCI_CHIP_VT3364:
case PCI_CHIP_VT3353:
return V3_ENABLE | VIDEO_EXPIRE_NUM_VT3336;
+ case PCI_CHIP_VT3409:
+ return V3_ENABLE | VIDEO_EXPIRE_NUM_VT3409;
case PCI_CHIP_CLE3122:
if (CLE266_REV_IS_CX(pVia->ChipRev))
return V3_ENABLE | V3_EXPIRE_NUM_F;
@@ -1269,24 +1276,28 @@ SetFIFO_V1(VIAPtr pVia, CARD8 depth, CARD8 prethreshold, CARD8 threshold)
static void
SetFIFO_V3(VIAPtr pVia, CARD8 depth, CARD8 prethreshold, CARD8 threshold)
{
- if ((pVia->ChipId == PCI_CHIP_VT3314)
- || (pVia->ChipId == PCI_CHIP_VT3324)
- || (pVia->ChipId == PCI_CHIP_VT3327
- || (pVia->ChipId == PCI_CHIP_VT3353))) {
- SaveVideoRegister(pVia, ALPHA_V3_FIFO_CONTROL,
- (VIDInD(ALPHA_V3_FIFO_CONTROL) & ALPHA_FIFO_MASK)
- | ((depth - 1) & 0xff) | ((threshold & 0xff) << 8));
- SaveVideoRegister(pVia, ALPHA_V3_PREFIFO_CONTROL,
- (VIDInD(ALPHA_V3_PREFIFO_CONTROL)
- & ~V3_FIFO_MASK_3314) | (prethreshold & 0xff));
- } else {
- SaveVideoRegister(pVia, ALPHA_V3_FIFO_CONTROL,
- (VIDInD(ALPHA_V3_FIFO_CONTROL) & ALPHA_FIFO_MASK)
- | ((depth - 1) & 0xff) | ((threshold & 0xff) << 8));
- SaveVideoRegister(pVia, ALPHA_V3_PREFIFO_CONTROL,
- (VIDInD(ALPHA_V3_PREFIFO_CONTROL) & ~V3_FIFO_MASK)
- | (prethreshold & 0x7f));
- }
+ switch (pVia->ChipId) {
+ case PCI_CHIP_VT3314:
+ case PCI_CHIP_VT3324:
+ case PCI_CHIP_VT3327:
+ case PCI_CHIP_VT3353:
+ case PCI_CHIP_VT3409:
+ SaveVideoRegister(pVia, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL) & ALPHA_FIFO_MASK)
+ | ((depth - 1) & 0xff) | ((threshold & 0xff) << 8));
+ SaveVideoRegister(pVia, ALPHA_V3_PREFIFO_CONTROL,
+ (VIDInD(ALPHA_V3_PREFIFO_CONTROL)
+ & ~V3_FIFO_MASK_3314) | (prethreshold & 0xff));
+ break;
+ default :
+ SaveVideoRegister(pVia, ALPHA_V3_FIFO_CONTROL,
+ (VIDInD(ALPHA_V3_FIFO_CONTROL) & ALPHA_FIFO_MASK)
+ | ((depth - 1) & 0xff) | ((threshold & 0xff) << 8));
+ SaveVideoRegister(pVia, ALPHA_V3_PREFIFO_CONTROL,
+ (VIDInD(ALPHA_V3_PREFIFO_CONTROL) & ~V3_FIFO_MASK)
+ | (prethreshold & 0x7f));
+ break;
+ }
}
static void
@@ -1335,6 +1346,7 @@ SetFIFO_V3_64or32or32(VIAPtr pVia)
case PCI_CHIP_VT3324:
case PCI_CHIP_VT3364:
case PCI_CHIP_VT3353:
+ case PCI_CHIP_VT3409:
SetFIFO_V3(pVia, 225, 200, 250);
break;
case PCI_CHIP_VT3204:
@@ -1367,6 +1379,7 @@ SetFIFO_V3_64or32or16(VIAPtr pVia)
case PCI_CHIP_VT3324:
case PCI_CHIP_VT3364:
case PCI_CHIP_VT3353:
+ case PCI_CHIP_VT3409:
SetFIFO_V3(pVia, 225, 200, 250);
break;
case PCI_CHIP_VT3204:
@@ -1640,9 +1653,9 @@ SetVideoWindow(ScrnInfoPtr pScrn, unsigned long videoFlag,
*/
if (videoFlag & VIDEO_1_INUSE) {
if (pBIOSInfo->SetDVI && pBIOSInfo->scaleY) {
- top = (pUpdate->DstTop * pBIOSInfo->panelY
+ top = (pUpdate->DstTop * pBIOSInfo->Panel->NativeMode->Height
/ pScrn->currentMode->VDisplay);
- bottom = (pUpdate->DstBottom * pBIOSInfo->panelY
+ bottom = (pUpdate->DstBottom * pBIOSInfo->Panel->NativeMode->Height
/ pScrn->currentMode->VDisplay);
}
}
@@ -2011,7 +2024,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag,
if (pVia->VideoEngine == VIDEO_ENGINE_CME) {
VIDOutD(HQV_SRC_DATA_OFFSET_CONTROL1,0);
VIDOutD(HQV_SRC_DATA_OFFSET_CONTROL3,((pUpdate->SrcRight - 1 ) << 16) | (pUpdate->SrcBottom - 1));
- if (pVia->Chipset == VIA_VX800) {
+ if (pVia->Chipset == VIA_VX800 || pVia->Chipset == VIA_VX855) {
VIDOutD(HQV_SRC_DATA_OFFSET_CONTROL2,0);
VIDOutD(HQV_SRC_DATA_OFFSET_CONTROL4,((pUpdate->SrcRight - 1 ) << 16) | (pUpdate->SrcBottom - 1));
}
diff --git a/driver/xf86-video-openchrome/src/via_vbe.c b/driver/xf86-video-openchrome/src/via_vbe.c
index c1dd63689..2e3998f6b 100644
--- a/driver/xf86-video-openchrome/src/via_vbe.c
+++ b/driver/xf86-video-openchrome/src/via_vbe.c
@@ -112,7 +112,6 @@ static Bool
ViaVbeSetActiveDevices(ScrnInfoPtr pScrn, int mode, int refresh)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
vbeInfoPtr pVbe = pVia->pVbe;
ViaVbeInitInt10(pVbe);
@@ -140,7 +139,6 @@ static Bool
ViaVbeSetPanelMode(ScrnInfoPtr pScrn, Bool expand)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
vbeInfoPtr pVbe = pVia->pVbe;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVbeSetPanelMode\n"));
@@ -162,7 +160,6 @@ static Bool
ViaVbeSetRefresh(ScrnInfoPtr pScrn, int maxRefresh)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVbeSetRefresh\n"));
vbeInfoPtr pVbe = pVia->pVbe;
@@ -351,8 +348,7 @@ ViaVbeModePreInit(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
VbeInfoBlock *vbe;
- VbeModeInfoBlock *vbeMode;
- DisplayModePtr pMode;
+
int i;
memset(&(pVia->vbeMode), 0, sizeof(ViaVbeModeInfo));
diff --git a/driver/xf86-video-openchrome/src/via_video.c b/driver/xf86-video-openchrome/src/via_video.c
index af632b473..c605f1165 100644
--- a/driver/xf86-video-openchrome/src/via_video.c
+++ b/driver/xf86-video-openchrome/src/via_video.c
@@ -32,7 +32,11 @@
#include "xf86.h"
#include "xf86_OSproc.h"
+
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
#include "xf86Resources.h"
+#endif
+
#include "compiler.h"
#include "xf86PciInfo.h"
#include "xf86Pci.h"
@@ -277,6 +281,7 @@ DecideOverlaySupport(ScrnInfoPtr pScrn)
pVia->ChipId != PCI_CHIP_VT3314 &&
pVia->ChipId != PCI_CHIP_VT3327 &&
pVia->ChipId != PCI_CHIP_VT3336 &&
+ pVia->ChipId != PCI_CHIP_VT3409 &&
pVia->ChipId != PCI_CHIP_VT3364 &&
pVia->ChipId != PCI_CHIP_VT3324 &&
pVia->ChipId != PCI_CHIP_VT3353) {
@@ -574,6 +579,7 @@ viaInitVideo(ScreenPtr pScreen)
(pVia->Chipset == VIA_P4M900) ||
(pVia->Chipset == VIA_CX700) ||
(pVia->Chipset == VIA_VX800) ||
+ (pVia->Chipset == VIA_VX855) ||
(pVia->Chipset == VIA_P4M890));
if ((pVia->drmVerMajor < 2) ||
((pVia->drmVerMajor == 2) && (pVia->drmVerMinor < 9)))
@@ -592,7 +598,8 @@ viaInitVideo(ScreenPtr pScreen)
(pVia->Chipset == VIA_K8M800) || (pVia->Chipset == VIA_PM800) ||
(pVia->Chipset == VIA_VM800) || (pVia->Chipset == VIA_K8M890) ||
(pVia->Chipset == VIA_P4M900) || (pVia->Chipset == VIA_CX700) ||
- (pVia->Chipset == VIA_P4M890) || (pVia->Chipset == VIA_VX800)) {
+ (pVia->Chipset == VIA_P4M890) || (pVia->Chipset == VIA_VX800) ||
+ (pVia->Chipset == VIA_VX855)) {
num_new = viaSetupAdaptors(pScreen, &newAdaptors);
num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
} else {
@@ -667,7 +674,7 @@ viaVideoFillPixmap(ScrnInfoPtr pScrn,
{
int i;
- ErrorF("pitch %lu, depth %d, x %d, y %d, w %d h %d, color 0x%08lx\n",
+ ErrorF("pitch %lu, depth %d, x %d, y %d, w %d, h %d, color 0x%08lx\n",
pitch, depth, x, y, w, h, color);
depth = (depth + 7) >> 3;
@@ -1260,6 +1267,20 @@ viaDmaBlitImage(VIAPtr pVia,
#endif
+/*
+ * The source rectangle of the video is defined by (src_x, src_y, src_w, src_h).
+ * The dest rectangle of the video is defined by (drw_x, drw_y, drw_w, drw_h).
+ * id is a fourcc code for the format of the video.
+ * buf is the pointer to the source data in system memory.
+ * width and height are the w/h of the source data.
+ * If "sync" is TRUE, then we must be finished with *buf at the point of return
+ * (which we always are).
+ * clipBoxes is the clipping region in screen space.
+ * data is a pointer to our port private.
+ * pDraw is a Drawable, which might not be the screen in the case of
+ * compositing. It's a new argument to the function in the 1.1 server.
+ */
+
static int
viaPutImage(ScrnInfoPtr pScrn,
short src_x, short src_y,
@@ -1313,7 +1334,7 @@ viaPutImage(ScrnInfoPtr pScrn,
/* Copy image data from system memory to video memory
* TODO: use DRM's DMA feature to accelerate data copy
*/
- if (FOURCC_XVMC != id) {
+ if (id != FOURCC_XVMC) {
dstPitch = pVia->swov.SWDevice.dwPitch;
if (pVia->useDmaBlit) {
diff --git a/driver/xf86-video-openchrome/src/via_vt162x.c b/driver/xf86-video-openchrome/src/via_vt162x.c
index 511020514..aa64b336d 100644
--- a/driver/xf86-video-openchrome/src/via_vt162x.c
+++ b/driver/xf86-video-openchrome/src/via_vt162x.c
@@ -32,6 +32,40 @@
#include "via_vt162x.h"
#include "via_id.h"
+static void
+ViaSetTVClockSource(ScrnInfoPtr pScrn)
+{
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetTVClockSource\n"));
+
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ /* External TV: */
+ switch(pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_VX800:
+ if (pBIOSInfo->FirstCRTC->IsActive) {
+ if(pBIOSInfo->TVDIPort == VIA_DI_PORT_DVP1)
+ ViaCrtcMask(hwp, 0x6C, 0xB0, 0xF0);
+ else if(pBIOSInfo->TVDIPort == VIA_DI_PORT_DVP0)
+ ViaCrtcMask(hwp, 0x6C, 0x90, 0xF0);
+ } else {
+ /* IGA2 */
+ if(pBIOSInfo->TVDIPort == VIA_DI_PORT_DVP1)
+ ViaCrtcMask(hwp, 0x6C, 0x0B, 0x0F);
+ else if(pBIOSInfo->TVDIPort == VIA_DI_PORT_DVP0)
+ ViaCrtcMask(hwp, 0x6C, 0x09, 0x0F);
+ }
+ break;
+ default:
+ if (pBIOSInfo->FirstCRTC->IsActive)
+ ViaCrtcMask(hwp, 0x6C, 0x21, 0x21);
+ else
+ ViaCrtcMask(hwp, 0x6C, 0xA1, 0xA1);
+ break;
+ }
+}
static void
VT162xPrintRegs(ScrnInfoPtr pScrn)
@@ -650,11 +684,30 @@ VT1622ModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode)
xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x2B, Table.RGB[4]);
if (Table.RGB[5])
xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x2C, Table.RGB[5]);
+ if (pBIOSInfo->TVEncoder == VIA_VT1625) {
+ if (pBIOSInfo->TVType < TVTYPE_480P) {
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x02, 0x12);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x23, 0x7E);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4A, 0x85);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4B, 0x0A);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4E, 0x00);
+ } else {
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x02, 0x12);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4A, 0x85);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4B, 0x0A);
+ }
+ }
} else if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) {
xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x02, 0x03);
xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x65, Table.YCbCr[0]);
xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x66, Table.YCbCr[1]);
xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x67, Table.YCbCr[2]);
+ if (pBIOSInfo->TVEncoder == VIA_VT1625) {
+ if (pBIOSInfo->TVType < TVTYPE_480P) {
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x23, 0x7E);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4E, 0x00);
+ }
+ }
}
/* Configure flicker filter. */
@@ -721,8 +774,7 @@ VT1622ModeCrtc(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
pBIOSInfo->ClockExternal = TRUE;
ViaCrtcMask(hwp, 0x6A, 0x40, 0x40);
- ViaCrtcMask(hwp, 0x6C, 0x01, 0x01);
- ViaSeqMask(hwp, 0x1E, 0xF0, 0xF0); /* enable DI0/DVP0 */
+ ViaSetTVClockSource(pScrn);
}
diff --git a/driver/xf86-video-openchrome/src/via_vt162x.h b/driver/xf86-video-openchrome/src/via_vt162x.h
index ac5278f08..a1bc003b5 100644
--- a/driver/xf86-video-openchrome/src/via_vt162x.h
+++ b/driver/xf86-video-openchrome/src/via_vt162x.h
@@ -755,19 +755,19 @@ static DisplayModeRec VT1625Modes[] = {
{ MODEPREFIX("1024x768Over"), ... , MODESUFFIXPAL },
{ MODEPREFIX("720x576Over"), ... , MODESUFFIXPAL },*/
/* clock HR SH1 SH2 HFL VR SV1 SV2 VFL*/
- { MODEPREFIX("640x480"), 30000, 640, 680, 808, 1000, 0, 480, 520, 523, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
+ { MODEPREFIX("640x480"), 30000, 640, 688, 744, 784, 0, 480, 488, 495, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("800x600"), 34500, 800, 816, 880, 920, 0, 600, 604, 620, 750, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("1024x768"), 57000, 1024, 1040, 1112, 1200, 0, 768, 829, 840, 950, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
- { MODEPREFIX("720x576"), 34500, 720, 766, 800, 1000, 0, 576, 576, 579, 690, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL },
+ { MODEPREFIX("720x576"), 34500, 720, 760, 800, 1000, 0, 576, 577, 580, 690, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("720x576Over"), 27000, 720, 768, 800, 864, 0, 576, 577, 579, 625, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("1280x720"), 74250, 1280, 1320, 1376, 1650, 0, 720, 722, 728, 750, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX720P },
- { MODEPREFIX("1920x1080"), 74250, 1920, 1960, 2016, 2200, 0, 1080, 1082, 1088, 1125, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX1080I },
+ { MODEPREFIX("1920x1080"), 74250, 1920, 1960, 2064, 2200, 0, 1080, 1083, 1087, 1125, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX1080I },
{ MODEPREFIX("640x480"), 24696, 640, 656, 744, 784, 0, 480, 482, 483, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
{ MODEPREFIX("720x480Under"), 34000, 720, 728, 744, 784, 0, 480, 490, 496, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
- { MODEPREFIX("720x480Fit"), 28980, 720, 728, 744, 784, 0, 480, 490, 496, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
- { MODEPREFIX("720x480Over"), 27025, 720, 728, 744, 784, 0, 480, 490, 496, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
+ { MODEPREFIX("720x480Fit"), 28980, 720, 728, 776, 840, 0, 480, 484, 499, 575, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
+ { MODEPREFIX("720x480Over"), 27025, 720, 752, 792, 800, 0, 480, 482, 485, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
{ MODEPREFIX("720x480Under"), 28224, 720, 728, 744, 784, 0, 480, 490, 496, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX480P },
{ MODEPREFIX("720x480Fit"), 28980, 720, 728, 776, 840, 0, 480, 484, 499, 575, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX480P },
@@ -828,13 +828,13 @@ VT1625Table[] = {
},
{ "720x480Over", 720, 480, TVTYPE_NTSC, 0, 0,
/* 00 0F */
- { 0x03, 0, 0x10, 0x1F, 0x00, 0, 0, 0x33, 0x1C, 0x06, 0x7B, 0x15, 0x50, 0x57, 0, 0x9E,
- 0, 0x80, 0x04, 0x08, 0x08, 0x10, 0xD6, 0x7B, 0xF0, 0x21, 0x00, 0x50, 0x43, 0x80, 0, 0x10,
- 0x1C, 0x08, 0xDC, 0x77, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0x03, 0, 0x10, 0x1F, 0x00, 0, 0, 0x02, 0x10, 0x00, 0x7B, 0x15, 0x50, 0x57, 0, 0xB7,
+ 0, 0x80, 0xAD, 0x21, 0x64, 0x34, 0xD6, 0x7B, 0xF0, 0x21, 0x00, 0x50, 0x00, 0x80, 0, 0x10,
+ 0x1C, 0x08, 0xE5, 0x77, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* 4A 4F 50 59 */
- { 0xC5, 0x0F, 0, 0x01, 0x10, 0x4A, 0x59, 0xCF, 0x23, 0x0C, 0x22, 0x59, 0xCF, 0x7F, 0x23, 0x91,
+ { 0xC5, 0x0F, 0, 0x01, 0x10, 0x4A, 0x1F, 0xD2, 0x23, 0x0C, 0x22, 0x59, 0xC0, 0x7E, 0x23, 0x8C,
/* 5A 5F 60 64 */
- 0xD2, 0xE1, 0x7D, 0x06, 0, 0, 0x80, 0x28, 0xFF, 0x59, 0x03 },
+ 0xD0, 0xF6, 0x7C, 0x06, 0, 0x34, 0x80, 0x28, 0xFF, 0x1F, 0x03 },
/* RBG 65,66,67,27,2b,2c */
{ 0x55, 0x37, 0x5C, 0, 0, 0 },
/* Y-Cb-Cr 65,66,67 */
@@ -876,8 +876,8 @@ VT1625Table[] = {
},
{ "720x480Over", 720, 480, TVTYPE_480P, 0, 0,
/* 00 0F */
- { 0x03, 0, 0x10, 0x40, 0x10, 0, 0, 0x33, 0x20, 0xFF, 0x7B, 0, 0x50, 0x57, 0, 0x9E,
- 0, 0x80, 0x04, 0x08, 0x08, 0x10, 0xD6, 0x7B, 0xF0, 0x21, 0x02, 0x50, 0x43, 0x80, 0, 0x01,
+ { 0x03, 0, 0x10, 0x40, 0x10, 0, 0, 0x01, 0x20, 0, 0x7B, 0, 0x50, 0x57, 0, 0x9E,
+ 0, 0x80, 0x04, 0x08, 0x08, 0x10, 0xD6, 0x7B, 0xF0, 0x21, 0x02, 0x50, 0x00, 0x80, 0, 0x01,
0x2F, 0x08, 0xDC, 0x7E, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* 4A 4F 50 59 */
{ 0xC5, 0x0F, 0, 0x01, 0, 0x4A, 0x59, 0xCF, 0x23, 0x0C, 0x22, 0x59, 0xCF, 0x7F, 0x23, 0x91,
@@ -909,15 +909,15 @@ VT1625Table[] = {
0x0, 0x0,
},
- { "1920x1080", 1920, 540, TVTYPE_1080I, 0, 0,
+ { "1920x1080", 1920, 1080, TVTYPE_1080I, 0, 0,
/* 00 0F */
- { 0x83, 0, 0x10, 0x4A, 0x86, 0x39, 0, 0x8B, 0x3D, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9E,
- 0x00, 0x80, 0x4A, 0x08, 0x37, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x44, 0x80, 0x00, 0x03,
+ { 0x83, 0, 0x10, 0x4A, 0x86, 0x32, 0, 0x8B, 0x3D, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9E,
+ 0x00, 0x80, 0x4A, 0x08, 0x37, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x04, 0x80, 0x00, 0x03,
0x25, 0x00, 0x00, 0x7E, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* 4A 4F 50 59 */
{ 0xC5, 0x0F, 0, 0x01, 0, 0x00, 0x97, 0x7F, 0x78, 0x64, 0x14, 0x97, 0x7f, 0x59, 0x78, 0xb0,
/* 5A 5F 60 64 */
- 0x1a, 0xec, 0xfa, 0x08, 0x00, 0x00, 0x80, 0x20, 0xFF, 0x97, 0x28 },
+ 0x1a, 0xdc, 0x5d, 0x08, 0x00, 0x00, 0x80, 0x28, 0xFF, 0x97, 0x28 },
/* RBG 65,66,67,27,2b,2c */
{ 0x55, 0x39, 0x66, 0, 0, 0 },
/* Y-Cb-Cr 65,66,67 */
@@ -945,9 +945,9 @@ VT1625Table[] = {
{ "720x576", 720, 576, TVTYPE_PAL, 0, 0,
/* 00 0F */
- { 0x03, 0x00, 0x10, 0x1f, 0x03, 0x00, 0x00, 0xc9, 0x4c, 0x11, 0x7c, 0x00, 0x56, 0x57, 0x07, 0xbf,
- 0x00, 0x80, 0x09, 0x08, 0x17, 0x24, 0xcb, 0x8a, 0x09, 0x2a, 0x06, 0x50, 0x01, 0x80, 0x00, 0x10,
- 0x14, 0x0c, 0x32, 0x7e, 0x00, 0x5f, 0x34, 0x8c, 0x4f, 0x5e, 0x15, 0xa2, 0x22, 0x80, 0xd3, 0x10
+ { 0x03, 0x00, 0x10, 0x1f, 0x03, 0x00, 0x00, 0xc9, 0x4c, 0x10, 0x7c, 0x00, 0x56, 0x57, 0x07, 0xbf,
+ 0x00, 0x80, 0x09, 0x08, 0x17, 0x24, 0xcb, 0x8a, 0x09, 0x2a, 0x06, 0x50, 0x00, 0x80, 0x00, 0x10,
+ 0x14, 0x0c, 0x32, 0x7e, 0x00, 0x5f, 0x34, 0x8c, 0x4f, 0x5e, 0x15, 0xa2, 0x22, 0x80, 0xd3, 0x10
},
/* 4A 4F 50 59 */
{ 0xc5, 0x0f, 0x00, 0x01, 0x00, 0x4b, 0xe7, 0xd2, 0x23, 0xb1, 0x22, 0x5f, 0x61, 0x7f, 0x23, 0x90,
diff --git a/driver/xf86-video-openchrome/src/via_xvmc.c b/driver/xf86-video-openchrome/src/via_xvmc.c
index 082e7ab75..120e251e4 100644
--- a/driver/xf86-video-openchrome/src/via_xvmc.c
+++ b/driver/xf86-video-openchrome/src/via_xvmc.c
@@ -27,7 +27,11 @@
#include "xf86.h"
#include "xf86_OSproc.h"
+
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
#include "xf86Resources.h"
+#endif
+
#include "compiler.h"
#include "xf86PciInfo.h"
#include "xf86Pci.h"
@@ -322,6 +326,7 @@ ViaInitXVMC(ScreenPtr pScreen)
if ((pVia->Chipset == VIA_KM400) ||
(pVia->Chipset == VIA_CX700) ||
(pVia->Chipset == VIA_VX800) ||
+ (pVia->Chipset == VIA_VX855) ||
(pVia->Chipset == VIA_K8M890) ||
(pVia->Chipset == VIA_P4M900)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,