2
* Copyright 2005-2007 The Openchrome Project [openchrome.org]
3
* Copyright 2004-2006 Luc Verhaegen.
4
* Copyright 2004-2005 The Unichrome Project [unichrome.sf.net]
5
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
6
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
8
* Permission is hereby granted, free of charge, to any person obtaining a
9
* copy of this software and associated documentation files (the "Software"),
10
* to deal in the Software without restriction, including without limitation
11
* the rights to use, copy, modify, merge, publish, distribute, sub license,
12
* and/or sell copies of the Software, and to permit persons to whom the
13
* Software is furnished to do so, subject to the following conditions:
15
* The above copyright notice and this permission notice (including the
16
* next paragraph) shall be included in all copies or substantial portions
19
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
22
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
* DEALINGS IN THE SOFTWARE.
35
#ifdef HAVE_XEXTPROTO_71
36
#include <X11/extensions/dpmsconst.h>
39
#include <X11/extensions/dpms.h>
43
#include "via_driver.h"
45
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
55
#include "xf86RandR12.h"
64
static const ViaDRMVersion drmExpected = { 1, 3, 0 };
65
static const ViaDRMVersion drmCompat = { 3, 1, 0 };
68
static void VIAIdentify(int flags);
71
static Bool via_pci_probe(DriverPtr drv, int entity_num,
72
struct pci_device *dev, intptr_t match_data);
73
#else /* !HAVE_PCIACCESS */
74
static Bool VIAProbe(DriverPtr drv, int flags);
77
static Bool VIASetupDefaultOptions(ScrnInfoPtr pScrn);
78
static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags);
79
static Bool VIAScreenInit(SCREEN_INIT_ARGS_DECL);
80
static const OptionInfoRec *VIAAvailableOptions(int chipid, int busid);
84
#define VIA_DEVICE_MATCH(d,i) \
85
{ 0x1106, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
87
static const struct pci_id_match via_device_match[] = {
88
VIA_DEVICE_MATCH (PCI_CHIP_VT3204, 0 ),
89
VIA_DEVICE_MATCH (PCI_CHIP_VT3259, 0 ),
90
VIA_DEVICE_MATCH (PCI_CHIP_CLE3122, 0 ),
91
VIA_DEVICE_MATCH (PCI_CHIP_VT3205, 0 ),
92
VIA_DEVICE_MATCH (PCI_CHIP_VT3314, 0 ),
93
VIA_DEVICE_MATCH (PCI_CHIP_VT3336, 0 ),
94
VIA_DEVICE_MATCH (PCI_CHIP_VT3364, 0 ),
95
VIA_DEVICE_MATCH (PCI_CHIP_VT3324, 0 ),
96
VIA_DEVICE_MATCH (PCI_CHIP_VT3327, 0 ),
97
VIA_DEVICE_MATCH (PCI_CHIP_VT3353, 0 ),
98
VIA_DEVICE_MATCH (PCI_CHIP_VT3409, 0 ),
99
VIA_DEVICE_MATCH (PCI_CHIP_VT3410, 0 ),
103
#endif /* HAVE_PCIACCESS */
105
_X_EXPORT DriverRec VIA = {
109
#ifdef HAVE_PCIACCESS
118
#ifdef HAVE_PCIACCESS
124
/* Supported chipsets */
125
static SymTabRec VIAChipsets[] = {
126
{VIA_CLE266, "CLE266"},
127
{VIA_KM400, "KM400/KN400"},
128
{VIA_K8M800, "K8M800/K8N800"},
129
{VIA_PM800, "PM800/PM880/CN400"},
130
{VIA_VM800, "VM800/P4M800Pro/VN800/CN700"},
131
{VIA_CX700, "CX700/VX700"},
132
{VIA_K8M890, "K8M890/K8N890"},
133
{VIA_P4M890, "P4M890"},
134
{VIA_P4M900, "P4M900/VN896/CN896"},
135
{VIA_VX800, "VX800/VX820"},
136
{VIA_VX855, "VX855/VX875"},
137
{VIA_VX900, "VX900"},
141
/* Mapping a PCI device ID to a chipset family identifier. */
142
static PciChipsets VIAPciChipsets[] = {
143
{VIA_CLE266, PCI_CHIP_CLE3122, VIA_RES_SHARED},
144
{VIA_KM400, PCI_CHIP_VT3205, VIA_RES_SHARED},
145
{VIA_K8M800, PCI_CHIP_VT3204, VIA_RES_SHARED},
146
{VIA_PM800, PCI_CHIP_VT3259, VIA_RES_SHARED},
147
{VIA_VM800, PCI_CHIP_VT3314, VIA_RES_SHARED},
148
{VIA_CX700, PCI_CHIP_VT3324, VIA_RES_SHARED},
149
{VIA_K8M890, PCI_CHIP_VT3336, VIA_RES_SHARED},
150
{VIA_P4M890, PCI_CHIP_VT3327, VIA_RES_SHARED},
151
{VIA_P4M900, PCI_CHIP_VT3364, VIA_RES_SHARED},
152
{VIA_VX800, PCI_CHIP_VT3353, VIA_RES_SHARED},
153
{VIA_VX855, PCI_CHIP_VT3409, VIA_RES_SHARED},
154
{VIA_VX900, PCI_CHIP_VT3410, VIA_RES_SHARED},
155
{-1, -1, VIA_RES_UNDEF}
168
OPTION_EXA_NOCOMPOSITE,
169
OPTION_EXA_SCRATCH_SIZE,
172
OPTION_ROTATION_TYPE,
191
OPTION_VBE_SAVERESTORE,
194
OPTION_DISABLE_XV_BW_CHECK,
195
OPTION_MODE_SWITCH_METHOD
198
static OptionInfoRec VIAOptions[] = {
199
#ifdef HAVE_DEBUG /* Don't document these three. */
200
{OPTION_PRINTVGAREGS, "PrintVGARegs", OPTV_BOOLEAN, {0}, FALSE},
201
{OPTION_PRINTTVREGS, "PrintTVRegs", OPTV_BOOLEAN, {0}, FALSE},
202
{OPTION_I2CSCAN, "I2CScan", OPTV_BOOLEAN, {0}, FALSE},
204
{OPTION_VBEMODES, "VBEModes", OPTV_BOOLEAN, {0}, FALSE},
205
{OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
206
{OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE},
207
{OPTION_EXA_NOCOMPOSITE, "ExaNoComposite", OPTV_BOOLEAN, {0}, FALSE},
208
{OPTION_EXA_SCRATCH_SIZE, "ExaScratchSize", OPTV_INTEGER, {0}, FALSE},
209
{OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE},
210
{OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE},
211
{OPTION_ROTATION_TYPE, "RotationType", OPTV_ANYSTR, {0}, FALSE},
212
{OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE},
213
{OPTION_VIDEORAM, "VideoRAM", OPTV_INTEGER, {0}, FALSE},
214
{OPTION_ACTIVEDEVICE, "ActiveDevice", OPTV_ANYSTR, {0}, FALSE},
215
{OPTION_TVDOTCRAWL, "TVDotCrawl", OPTV_BOOLEAN, {0}, FALSE},
216
{OPTION_TVDEFLICKER, "TVDeflicker", OPTV_INTEGER, {0}, FALSE},
217
{OPTION_TVTYPE, "TVType", OPTV_ANYSTR, {0}, FALSE},
218
{OPTION_TVOUTPUT, "TVOutput", OPTV_ANYSTR, {0}, FALSE},
219
{OPTION_TVDIPORT, "TVPort", OPTV_ANYSTR, {0}, FALSE},
220
{OPTION_DISABLEVQ, "DisableVQ", OPTV_BOOLEAN, {0}, FALSE},
221
{OPTION_DISABLEIRQ, "DisableIRQ", OPTV_BOOLEAN, {0}, FALSE},
222
{OPTION_AGP_DMA, "EnableAGPDMA", OPTV_BOOLEAN, {0}, FALSE},
223
{OPTION_2D_DMA, "NoAGPFor2D", OPTV_BOOLEAN, {0}, FALSE},
224
{OPTION_XV_DMA, "NoXVDMA", OPTV_BOOLEAN, {0}, FALSE},
225
{OPTION_VBE_SAVERESTORE, "VbeSaveRestore", OPTV_BOOLEAN, {0}, FALSE},
226
{OPTION_DISABLE_XV_BW_CHECK, "DisableXvBWCheck", OPTV_BOOLEAN, {0}, FALSE},
227
{OPTION_MODE_SWITCH_METHOD, "ModeSwitchMethod", OPTV_ANYSTR, {0}, FALSE},
228
{OPTION_MAX_DRIMEM, "MaxDRIMem", OPTV_INTEGER, {0}, FALSE},
229
{OPTION_AGPMEM, "AGPMem", OPTV_INTEGER, {0}, FALSE},
230
{OPTION_I2CDEVICES, "I2CDevices", OPTV_ANYSTR, {0}, FALSE},
231
{-1, NULL, OPTV_NONE, {0}, FALSE}
235
static MODULESETUPPROTO(VIASetup);
237
static XF86ModuleVersionInfo VIAVersRec = {
239
"http://openchrome.org/",
242
#ifdef XORG_VERSION_CURRENT
243
XORG_VERSION_CURRENT,
245
XF86_VERSION_CURRENT,
247
VIA_MAJOR_VERSION, VIA_MINOR_VERSION, VIA_PATCHLEVEL,
249
ABI_VIDEODRV_VERSION,
254
_X_EXPORT XF86ModuleData openchromeModuleData = { &VIAVersRec, VIASetup, NULL };
257
VIASetup(pointer module, pointer opts, int *errmaj, int *errmin)
259
static Bool setupDone = FALSE;
261
/* Only be loaded once */
264
xf86AddDriver(&VIA, module,
265
#ifdef HAVE_PCIACCESS
275
*errmaj = LDR_ONCEONLY;
281
#endif /* XFree86LOADER */
283
static const OptionInfoRec *
284
VIAAvailableOptions(int chipid, int busid)
290
VIASwitchMode(SWITCH_MODE_ARGS_DECL)
294
return xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
298
VIAAdjustFrame(ADJUST_FRAME_ARGS_DECL)
301
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
304
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAAdjustFrame %dx%d\n", x, y));
306
for (i = 0; i < xf86_config->num_crtc; i++) {
307
xf86CrtcPtr crtc = xf86_config->crtc[i];
309
xf86CrtcSetOrigin(crtc, x, y);
314
VIAEnterVT_internal(ScrnInfoPtr pScrn, int flags)
316
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
317
VIAPtr pVia = VIAPTR(pScrn);
320
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAEnterVT\n"));
322
for (i = 0; i < xf86_config->num_crtc; i++) {
323
xf86CrtcPtr crtc = xf86_config->crtc[i];
325
if (crtc->funcs->save)
326
crtc->funcs->save(crtc);
329
for (i = 0; i < xf86_config->num_output; i++) {
330
xf86OutputPtr output = xf86_config->output[i];
332
if (output->funcs->save)
333
output->funcs->save(output);
336
if (!xf86SetDesiredModes(pScrn))
340
/* Restore video status. */
341
if (!pVia->IsSecondary)
342
viaRestoreVideo(pScrn);
345
if (pVia->directRenderingType == DRI_1) {
347
VIADRIRingBufferInit(pScrn);
348
viaDRIOffscreenRestore(pScrn);
349
DRIUnlock(xf86ScrnToScreen(pScrn));
357
VIAEnterVT(VT_FUNC_ARGS_DECL)
360
return VIAEnterVT_internal(pScrn, 0);
364
VIALeaveVT(VT_FUNC_ARGS_DECL)
367
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
368
VIAPtr pVia = VIAPTR(pScrn);
371
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIALeaveVT\n"));
374
if (pVia->directRenderingType == DRI_1) {
375
volatile drm_via_sarea_t *saPriv = (drm_via_sarea_t *) DRIGetSAREAPrivate(pScrn->pScreen);
377
DRILock(xf86ScrnToScreen(pScrn), 0);
378
saPriv->ctxOwner = ~0;
382
VIADRIRingBufferCleanup(pScrn);
383
viaDRIOffscreenSave(pScrn);
390
/* Save video status and turn off all video activities. */
391
if (!pVia->IsSecondary)
394
for (i = 0; i < xf86_config->num_output; i++) {
395
xf86OutputPtr output = xf86_config->output[i];
397
if (output->funcs->restore)
398
output->funcs->restore(output);
401
for (i = 0; i < xf86_config->num_crtc; i++) {
402
xf86CrtcPtr crtc = xf86_config->crtc[i];
404
if (crtc->funcs->restore)
405
crtc->funcs->restore(crtc);
407
pScrn->vtSema = FALSE;
411
VIAFreeRec(ScrnInfoPtr pScrn)
413
VIAPtr pVia = VIAPTR(pScrn);
415
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAFreeRec\n"));
416
if (!pScrn->driverPrivate)
419
VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
422
if (pBIOSInfo->TVI2CDev)
423
xf86DestroyI2CDevRec(pBIOSInfo->TVI2CDev, TRUE);
425
pVia->pBIOSInfo = NULL;
429
if (VIAPTR(pScrn)->pVbe)
430
vbeFree(VIAPTR(pScrn)->pVbe);
433
free(pVia->VideoRegs);
437
free(pScrn->driverPrivate);
438
pScrn->driverPrivate = NULL;
442
* This only gets called when a screen is being deleted. It does not
443
* get called routinely at the end of a server generation.
446
VIAFreeScreen(FREE_SCREEN_ARGS_DECL)
449
VIAPtr pVia = VIAPTR(pScrn);
451
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAFreeScreen\n"));
453
if (pVia->directRenderingType != DRI_2)
458
if (!pVia->KMS && xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
459
vgaHWFreeHWRec(pScrn);
463
VIAIdentify(int flags)
465
xf86PrintChipsets("OPENCHROME", "Driver for VIA Chrome chipsets",
469
#ifdef HAVE_PCIACCESS
471
via_pci_probe(DriverPtr driver, int entity_num,
472
struct pci_device *device, intptr_t match_data)
474
ScrnInfoPtr scrn = NULL;
475
EntityInfoPtr entity;
477
scrn = xf86ConfigPciEntity(scrn, 0, entity_num, VIAPciChipsets,
478
NULL, NULL, NULL, NULL, NULL);
481
scrn->driverVersion = VIA_VERSION;
482
scrn->driverName = DRIVER_NAME;
483
scrn->name = "CHROME";
486
entity = xf86GetEntityInfo(entity_num);
488
scrn->PreInit = VIAPreInit;
489
scrn->ScreenInit = VIAScreenInit;
490
scrn->SwitchMode = VIASwitchMode;
491
scrn->AdjustFrame = VIAAdjustFrame;
492
scrn->EnterVT = VIAEnterVT;
493
scrn->LeaveVT = VIALeaveVT;
494
scrn->FreeScreen = VIAFreeScreen;
497
"VIA Technologies does not support this driver in any way.\n");
499
"For support, please refer to http://www.openchrome.org/.\n");
501
xf86Msg(X_NOTICE, BUILDCOMMENT"\n");
506
#else /* !HAVE_PCIACCESS */
508
VIAProbe(DriverPtr drv, int flags)
510
GDevPtr *devSections;
514
Bool foundScreen = FALSE;
518
if ((numDevSections = xf86MatchDevice(DRIVER_NAME, &devSections)) <= 0)
521
if (xf86GetPciVideoInfo() == NULL)
524
numUsed = xf86MatchPciInstances(DRIVER_NAME,
538
"VIA Technologies does not support this driver in any way.\n");
539
xf86Msg(X_NOTICE, "For support, please refer to http://openchrome.org/.\n");
542
xf86Msg(X_NOTICE, BUILDCOMMENT"\n");
545
if (flags & PROBE_DETECT) {
548
for (i = 0; i < numUsed; i++) {
549
ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
552
if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
553
VIAPciChipsets, 0, 0, 0, 0, 0))) {
554
pScrn->driverVersion = VIA_VERSION;
555
pScrn->driverName = DRIVER_NAME;
556
pScrn->name = "CHROME";
557
pScrn->Probe = VIAProbe;
558
pScrn->PreInit = VIAPreInit;
559
pScrn->ScreenInit = VIAScreenInit;
560
pScrn->SwitchMode = VIASwitchMode;
561
pScrn->AdjustFrame = VIAAdjustFrame;
562
pScrn->EnterVT = VIAEnterVT;
563
pScrn->LeaveVT = VIALeaveVT;
564
pScrn->FreeScreen = VIAFreeScreen;
568
xf86ConfigActivePciEntity(pScrn,
577
pEnt = xf86GetEntityInfo(usedChips[i]);
579
/* CLE266 supports dual-head; mark the entity as sharable. */
580
if (pEnt->chipset == VIA_CLE266 || pEnt->chipset == VIA_KM400) {
581
static int instance = 0;
584
xf86SetEntitySharable(usedChips[i]);
585
xf86SetEntityInstanceForScreen(pScrn,
586
pScrn->entityList[0], instance);
588
if (gVIAEntityIndex < 0) {
589
gVIAEntityIndex = xf86AllocateEntityPrivateIndex();
590
pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
596
pPriv->ptr = xnfcalloc(sizeof(VIAEntRec), 1);
597
pVIAEnt = pPriv->ptr;
598
pVIAEnt->IsDRIEnabled = FALSE;
599
pVIAEnt->BypassSecondary = FALSE;
600
pVIAEnt->HasSecondary = FALSE;
601
pVIAEnt->IsSecondaryRestored = FALSE;
615
#endif /* !HAVE_PCIACCESS */
618
LookupChipSet(PciChipsets *pset, int chipSet)
620
while (pset->numChipset >= 0) {
621
if (pset->numChipset == chipSet)
630
LookupChipID(PciChipsets *pset, int ChipID)
632
/* Is there a function to do this for me? */
633
while (pset->numChipset >= 0) {
634
if (pset->PCIid == ChipID)
635
return pset->numChipset;
644
VIASetupDefaultOptions(ScrnInfoPtr pScrn)
646
VIAPtr pVia = VIAPTR(pScrn);
647
VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
649
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASetupDefaultOptions - Setting up default chipset options.\n"));
651
pVia->shadowFB = FALSE;
652
pVia->NoAccel = FALSE;
653
pVia->noComposite = FALSE;
655
pVia->exaScratchSize = VIA_SCRATCH_SIZE / 1024;
656
pVia->drmmode.hwcursor = TRUE;
657
pVia->VQEnable = TRUE;
658
pVia->DRIIrqEnable = TRUE;
659
pVia->agpEnable = TRUE;
662
pVia->useVBEModes = FALSE;
665
pVia->disableXvBWCheck = FALSE;
667
pVia->maxDriSize = 0;
668
pVia->agpMem = AGP_SIZE / 1024;
669
pVia->ActiveDevice = 0x00;
670
pVia->I2CDevices = VIA_I2C_BUS1 | VIA_I2C_BUS2 | VIA_I2C_BUS3;
671
pVia->VideoEngine = VIDEO_ENGINE_CLE;
673
pVia->PrintVGARegs = FALSE;
676
/* Disable vertical interpolation because the size of */
677
/* line buffer (limited to 800) is too small to do interpolation. */
678
pVia->swov.maxWInterp = 800;
679
pVia->swov.maxHInterp = 600;
680
pVia->useLegacyVBE = TRUE;
682
pVia->UseLegacyModeSwitch = FALSE;
683
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP1;
685
switch (pVia->Chipset) {
687
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
688
pVia->UseLegacyModeSwitch = TRUE;
691
/* IRQ is not broken on KM400A, but testing (pVia->ChipRev < 0x80)
692
* is not enough to make sure we have an older, broken KM400. */
693
pVia->DRIIrqEnable = FALSE;
694
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
697
pVia->DRIIrqEnable = FALSE;
700
/* Use new mode switch to resolve many resolution and display bugs (switch to console) */
701
/* FIXME The video playing (XV) is not working correctly after turn on new mode switch */
702
pVia->VideoEngine = VIDEO_ENGINE_CME;
705
/* New mode switch resolve bug with gamma set #282 */
706
/* and with Xv after hibernate #240 */
709
pVia->VideoEngine = VIDEO_ENGINE_CME;
710
pVia->swov.maxWInterp = 1920;
711
pVia->swov.maxHInterp = 1080;
714
pVia->VideoEngine = VIDEO_ENGINE_CME;
715
pVia->agpEnable = FALSE;
719
pVia->VideoEngine = VIDEO_ENGINE_CME;
723
pVia->VideoEngine = VIDEO_ENGINE_CME;
724
pVia->agpEnable = FALSE;
725
pVia->useLegacyVBE = FALSE;
726
/* FIXME: this needs to be tested */
728
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
733
pVia->VideoEngine = VIDEO_ENGINE_CME;
734
pVia->agpEnable = FALSE;
743
VIAGetRec(ScrnInfoPtr pScrn)
748
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetRec\n"));
750
if (pScrn->driverPrivate)
753
/* allocate VIARec */
754
pVia = (VIARec *) xnfcalloc(sizeof(VIARec), 1);
756
pVia->pBIOSInfo = xnfcalloc(sizeof(VIABIOSInfoRec), 1);
757
VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
760
pBIOSInfo->TVI2CDev = NULL;
762
pVia->VideoRegs = (video_via_regs *) xnfcalloc(sizeof(video_via_regs), 1);
763
if (!pVia->VideoRegs) {
767
pScrn->driverPrivate = pVia;
776
map_legacy_formats(int bpp, int depth)
778
int fmt = DRM_FORMAT_XRGB8888;
786
fmt = DRM_FORMAT_XRGB1555;
788
fmt = DRM_FORMAT_RGB565;
791
fmt = DRM_FORMAT_RGB888;
795
fmt = DRM_FORMAT_XRGB8888;
796
else if (depth == 30)
797
fmt = DRM_FORMAT_XRGB2101010;
805
via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
807
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
808
struct buffer_object *old_front = NULL, *new_front = NULL;
809
int old_width, old_height, old_dwidth, format;
810
int cpp = (scrn->bitsPerPixel + 7) >> 3, i;
811
ScreenPtr screen = scrn->pScreen;
812
VIAPtr pVia = VIAPTR(scrn);
813
void *new_pixels = NULL;
818
if (scrn->virtualX == width && scrn->virtualY == height)
821
format = map_legacy_formats(scrn->bitsPerPixel, scrn->depth);
822
new_front = drm_bo_alloc_surface(scrn, width, height, format,
823
16, TTM_PL_FLAG_VRAM);
827
xf86DrvMsg(scrn->scrnIndex, X_INFO,
828
"Allocate new frame buffer %dx%d stride %d\n",
829
width, height, new_front->pitch);
831
new_pixels = drm_bo_map(scrn, new_front);
835
if (pVia->shadowFB) {
836
new_pixels = malloc(height * new_front->pitch);
839
free(pVia->ShadowPtr);
840
pVia->ShadowPtr = new_pixels;
843
ppix = screen->GetScreenPixmap(screen);
844
if (!screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
849
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,9,99,1,0)
850
scrn->pixmapPrivate.ptr = ppix->devPrivate.ptr;
853
scrn->virtualX = width;
854
scrn->virtualY = height;
855
scrn->displayWidth = new_front->pitch / cpp;
857
for (i = 0; i < xf86_config->num_crtc; i++) {
858
xf86CrtcPtr crtc = xf86_config->crtc[i];
859
drmmode_crtc_private_ptr drmmode_crtc;
862
if (!crtc->enabled || !crtc->driver_private)
865
drmmode_crtc = crtc->driver_private;
866
drmmode = drmmode_crtc->drmmode;
868
old_front = drmmode->front_bo;
869
old_fb_id = drmmode->fb_id;
871
drmmode->front_bo = new_front;
874
ret = xf86CrtcSetMode(crtc, &crtc->mode, crtc->rotation,
877
xf86DrvMsg(scrn->scrnIndex, X_INFO,
878
"SetMode !ret so we reset front_bo\n");
879
drmmode->front_bo = old_front;
880
drmmode->fb_id = old_fb_id;
884
xf86DrvMsg(scrn->scrnIndex, X_INFO,
885
"SetMode ret so we cleanup old front_bo\n");
886
if (pVia->KMS && old_fb_id)
887
drmModeRmFB(drmmode->fd, old_fb_id);
894
xf86DrvMsg(scrn->scrnIndex, X_INFO,
895
"More cleanup old front_bo\n");
896
drm_bo_unmap(scrn, old_front);
897
drm_bo_free(scrn, old_front);
903
drm_bo_unmap(scrn, new_front);
904
drm_bo_free(scrn, new_front);
906
scrn->virtualY = old_height;
907
scrn->virtualX = old_width;
908
scrn->displayWidth = old_dwidth;
913
xf86CrtcConfigFuncsRec via_xf86crtc_config_funcs = {
918
VIAPreInit(ScrnInfoPtr pScrn, int flags)
920
XF86OptionPtr option = xf86NewOption("MigrationHeuristic", "greedy");
923
VIABIOSInfoPtr pBIOSInfo;
924
MessageType from = X_DEFAULT;
928
drmVersionPtr drmVer;
931
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAPreInit\n"));
933
if (pScrn->numEntities > 1)
936
if (flags & PROBE_DETECT)
939
if (!VIAGetRec(pScrn)) {
943
pVia = VIAPTR(pScrn);
944
pVia->IsSecondary = FALSE;
945
pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
946
#ifndef HAVE_PCIACCESS
947
if (pEnt->resources) {
954
pVia->EntityIndex = pEnt->index;
956
if (xf86IsEntityShared(pScrn->entityList[0])) {
957
if (xf86IsPrimInitDone(pScrn->entityList[0])) {
962
pVia->IsSecondary = TRUE;
963
pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gVIAEntityIndex);
964
pVIAEnt = pPriv->ptr;
965
if (pVIAEnt->BypassSecondary) {
970
pVIAEnt->pSecondaryScrn = pScrn;
971
pVIAEnt->HasSecondary = TRUE;
972
pVia1 = VIAPTR(pVIAEnt->pPrimaryScrn);
973
pVia1->HasSecondary = TRUE;
974
pVia->sharedData = pVia1->sharedData;
979
xf86SetPrimInitDone(pScrn->entityList[0]);
980
pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gVIAEntityIndex);
981
pVia->sharedData = xnfcalloc(sizeof(ViaSharedRec), 1);
982
pVIAEnt = pPriv->ptr;
983
pVIAEnt->pPrimaryScrn = pScrn;
984
pVIAEnt->IsDRIEnabled = FALSE;
985
pVIAEnt->BypassSecondary = FALSE;
986
pVIAEnt->HasSecondary = FALSE;
987
pVIAEnt->RestorePrimary = FALSE;
988
pVIAEnt->IsSecondaryRestored = FALSE;
991
pVia->sharedData = xnfcalloc(sizeof(ViaSharedRec), 1);
994
pVia->PciInfo = xf86GetPciInfoForEntity(pEnt->index);
995
#ifndef HAVE_PCIACCESS
996
xf86RegisterResources(pEnt->index, NULL, ResNone);
998
if (pEnt->device->chipset && *pEnt->device->chipset) {
1000
pScrn->chipset = pEnt->device->chipset;
1001
pVia->Chipset = xf86StringToToken(VIAChipsets, pScrn->chipset);
1002
pVia->ChipId = LookupChipSet(VIAPciChipsets, pVia->Chipset);
1003
} else if (pEnt->device->chipID >= 0) {
1005
pVia->ChipId = pEnt->device->chipID;
1006
pVia->Chipset = LookupChipID(VIAPciChipsets, pVia->ChipId);
1007
pScrn->chipset = (char *)xf86TokenToString(VIAChipsets, pVia->Chipset);
1008
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n",
1009
pEnt->device->chipID);
1012
pVia->ChipId = DEVICE_ID(pVia->PciInfo);
1013
pVia->Chipset = LookupChipID(VIAPciChipsets, pVia->ChipId);
1014
pScrn->chipset = (char *)xf86TokenToString(VIAChipsets, pVia->Chipset);
1017
xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: %s\n", pScrn->chipset);
1019
if (pEnt->device->chipRev >= 0) {
1020
pVia->ChipRev = pEnt->device->chipRev;
1021
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n",
1024
/* Read PCI bus 0, dev 0, function 0, index 0xF6 to get chip revision */
1025
#ifdef HAVE_PCIACCESS
1026
struct pci_device *bridge = pci_device_get_parent_bridge(pVia->PciInfo);
1029
pci_device_cfg_read_u8(bridge, &rev, 0xF6);
1030
pVia->ChipRev = rev;
1032
pVia->ChipRev = pciReadByte(pciTag(0, 0, 0), 0xF6);
1036
xf86DrvMsg(pScrn->scrnIndex, from, "Chipset revision: %d\n", pVia->ChipRev);
1038
pVia->directRenderingType = DRI_NONE;
1041
busId = DRICreatePCIBusID(pVia->PciInfo);
1042
pVia->drmmode.fd = drmOpen("via", busId);
1043
if (pVia->drmmode.fd != -1) {
1044
if (!drmCheckModesettingSupported(busId)) {
1045
xf86DrvMsg(-1, X_INFO, "[drm] KMS supported\n");
1048
xf86DrvMsg(-1, X_INFO, "[drm] KMS not enabled\n");
1050
drmVer = drmGetVersion(pVia->drmmode.fd);
1052
pVia->drmVerMajor = drmVer->version_major;
1053
pVia->drmVerMinor = drmVer->version_minor;
1054
pVia->drmVerPL = drmVer->version_patchlevel;
1055
drmFreeVersion(drmVer);
1057
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1058
"[drm] via interface version: %d.%d.%d\n",
1059
pVia->drmVerMajor, pVia->drmVerMinor, pVia->drmVerPL);
1061
/* DRI2 or DRI1 support */
1062
if ((pVia->drmVerMajor < drmExpected.major) ||
1063
(pVia->drmVerMajor > drmCompat.major) ||
1064
((pVia->drmVerMajor == drmExpected.major) &&
1065
(pVia->drmVerMinor < drmExpected.minor))) {
1066
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1067
"[drm] Kernel drm is not compatible with this driver.\n"
1068
"[drm] Kernel drm version is %d.%d.%d, "
1069
"and I can work with versions %d.%d.x - %d.x.x.\n"
1070
"[drm] Update either this 2D driver or your kernel DRM. "
1071
"Disabling DRI.\n", pVia->drmVerMajor, pVia->drmVerMinor,
1072
pVia->drmVerPL, drmExpected.major, drmExpected.minor,
1075
/* DRI2 or DRI1 support */
1076
if (pVia->drmVerMajor < drmCompat.major) {
1077
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DRI 1 api supported\n");
1078
pVia->directRenderingType = DRI_1;
1080
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DRI 2 api not supported yet\n");
1081
pVia->directRenderingType = DRI_2;
1082
pVia->NoAccel = TRUE;
1086
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Could not get DRM driver version\n");
1089
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
1090
"[drm] Failed to open DRM device for %s: %s\n",
1091
busId, strerror(errno));
1096
if (!UMSPreInit(pScrn)) {
1101
/* Now handle the Display */
1102
if (flags & PROBE_DETECT)
1105
pScrn->monitor = pScrn->confScreen->monitor;
1108
* We support depths of 8, 16 and 24.
1109
* We support bpp of 8, 16, and 32.
1112
if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) {
1117
switch (pScrn->depth) {
1125
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
1126
"Given depth (%d) is not supported by this driver\n",
1134
xf86PrintDepthBpp(pScrn);
1136
if (pScrn->depth == 32) {
1140
if (pScrn->depth > 8) {
1141
rgb zeros = { 0, 0, 0 };
1143
if (!xf86SetWeight(pScrn, zeros, zeros)) {
1148
/* TODO check weight returned is supported */
1153
if (!xf86SetDefaultVisual(pScrn, -1)) {
1156
/* We don't currently support DirectColor at > 8bpp */
1157
if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
1158
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual"
1159
" (%s) is not supported at depth %d.\n",
1160
xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
1167
/* We use a programmable clock */
1168
pScrn->progClock = TRUE;
1170
xf86CollectOptions(pScrn, option);
1172
/* Set the bits per RGB for 8bpp mode */
1173
if (pScrn->depth == 8)
1176
if (!VIASetupDefaultOptions(pScrn)) {
1181
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, VIAOptions);
1183
if (xf86GetOptValInteger(VIAOptions, OPTION_VIDEORAM, &pScrn->videoRam))
1184
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1185
"Setting amount of VideoRAM to %d kB\n", pScrn->videoRam);
1187
if ((s = xf86GetOptValString(VIAOptions, OPTION_MODE_SWITCH_METHOD))) {
1188
if (!xf86NameCmp(s, "legacy")) {
1189
if (pVia->UseLegacyModeSwitch) {
1190
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1191
"Already using \"legacy\" as ModeSwitchMethod, "
1192
"did not force anything.\n");
1194
pVia->UseLegacyModeSwitch = TRUE;
1195
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1196
"Forced ModeSwitchMethod to \"legacy\".\n");
1199
else if (!xf86NameCmp(s, "new")) {
1200
if (pVia->UseLegacyModeSwitch) {
1201
pVia->UseLegacyModeSwitch = FALSE;
1202
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1203
"Forced ModeSwitchMethod to \"new\".\n");
1205
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1206
"Already using \"new\" as ModeSwitchMethod, "
1207
"did not force anything.\n");
1210
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
1211
"value for Option \"ModeSwitchMethod\".\n", s);
1212
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1213
"Valid options are \"legacy\" or \"new\".\n");
1217
/* When rotating, switch shadow framebuffer on and acceleration off. */
1218
if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATION_TYPE))) {
1219
if (!xf86NameCmp(s, "SWRandR")) {
1220
pVia->shadowFB = TRUE;
1221
pVia->NoAccel = TRUE;
1222
pVia->RandRRotation = TRUE;
1223
pVia->rotate = RR_Rotate_0;
1224
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
1225
"RandR enabled, acceleration disabled\n");
1226
} else if (!xf86NameCmp(s, "HWRandR")) {
1227
pVia->shadowFB = TRUE;
1228
pVia->NoAccel = TRUE;
1229
pVia->RandRRotation = TRUE;
1230
pVia->rotate = RR_Rotate_0;
1231
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Hardware accelerated "
1232
"rotating screen is not implemented. Using SW RandR.\n");
1234
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
1235
"value for Option \"RotationType\".\n", s);
1236
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1237
"Valid options are \"SWRandR\" and \"HWRandR\".\n");
1241
/* When rotating, switch shadow framebuffer on and acceleration off. */
1242
if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATE))) {
1243
if (!xf86NameCmp(s, "CW")) {
1244
pVia->shadowFB = TRUE;
1245
pVia->NoAccel = TRUE;
1246
pVia->RandRRotation = TRUE;
1247
pVia->rotate = RR_Rotate_270;
1248
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
1249
"clockwise -- acceleration is disabled.\n");
1250
} else if (!xf86NameCmp(s, "CCW")) {
1251
pVia->shadowFB = TRUE;
1252
pVia->NoAccel = TRUE;
1253
pVia->RandRRotation = TRUE;
1254
pVia->rotate = RR_Rotate_90;
1255
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
1256
"counterclockwise -- acceleration is disabled.\n");
1257
} else if (!xf86NameCmp(s, "UD")) {
1258
pVia->shadowFB = TRUE;
1259
pVia->NoAccel = TRUE;
1260
pVia->RandRRotation = TRUE;
1261
pVia->rotate = RR_Rotate_180;
1262
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen "
1263
"upside-down -- acceleration is disabled.\n");
1265
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
1266
"value for Option \"Rotate\".\n", s);
1267
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1268
"Valid options are \"CW\", \"CCW\" or \"UD\".\n");
1272
from = (xf86GetOptValBool(VIAOptions, OPTION_SHADOW_FB, &pVia->shadowFB)
1273
? X_CONFIG : X_DEFAULT);
1274
xf86DrvMsg(pScrn->scrnIndex, from, "Shadow framebuffer is %s.\n",
1275
pVia->shadowFB ? "enabled" : "disabled");
1277
/* Use hardware acceleration, unless on shadow framebuffer. */
1278
from = (xf86GetOptValBool(VIAOptions, OPTION_NOACCEL, &pVia->NoAccel)
1279
? X_CONFIG : X_DEFAULT);
1280
if (!pVia->NoAccel && pVia->shadowFB) {
1281
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Acceleration is "
1282
"not supported when using shadow framebuffer.\n");
1283
pVia->NoAccel = TRUE;
1287
/* Disable EXA for KMS case */
1289
pVia->NoAccel = TRUE;
1291
xf86DrvMsg(pScrn->scrnIndex, from, "Hardware acceleration is %s.\n",
1292
!pVia->NoAccel ? "enabled" : "disabled");
1294
if (!pVia->NoAccel) {
1296
if ((s = (char *)xf86GetOptValString(VIAOptions, OPTION_ACCELMETHOD))) {
1297
if (!xf86NameCmp(s, "EXA")) {
1299
pVia->useEXA = TRUE;
1300
} else if (!xf86NameCmp(s, "XAA")) {
1302
pVia->useEXA = TRUE;
1305
xf86DrvMsg(pScrn->scrnIndex, from,
1306
"Using %s acceleration architecture.\n",
1307
pVia->useEXA ? "EXA" : "XAA");
1309
//pVia->noComposite = FALSE;
1311
from = xf86GetOptValBool(VIAOptions, OPTION_EXA_NOCOMPOSITE,
1312
&pVia->noComposite) ? X_CONFIG : X_DEFAULT;
1313
xf86DrvMsg(pScrn->scrnIndex, from,
1314
"EXA composite acceleration %s.\n",
1315
!pVia->noComposite ? "enabled" : "disabled");
1317
//pVia->exaScratchSize = VIA_SCRATCH_SIZE / 1024;
1318
from = xf86GetOptValInteger(VIAOptions, OPTION_EXA_SCRATCH_SIZE,
1319
&pVia->exaScratchSize)
1320
? X_CONFIG : X_DEFAULT;
1321
xf86DrvMsg(pScrn->scrnIndex, from,
1322
"EXA scratch area size is %d kB.\n",
1323
pVia->exaScratchSize);
1327
/* Use a hardware cursor, unless on secondary or on shadow framebuffer. */
1329
if (pVia->IsSecondary || pVia->shadowFB)
1330
pVia->drmmode.hwcursor = FALSE;
1331
else if (xf86GetOptValBool(VIAOptions, OPTION_SWCURSOR,
1332
&pVia->drmmode.hwcursor)) {
1333
pVia->drmmode.hwcursor = !pVia->drmmode.hwcursor;
1336
if (pVia->drmmode.hwcursor)
1337
xf86DrvMsg(pScrn->scrnIndex, from, "Using hardware two-color "
1338
"cursors and software full-color cursors.\n");
1340
xf86DrvMsg(pScrn->scrnIndex, from, "Using software cursors.\n");
1342
//pVia->VQEnable = TRUE;
1343
from = xf86GetOptValBool(VIAOptions, OPTION_DISABLEVQ, &pVia->VQEnable)
1344
? X_CONFIG : X_DEFAULT;
1345
if (from == X_CONFIG)
1346
pVia->VQEnable = !pVia->VQEnable;
1347
xf86DrvMsg(pScrn->scrnIndex, from,
1348
"GPU virtual command queue will be %s.\n",
1349
(pVia->VQEnable) ? "enabled" : "disabled");
1351
//pVia->DRIIrqEnable = TRUE;
1352
from = xf86GetOptValBool(VIAOptions, OPTION_DISABLEIRQ, &pVia->DRIIrqEnable)
1353
? X_CONFIG : X_DEFAULT;
1354
if (from == X_CONFIG)
1355
pVia->DRIIrqEnable = !pVia->DRIIrqEnable;
1356
xf86DrvMsg(pScrn->scrnIndex, from,
1357
"DRI IRQ will be %s if DRI is enabled.\n",
1358
(pVia->DRIIrqEnable) ? "enabled" : "disabled");
1360
//pVia->agpEnable = FALSE;
1361
from = xf86GetOptValBool(VIAOptions, OPTION_AGP_DMA, &pVia->agpEnable)
1362
? X_CONFIG : X_DEFAULT;
1363
xf86DrvMsg(pScrn->scrnIndex, from,
1364
"AGP DMA will be %s if DRI is enabled.\n",
1365
(pVia->agpEnable) ? "enabled" : "disabled");
1367
//pVia->dma2d = TRUE;
1368
if (pVia->agpEnable) {
1369
from = xf86GetOptValBool(VIAOptions, OPTION_2D_DMA, &pVia->dma2d)
1370
? X_CONFIG : X_DEFAULT;
1371
if (from == X_CONFIG)
1372
pVia->dma2d = !pVia->dma2d;
1373
xf86DrvMsg(pScrn->scrnIndex, from, "AGP DMA will %sbe used for "
1374
"2D acceleration.\n", (pVia->dma2d) ? "" : "not ");
1376
//pVia->dmaXV = TRUE;
1377
from = xf86GetOptValBool(VIAOptions, OPTION_XV_DMA, &pVia->dmaXV)
1378
? X_CONFIG : X_DEFAULT;
1379
if (from == X_CONFIG)
1380
pVia->dmaXV = !pVia->dmaXV;
1381
xf86DrvMsg(pScrn->scrnIndex, from, "PCI DMA will %sbe used for XV "
1382
"image transfer if DRI is enabled.\n",
1383
(pVia->dmaXV) ? "" : "not ");
1385
//pVia->useVBEModes = FALSE;
1386
from = xf86GetOptValBool(VIAOptions, OPTION_VBEMODES, &pVia->useVBEModes)
1387
? X_CONFIG : X_DEFAULT;
1388
xf86DrvMsg(pScrn->scrnIndex, from, "Will %senable VBE modes.\n",
1389
(pVia->useVBEModes) ? "" : "not ");
1391
//pVia->vbeSR = FALSE;
1392
from = xf86GetOptValBool(VIAOptions, OPTION_VBE_SAVERESTORE, &pVia->vbeSR)
1393
? X_CONFIG : X_DEFAULT;
1394
xf86DrvMsg(pScrn->scrnIndex, from, "VBE VGA register save & restore "
1395
"will %sbe used\n\tif VBE modes are enabled.\n",
1396
(pVia->vbeSR) ? "" : "not ");
1399
//pVia->disableXvBWCheck = FALSE;
1400
from = xf86GetOptValBool(VIAOptions, OPTION_DISABLE_XV_BW_CHECK,
1401
&pVia->disableXvBWCheck)
1402
? X_CONFIG : X_DEFAULT;
1403
xf86DrvMsg(pScrn->scrnIndex, from, "Xv Bandwidth check is %s.\n",
1404
pVia->disableXvBWCheck ? "disabled" : "enabled");
1405
if (pVia->disableXvBWCheck) {
1406
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1407
"You may get a \"snowy\" screen"
1408
" when using the Xv overlay.\n");
1412
//pVia->maxDriSize = 0;
1413
from = xf86GetOptValInteger(VIAOptions, OPTION_MAX_DRIMEM,
1415
? X_CONFIG : X_DEFAULT;
1416
if (pVia->maxDriSize > 0)
1417
xf86DrvMsg(pScrn->scrnIndex, from,
1418
"Will impose a %d kB limit on video RAM reserved for DRI.\n",
1421
xf86DrvMsg(pScrn->scrnIndex, from,
1422
"Will not impose a limit on video RAM reserved for DRI.\n");
1424
//pVia->agpMem = AGP_SIZE / 1024;
1425
from = xf86GetOptValInteger(VIAOptions, OPTION_AGPMEM, &pVia->agpMem)
1426
? X_CONFIG : X_DEFAULT;
1427
xf86DrvMsg(pScrn->scrnIndex, from,
1428
"Will try to allocate %d kB of AGP memory.\n", pVia->agpMem);
1430
/* ActiveDevice Option for device selection */
1431
//pVia->ActiveDevice = 0x00;
1432
if ((s = xf86GetOptValString(VIAOptions, OPTION_ACTIVEDEVICE))) {
1433
if (strstr(s, "CRT"))
1434
pVia->ActiveDevice |= VIA_DEVICE_CRT;
1435
if (strstr(s, "LCD"))
1436
pVia->ActiveDevice |= VIA_DEVICE_LCD;
1437
if (strstr(s, "DFP"))
1438
pVia->ActiveDevice |= VIA_DEVICE_DFP;
1439
if (strstr(s, "TV"))
1440
pVia->ActiveDevice |= VIA_DEVICE_TV;
1443
pBIOSInfo = pVia->pBIOSInfo;
1444
pBIOSInfo->TVDotCrawl = FALSE;
1445
from = xf86GetOptValBool(VIAOptions, OPTION_TVDOTCRAWL,
1446
&pBIOSInfo->TVDotCrawl)
1447
? X_CONFIG : X_DEFAULT;
1448
xf86DrvMsg(pScrn->scrnIndex, from, "TV dotCrawl is %s.\n",
1449
pBIOSInfo->TVDotCrawl ? "enabled" : "disabled");
1452
pBIOSInfo->TVDeflicker = 0;
1453
from = xf86GetOptValInteger(VIAOptions, OPTION_TVDEFLICKER,
1454
&pBIOSInfo->TVDeflicker)
1455
? X_CONFIG : X_DEFAULT;
1456
xf86DrvMsg(pScrn->scrnIndex, from, "TV deflicker is set to %d.\n",
1457
pBIOSInfo->TVDeflicker);
1459
pBIOSInfo->TVType = TVTYPE_NONE;
1460
if ((s = xf86GetOptValString(VIAOptions, OPTION_TVTYPE))) {
1461
if (!xf86NameCmp(s, "NTSC")) {
1462
pBIOSInfo->TVType = TVTYPE_NTSC;
1463
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is NTSC.\n");
1464
} else if (!xf86NameCmp(s, "PAL")) {
1465
pBIOSInfo->TVType = TVTYPE_PAL;
1466
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is PAL.\n");
1467
} else if (!xf86NameCmp(s, "480P")) {
1468
pBIOSInfo->TVType = TVTYPE_480P;
1469
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is SDTV 480P.\n");
1470
} else if (!xf86NameCmp(s, "576P")) {
1471
pBIOSInfo->TVType = TVTYPE_576P;
1472
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is SDTV 576P.\n");
1473
} else if (!xf86NameCmp(s, "720P")) {
1474
pBIOSInfo->TVType = TVTYPE_720P;
1475
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is HDTV 720P.\n");
1476
} else if (!xf86NameCmp(s, "1080I")) {
1477
pBIOSInfo->TVType = TVTYPE_1080I;
1478
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Type is HDTV 1080i.\n");
1481
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "No default TV type is set.\n");
1484
/* TV output signal Option */
1485
pBIOSInfo->TVOutput = TVOUTPUT_NONE;
1486
if ((s = xf86GetOptValString(VIAOptions, OPTION_TVOUTPUT))) {
1487
if (!xf86NameCmp(s, "S-Video")) {
1488
pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO;
1489
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1490
"TV Output Signal is S-Video.\n");
1491
} else if (!xf86NameCmp(s, "Composite")) {
1492
pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE;
1493
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1494
"TV Output Signal is Composite.\n");
1495
} else if (!xf86NameCmp(s, "SC")) {
1496
pBIOSInfo->TVOutput = TVOUTPUT_SC;
1497
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Output Signal is SC.\n");
1498
} else if (!xf86NameCmp(s, "RGB")) {
1499
pBIOSInfo->TVOutput = TVOUTPUT_RGB;
1500
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1501
"TV Output Signal is RGB.\n");
1502
} else if (!xf86NameCmp(s, "YCbCr")) {
1503
pBIOSInfo->TVOutput = TVOUTPUT_YCBCR;
1504
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1505
"TV Output Signal is YCbCr.\n");
1508
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
1509
"No default TV output signal type is set.\n");
1513
if ((s = xf86GetOptValString(VIAOptions, OPTION_TVDIPORT))) {
1514
if (!xf86NameCmp(s, "DVP0")) {
1515
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
1516
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1517
"TV Output Port is DVP0.\n");
1518
} else if (!xf86NameCmp(s, "DVP1")) {
1519
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP1;
1520
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1521
"TV Output Port is DVP1.\n");
1522
} else if (!xf86NameCmp(s, "DFPHigh")) {
1523
pBIOSInfo->TVDIPort = VIA_DI_PORT_DFPHIGH;
1524
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1525
"TV Output Port is DFPHigh.\n");
1526
} else if (!xf86NameCmp(s, "DFPLow")) {
1527
pBIOSInfo->TVDIPort = VIA_DI_PORT_DFPLOW;
1528
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1529
"TV Output Port is DFPLow.\n");
1532
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
1533
"No default TV output port is set.\n");
1536
VIAVidHWDiffInit(pScrn);
1539
//pVia->PrintVGARegs = FALSE;
1540
from = xf86GetOptValBool(VIAOptions, OPTION_PRINTVGAREGS,
1541
&pVia->PrintVGARegs)
1542
? X_CONFIG : X_DEFAULT;
1543
xf86DrvMsg(pScrn->scrnIndex, from, "Will %sprint VGA registers.\n",
1544
pVia->PrintVGARegs ? "" : "not ");
1545
if (pVia->PrintVGARegs)
1546
ViaVgahwPrint(VGAHWPTR(pScrn)); /* Do this as early as possible */
1548
pVia->I2CScan = FALSE;
1549
from = xf86GetOptValBool(VIAOptions, OPTION_I2CSCAN, &pVia->I2CScan)
1550
? X_CONFIG : X_DEFAULT;
1551
xf86DrvMsg(pScrn->scrnIndex, from, "Will %sscan I2C buses.\n",
1552
pVia->I2CScan ? "" : "not ");
1553
#endif /* HAVE_DEBUG */
1555
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1556
"...Finished parsing config file options.\n");
1558
ViaCheckCardId(pScrn);
1560
/* I2CDevices Option for I2C Initialization */
1561
if ((s = xf86GetOptValString(VIAOptions, OPTION_I2CDEVICES))) {
1562
pVia->I2CDevices = 0;
1563
if (strstr(s, "Bus1"))
1564
pVia->I2CDevices |= VIA_I2C_BUS1;
1565
if (strstr(s, "Bus2"))
1566
pVia->I2CDevices |= VIA_I2C_BUS2;
1567
if (strstr(s, "Bus3"))
1568
pVia->I2CDevices |= VIA_I2C_BUS3;
1571
if (!xf86NameCmp(pVia->Id->String, "OLPC XO 1.5"))
1572
pVia->I2CDevices &= ~VIA_I2C_BUS2;
1575
xf86CrtcConfigInit(pScrn, &via_xf86crtc_config_funcs);
1578
if (!KMSCrtcInit(pScrn, &pVia->drmmode)) {
1583
if (!UMSCrtcInit(pScrn)) {
1589
if (!xf86InitialConfiguration(pScrn, TRUE)) {
1590
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Initial configuration failed\n");
1594
if (!pScrn->modes) {
1595
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
1599
/* Initialize the colormap */
1600
Gamma zeros = { 0.0, 0.0, 0.0 };
1601
if (!xf86SetGamma(pScrn, zeros)) {
1606
/* Set up screen parameters. */
1607
pVia->Bpp = pScrn->bitsPerPixel >> 3;
1608
pVia->Bpl = pScrn->virtualX * pVia->Bpp;
1610
/* Set the current mode to the first in the list */
1611
pScrn->currentMode = pScrn->modes;
1613
/* Set display resolution */
1614
xf86SetDpi(pScrn, 0, 0);
1616
if (xf86LoadSubModule(pScrn, "fb") == NULL) {
1621
if (!pVia->NoAccel) {
1625
memset(&req, 0, sizeof(req));
1626
req.majorversion = 2;
1627
req.minorversion = 0;
1628
if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &req,
1629
&errmaj, &errmin)) {
1630
LoaderErrorMsg(NULL, "exa", errmaj, errmin);
1636
if (pVia->shadowFB) {
1637
if (!xf86LoadSubModule(pScrn, "shadow")) {
1646
LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
1647
LOCO * colors, VisualPtr pVisual)
1649
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
1650
CARD16 lut_r[256], lut_g[256], lut_b[256];
1653
for (k = 0; k < xf86_config->num_crtc; k++) {
1654
xf86CrtcPtr crtc = xf86_config->crtc[k];
1656
switch (pScrn->depth) {
1658
for (i = 0; i < numColors; i++) {
1660
for (j = 0; j < 8; j++) {
1661
lut_r[index * 8 + j] = colors[index].red << 8;
1662
lut_g[index * 8 + j] = colors[index].green << 8;
1663
lut_b[index * 8 + j] = colors[index].blue << 8;
1668
for (i = 0; i < numColors; i++) {
1672
for (j = 0; j < 8; j++) {
1673
lut_r[index * 8 + j] = colors[index].red << 8;
1674
lut_b[index * 8 + j] = colors[index].blue << 8;
1678
for (j = 0; j < 4; j++)
1679
lut_g[index * 4 + j] = colors[index].green << 8;
1683
for (i = 0; i < numColors; i++) {
1685
lut_r[index] = colors[index].red << 8;
1686
lut_g[index] = colors[index].green << 8;
1687
lut_b[index] = colors[index].blue << 8;
1692
/* Make the change through RandR */
1693
#ifdef RANDR_12_INTERFACE
1694
RRCrtcGammaSet(crtc->randr_crtc, lut_r, lut_g, lut_b);
1695
#else /*RANDR_12_INTERFACE*/
1696
crtc->funcs->gamma_set(crtc, lut_r, lut_g, lut_b, 256);
1702
viaShadowWindow(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
1703
CARD32 *size, void *closure)
1705
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1706
VIAPtr pVia = VIAPTR(pScrn);
1709
stride = (pScrn->displayWidth * pScrn->bitsPerPixel) / 8;
1711
return ((uint8_t *) drm_bo_map(pScrn, pVia->drmmode.front_bo) + row * stride + offset);
1715
VIACreateScreenResources(ScreenPtr pScreen)
1717
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1718
VIAPtr pVia = VIAPTR(pScrn);
1719
PixmapPtr rootPixmap;
1722
pScreen->CreateScreenResources = pVia->CreateScreenResources;
1723
if (!(*pScreen->CreateScreenResources)(pScreen))
1725
pScreen->CreateScreenResources = VIACreateScreenResources;
1727
rootPixmap = pScreen->GetScreenPixmap(pScreen);
1730
drmmode_uevent_init(pScrn, &pVia->drmmode);
1732
surface = drm_bo_map(pScrn, pVia->drmmode.front_bo);
1737
surface = pVia->ShadowPtr;
1739
if (!pScreen->ModifyPixmapHeader(rootPixmap, pScrn->virtualX,
1740
pScrn->virtualY, -1, -1,
1741
pVia->drmmode.front_bo->pitch,
1745
if (pVia->shadowFB) {
1746
if (!shadowAdd(pScreen, rootPixmap, shadowUpdatePackedWeak(),
1747
viaShadowWindow, 0, NULL))
1754
VIACloseScreen(CLOSE_SCREEN_ARGS_DECL)
1756
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1757
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
1758
VIAPtr pVia = VIAPTR(pScrn);
1761
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIACloseScreen\n"));
1763
if (pVia->directRenderingType != DRI_2)
1764
viaExitVideo(pScrn);
1766
viaExitAccel(pScreen);
1768
if (pVia->ShadowPtr) {
1769
shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
1770
free(pVia->ShadowPtr);
1771
pVia->ShadowPtr = NULL;
1774
/* Is the display currently visible? */
1776
VIALeaveVT(VT_FUNC_ARGS(0));
1779
drmmode_uevent_fini(pScrn, &pVia->drmmode);
1781
xf86_cursors_fini(pScreen);
1783
for (i = 0; i < xf86_config->num_crtc; i++) {
1784
xf86CrtcPtr crtc = xf86_config->crtc[i];
1785
drmmode_crtc_private_ptr iga = crtc->driver_private;
1788
drm_bo_free(pScrn, iga->cursor_bo);
1791
if (pVia->drmmode.front_bo) {
1793
if (pVia->KMS && pVia->drmmode.fb_id)
1794
drmModeRmFB(pVia->drmmode.fd, pVia->drmmode.fb_id);
1796
pVia->drmmode.fb_id = 0;
1798
drm_bo_free(pScrn, pVia->drmmode.front_bo);
1802
if (pVia->directRenderingType == DRI_1)
1803
VIADRICloseScreen(pScreen);
1806
drmmode_uevent_fini(pScrn, &pVia->drmmode);
1808
if (drmDropMaster(pVia->drmmode.fd))
1809
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1810
"drmDropMaster failed: %s\n",
1815
pScrn->vtSema = FALSE;
1816
pScreen->CloseScreen = pVia->CloseScreen;
1817
return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
1821
VIAScreenInit(SCREEN_INIT_ARGS_DECL)
1823
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1824
VIAPtr pVia = VIAPTR(pScrn);
1827
pScrn->pScreen = pScreen;
1828
pScrn->displayWidth = pScrn->virtualX;
1829
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAScreenInit\n"));
1833
if (drmSetMaster(pVia->drmmode.fd)) {
1834
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1835
"drmSetMaster failed: %s\n",
1840
if (pVia->drmmode.fd != -1) {
1841
if (pVia->directRenderingType == DRI_1) {
1842
/* DRI2 or DRI1 support */
1843
if (VIADRI1ScreenInit(pScreen))
1844
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DRI1 ScreenInit commplete\n"));
1846
pVia->directRenderingType = DRI_NONE;
1851
if (!drm_bo_manager_init(pScrn))
1854
format = map_legacy_formats(pScrn->bitsPerPixel, pScrn->depth);
1855
pVia->drmmode.front_bo = drm_bo_alloc_surface(pScrn, pScrn->virtualX, pScrn->virtualY,
1856
format, 16, TTM_PL_FLAG_VRAM);
1857
if (!pVia->drmmode.front_bo)
1860
if (!drm_bo_map(pScrn, pVia->drmmode.front_bo))
1863
if (!pVia->NoAccel && !UMSAccelInit(pScrn->pScreen))
1866
miClearVisualTypes();
1868
if (pScrn->bitsPerPixel > 8 && !pVia->IsSecondary) {
1869
if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
1870
pScrn->rgbBits, pScrn->defaultVisual))
1872
if (!miSetPixmapDepths())
1875
if (!miSetVisualTypes(pScrn->depth,
1876
miGetDefaultVisualMask(pScrn->depth),
1877
pScrn->rgbBits, pScrn->defaultVisual))
1879
if (!miSetPixmapDepths())
1883
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Visuals set up\n"));
1885
if (pVia->shadowFB) {
1886
int pitch = BitmapBytePad(pScrn->bitsPerPixel * pScrn->virtualX);
1888
pVia->shadowFB = FALSE;
1889
pVia->ShadowPtr = malloc(pitch * pScrn->virtualY);
1890
if (pVia->ShadowPtr) {
1891
if (shadowSetup(pScreen))
1892
pVia->shadowFB = TRUE;
1896
if (!fbScreenInit(pScreen, NULL, pScrn->virtualX, pScrn->virtualY,
1897
pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
1898
pScrn->bitsPerPixel))
1901
xf86SetBlackWhitePixels(pScreen);
1902
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- B & W\n"));
1904
if (pScrn->bitsPerPixel > 8) {
1907
visual = pScreen->visuals + pScreen->numVisuals;
1908
while (--visual >= pScreen->visuals) {
1909
if ((visual->class | DynamicClass) == DirectColor) {
1910
visual->offsetRed = pScrn->offset.red;
1911
visual->offsetGreen = pScrn->offset.green;
1912
visual->offsetBlue = pScrn->offset.blue;
1913
visual->redMask = pScrn->mask.red;
1914
visual->greenMask = pScrn->mask.green;
1915
visual->blueMask = pScrn->mask.blue;
1920
/* Must be after RGB ordering is fixed. */
1921
fbPictureInit(pScreen, NULL, 0);
1923
if (!pVia->NoAccel && !viaInitExa(pScreen))
1926
xf86SetBackingStore(pScreen);
1928
xf86SetSilkenMouse(pScreen);
1930
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Backing store set up\n"));
1932
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
1933
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- SW cursor set up\n"));
1935
if (pVia->drmmode.hwcursor) {
1936
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
1937
int flags = (HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
1938
HARDWARE_CURSOR_TRUECOLOR_AT_8BPP);
1939
int cursorSize, size, i = 0;
1941
switch (pVia->Chipset) {
1944
flags |= HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
1946
cursorSize = ((size * size) >> 3) * 2;
1949
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HWCursor ARGB enabled\n"));
1950
flags |= (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | HARDWARE_CURSOR_ARGB);
1952
cursorSize = (size * size) << 2;
1956
for (i = 0; i < xf86_config->num_crtc; i++) {
1957
xf86CrtcPtr crtc = xf86_config->crtc[i];
1958
drmmode_crtc_private_ptr iga = crtc->driver_private;
1960
/* Set cursor location in frame buffer. */
1961
iga->cursor_bo = drm_bo_alloc(pScrn, cursorSize, 16, TTM_PL_FLAG_VRAM);
1964
if (!xf86_cursors_init(pScreen, size, size, flags)) {
1965
pVia->drmmode.hwcursor = FALSE;
1966
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
1967
"Hardware cursor initialization failed\n");
1971
pScrn->vtSema = TRUE;
1972
pScreen->SaveScreen = xf86SaveScreen;
1973
pVia->CloseScreen = pScreen->CloseScreen;
1974
pScreen->CloseScreen = VIACloseScreen;
1975
pVia->CreateScreenResources = pScreen->CreateScreenResources;
1976
pScreen->CreateScreenResources = VIACreateScreenResources;
1978
if (!xf86CrtcScreenInit(pScreen))
1981
if (!miCreateDefColormap(pScreen))
1983
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Def Color map set up\n"));
1985
if (!xf86HandleColormaps(pScreen, 256, 8, LoadPalette, NULL,
1986
CMAP_RELOAD_ON_MODE_SWITCH
1987
| CMAP_PALETTED_TRUECOLOR))
1990
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Palette loaded\n"));
1991
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Color maps etc. set up\n"));
1993
xf86DPMSInit(pScreen, xf86DPMSSet, 0);
1994
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- DPMS set up\n"));
1996
if (!VIAEnterVT_internal(pScrn, 1))
1999
if (pVia->directRenderingType != DRI_2) {
2001
if (pVia->directRenderingType == DRI_1) {
2002
if (!VIADRIFinishScreenInit(pScreen)) {
2003
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n");
2004
pVia->directRenderingType = DRI_NONE;
2006
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n");
2010
viaFinishInitAccel(pScreen);
2012
viaInitVideo(pScrn->pScreen);
2015
if (serverGeneration == 1)
2016
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
2019
if (pVia->PrintVGARegs) {
2020
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
2021
"VIAScreenInit: Printing VGA registers.\n");
2022
ViaVgahwPrint(VGAHWPTR(pScrn));
2025
if (pVia->PrintTVRegs) {
2026
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
2027
"VIAScreenInit: Printing TV registers.\n");
2028
ViaTVPrintRegs(pScrn);
2032
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Done\n"));