summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2009-02-03 18:01:34 +0100
committerLuc Verhaegen <libv@skynet.be>2009-02-03 18:03:25 +0100
commit706a42943ed3fb15716f0de8a9849bcbdc43d145 (patch)
treeee8e03db3446217d7f83f97416f8657cd644927a
parent0178b02c83e40a23ee610d4db9ba3f6b16fd11dd (diff)
Rework VIAFUNC() macro to no longer take scrnIndex directly.
-rw-r--r--src/via_accel.c14
-rw-r--r--src/via_ch7xxx.c22
-rw-r--r--src/via_crt.c10
-rw-r--r--src/via_crtc.c46
-rw-r--r--src/via_cursor.c16
-rw-r--r--src/via_dri.c4
-rw-r--r--src/via_driver.c44
-rw-r--r--src/via_driver.h10
-rw-r--r--src/via_host.c16
-rw-r--r--src/via_i2c.c8
-rw-r--r--src/via_memory.c22
-rw-r--r--src/via_mode.c4
-rw-r--r--src/via_output.c20
-rw-r--r--src/via_panel.c12
-rw-r--r--src/via_sii16x.c16
-rw-r--r--src/via_video.c22
-rw-r--r--src/via_vt162x.c34
17 files changed, 153 insertions, 167 deletions
diff --git a/src/via_accel.c b/src/via_accel.c
index f9f15aa..36c9412 100644
--- a/src/via_accel.c
+++ b/src/via_accel.c
@@ -43,7 +43,7 @@ ViaAccelDumpRegs(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
ViaDebug(pScrn->scrnIndex, "GE Command: 0x%08X\n", VIAGETREG(VIA_REG_GECMD));
ViaDebug(pScrn->scrnIndex, "GE Mode/Status: 0x%08X\n", VIAGETREG(VIA_REG_GEMODE));
@@ -85,7 +85,7 @@ ViaAccelDumpRegs(ScrnInfoPtr pScrn)
static void
ViaAccelRegistersReset(VIAPtr pVia)
{
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
/* init 2D engine regs to reset 2D engine */
VIASETREG(0x04, 0x0);
@@ -112,7 +112,7 @@ ViaAccelRegistersReset(VIAPtr pVia)
static void
ViaAGPRegistersInit(VIAPtr pVia)
{
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
VIASETREG(VIA_REG_TRANSET, 0x00100000);
VIASETREG(VIA_REG_TRANSPACE, 0x00000000);
@@ -137,7 +137,7 @@ ViaVQEnable(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
CARD32 Start, End;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
Start = pVia->FBVQStart;
End = pVia->FBVQStart + pVia->FBVQSize;
@@ -176,7 +176,7 @@ ViaVQDisable(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
VIASETREG(VIA_REG_TRANSET, VIA_REG_VIRTUAL_QUEUE);
VIASETREG(VIA_REG_TRANSPACE, 0x00000004);
@@ -196,7 +196,7 @@ VIAInitialize2DEngine(ScrnInfoPtr pScrn)
CARD32 dwGEMode;
ViaTwodContext *tdc = &pVia->td;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
ViaAccelRegistersReset(pVia);
ViaAGPRegistersInit(pVia);
@@ -1296,7 +1296,7 @@ VIAInitAccel(ScrnInfoPtr pScrn, ScreenPtr pScreen)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* Clamp down on supported chipsets. */
switch (pVia->Chipset) {
diff --git a/src/via_ch7xxx.c b/src/via_ch7xxx.c
index 581c923..ed4638f 100644
--- a/src/via_ch7xxx.c
+++ b/src/via_ch7xxx.c
@@ -70,7 +70,7 @@ CH7xxxPrivateDestroy(struct ViaOutput *Output)
{
struct CH7xxxOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
xfree(Private->Regs);
xfree(Private);
@@ -86,7 +86,7 @@ CH7xxxPrivateCreate(struct ViaOutput *Output)
{
struct CH7xxxOutputPrivate *Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
Output->PrivSize = sizeof(struct CH7xxxOutputPrivate);
Output->Private = xnfcalloc(1, Output->PrivSize);
@@ -207,7 +207,7 @@ CH7011Save(struct ViaOutput *Output)
struct CH7xxxOutputPrivate *Private = Output->Private;
int i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
for (i = 0; i < 0x11; i++)
xf86I2CReadByte(Output->I2CDev, i, &(Private->Regs[i]));
@@ -237,7 +237,7 @@ CH7011Restore(struct ViaOutput *Output)
struct CH7xxxOutputPrivate *Private = Output->Private;
int i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
for (i = 0; i < 0x11; i++)
xf86I2CWriteByte(Output->I2CDev, i, Private->Regs[i]);
@@ -259,7 +259,7 @@ CH7xxxTVDACSense(struct ViaOutput *Output)
{
CARD8 dacsave, save, sense;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
/* Enable all DACs */
xf86I2CReadByte(Output->I2CDev, 0x49, &dacsave);
@@ -301,7 +301,7 @@ CH7011DACSense(struct ViaOutput *Output)
struct CH7xxxOutputPrivate *Private = Output->Private;
CARD8 sense;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
/* Config already set this */
if (Private->Output != TVOUTPUT_NONE)
@@ -346,7 +346,7 @@ CH7011TVStandardSet(struct ViaOutput *Output, int Standard)
{
struct CH7xxxOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (Output->MonitorName)
xfree(Output->MonitorName);
@@ -397,7 +397,7 @@ CH7011TVModeValid(struct ViaOutput *Output, DisplayModePtr mode)
char ID[12] = CH7011ID;
int i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (mode->PrivSize == sizeof(struct CH7011TableRec))
Table = (struct CH7011TableRec *) mode->Private;
@@ -454,7 +454,7 @@ CH7011TVMode(struct ViaOutput *Output, DisplayModePtr mode)
CARD8 tmp;
int i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
Table = (struct CH7011TableRec *) mode->Private;
@@ -530,7 +530,7 @@ CH7xxxTVPower(struct ViaOutput *Output, Bool On)
{
CARD8 save;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (On) {
/* POUTE */
@@ -558,7 +558,7 @@ ViaCH7xxxInit(ScrnInfoPtr pScrn, I2CDevPtr pDev)
struct CH7xxxOutputPrivate *Private;
CARD8 buf;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!xf86I2CReadByte(pDev, 0x4B, &buf)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to read from %s Slave %d.\n",
diff --git a/src/via_crt.c b/src/via_crt.c
index 8f96123..165ddbf 100644
--- a/src/via_crt.c
+++ b/src/via_crt.c
@@ -70,7 +70,7 @@ CRTPrivateDestroy(struct ViaOutput *Output)
static struct CRTPrivate *
CRTPrivateCreate(struct ViaOutput *Output)
{
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
Output->PrivSize = sizeof(struct CRTPrivate);
Output->Private = xnfcalloc(1, Output->PrivSize);
@@ -446,7 +446,7 @@ VT3122AxCRTSense(struct ViaOutput *Output)
vgaHWPtr hwp = VGAHWPTR(pScrn);
Bool Found;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!VGACRTSenseSignals(pScrn) || (hwp->readCrtc(hwp, 0x6A) & 0x80) ||
(hwp->readSeq(hwp, 0x16) & 0x40))
@@ -475,7 +475,7 @@ VT3122CxCRTSense(struct ViaOutput *Output)
CARD8 SR01, CR36;
Bool Found = FALSE;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
SR01 = hwp->readSeq(hwp, 0x01);
CR36 = hwp->readCrtc(hwp, 0x36);
@@ -514,7 +514,7 @@ CRTPower(struct ViaOutput *Output, Bool On)
ScrnInfoPtr pScrn = xf86Screens[Output->scrnIndex];
vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (On)
ViaCrtcMask(hwp, 0x36, 0x00, 0x30);
@@ -550,7 +550,7 @@ ViaCRTInit(ScrnInfoPtr pScrn, I2CDevPtr pDev)
struct ViaOutput *Output;
struct CRTPrivate *Private;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (pDev)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
diff --git a/src/via_crtc.c b/src/via_crtc.c
index 35144b3..f5fdfc7 100644
--- a/src/via_crtc.c
+++ b/src/via_crtc.c
@@ -95,12 +95,12 @@ VT3122PLLGenerateBest(int Clock, int Shift, int MinDiv, int MaxDiv,
* perseverance.
*/
static CARD32
-VT3122PLLGenerate(int scrnIndex, int Clock)
+VT3122PLLGenerate(struct ViaCrtc *Crtc, int Clock)
{
CARD32 PLL;
int Diff = 300000;
- VIAFUNC(scrnIndex);
+ VIAFUNC(Crtc);
if (Clock > 72514)
PLL = VT3122PLLGenerateBest(Clock, 1, 2, 25, &Diff);
@@ -139,7 +139,7 @@ VT3122PLLGenerate(int scrnIndex, int Clock)
else
PLL = VT3122PLLGenerateBest(Clock, 4, 8, 19, &Diff);
- ViaDebug(scrnIndex, "%s: PLL: 0x%04X (%d off from %d)\n",
+ ViaDebug(Crtc->scrnIndex, "%s: PLL: 0x%04X (%d off from %d)\n",
__func__, PLL, Diff, Clock);
return PLL;
}
@@ -173,13 +173,13 @@ VT3108PLLGenerateBest(int Clock, int Shift, int Div, int oldDiff, CARD32 *PLL)
*
*/
static CARD32
-VT3108PLLGenerate(int scrnIndex, int Clock)
+VT3108PLLGenerate(struct ViaCrtc *Crtc, int Clock)
{
CARD32 PLL;
int Diff = 300000;
int i;
- VIAFUNC(scrnIndex);
+ VIAFUNC(Crtc);
for (i = 2; i < 15; i++)
Diff = VT3108PLLGenerateBest(Clock, 0, i, Diff, &PLL);
@@ -193,7 +193,7 @@ VT3108PLLGenerate(int scrnIndex, int Clock)
for (i = 2; i < 21; i++)
Diff = VT3108PLLGenerateBest(Clock, 3, i, Diff, &PLL);
- ViaDebug(scrnIndex, "%s: PLL: 0x%04X (%d off from %d)\n",
+ ViaDebug(Crtc->scrnIndex, "%s: PLL: 0x%04X (%d off from %d)\n",
__func__, PLL, Diff, Clock);
return PLL;
@@ -219,7 +219,7 @@ ViaCrtc1PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags)
else
PLL = 0x871C;
} else
- PLL = VT3122PLLGenerate(Crtc->scrnIndex, Clock);
+ PLL = VT3122PLLGenerate(Crtc, Clock);
ViaDebug(Crtc->scrnIndex, "%s: %dkHz -> 0x%04X.\n",
__func__, Clock, PLL);
@@ -232,7 +232,7 @@ ViaCrtc1PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags)
if (flags & PLL_FLAG_EXTERNAL)
break; /* seem perfectly happy like this??? */
else
- PLL = VT3108PLLGenerate(Crtc->scrnIndex, Clock);
+ PLL = VT3108PLLGenerate(Crtc, Clock);
ViaDebug(Crtc->scrnIndex, "%s: %dkHz -> 0x%06X.\n",
__func__, Clock, PLL);
@@ -289,7 +289,7 @@ ViaCrtc2PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags)
else
PLL = 0x871C;
} else
- PLL = VT3122PLLGenerate(Crtc->scrnIndex, Clock);
+ PLL = VT3122PLLGenerate(Crtc, Clock);
ViaDebug(Crtc->scrnIndex, "%s: %dkHz -> 0x%04X.\n",
__func__, Clock, PLL);
@@ -302,7 +302,7 @@ ViaCrtc2PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags)
if (flags & PLL_FLAG_EXTERNAL)
break; /* seem perfectly happy like this??? */
else
- PLL = VT3108PLLGenerate(Crtc->scrnIndex, Clock);
+ PLL = VT3108PLLGenerate(Crtc, Clock);
ViaDebug(Crtc->scrnIndex, "%s: %dkHz -> 0x%06X.\n",
__func__, Clock, PLL);
@@ -394,7 +394,7 @@ ViaCrtc1ExpireGet(struct ViaCrtc *Crtc, DisplayModePtr mode, ViaExpireNumberTabl
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
for (; Expire->X; Expire++)
if ((Expire->X == mode->CrtcHDisplay) &&
@@ -447,7 +447,7 @@ ViaCrtc1FIFOSet(struct ViaCrtc *Crtc, DisplayModePtr mode)
CARD16 Pitch, fetch;
CARD8 tmp;
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
/* fetch count */
/* Make this 32byte aligned as well... for reasons unknown and untested */
@@ -584,7 +584,7 @@ ViaCrtc2FIFOSet(struct ViaCrtc *Crtc, DisplayModePtr mode)
VIAPtr pVia = VIAPTR(pScrn);
CARD16 fetch;
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
/* Fetch count */
/* Make this 32byte aligned as well... for reasons unknown and untested */
@@ -1140,7 +1140,7 @@ ViaCrtc2SimultaneousModeSet(ScrnInfoPtr pScrn, DisplayModePtr mode)
vgaHWPtr hwp = VGAHWPTR(pScrn);
CARD16 temp;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
temp = (mode->CrtcHTotal >> 3) - 5;
hwp->writeCrtc(hwp, 0x6D, temp);
@@ -1328,7 +1328,7 @@ ViaCrtc1GammaEnable(struct ViaCrtc *Crtc, Bool Enable)
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
if (pVia->Chipset < VT3108) {
if (Enable)
@@ -1351,7 +1351,7 @@ ViaCrtc2GammaEnable(struct ViaCrtc *Crtc, Bool Enable)
{
vgaHWPtr hwp = VGAHWPTR(xf86Screens[Crtc->scrnIndex]);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
if (Enable)
ViaCrtcMask(hwp, 0x6A, 0x02, 0x02);
@@ -1418,7 +1418,7 @@ ViaCrtc1GammaSet(struct ViaCrtc *Crtc, int numColors, int *indices, LOCO *colors
{
vgaHWPtr hwp = VGAHWPTR(xf86Screens[Crtc->scrnIndex]);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
ViaSeqMask(hwp, 0x1A, 0x00, 0x01);
@@ -1433,7 +1433,7 @@ ViaCrtc2GammaSet(struct ViaCrtc *Crtc, int numColors, int *indices, LOCO *colors
{
vgaHWPtr hwp = VGAHWPTR(xf86Screens[Crtc->scrnIndex]);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
ViaSeqMask(hwp, 0x1A, 0x01, 0x01);
@@ -1448,7 +1448,7 @@ ViaCrtc1Enable(struct ViaCrtc *Crtc, Bool Enable)
{
vgaHWPtr hwp = VGAHWPTR(xf86Screens[Crtc->scrnIndex]);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
if (Enable)
ViaSeqMask(hwp, 0x1B, 0x30, 0x30);
@@ -1463,7 +1463,7 @@ ViaCrtc2Enable(struct ViaCrtc *Crtc, Bool Enable)
{
vgaHWPtr hwp = VGAHWPTR(xf86Screens[Crtc->scrnIndex]);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
if (Enable) {
ViaSeqMask(hwp, 0x1B, 0xC0, 0xC0);
@@ -1482,7 +1482,7 @@ ViaCrtc1Reset(struct ViaCrtc *Crtc, Bool Reset)
{
vgaHWPtr hwp = VGAHWPTR(xf86Screens[Crtc->scrnIndex]);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
/* Old VGA synchronous mode */
if (Reset)
@@ -1499,7 +1499,7 @@ ViaCrtc2Reset(struct ViaCrtc *Crtc, Bool Reset)
{
vgaHWPtr hwp = VGAHWPTR(xf86Screens[Crtc->scrnIndex]);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
if (Reset)
ViaCrtcMask(hwp, 0x6A, 0x00, 0x40);
@@ -1593,7 +1593,7 @@ ViaCrtcModeSetInitial(ScrnInfoPtr pScrn)
vgaHWPtr hwp = VGAHWPTR(pScrn);
CARD8 i;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
i = hwp->readMiscOut(hwp) | 0x22;
hwp->writeMiscOut(hwp, i);
diff --git a/src/via_cursor.c b/src/via_cursor.c
index 7b20b12..a144a9e 100644
--- a/src/via_cursor.c
+++ b/src/via_cursor.c
@@ -70,7 +70,7 @@ ViaCursorShow(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
CARD32 dwCursorMode;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
dwCursorMode = VIAGETREG(VIA_REG_CURSOR_MODE);
@@ -87,7 +87,7 @@ ViaCursorHide(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
CARD32 dwCursorMode;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
dwCursorMode = VIAGETREG(VIA_REG_CURSOR_MODE);
@@ -105,7 +105,7 @@ ViaCursorLoadImage(ScrnInfoPtr pScrn, unsigned char *src)
struct ViaCursor *Cursor = pVia->Cursor;
CARD32 dwCursorMode;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
VIAAccelSync(pScrn);
@@ -234,7 +234,7 @@ VIACursorInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
struct ViaCursor *Cursor;
CARD32 Mode = 0;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
switch(pVia->Chipset) {
case VT3122:
@@ -325,7 +325,7 @@ VIACursorDestroy(VIAPtr pVia)
if (!Cursor)
return;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
xf86DestroyCursorInfoRec(Cursor->Info);
if (Cursor->Image)
@@ -346,7 +346,7 @@ VIACursorStore(VIAPtr pVia)
if (!Cursor)
return;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
if (Cursor->Image) {
xf86DrvMsg(pVia->scrnIndex, X_WARNING, "%s: stale image left.\n", __func__);
@@ -372,7 +372,7 @@ VIACursorRestore(VIAPtr pVia)
if (!Cursor)
return;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
if (Cursor->Image) {
memcpy(pVia->FBBase + Cursor->Address, Cursor->Image, Cursor->Size);
@@ -398,7 +398,7 @@ VIACursorHide(VIAPtr pVia)
if (!Cursor)
return;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
Cursor->Info->HideCursor(xf86Screens[Cursor->scrnIndex]);
}
diff --git a/src/via_dri.c b/src/via_dri.c
index b2a2cda..f10405a 100644
--- a/src/via_dri.c
+++ b/src/via_dri.c
@@ -591,7 +591,7 @@ ViaDRMGetVersion(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
drmVersionPtr drmVersion = drmGetVersion(pVia->drmFD);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!drmVersion) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] unable to retrieve DRM"
@@ -651,7 +651,7 @@ VIADRIScreenInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
DRIInfoPtr pDRIInfo;
VIADRIPtr pVIADRI;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* if symbols or version check fails, we still want this to be NULL */
pVia->pDRIInfo = NULL;
diff --git a/src/via_driver.c b/src/via_driver.c
index 298e6ee..e86e552 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -423,7 +423,7 @@ VIAGetRec(ScrnInfoPtr pScrn)
{
VIAPtr pVia;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (pScrn->driverPrivate)
return TRUE;
@@ -441,7 +441,7 @@ VIAFreeRec(ScrnInfoPtr pScrn)
{
VIAPtr pVia;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!pScrn->driverPrivate)
return;
@@ -748,7 +748,7 @@ ViaScratchGet(ScrnInfoPtr pScrn)
struct ViaScratch *Scratch = xnfcalloc(sizeof(struct ViaScratch), 1);
int tmp;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!xf86IsScreenPrimary(pScrn->scrnIndex))
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s called when not the primary"
@@ -963,7 +963,7 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
vgaHWPtr hwp;
DisplayModePtr Modes;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (flags & PROBE_DETECT) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "libv doesn't believe in "
@@ -1449,7 +1449,7 @@ VIAEnterVT(int scrnIndex, int flags)
vgaHWPtr hwp = VGAHWPTR(pScrn);
/* FIXME: Rebind AGP memory here */
- VIAFUNC(scrnIndex);
+ VIAFUNC(pScrn);
ViaMMIOEnable(pScrn);
@@ -1501,7 +1501,7 @@ static void VIALeaveVT(int scrnIndex, int flags)
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(scrnIndex);
+ VIAFUNC(pScrn);
#ifdef HAVE_DRI
if (pVia->directRenderingEnabled)
@@ -1539,7 +1539,7 @@ VIASave(ScrnInfoPtr pScrn)
VIARegPtr Regs = &pVia->SavedReg;
int i;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
vgaHWProtect(pScrn, TRUE);
@@ -1635,7 +1635,7 @@ VIARestore(ScrnInfoPtr pScrn)
int i;
CARD8 tmp;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
vgaHWProtect(pScrn, TRUE);
/* Unlock Extended Regs */
@@ -1744,7 +1744,7 @@ ViaBrokenMTRRHack(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
CARD8 *tmp;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
tmp = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag,
pVia->FrameBufferBase, pScrn->videoRam << 10 );
@@ -1793,7 +1793,7 @@ VIAMapMMIO(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
#ifdef XSERVER_LIBPCIACCESS
pVia->MmioBase = pVia->PciInfo->regions[1].base_addr;
@@ -1869,7 +1869,7 @@ ViaMapFB(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* we're going to try to map before ScreenInit, because we need direct access
during store/restore. */
@@ -1916,7 +1916,7 @@ VIAUnmapMem(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* Disable MMIO */
ViaSeqMask(VGAHWPTR(pScrn), 0x1A, 0x00, 0x02);
@@ -1953,7 +1953,7 @@ ViaPaletteLoad(ScrnInfoPtr pScrn, int numColors, int *indices,
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if ((pVia->Crtc[0]->scrnIndex == pScrn->scrnIndex) && pVia->Crtc[0]->Active)
pVia->Crtc[0]->GammaSet(pVia->Crtc[0], numColors, indices, colors);
@@ -1970,7 +1970,7 @@ ViaOverScan(ScrnInfoPtr pScrn, int overscan)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
switch (pScrn->bitsPerPixel) {
case 16:
@@ -2007,7 +2007,7 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(scrnIndex);
+ VIAFUNC(pScrn);
if (!VIAMapMMIO(pScrn))
return FALSE;
@@ -2209,7 +2209,7 @@ VIAInternalScreenInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
int width, height, displayWidth;
unsigned char *FBStart;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (pVia->rotate) {
height = pScrn->virtualX;
@@ -2258,7 +2258,7 @@ VIAWriteMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* this is waaaay too simplistic and even plain wrong. */
#ifdef _VIA_VIDEO_H_
@@ -2291,7 +2291,7 @@ VIACloseScreen(int scrnIndex, ScreenPtr pScreen)
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(scrnIndex);
+ VIAFUNC(pScrn);
/* Is the display currently visible ? */
if (pScrn->vtSema) {
@@ -2347,7 +2347,7 @@ VIACloseScreen(int scrnIndex, ScreenPtr pScreen)
*/
static void VIAFreeScreen(int scrnIndex, int flags)
{
- VIAFUNC(scrnIndex);
+ VIAFUNC(xf86Screens[scrnIndex]);
VIAFreeRec(xf86Screens[scrnIndex]);
@@ -2374,7 +2374,7 @@ VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(scrnIndex);
+ VIAFUNC(pScrn);
if (pVia->Crtc[0]->Active)
ViaOutputsPower(pVia->Crtc[0], FALSE);
@@ -2423,7 +2423,7 @@ static void VIADPMS(ScrnInfoPtr pScrn, int mode, int flags)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
switch (mode) {
case DPMSModeOn:
@@ -2456,7 +2456,7 @@ VIAInitialize3DEngine(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
int i;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/*
* FIXME: Reinitializing the 3D engine after VT switch seems to be the way
diff --git a/src/via_driver.h b/src/via_driver.h
index 30da3a6..8035586 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -64,14 +64,6 @@
typedef struct pci_device *pciVideoPtr;
#endif
-#define VIA_MAX_ACCEL_X (2047)
-#define VIA_MAX_ACCEL_Y (2047)
-#ifdef X_USE_LINEARFB
-#define VIA_PIXMAP_CACHE_SIZE (4 * (VIA_MAX_ACCEL_X + 1) * (VIA_MAX_ACCEL_Y +1))
-#else
-#define VIA_PIXMAP_CACHE_SIZE (256 * 1024)
-#endif /* X_USE_LINEARFB */
-#define VIA_VQ_SIZE (256 * 1024)
#define VIA_CBUFFERSIZE 512
/* For pVia->ActiveDevice */
@@ -347,6 +339,6 @@ Bool VIADRIRingBufferInit(ScrnInfoPtr pScrn);
#define LOG_DEBUG_XV LOG_DEBUG + 1
void ViaDebug(int scrnIndex, const char *format, ...);
-#define VIAFUNC(scrnIndex) (ViaDebug(scrnIndex, "FUNCTION: %s\n", __func__))
+#define VIAFUNC(p) (ViaDebug((p)->scrnIndex, "FUNCTION: %s\n", __func__))
#endif /* _VIA_DRIVER_H_ */
diff --git a/src/via_host.c b/src/via_host.c
index 42db479..5cb98fc 100644
--- a/src/via_host.c
+++ b/src/via_host.c
@@ -120,7 +120,7 @@ ViaHostIdentify(ScrnInfoPtr pScrn)
CARD16 ID;
int i;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
PCIREADWORD(Dev, 0x02, &ID);
@@ -151,7 +151,7 @@ CLE266RAMTypeGet(ScrnInfoPtr pScrn)
CARD8 Reg54, Reg60, Reg69, RegE3;
int freq = 0;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
PCIREADBYTE(Dev, 0x54, &Reg54);
PCIREADBYTE(Dev, 0x69, &Reg69);
@@ -235,7 +235,7 @@ KM400RAMTypeGet(ScrnInfoPtr pScrn)
PCIDEVVAR Dev = PCIDEVFROMPOS(0, 0, 0);
CARD8 FSB, RAM, tmp;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* FSB frequency */
PCIREADBYTE(Dev, 0x54, &FSB);
@@ -473,7 +473,7 @@ CN700RAMTypeGet(ScrnInfoPtr pScrn)
{
CARD8 tmp;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
PCIREADBYTE(PCIDEVFROMPOS(0, 0, 3), 0x90, &tmp);
switch(tmp & 0x07) {
@@ -506,7 +506,7 @@ AMDRAMTypeGet(ScrnInfoPtr pScrn)
PCIDEVVAR Dev;
CARD8 tmp;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* AMD 0Fh DRAM Controller */
Dev = PCIDEVFROMIDS(0x1022, 0x1102);
@@ -635,7 +635,7 @@ CX700RAMTypeGet(ScrnInfoPtr pScrn)
PCIDEVVAR Dev = PCIDEVFROMPOS(0, 0, 3);
CARD8 Clock, Type;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
PCIREADBYTE(Dev, 0x90, &Clock); /* DRAM Clock */
PCIREADBYTE(Dev, 0x6C, &Type); /* DDR or DDR2 */
@@ -711,7 +711,7 @@ ViaFBInit(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
CARD8 tmp;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
pVia->MemType = VIA_MEM_NONE;
@@ -921,7 +921,7 @@ ViaFBBaseGet(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
unsigned long FBBase;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* PCI BAR */
#ifdef XSERVER_LIBPCIACCESS
diff --git a/src/via_i2c.c b/src/via_i2c.c
index 967e27a..69de8c2 100644
--- a/src/via_i2c.c
+++ b/src/via_i2c.c
@@ -82,8 +82,6 @@ ViaI2CBus1Init(int scrnIndex)
{
I2CBusPtr pI2CBus = xf86CreateI2CBusRec();
- VIAFUNC(scrnIndex);
-
if (!pI2CBus)
return NULL;
@@ -144,8 +142,6 @@ ViaI2CBus2Init(int scrnIndex)
{
I2CBusPtr pI2CBus = xf86CreateI2CBusRec();
- VIAFUNC(scrnIndex);
-
if (!pI2CBus)
return NULL;
@@ -352,8 +348,6 @@ ViaI2CBus3Init(int scrnIndex)
{
I2CBusPtr pI2CBus = xf86CreateI2CBusRec();
- VIAFUNC(scrnIndex);
-
if (!pI2CBus)
return NULL;
@@ -401,7 +395,7 @@ ViaI2CInit(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
pVia->pI2CBus1 = ViaI2CBus1Init(pScrn->scrnIndex);
pVia->pI2CBus2 = ViaI2CBus2Init(pScrn->scrnIndex);
diff --git a/src/via_memory.c b/src/via_memory.c
index d7c11c6..a946166 100644
--- a/src/via_memory.c
+++ b/src/via_memory.c
@@ -51,7 +51,7 @@ ViaMemInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
VIAPtr pVia = VIAPTR(pScrn);
int i;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
ViaDebug(pScrn->scrnIndex, "FB %p (%08X) is available for allocation.\n",
pVia->FBFreeStart, pVia->FBFreeSize);
@@ -69,7 +69,7 @@ ViaMemFBSort(VIAPtr pVia)
int i;
Bool swapped = TRUE;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
while (swapped) {
swapped = FALSE;
@@ -100,7 +100,7 @@ ViaMemFBFree(ScrnInfoPtr pScrn, struct ViaMem *Mem)
VIAPtr pVia = VIAPTR(pScrn);
int i;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
for (i = 0; i < VIA_MEM_SLOTS; i++)
if (pVia->Mem[i] == Mem) {
@@ -125,7 +125,7 @@ ViaMemFBAlloc(ScrnInfoPtr pScrn, unsigned long size, CARD8 alignment)
struct ViaMem *Mem;
int i;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* general checks first */
if (pVia->FBFreeSize < (size + alignment)) {
@@ -215,7 +215,7 @@ ViaMemInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
VIAPtr pVia = VIAPTR(pScrn);
unsigned long offset, size;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
ViaDebug(pScrn->scrnIndex, "FB %p (%08X) is available for allocation.\n",
pVia->FBFreeStart, pVia->FBFreeSize);
@@ -234,7 +234,7 @@ ViaMemInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
static void
ViaMemFBFree(ScrnInfoPtr pScrn, struct ViaMem *Mem)
{
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
xf86FreeOffscreenLinear((FBLinearPtr) Mem->Private);
@@ -253,7 +253,7 @@ ViaMemFBAlloc(ScrnInfoPtr pScrn, unsigned long size, CARD8 alignment)
FBLinearPtr linear;
unsigned long tempsize;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* Make sure we don't truncate requested size */
tempsize = (size + alignment + pVia->Bpp - 1) / pVia->Bpp;
@@ -305,7 +305,7 @@ ViaMemDRMFree(ScrnInfoPtr pScrn, struct ViaMem *Mem)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (drmCommandWrite(pVia->drmFD, DRM_VIA_FREEMEM, (drm_via_mem_t *) Mem->Private,
sizeof(drm_via_mem_t)) < 0)
@@ -327,7 +327,7 @@ ViaMemDRMAlloc(ScrnInfoPtr pScrn, unsigned long size, CARD8 alignment)
drm_via_mem_t * DrmMem;
int ret;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
DrmMem = xnfcalloc(sizeof(drm_via_mem_t), 1);
@@ -376,7 +376,7 @@ ViaMemAlloc(ScrnInfoPtr pScrn, unsigned long size, CARD8 alignment)
{
struct ViaMem *Mem;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!size) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s: libv is an idiot"
@@ -406,7 +406,7 @@ ViaMemAlloc(ScrnInfoPtr pScrn, unsigned long size, CARD8 alignment)
void
ViaMemFree(ScrnInfoPtr pScrn, struct ViaMem *Mem)
{
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (Mem) {
ViaDebug(pScrn->scrnIndex, "Freeing %d bytes at %p.\n", Mem->Size,
diff --git a/src/via_mode.c b/src/via_mode.c
index 519a0f0..a1e6d77 100644
--- a/src/via_mode.c
+++ b/src/via_mode.c
@@ -715,7 +715,7 @@ ViaModeValidateCrtc(struct ViaCrtc *Crtc, DisplayModePtr Mode)
VIAPtr pVia = VIAPTR(xf86Screens[Crtc->scrnIndex]);
int Status, i;
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
Status = ViaModeSanity(Mode);
if (Status != MODE_OK)
@@ -1618,7 +1618,7 @@ ViaModeSet(ScrnInfoPtr pScrn, DisplayModePtr Mode)
struct ViaCrtc *Crtc2 = pVia->Crtc[1];
DisplayModePtr Crtc1Mode, Crtc2Mode, ShadowMode;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
Crtc1Mode = Mode;
Crtc2Mode = Mode;
diff --git a/src/via_output.c b/src/via_output.c
index 8245a0a..94219af 100644
--- a/src/via_output.c
+++ b/src/via_output.c
@@ -170,7 +170,7 @@ ViaVT1631Init(ScrnInfoPtr pScrn, I2CDevPtr pDev)
CARD8 buf = 0, Read[4];
CARD32 ID;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!xf86I2CWriteRead(pDev, &buf, 1, Read, 4)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -211,7 +211,7 @@ ViaSAA710xInit(ScrnInfoPtr pScrn, I2CDevPtr pDev)
{
CARD8 buf;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!xf86I2CReadByte(pDev, 0x1C, &buf)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -250,7 +250,7 @@ ViaFS45xInit(ScrnInfoPtr pScrn, I2CDevPtr pDev)
{
CARD8 buf;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!xf86I2CReadByte(pDev, 0x7F, &buf)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -283,7 +283,7 @@ ViaAIT213xInit(ScrnInfoPtr pScrn, I2CDevPtr pDev)
{
CARD8 buf;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!xf86I2CReadByte(pDev, 0x3D, &buf)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -412,7 +412,7 @@ ViaOutputsDetect(ScrnInfoPtr pScrn)
struct ViaOutput *Output;
CARD8 SR12 = hwp->readSeq(hwp, 0x12);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* CRT */
Output = ViaCRTInit(pScrn, NULL);
@@ -727,7 +727,7 @@ ViaOutputsActive(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (pVia->ActiveDevice) {
struct ViaOutput *Output;
@@ -801,7 +801,7 @@ ViaMatchCrtcsAndOutputs(ScrnInfoPtr pScrn)
Bool Crtc1ModeFixed = FALSE;
Bool Crtc2ModeFixed = FALSE;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
Crtc1->Active = FALSE;
Crtc2->Active = FALSE;
@@ -927,7 +927,7 @@ ViaLayOutCrtcsAndOutputs(ScrnInfoPtr pScrn)
struct ViaCrtc *Crtc2 = pVia->Crtc[1];
struct ViaOutput *Output;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!ViaOutputsActive(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No active output found.\n");
@@ -1195,7 +1195,7 @@ ViaOutputBusSet(struct ViaCrtc *Crtc, struct ViaOutput *Output)
vgaHWPtr hwp = VGAHWPTR(xf86Screens[Crtc->scrnIndex]);
VIAPtr pVia = VIAPTR(xf86Screens[Crtc->scrnIndex]);
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
switch (Output->Position) {
case OUTPUT_BUS_CRT:
@@ -1332,7 +1332,7 @@ ViaOutputsModeSet(struct ViaCrtc *Crtc, DisplayModeRec *Mode)
VIAPtr pVia = VIAPTR(xf86Screens[Crtc->scrnIndex]);
struct ViaOutput *Output;
- VIAFUNC(Crtc->scrnIndex);
+ VIAFUNC(Crtc);
for (Output = pVia->Outputs; Output; Output = Output->Next) {
if ((Output->Owner == Crtc->ID) && Output->Active) {
diff --git a/src/via_panel.c b/src/via_panel.c
index de8a584..5993b8c 100644
--- a/src/via_panel.c
+++ b/src/via_panel.c
@@ -68,7 +68,7 @@ ViaPanelPrivateDestroy(struct ViaOutput *Output)
static struct ViaPanelOutputPrivate *
ViaPanelPrivateCreate(struct ViaOutput *Output)
{
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
Output->PrivSize = sizeof(struct ViaPanelOutputPrivate);
Output->Private = xnfcalloc(1, Output->PrivSize);
@@ -202,7 +202,7 @@ ViaPanelNativeResolutionFromConsole(VIAPtr pVia, CARD16 *HDisplay,
vgaHWPtr hwp = VGAHWPTR(xf86Screens[pVia->scrnIndex]);
CARD8 CR6A, CR6B, CR97, CR99;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
if (!xf86IsPrimaryPci(pVia->PciInfo))
return FALSE; /* VT has nothing set up anyway */
@@ -254,7 +254,7 @@ ViaPanelNativeResolutionFromConsole(VIAPtr pVia, CARD16 *HDisplay,
static Bool
ViaPanelNativeResolution(VIAPtr pVia, struct ViaPanelOutputPrivate *Private)
{
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
/* This could have been provided by config */
if (!Private->X || !Private->Y) {
@@ -322,7 +322,7 @@ ViaPanelTimingSet(struct ViaOutput *Output)
DisplayModePtr Modes, Mode;
float VSync = 60.0;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
/* To tackle the fact that CVT returns a 29.7H/59.4V mode otherwise */
if ((Private->X == 640) && (Private->Y == 480))
@@ -354,7 +354,7 @@ ViaPanelModeValid(struct ViaOutput *Output, DisplayModePtr mode)
{
struct ViaPanelOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if ((mode->HDisplay > Private->X) || (mode->VDisplay > Private->Y))
return MODE_PANEL;
@@ -475,7 +475,7 @@ ViaPanelInit(ScrnInfoPtr pScrn, I2CDevPtr pDev)
struct ViaOutput *Output;
struct ViaPanelOutputPrivate *Private;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (pDev)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s: Ignoring I2C Device"
diff --git a/src/via_sii16x.c b/src/via_sii16x.c
index 961b166..2a808fa 100644
--- a/src/via_sii16x.c
+++ b/src/via_sii16x.c
@@ -76,7 +76,7 @@ SiI16xPrivateCreate(struct ViaOutput *Output)
struct SiI16xOutputPrivate *Private;
CARD8 buf;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
Output->PrivSize = sizeof(struct SiI16xOutputPrivate);
Output->Private = xnfcalloc(1, Output->PrivSize);
@@ -123,7 +123,7 @@ SiI16xSave(struct ViaOutput *Output)
{
struct SiI16xOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
xf86I2CReadByte(Output->I2CDev, 0x08, &Private->Reg08);
}
@@ -136,7 +136,7 @@ SiI16xRestore(struct ViaOutput *Output)
{
struct SiI16xOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
xf86I2CWriteByte(Output->I2CDev, 0x08, Private->Reg08);
}
@@ -149,7 +149,7 @@ SiI16xSense(struct ViaOutput *Output)
{
CARD8 tmp;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
xf86I2CReadByte(Output->I2CDev, 0x09, &tmp);
@@ -164,7 +164,7 @@ SiI16xModeValid(struct ViaOutput *Output, DisplayModePtr mode)
{
struct SiI16xOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (mode->Clock < Private->DotclockMin)
return MODE_CLOCK_LOW;
@@ -181,7 +181,7 @@ SiI16xModeValid(struct ViaOutput *Output, DisplayModePtr mode)
static void
SiI16xMode(struct ViaOutput *Output, DisplayModePtr mode)
{
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
xf86I2CWriteByte(Output->I2CDev, 0x08, 0x37);
@@ -201,7 +201,7 @@ SiI16xPower(struct ViaOutput *Output, Bool On)
{
CARD8 buf;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
xf86I2CReadByte(Output->I2CDev, 0x08, &buf);
if (On)
@@ -228,7 +228,7 @@ ViaSiI16xInit(ScrnInfoPtr pScrn, I2CDevPtr pDev)
CARD8 buf = 0, Read[5];
CARD32 ID;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* Read the first 5 bytes */
if (!xf86I2CWriteRead(pDev, &buf, 1, Read, 5)) {
diff --git a/src/via_video.c b/src/via_video.c
index 6a82ba7..a0cc053 100644
--- a/src/via_video.c
+++ b/src/via_video.c
@@ -228,7 +228,7 @@ static XF86ImageRec ImagesG[NUM_IMAGES_G] =
static void
ViaSwovPrintRegs(struct ViaSwov *Swov, const char *function)
{
- VIAFUNC(Swov->scrnIndex);
+ VIAFUNC(Swov);
ViaDebug(Swov->scrnIndex, "%s: Video Map:\n", function);
ViaDebug(Swov->scrnIndex, "Flags: 0x%08X.\n", Swov->Video->Flags);
@@ -1145,7 +1145,7 @@ ViaAllocateFrontBuffer(ScrnInfoPtr pScrn, int FourCC, CARD16 Width, CARD16 Heigh
struct ViaXvPort *Port = Swov->Port;
int Size;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (Port->Front[0])
ViaMemFree(pScrn, Port->Front[0]);
@@ -1263,7 +1263,7 @@ ViaAllocateBackBuffers(ScrnInfoPtr pScrn)
struct ViaXvPort *Port = Swov->Port;
int Size;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (Port->Back[0])
ViaMemFree(pScrn, Port->Back[0]);
@@ -1336,7 +1336,7 @@ ViaSwovSurfaceDestroy(ScrnInfoPtr pScrn)
struct ViaSwov *Swov = VIAPTR(pScrn)->Swov;
struct ViaXvPort *Port = Swov->Port;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
Port->FourCC = 0;
Port->Width = 0;
@@ -2378,7 +2378,7 @@ ViaVideoReset(ScrnInfoPtr pScrn)
{
struct ViaSwov *Swov = VIAPTR(pScrn)->Swov;
- VIAFUNC(Swov->scrnIndex);
+ VIAFUNC(Swov);
Swov->Video->Video1Control = 0;
Swov->Video->Video3Control = 0;
@@ -2413,7 +2413,7 @@ ViaSwovStop(ScrnInfoPtr pScrn)
struct ViaSwov *Swov = VIAPTR(pScrn)->Swov;
vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
ViaHQVIdleWait(Swov);
@@ -2444,7 +2444,7 @@ ViaStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
struct ViaSwov *Swov = VIAPTR(pScrn)->Swov;
struct ViaXvPort *Port = (struct ViaXvPort *)data;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!Port->Opacity)
REGION_EMPTY(pScrn->pScreen, &Port->clip);
@@ -2479,7 +2479,7 @@ ViaSwovInit(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
struct ViaSwov *Swov;
- VIAFUNC(pVia->scrnIndex);
+ VIAFUNC(pVia);
pVia->Swov = (struct ViaSwov *) xnfcalloc(1, sizeof(struct ViaSwov));
@@ -2559,7 +2559,7 @@ ViaXvAdaptorInit(ScrnInfoPtr pScrn)
{
XF86VideoAdaptorPtr Adaptor;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
Adaptor = xf86XVAllocateVideoAdaptorRec(pScrn);
@@ -2603,7 +2603,7 @@ ViaVideoInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
XF86VideoAdaptorPtr adaptor[1], *adaptors[1];
int num_adaptors;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
switch (pVia->Chipset) {
case VT3122:
@@ -2653,7 +2653,7 @@ ViaVideoDestroy(ScrnInfoPtr pScrn)
VIAPtr pVia = VIAPTR(pScrn);
struct ViaSwov *Swov = pVia->Swov;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
/* Make sure we're shut down first. */
ViaStopVideo(pScrn, Swov->Port, TRUE);
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index a1bb8ea..e795a6d 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -89,7 +89,7 @@ VT162xPrivateCreate(struct ViaOutput *Output)
{
struct VT162xOutputPrivate *Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
Output->PrivSize = sizeof(struct VT162xOutputPrivate);
Output->Private = xnfcalloc(1, Output->PrivSize);
@@ -224,7 +224,7 @@ VT162xSave(struct ViaOutput *Output)
struct VT162xOutputPrivate *Private = Output->Private;
CARD8 buf = 0x00;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
xf86I2CWriteRead(Output->I2CDev, &buf,1, Private->Regs, Private->RegsSize);
}
@@ -238,7 +238,7 @@ VT162xRestore(struct ViaOutput *Output)
struct VT162xOutputPrivate *Private = Output->Private;
int i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
for (i = 0; i < Private->RegsSize; i++)
xf86I2CWriteByte(Output->I2CDev, i, Private->Regs[i]);
@@ -272,7 +272,7 @@ VT1621DACSense(struct ViaOutput *Output)
struct VT162xOutputPrivate *Private = Output->Private;
CARD8 sense;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
/* Config already set this */
if (Private->Output != TVOUTPUT_NONE)
@@ -314,7 +314,7 @@ VT1622DACSense(struct ViaOutput *Output)
struct VT162xOutputPrivate *Private = Output->Private;
CARD8 sense;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
/* Config already set this */
if (Private->Output != TVOUTPUT_NONE)
@@ -362,7 +362,7 @@ VT1621TVStandardSet(struct ViaOutput *Output, int Standard)
{
struct VT162xOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (Output->MonitorName)
xfree(Output->MonitorName);
@@ -411,7 +411,7 @@ VT1621ModeIndex(struct ViaOutput *Output, DisplayModePtr mode)
struct VT162xOutputPrivate *Private = Output->Private;
int i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
for (i = 0; VT1621Table[i].Width; i++) {
if ((VT1621Table[i].Width == mode->CrtcHDisplay) &&
@@ -433,7 +433,7 @@ VT1621ModeValid(struct ViaOutput *Output, DisplayModePtr mode)
{
struct VT162xOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if ((mode->PrivSize != sizeof(struct VT162xModePrivate)) ||
((mode->Private != (void *) &VT162xModePrivateNTSC) &&
@@ -460,7 +460,7 @@ VT1622TVStandardSet(struct ViaOutput *Output, int Standard)
{
struct VT162xOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (Output->MonitorName)
xfree(Output->MonitorName);
@@ -508,7 +508,7 @@ VT1623TVStandardSet(struct ViaOutput *Output, int Standard)
{
struct VT162xOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (Output->MonitorName)
xfree(Output->MonitorName);
@@ -558,7 +558,7 @@ VT1622ModeIndex(struct ViaOutput *Output, DisplayModePtr mode)
struct VT162XTableRec *Table;
int i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (Private->Device == VT1622)
Table = VT1622Table;
@@ -585,7 +585,7 @@ VT1622ModeValid(struct ViaOutput *Output, DisplayModePtr mode)
{
struct VT162xOutputPrivate *Private = Output->Private;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if ((mode->PrivSize != sizeof(struct VT162xModePrivate)) ||
((mode->Private != (void *) &VT162xModePrivateNTSC) &&
@@ -626,7 +626,7 @@ VT1621Mode(struct ViaOutput *Output, DisplayModePtr mode)
struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(Output, mode)];
CARD8 i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
for (i = 0; i < 0x16; i++)
xf86I2CWriteByte(Output->I2CDev, i, Table.TV[i]);
@@ -676,7 +676,7 @@ VT1622Mode(struct ViaOutput *Output, DisplayModePtr mode)
struct VT162XTableRec Table;
CARD8 save, i;
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (Private->Device == VT1622)
Table = VT1622Table[VT1622ModeIndex(Output, mode)];
@@ -751,7 +751,7 @@ VT1622Mode(struct ViaOutput *Output, DisplayModePtr mode)
static void
VT1621Power(struct ViaOutput *Output, Bool On)
{
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (On)
xf86I2CWriteByte(Output->I2CDev, 0x0E, 0x00);
@@ -765,7 +765,7 @@ VT1621Power(struct ViaOutput *Output, Bool On)
static void
VT1622Power(struct ViaOutput *Output, Bool On)
{
- VIAFUNC(Output->scrnIndex);
+ VIAFUNC(Output);
if (On)
xf86I2CWriteByte(Output->I2CDev, 0x0E, 0x00);
@@ -783,7 +783,7 @@ ViaVT162xInit(ScrnInfoPtr pScrn, I2CDevPtr pDev)
struct VT162xOutputPrivate *Private;
CARD8 buf;
- VIAFUNC(pScrn->scrnIndex);
+ VIAFUNC(pScrn);
if (!xf86I2CReadByte(pDev, 0x1B, &buf)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to read from %s Slave %d.\n",