summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenno Schulenberg <bensberg@justemail.net>2007-12-11 19:48:34 +0000
committerBenno Schulenberg <bensberg@justemail.net>2007-12-11 19:48:34 +0000
commit070fb1a05ac6e83ba47353bb462501cd8c484086 (patch)
tree4c3cea8299b0beaff3daa7bdb53beaa11ee1a927
parent14ea6693e358eaeb1620ef44d8b1d5efd06dedcc (diff)
Whitespace and comment tweaks (in via_cursor.c).
-rw-r--r--src/via_cursor.c291
1 files changed, 149 insertions, 142 deletions
diff --git a/src/via_cursor.c b/src/via_cursor.c
index 372884c..85b5db6 100644
--- a/src/via_cursor.c
+++ b/src/via_cursor.c
@@ -55,48 +55,42 @@ static void viaCursorARGBShow(ScrnInfoPtr pScrn);
static void viaCursorARGBHide(ScrnInfoPtr pScrn);
static void viaCursorARGBSetPosition(ScrnInfoPtr pScrn, int x, int y);
static Bool viaCursorARGBUse(ScreenPtr pScreen, CursorPtr pCurs);
-static void viaCursorARGBLoad (ScrnInfoPtr pScrn, CursorPtr pCurs);
+static void viaCursorARGBLoad(ScrnInfoPtr pScrn, CursorPtr pCurs);
#endif
#ifdef ARGB_CURSOR
-static void
+static void
viaCursorARGBInit(ScrnInfoPtr pScrn)
{
- VIAPtr pVia= VIAPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "viaCursorARGBInit\n"));
- unsigned long fbOffset = pScrn->fbOffset
- + pVia->cursor->fbCursorStart ;
+ unsigned long fbOffset = pScrn->fbOffset + pVia->cursor->fbCursorStart;
- switch(pVia->Chipset ) {
+ switch (pVia->Chipset) {
case VIA_CX700:
/* case VIA_CN750: */
case VIA_P4M890:
case VIA_P4M900:
- if(pBIOSInfo->FirstCRTC->IsActive) {
+ if (pBIOSInfo->FirstCRTC->IsActive) {
VIASETREG(VIA_REG_PRIM_HI_FBOFFSET, fbOffset);
-
- /* set 0 as transparent color key */
+ /* Set 0 as transparent color key. */
VIASETREG(VIA_REG_PRIM_HI_TRANSCOLOR, 0);
- VIASETREG(VIA_REG_PRIM_HI_FIFO,0x0D000D0F);
+ VIASETREG(VIA_REG_PRIM_HI_FIFO, 0x0D000D0F);
VIASETREG(VIA_REG_PRIM_HI_INVTCOLOR, 0X00FFFFFF);
VIASETREG(VIA_REG_V327_HI_INVTCOLOR, 0X00FFFFFF);
}
-
- if(pBIOSInfo->SecondCRTC->IsActive) {
- VIASETREG(VIA_REG_HI_FBOFFSET,fbOffset);
-
- /* set 0 as transparent color key */
+ if (pBIOSInfo->SecondCRTC->IsActive) {
+ VIASETREG(VIA_REG_HI_FBOFFSET, fbOffset);
+ /* Set 0 as transparent color key. */
VIASETREG(VIA_REG_HI_TRANSPARENT_COLOR, 0);
VIASETREG(VIA_REG_HI_INVTCOLOR, 0X00FFFFFF);
VIASETREG(ALPHA_V3_PREFIFO_CONTROL, 0xE0000);
VIASETREG(ALPHA_V3_FIFO_CONTROL, 0xE0F0000);
}
-
break;
-
default:
VIASETREG(VIA_REG_HI_FBOFFSET, fbOffset);
VIASETREG(VIA_REG_HI_TRANSPARENT_COLOR, 0);
@@ -108,12 +102,13 @@ viaCursorARGBInit(ScrnInfoPtr pScrn)
}
#endif
-void
+void
viaCursorSetFB(ScrnInfoPtr pScrn)
{
- VIAPtr pVia= VIAPTR(pScrn);
- if (!pVia->cursor->fbCursorStart
- && ((pVia->FBFreeEnd - pVia->FBFreeStart) > pVia->cursor->size)) {
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ if (!pVia->cursor->fbCursorStart
+ && ((pVia->FBFreeEnd - pVia->FBFreeStart) > pVia->cursor->size)) {
pVia->cursor->fbCursorStart = pVia->FBFreeEnd - pVia->cursor->size;
pVia->FBFreeEnd -= pVia->cursor->size;
}
@@ -127,6 +122,7 @@ viaCursorHWInit(ScreenPtr pScreen)
xf86CursorInfoPtr infoPtr;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIACursorHWInit\n"));
+
infoPtr = xf86CreateCursorInfoRec();
if (!infoPtr)
return FALSE;
@@ -135,19 +131,20 @@ viaCursorHWInit(ScreenPtr pScreen)
infoPtr->MaxWidth = pVia->cursor->maxWidth;
infoPtr->MaxHeight = pVia->cursor->maxHeight;
- infoPtr->Flags = HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
- /*HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK |*/
- HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
- HARDWARE_CURSOR_INVERT_MASK |
- HARDWARE_CURSOR_BIT_ORDER_MSBFIRST|
- 0;
-
+ infoPtr->Flags = (HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+ /*HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | */
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_INVERT_MASK |
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+ 0);
+
if (pVia->cursor->maxWidth == 64)
infoPtr->Flags |= HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64;
else if (pVia->cursor->maxWidth == 32)
infoPtr->Flags |= HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32;
else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VIACursorHWInit: unhandled width\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "VIACursorHWInit: unhandled width\n");
return FALSE;
}
/*
@@ -167,9 +164,9 @@ viaCursorHWInit(ScreenPtr pScreen)
infoPtr->LoadCursorARGB = viaCursorARGBLoad;
}
#endif
-
+
viaCursorSetFB(pScrn);
-
+
#ifdef ARGB_CURSOR
if (pVia->cursor->isARGBSupported && pVia->cursor->isARGBEnabled)
viaCursorARGBInit(pScrn);
@@ -177,41 +174,44 @@ viaCursorHWInit(ScreenPtr pScreen)
/* Set cursor location in frame buffer. */
VIASETREG(VIA_REG_CURSOR_MODE, pVia->cursor->fbCursorStart);
- viaCursorHWHide(pScrn) ;
+ viaCursorHWHide(pScrn);
return xf86InitCursor(pScreen, infoPtr);
}
-static void
+static void
viaCursorHWShow(ScrnInfoPtr pScrn)
{
- VIAPtr pVia= VIAPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
CARD32 mode;
+
mode = VIAGETREG(VIA_REG_CURSOR_MODE);
- mode &=~0x80000003;
-
- /* Turn on Hardware Cursor */
+ mode &= ~0x80000003;
+
+ /* Turn on hardware cursor. */
if (pVia->pBIOSInfo->FirstCRTC->IsActive)
VIASETREG(VIA_REG_CURSOR_MODE, mode | 0x1);
if (pVia->pBIOSInfo->SecondCRTC->IsActive)
VIASETREG(VIA_REG_CURSOR_MODE, mode | 0x80000001);
-
+
}
-static void
+static void
viaCursorHWHide(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
CARD32 mode = VIAGETREG(VIA_REG_CURSOR_MODE);
- /* Turn cursor off. */
+
+ /* Turn hardware cursor off. */
VIASETREG(VIA_REG_CURSOR_MODE, mode & 0xFFFFFFFE);
}
-void
+void
viaCursorShow(ScrnInfoPtr pScrn)
{
- VIAPtr pVia= VIAPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+
#ifdef ARGB_CURSOR
if (pVia->cursor->isARGBSupported && pVia->cursor->isARGBEnabled)
viaCursorARGBShow(pScrn);
@@ -224,41 +224,46 @@ void
viaCursorHide(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
-#ifdef ARGB_CURSOR
+
+#ifdef ARGB_CURSOR
if (pVia->cursor->isARGBSupported && pVia->cursor->isARGBEnabled)
viaCursorARGBHide(pScrn);
else
-#endif
+#endif
viaCursorHWHide(pScrn);
}
static void
-viaCursorLoadImage(ScrnInfoPtr pScrn, unsigned char* src)
+viaCursorLoadImage(ScrnInfoPtr pScrn, unsigned char *src)
{
VIAPtr pVia = VIAPTR(pScrn);
- int x, y, i ;
+ int x, y, i;
+
viaAccelSync(pScrn);
- CARD32* dst = (CARD32*)(pVia->FBBase + pVia->cursor->fbCursorStart);
+ CARD32 *dst = (CARD32 *) (pVia->FBBase + pVia->cursor->fbCursorStart);
+
memset(dst, 0x00, pVia->cursor->size);
-#ifdef ARGB_CURSOR
+#ifdef ARGB_CURSOR
if (pVia->cursor->isARGBSupported && pVia->cursor->isARGBEnabled) {
viaCursorARGBHide(pScrn);
- /* Convert monochrome to ARGB */
- int width = pVia->cursor->maxWidth / 8 ;
- for (y = 0 ; y < (pVia->cursor->maxHeight / 8) * 2; y++) {
- for (x = 0 ; x < width; x++) {
+ /* Convert monochrome to ARGB. */
+ int width = pVia->cursor->maxWidth / 8;
+
+ for (y = 0; y < (pVia->cursor->maxHeight / 8) * 2; y++) {
+ for (x = 0; x < width; x++) {
char t = *(src + width); /* is transparent? */
- char fb = *src++ ; /* foreground or background ? */
- for (i = 7 ; i >= 0 ; i--) {
- if (t & (1 << i ))
- *dst++ = 0x00000000 ; /* transparent */
+ char fb = *src++; /* foreground or background ? */
+
+ for (i = 7; i >= 0; i--) {
+ if (t & (1 << i))
+ *dst++ = 0x00000000; /* transparent */
else
- *dst++ = fb & (1 << i) ?
+ *dst++ = fb & (1 << i) ?
0xFF000000 | pVia->cursor->foreground :
0xFF000000 | pVia->cursor->background;
}
}
- src += width ;
+ src += width;
}
} else
#endif
@@ -274,6 +279,7 @@ static void
viaCursorHWSetPosition(ScrnInfoPtr pScrn, int x, int y, int xoff, int yoff)
{
VIAPtr pVia = VIAPTR(pScrn);
+
/* viaCursorHWHide(pScrn); */
VIASETREG(VIA_REG_CURSOR_ORG, ((xoff << 16) | (yoff & 0x003f)));
VIASETREG(VIA_REG_CURSOR_POS, ((x << 16) | (y & 0x07ff)));
@@ -283,9 +289,9 @@ viaCursorHWSetPosition(ScrnInfoPtr pScrn, int x, int y, int xoff, int yoff)
static void
viaCursorSetPosition(ScrnInfoPtr pScrn, int x, int y)
{
- VIAPtr pVia = VIAPTR(pScrn);
- VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
- unsigned char xoff, yoff;
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ unsigned char xoff, yoff;
if (x < 0) {
xoff = ((-x) & 0xFE);
@@ -301,11 +307,12 @@ viaCursorSetPosition(ScrnInfoPtr pScrn, int x, int y)
yoff = 0;
/* LCD Expand Mode Cursor Y Position Re-Calculated */
if (pBIOSInfo->scaleY) {
- y = (int)(((pBIOSInfo->panelY * y) + (pBIOSInfo->resY >> 1)) / pBIOSInfo->resY);
+ y = (int)(((pBIOSInfo->panelY * y) + (pBIOSInfo->resY >> 1))
+ / pBIOSInfo->resY);
}
}
#ifdef ARGB_CURSOR
- if(pVia->cursor->isARGBSupported && pVia->cursor->isARGBEnabled)
+ if (pVia->cursor->isARGBSupported && pVia->cursor->isARGBEnabled)
viaCursorARGBSetPosition(pScrn, x, y);
else
#endif
@@ -317,7 +324,7 @@ static void
viaCursorSetColors(ScrnInfoPtr pScrn, int bg, int fg)
{
VIAPtr pVia = VIAPTR(pScrn);
-
+
pVia->cursor->foreground = fg;
pVia->cursor->background = bg;
@@ -328,37 +335,31 @@ viaCursorSetColors(ScrnInfoPtr pScrn, int bg, int fg)
VIASETREG(VIA_REG_CURSOR_FG, fg);
VIASETREG(VIA_REG_CURSOR_BG, bg);
-
}
-/*
- *
- */
void
viaCursorStore(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
-
+
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "viaCursorStore\n"));
-
+
if (pVia->cursor->image) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "viaCursorStore: stale image left.\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "viaCursorStore: stale image left.\n");
xfree(pVia->cursor->image);
}
pVia->cursor->image = xcalloc(1, pVia->cursor->size);
if (pVia->cursor->image)
- memcpy(pVia->cursor->image, pVia->FBBase + pVia->cursor->fbCursorStart,
- pVia->cursor->size);
-
- pVia->cursor->foreground = (CARD32)VIAGETREG(VIA_REG_CURSOR_FG);
- pVia->cursor->background = (CARD32)VIAGETREG(VIA_REG_CURSOR_BG);
- pVia->cursor->mode = (CARD32)VIAGETREG(VIA_REG_CURSOR_MODE);
+ memcpy(pVia->cursor->image, pVia->FBBase + pVia->cursor->fbCursorStart,
+ pVia->cursor->size);
+
+ pVia->cursor->foreground = (CARD32) VIAGETREG(VIA_REG_CURSOR_FG);
+ pVia->cursor->background = (CARD32) VIAGETREG(VIA_REG_CURSOR_BG);
+ pVia->cursor->mode = (CARD32) VIAGETREG(VIA_REG_CURSOR_MODE);
}
-/*
- *
- */
void
viaCursorRestore(ScrnInfoPtr pScrn)
{
@@ -367,36 +368,39 @@ viaCursorRestore(ScrnInfoPtr pScrn)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "viaCursorRestore\n"));
if (pVia->cursor->image) {
- memcpy(pVia->FBBase + pVia->cursor->fbCursorStart, pVia->cursor->image,
- pVia->cursor->size);
- VIASETREG(VIA_REG_CURSOR_FG, pVia->cursor->foreground);
- VIASETREG(VIA_REG_CURSOR_BG, pVia->cursor->background);
- VIASETREG(VIA_REG_CURSOR_MODE, pVia->cursor->mode);
- xfree(pVia->cursor->image);
- pVia->cursor->image = NULL;
+ memcpy(pVia->FBBase + pVia->cursor->fbCursorStart, pVia->cursor->image,
+ pVia->cursor->size);
+ VIASETREG(VIA_REG_CURSOR_FG, pVia->cursor->foreground);
+ VIASETREG(VIA_REG_CURSOR_BG, pVia->cursor->background);
+ VIASETREG(VIA_REG_CURSOR_MODE, pVia->cursor->mode);
+ xfree(pVia->cursor->image);
+ pVia->cursor->image = NULL;
} else
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "viaCursorRestore: No cursor image stored.\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "viaCursorRestore: No cursor image stored.\n");
}
#ifdef ARGB_CURSOR
static void
-viaCursorARGBShow(ScrnInfoPtr pScrn) {
- VIAPtr pVia= VIAPTR(pScrn);
- switch(pVia->Chipset) {
+viaCursorARGBShow(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ switch (pVia->Chipset) {
case VIA_CX700:
/* case VIA_CN750: */
case VIA_P4M890:
case VIA_P4M900:
- /* Turn on Hardware icon Cursor */
+ /* Turn on hardware icon cursor. */
if (pVia->pBIOSInfo->FirstCRTC->IsActive)
VIASETREG(VIA_REG_PRIM_HI_CTRL, 0x76000005);
if (pVia->pBIOSInfo->SecondCRTC->IsActive)
VIASETREG(VIA_REG_HI_CONTROL, 0xf6000005);
break;
default:
- VIASETREG(VIA_REG_HI_CONTROL, 0xf6000005);
- break;
+ VIASETREG(VIA_REG_HI_CONTROL, 0xf6000005);
+ break;
}
}
@@ -406,19 +410,18 @@ viaCursorARGBHide(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
CARD32 hiControl;
-
- switch(pVia->Chipset) {
+
+ switch (pVia->Chipset) {
case VIA_CX700:
/* case VIA_CN750: */
case VIA_P4M890:
case VIA_P4M900:
- if(pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
hiControl = VIAGETREG(VIA_REG_PRIM_HI_CTRL);
/* Turn hardware icon cursor off. */
VIASETREG(VIA_REG_PRIM_HI_CTRL, hiControl & 0xFFFFFFFE);
}
-
- if(pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
hiControl = VIAGETREG(VIA_REG_HI_CONTROL);
/* Turn hardware icon cursor off. */
VIASETREG(VIA_REG_HI_CONTROL, hiControl & 0xFFFFFFFE);
@@ -429,66 +432,67 @@ viaCursorARGBHide(ScrnInfoPtr pScrn)
/* Turn hardware icon cursor off. */
VIASETREG(VIA_REG_HI_CONTROL, hiControl & 0xFFFFFFFE);
}
-
}
static void
viaCursorARGBSetPosition(ScrnInfoPtr pScrn, int x, int y)
{
VIAPtr pVia = VIAPTR(pScrn);
+
/* viaCursorARGBHide(pScrn); */
- switch(pVia->Chipset ) {
+ switch (pVia->Chipset) {
case VIA_CX700:
/* case VIA_CN750: */
case VIA_P4M890:
case VIA_P4M900:
- if(pVia->pBIOSInfo->FirstCRTC->IsActive) {
- /*set hi position*/
+ if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
+ /* Set hardware icon position. */
VIASETREG(VIA_REG_PRIM_HI_POSSTART, ((x << 16) | (y & 0x07ff)));
- VIASETREG(VIA_REG_PRIM_HI_CENTEROFFSET, ((0<< 16) | (0 & 0x07ff)));
- }
- if(pVia->pBIOSInfo->SecondCRTC->IsActive) {
- /*set hi position*/
+ VIASETREG(VIA_REG_PRIM_HI_CENTEROFFSET,
+ ((0 << 16) | (0 & 0x07ff)));
+ }
+ if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
+ /* Set hardware icon position. */
VIASETREG(VIA_REG_HI_POSSTART, ((x << 16) | (y & 0x07ff)));
- VIASETREG(VIA_REG_HI_CENTEROFFSET, ((0<< 16) | (0 & 0x07ff)));
+ VIASETREG(VIA_REG_HI_CENTEROFFSET, ((0 << 16) | (0 & 0x07ff)));
}
break;
default:
- /*set hi position*/
+ /* Set hardware icon position. */
VIASETREG(VIA_REG_HI_POSSTART, ((x << 16) | (y & 0x07ff)));
- VIASETREG(VIA_REG_HI_CENTEROFFSET, ((0<< 16) | (0 & 0x07ff)));
+ VIASETREG(VIA_REG_HI_CENTEROFFSET, ((0 << 16) | (0 & 0x07ff)));
break;
}
-
/* viaCursorARGBShow(pScrn); */
}
-static Bool
+static Bool
viaCursorARGBUse(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
VIAPtr pVia = VIAPTR(pScrn);
- return pVia->cursor->isHWCursorEnabled
- && pVia->cursor->isARGBSupported
- && pVia->cursor->isARGBEnabled
- && pCurs->bits->width <= pVia->cursor->maxWidth
- && pCurs->bits->height <= pVia->cursor->maxHeight;
+
+ return (pVia->cursor->isHWCursorEnabled
+ && pVia->cursor->isARGBSupported
+ && pVia->cursor->isARGBEnabled
+ && pCurs->bits->width <= pVia->cursor->maxWidth
+ && pCurs->bits->height <= pVia->cursor->maxHeight);
}
-static void
+static void
viaCursorARGBLoad(ScrnInfoPtr pScrn, CursorPtr pCurs)
{
VIAPtr pVia = VIAPTR(pScrn);
- VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
CARD32 *dst = NULL;
CARD32 *image = pCurs->bits->argb;
- int x, y, w, h;
+ int x, y, w, h;
- dst = (CARD32 *)(pVia->FBBase + pVia->cursor->fbCursorStart);
+ dst = (CARD32 *) (pVia->FBBase + pVia->cursor->fbCursorStart);
if (!image)
return;
-
+
w = pCurs->bits->width;
if (w > pVia->cursor->maxWidth)
w = pVia->cursor->maxWidth;
@@ -497,19 +501,19 @@ viaCursorARGBLoad(ScrnInfoPtr pScrn, CursorPtr pCurs)
if (h > pVia->cursor->maxHeight)
h = pVia->cursor->maxHeight;
- memset(dst,0,pVia->cursor->size);
+ memset(dst, 0, pVia->cursor->size);
- for (y = 0; y < h; y++){
+ for (y = 0; y < h; y++) {
for (x = 0; x < w; x++)
*dst++ = *image++;
-
- /* pad to the right with transparent */
- for (; x < pVia->cursor->maxWidth; x++)
+
+ /* Pad to the right with transparent. */
+ for (; x < pVia->cursor->maxWidth; x++)
*dst++ = 0;
}
- /* pad below with transparent */
- for (; y < pVia->cursor->maxHeight; y++){
+ /* Pad below with transparent. */
+ for (; y < pVia->cursor->maxHeight; y++) {
for (x = 0; x < pVia->cursor->maxWidth; x++)
*dst++ = 0;
}
@@ -518,16 +522,18 @@ viaCursorARGBLoad(ScrnInfoPtr pScrn, CursorPtr pCurs)
#endif
-
Bool
viaCursorRecInit(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
+
if (!pVia->cursor)
- pVia->cursor = (ViaCursorInfoPtr)xnfcalloc(sizeof(ViaCursorInfoRec), 1);
-
+ pVia->cursor =
+ (ViaCursorInfoPtr) xnfcalloc(sizeof(ViaCursorInfoRec), 1);
+
if (pVia->cursor) {
ViaCursorInfoPtr cursor = pVia->cursor;
+
switch (pVia->Chipset) {
case VIA_CLE266:
case VIA_KM400:
@@ -546,17 +552,17 @@ viaCursorRecInit(ScrnInfoPtr pScrn)
break;
}
}
-
- return pVia->cursor != NULL ;
+
+ return pVia->cursor != NULL;
}
void
viaCursorRecDestroy(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->cursor) {
+
+ if (pVia->cursor)
xfree(pVia->cursor);
- }
}
static Bool
@@ -564,10 +570,11 @@ viaCursorHWUse(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
VIAPtr pVia = VIAPTR(pScrn);
- return pVia->cursor->isHWCursorEnabled
- /* The hardware can't enable hw cursor on both crtc at the same time */
- && !(pVia->pBIOSInfo->FirstCRTC->IsActive
- && pVia->pBIOSInfo->SecondCRTC->IsActive)
- && pCurs->bits->width <= pVia->cursor->maxWidth
- && pCurs->bits->height <= pVia->cursor->maxHeight;
+
+ return (pVia->cursor->isHWCursorEnabled
+ /* Can't enable HW cursor on both CRTCs at the same time. */
+ && !(pVia->pBIOSInfo->FirstCRTC->IsActive
+ && pVia->pBIOSInfo->SecondCRTC->IsActive)
+ && pCurs->bits->width <= pVia->cursor->maxWidth
+ && pCurs->bits->height <= pVia->cursor->maxHeight);
}