summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/regsmi.h6
-rw-r--r--src/smi_crtc.c55
-rw-r--r--src/smi_driver.c29
-rw-r--r--src/smi_hwcurs.c304
-rw-r--r--src/smilynx_crtc.c197
5 files changed, 243 insertions, 348 deletions
diff --git a/src/regsmi.h b/src/regsmi.h
index a2ddfda..2626f2e 100644
--- a/src/regsmi.h
+++ b/src/regsmi.h
@@ -311,6 +311,12 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
#define FPR15C_MASK_HWCADDREN 0xFFFF0000
#define FPR15C_MASK_HWCENABLE 0x80000000
+/* Maximum hardware cursor dimensions */
+#define SMILYNX_MAX_CURSOR 32
+#define SMI501_MAX_CURSOR 64
+#define SMILYNX_CURSOR_SIZE 1024
+#define SMI501_CURSOR_SIZE 2048
+
/* HWCursor definitons for Panel AND CRT */
#define SMI501_MASK_HWCENABLE 0x80000000
#define SMI501_MASK_MAXBITS 0x000007FF
diff --git a/src/smi_crtc.c b/src/smi_crtc.c
index 429df28..d182e37 100644
--- a/src/smi_crtc.c
+++ b/src/smi_crtc.c
@@ -84,9 +84,13 @@ SMI_CrtcPrepare(xf86CrtcPtr crtc)
static void
SMI_CrtcCommit(xf86CrtcPtr crtc)
{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ SMIPtr pSmi = SMIPTR(pScrn);
+
ENTER();
- /* Nothing */
+ if(pSmi->HwCursor)
+ xf86_reload_cursors(pScrn->pScreen);
LEAVE();
}
@@ -167,51 +171,12 @@ SMI_CrtcShadowDestroy (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data)
}
static void
-SMI_CrtcSetCursorColors (xf86CrtcPtr crtc, int bg, int fg)
-{
- ENTER();
- LEAVE();
-}
-
-static void
-SMI_CrtcSetCursorPosition (xf86CrtcPtr crtc, int x, int y)
-{
- ENTER();
- LEAVE();
-}
-
-static void
-SMI_CrtcShowCursor (xf86CrtcPtr crtc)
-{
- ENTER();
- LEAVE();
-}
-
-static void
-SMI_CrtcHideCursor (xf86CrtcPtr crtc)
-{
- ENTER();
- LEAVE();
-}
-
-static void
-SMI_CrtcLoadCursorImage (xf86CrtcPtr crtc, CARD8 *image)
+SMI_CrtcDestroy (xf86CrtcPtr crtc)
{
ENTER();
- LEAVE();
-}
-static void
-SMI_CrtcLoadCursorArgb (xf86CrtcPtr crtc, CARD32 *image)
-{
- ENTER();
- LEAVE();
-}
+ /* Nothing */
-static void
-SMI_CrtcDestroy (xf86CrtcPtr crtc)
-{
- ENTER();
LEAVE();
}
@@ -290,12 +255,6 @@ SMI_CrtcFuncsInit_base(xf86CrtcFuncsPtr crtcFuncs, SMICrtcPrivatePtr crtcPriv){
crtcFuncs->shadow_allocate = SMI_CrtcShadowAllocate;
crtcFuncs->shadow_create = SMI_CrtcShadowCreate;
crtcFuncs->shadow_destroy = SMI_CrtcShadowDestroy;
- crtcFuncs->set_cursor_colors = SMI_CrtcSetCursorColors;
- crtcFuncs->set_cursor_position = SMI_CrtcSetCursorPosition;
- crtcFuncs->show_cursor = SMI_CrtcShowCursor;
- crtcFuncs->hide_cursor = SMI_CrtcHideCursor;
- crtcFuncs->load_cursor_image = SMI_CrtcLoadCursorImage;
- crtcFuncs->load_cursor_argb = SMI_CrtcLoadCursorArgb;
crtcFuncs->destroy = SMI_CrtcDestroy;
}
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 4c0bad9..90ae7ad 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -1061,6 +1061,11 @@ SMI_EnterVT(int scrnIndex, int flags)
if (!xf86SetDesiredModes(pScrn))
RETURN(FALSE);
+ /* Initialize the hardware cursor */
+ if(!IS_MSOC(pSmi) && pSmi->HwCursor){
+ xf86_show_cursors(pScrn);
+ }
+
/* Reset the grapics engine */
if (!pSmi->NoAccel)
SMI_EngineReset(pScrn);
@@ -1771,10 +1776,24 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* initialization.
*/
if (pSmi->HwCursor) {
- if (!SMI_HWCursorInit(pScreen)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor "
- "initialization failed\n");
+ if(IS_MSOC(pSmi)){
+ if (!SMI_HWCursorInit(pScreen)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor "
+ "initialization failed\n");
+ }
+ }else{
+ if(!xf86_cursors_init(pScreen, SMILYNX_MAX_CURSOR, SMILYNX_MAX_CURSOR,
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 |
+ HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK |
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_INVERT_MASK)){
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor "
+ "initialization failed\n");
+ }
}
+
}
/* Initialise default colormap */
@@ -1828,6 +1847,10 @@ SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen)
ENTER();
+ if(!IS_MSOC(pSmi) && pSmi->HwCursor){
+ xf86_cursors_fini(pScreen);
+ }
+
if (pScrn->vtSema) {
if (!IS_MSOC(pSmi)) {
vgaHWPtr hwp = VGAHWPTR(pScrn);
diff --git a/src/smi_hwcurs.c b/src/smi_hwcurs.c
index a2213bb..8e93f9d 100644
--- a/src/smi_hwcurs.c
+++ b/src/smi_hwcurs.c
@@ -34,11 +34,6 @@ authorization from the XFree86 Project and Silicon Motion.
#include "cursorstr.h"
#include "smi.h"
-#define MAX_CURSOR 32
-#define MAX_CURSOR_501 64
-#define SMI_CURSOR_SIZE 1024
-#define SMI501_CURSOR_SIZE 2048
-
static unsigned short
InterleaveBytes(int source, int mask)
{
@@ -64,143 +59,7 @@ InterleaveBytes(int source, int mask)
return (usWord);
}
-static unsigned char *
-SMI_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
-{
- SMIPtr pSmi = SMIPTR(infoPtr->pScrn);
- CursorBitsPtr bits = pCurs->bits;
- unsigned char * ram;
- unsigned char * psource = bits->source;
- unsigned char * pmask = bits->mask;
- int x, y, srcwidth, i;
-
- ENTER();
-
- /* Allocate memory */
- ram = (unsigned char *) xcalloc(1, 1024);
- if (ram == NULL)
- RETURN(NULL);
-
- /* Calculate cursor information */
- srcwidth = ((bits->width + 31) / 8) & ~3;
- i = 0;
-
- switch (pSmi->rotate) {
- default:
- /* Copy cursor image */
- for (y = 0; y < min(MAX_CURSOR, bits->height); y++) {
- for (x = 0; x < min(MAX_CURSOR / 8, srcwidth); x++) {
- unsigned char mask = byte_reversed[*pmask++];
- unsigned char source = byte_reversed[*psource++] & mask;
-
- ram[i++] = ~mask;
- ram[i++] = source;
- if (i & 4) i += 4;
- }
-
- pmask += srcwidth - x;
- psource += srcwidth - x;
-
- /* Fill remaining part of line with no shape */
- for (; x < MAX_CURSOR / 8; x++) {
- ram[i++] = 0xFF;
- ram[i++] = 0x00;
- if (i & 4) i += 4;
- }
- }
-
- /* Fill remaining part of memory with no shape */
- for (; y < MAX_CURSOR; y++) {
- for (x = 0; x < MAX_CURSOR / 8; x++) {
- ram[i++] = 0xFF;
- ram[i++] = 0x00;
- if (i & 4) i += 4;
- }
- }
- break;
- case SMI_ROTATE_CW:
- /* Initialize cursor memory */
- for (i = 0; i < 1024;) {
- ram[i++] = 0xFF;
- ram[i++] = 0x00;
- if (i & 4) i += 4;
- }
-
- /* Rotate cursor image */
- for (y = 0; y < min(MAX_CURSOR, bits->height); y++) {
- unsigned char bitmask = 0x01 << (y & 7);
- int index = ((MAX_CURSOR - y - 1) / 8) * 2;
- if (index & 4) index += 4;
-
- for (x = 0; x < min(MAX_CURSOR / 8, srcwidth); x++) {
- unsigned char mask = *pmask++;
- unsigned char source = *psource++ & mask;
-
- i = index + (x * 8) * 16;
- if (mask || (source & mask)) {
- unsigned char bit;
- for (bit = 0x01; bit; bit <<= 1) {
- if (mask & bit) {
- ram[i + 0] &= ~bitmask;
- }
-
- if (source & bit) {
- ram[i + 1] |= bitmask;
- }
-
- i += 16;
- }
- }
- }
-
- pmask += srcwidth - x;
- psource += srcwidth - x;
- }
- break;
- case SMI_ROTATE_CCW:
- /* Initialize cursor memory */
- for (i = 0; i < 1024;) {
- ram[i++] = 0xFF;
- ram[i++] = 0x00;
- if (i & 4) i += 4;
- }
-
- /* Rotate cursor image */
- for (y = 0; y < min(MAX_CURSOR, bits->height); y++) {
- unsigned char bitmask = 0x80 >> (y & 7);
- int index = (y >> 3) * 2;
- if (index & 4) index += 4;
-
- for (x = 0; x < min(MAX_CURSOR / 8, srcwidth); x++) {
- unsigned char mask = *pmask++;
- unsigned char source = *psource++ & mask;
-
- i = index + (MAX_CURSOR - x * 8 - 1) * 16;
- if (mask || (source & mask)) {
- unsigned char bit;
- for (bit = 0x01; bit; bit <<= 1) {
- if (mask & bit) {
- ram[i + 0] &= ~bitmask;
- }
-
- if (source & bit) {
- ram[i + 1] |= bitmask;
- }
-
- i -= 16;
- }
- }
- }
-
- pmask += srcwidth - x;
- psource += srcwidth - x;
- }
- break;
- }
-
- RETURN(ram);
-}
-
+#if 0
/* From the SMI Windows CE driver */
static void
SMI501_RotateCursorShape(xf86CursorInfoPtr infoPtr, int angle,
@@ -273,11 +132,11 @@ SMI501_RotateCursorShape(xf86CursorInfoPtr infoPtr, int angle,
}
}
+#endif
static unsigned char *
SMI501_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
- SMIPtr pSmi = SMIPTR(infoPtr->pScrn);
CursorBitsPtr bits = pCurs->bits;
unsigned char *ram;
unsigned short *usram;
@@ -292,7 +151,7 @@ SMI501_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
ram = (unsigned char *) xcalloc (1, SMI501_CURSOR_SIZE);
usram = (unsigned short *) ram;
- MaxCursor = MAX_CURSOR_501;
+ MaxCursor = SMI501_MAX_CURSOR;
if (ram == NULL)
RETURN(NULL);
@@ -325,7 +184,9 @@ SMI501_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
usram[i++] = 0x0000;
}
+#if 0
SMI501_RotateCursorShape(infoPtr, pSmi->rotate, ram);
+#endif
RETURN(ram);
}
@@ -354,26 +215,6 @@ SMI_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
(unsigned int)pSmi->FBCursorOffset);
}
}
- else {
- CARD8 tmp;
-
- /* Load storage location. */
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x80,
- pSmi->FBCursorOffset / 2048);
- tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81) & 0x80;
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81,
- tmp | ((pSmi->FBCursorOffset / 2048) >> 8));
-
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR) {
- CARD32 fpr15c;
-
- /* put address in upper word, and disable the cursor */
- fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCCOLORS;
- fpr15c |= (pSmi->FBCursorOffset / 2048) << 16;
- WRITE_FPR(pSmi, FPR15C, fpr15c);
- }
- }
/* Copy cursor image to framebuffer storage */
memcpy(pSmi->FBBase + pSmi->FBCursorOffset, src, 1024);
@@ -403,23 +244,6 @@ SMI_ShowCursor(ScrnInfoPtr pScrn)
WRITE_DCR(pSmi, 0x0230, uiCrtTmp);
}
}
- else {
- char tmp;
-
- /* Show cursor */
- tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp | 0x80);
-
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR) {
- CARD32 fpr15c;
-
- /* turn on the top bit */
- fpr15c = READ_FPR(pSmi, FPR15C);
- fpr15c |= FPR15C_MASK_HWCENABLE;
- WRITE_FPR(pSmi, FPR15C, fpr15c);
- }
- }
LEAVE();
}
@@ -446,23 +270,6 @@ SMI_HideCursor(ScrnInfoPtr pScrn)
WRITE_DCR(pSmi, 0x0230, uiCrtTmp);
}
}
- else {
- char tmp;
-
- /* Hide cursor */
- tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp & ~0x80);
-
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR) {
- CARD32 fpr15c;
-
- /* turn off the top bit */
- fpr15c = READ_FPR(pSmi, FPR15C);
- fpr15c &= ~FPR15C_MASK_HWCENABLE;
- WRITE_FPR(pSmi, FPR15C, fpr15c);
- }
- }
LEAVE();
}
@@ -475,22 +282,6 @@ SMI_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
ENTER();
- /* Calculate coordinates for rotation */
- switch (pSmi->rotate) {
- default:
- xoff = x;
- yoff = y;
- break;
- case SMI_ROTATE_CW:
- xoff = pSmi->ShadowHeight - y - MAX_CURSOR;
- yoff = x;
- break;
- case SMI_ROTATE_CCW:
- xoff = y;
- yoff = pSmi->ShadowWidth - x - MAX_CURSOR;
- break;
- }
-
/* Program coordinates */
if (IS_MSOC(pSmi)) {
CARD32 hwcLocVal;
@@ -512,52 +303,6 @@ SMI_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
else
WRITE_DCR(pSmi, 0x0234, hwcLocVal); /* CRT HWC Location */
}
- else {
- if (xoff >= 0) {
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x88,
- xoff & 0xFF);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x89,
- (xoff >> 8) & 0x07);
- }
- else {
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x88,
- (-xoff) & (MAX_CURSOR - 1));
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x89,
- 0x08);
- }
-
- if (yoff >= 0) {
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8A,
- yoff & 0xFF);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8B,
- (yoff >> 8) & 0x07);
- }
- else {
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8A,
- (-yoff) & (MAX_CURSOR - 1));
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA,
- 0x8B, 0x08);
- }
-
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR) {
- CARD32 fpr158;
-
- if (xoff >= 0)
- fpr158 = (xoff & FPR158_MASK_MAXBITS) << 16;
- else
- fpr158 = ((-xoff & FPR158_MASK_MAXBITS) |
- FPR158_MASK_BOUNDARY) << 16;
-
- if (yoff >= 0)
- fpr158 |= yoff & FPR158_MASK_MAXBITS;
- else
- fpr158 |= (-yoff & FPR158_MASK_MAXBITS) | FPR158_MASK_BOUNDARY;
-
- /* Program combined coordinates */
- WRITE_FPR(pSmi, FPR158, fpr158);
- }
- }
LEAVE();
}
@@ -566,7 +311,6 @@ static void
SMI_SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
SMIPtr pSmi = SMIPTR(pScrn);
- unsigned char packedFG, packedBG;
ENTER();
@@ -602,29 +346,6 @@ SMI_SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
else
WRITE_DCR(pSmi, 0x023c, packedFGBG); /* CRT HWC Color 3 */
}
- else {
- /* Pack the true color into 8 bit */
- packedFG = (fg & 0xE00000) >> 16 |
- (fg & 0x00E000) >> 11 |
- (fg & 0x0000C0) >> 6;
- packedBG = (bg & 0xE00000) >> 16 |
- (bg & 0x00E000) >> 11 |
- (bg & 0x0000C0) >> 6;
-
- /* Program the colors */
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8C, packedFG);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8D, packedBG);
-
- /* Program FPR copy when on the 730 */
- if (pSmi->Chipset == SMI_COUGAR3DR) {
- CARD32 fpr15c;
-
- fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCADDREN;
- fpr15c |= packedFG;
- fpr15c |= packedBG << 8;
- WRITE_FPR(pSmi, FPR15C, fpr15c);
- }
- }
LEAVE();
}
@@ -648,23 +369,12 @@ SMI_HWCursorInit(ScreenPtr pScreen)
/* Fill in the information */
if (IS_MSOC(pSmi)) {
- infoPtr->MaxWidth = MAX_CURSOR_501;
- infoPtr->MaxHeight = MAX_CURSOR_501;
+ infoPtr->MaxWidth = SMI501_MAX_CURSOR;
+ infoPtr->MaxHeight = SMI501_MAX_CURSOR;
infoPtr->Flags = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK;
infoPtr->RealizeCursor = SMI501_RealizeCursor;
}
- else {
- infoPtr->MaxWidth = MAX_CURSOR;
- infoPtr->MaxHeight = MAX_CURSOR;
- infoPtr->Flags = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 |
- HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK |
- HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
- HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
- HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
- HARDWARE_CURSOR_INVERT_MASK;
- infoPtr->RealizeCursor = SMI_RealizeCursor;
- }
infoPtr->SetCursorColors = SMI_SetCursorColors;
infoPtr->SetCursorPosition = SMI_SetCursorPosition;
diff --git a/src/smilynx_crtc.c b/src/smilynx_crtc.c
index faeb0e3..4dd5719 100644
--- a/src/smilynx_crtc.c
+++ b/src/smilynx_crtc.c
@@ -493,6 +493,187 @@ SMILynx_CrtcLoadLUT_lcd(xf86CrtcPtr crtc)
LEAVE();
}
+static void
+SMILynx_CrtcSetCursorColors_crt (xf86CrtcPtr crtc, int bg, int fg)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD8 packedFG,packedBG;
+
+ ENTER();
+
+ /* Pack the true color into 8 bit */
+ packedFG = (fg & 0xE00000) >> 16 |
+ (fg & 0x00E000) >> 11 |
+ (fg & 0x0000C0) >> 6;
+ packedBG = (bg & 0xE00000) >> 16 |
+ (bg & 0x00E000) >> 11 |
+ (bg & 0x0000C0) >> 6;
+
+ /* Program the colors */
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8C, packedFG);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8D, packedBG);
+
+ /* Program FPR copy when on the 730 */
+ if (pSmi->Chipset == SMI_COUGAR3DR) {
+ CARD32 fpr15c;
+
+ fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCADDREN;
+ fpr15c |= packedFG;
+ fpr15c |= packedBG << 8;
+ WRITE_FPR(pSmi, FPR15C, fpr15c);
+ }
+
+ LEAVE();
+}
+
+static void
+SMILynx_CrtcSetCursorPosition_crt (xf86CrtcPtr crtc, int x, int y)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ SMIPtr pSmi = SMIPTR(pScrn);
+
+ ENTER();
+
+ if (x >= 0) {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x88,
+ x & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x89,
+ (x >> 8) & 0x07);
+ }
+ else {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x88,
+ (-x) & (SMILYNX_MAX_CURSOR - 1));
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x89,
+ 0x08);
+ }
+
+ if (y >= 0) {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8A,
+ y & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8B,
+ (y >> 8) & 0x07);
+ }
+ else {
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8A,
+ (-y) & (SMILYNX_MAX_CURSOR - 1));
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA,
+ 0x8B, 0x08);
+ }
+
+ /* Program FPR copy when on the 730 */
+ if (pSmi->Chipset == SMI_COUGAR3DR) {
+ CARD32 fpr158;
+
+ if (x >= 0)
+ fpr158 = (x & FPR158_MASK_MAXBITS) << 16;
+ else
+ fpr158 = ((-x & FPR158_MASK_MAXBITS) |
+ FPR158_MASK_BOUNDARY) << 16;
+
+ if (y >= 0)
+ fpr158 |= y & FPR158_MASK_MAXBITS;
+ else
+ fpr158 |= (-y & FPR158_MASK_MAXBITS) | FPR158_MASK_BOUNDARY;
+
+ /* Program combined coordinates */
+ WRITE_FPR(pSmi, FPR158, fpr158);
+ }
+
+ LEAVE();
+}
+
+static void
+SMILynx_CrtcShowCursor_crt (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ SMIPtr pSmi = SMIPTR(pScrn);
+ char tmp;
+
+ ENTER();
+
+ /* Show cursor */
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp | 0x80);
+
+ /* Program FPR copy when on the 730 */
+ if (pSmi->Chipset == SMI_COUGAR3DR) {
+ CARD32 fpr15c;
+
+ /* turn on the top bit */
+ fpr15c = READ_FPR(pSmi, FPR15C);
+ fpr15c |= FPR15C_MASK_HWCENABLE;
+ WRITE_FPR(pSmi, FPR15C, fpr15c);
+ }
+
+ LEAVE();
+}
+
+static void
+SMILynx_CrtcHideCursor_crt (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ SMIPtr pSmi = SMIPTR(pScrn);
+ char tmp;
+
+ ENTER();
+
+ /* Hide cursor */
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp & ~0x80);
+
+ /* Program FPR copy when on the 730 */
+ if (pSmi->Chipset == SMI_COUGAR3DR) {
+ CARD32 fpr15c;
+
+ /* turn off the top bit */
+ fpr15c = READ_FPR(pSmi, FPR15C);
+ fpr15c &= ~FPR15C_MASK_HWCENABLE;
+ WRITE_FPR(pSmi, FPR15C, fpr15c);
+ }
+
+
+ LEAVE();
+}
+
+static void
+SMILynx_CrtcLoadCursorImage_crt (xf86CrtcPtr crtc, CARD8 *image)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ SMIPtr pSmi = SMIPTR(pScrn);
+ CARD8 tmp;
+ int i;
+ CARD8* dst;
+
+ ENTER();
+
+ /* Load storage location. */
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x80,
+ pSmi->FBCursorOffset / 2048);
+ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81) & 0x80;
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81,
+ tmp | ((pSmi->FBCursorOffset / 2048) >> 8));
+
+ /* Program FPR copy when on the 730 */
+ if (pSmi->Chipset == SMI_COUGAR3DR) {
+ CARD32 fpr15c;
+
+ /* put address in upper word, and disable the cursor */
+ fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCCOLORS;
+ fpr15c |= (pSmi->FBCursorOffset / 2048) << 16;
+ WRITE_FPR(pSmi, FPR15C, fpr15c);
+ }
+
+ /* Copy cursor image to framebuffer storage */
+ dst = pSmi->FBBase + pSmi->FBCursorOffset;
+ for(i=0; i < (SMILYNX_MAX_CURSOR * SMILYNX_MAX_CURSOR >> 2); i++){
+ *(dst++) = image[i];
+ if((i & 0x3) == 0x3) dst+=4;
+ }
+
+ LEAVE();
+}
+
static xf86CrtcFuncsRec SMILynx_Crtc0Funcs;
static SMICrtcPrivateRec SMILynx_Crtc0Priv;
static xf86CrtcFuncsRec SMILynx_Crtc1Funcs;
@@ -519,6 +700,14 @@ SMILynx_CrtcPreInit(ScrnInfoPtr pScrn)
SMILynx_Crtc0Priv.video_init = SMI730_CrtcVideoInit;
SMILynx_Crtc0Priv.load_lut = SMILynx_CrtcLoadLUT_crt;
+ if(pSmi->HwCursor){
+ SMILynx_Crtc0Funcs.set_cursor_colors = SMILynx_CrtcSetCursorColors_crt;
+ SMILynx_Crtc0Funcs.set_cursor_position = SMILynx_CrtcSetCursorPosition_crt;
+ SMILynx_Crtc0Funcs.show_cursor = SMILynx_CrtcShowCursor_crt;
+ SMILynx_Crtc0Funcs.hide_cursor = SMILynx_CrtcHideCursor_crt;
+ SMILynx_Crtc0Funcs.load_cursor_image = SMILynx_CrtcLoadCursorImage_crt;
+ }
+
crtc0=xf86CrtcCreate(pScrn,&SMILynx_Crtc0Funcs);
if(!crtc0)
RETURN(FALSE);
@@ -558,6 +747,14 @@ SMILynx_CrtcPreInit(ScrnInfoPtr pScrn)
SMILynx_Crtc0Priv.video_init = SMILynx_CrtcVideoInit_crt;
SMILynx_Crtc0Priv.load_lut = SMILynx_CrtcLoadLUT_crt;
+ if(pSmi->HwCursor){
+ SMILynx_Crtc0Funcs.set_cursor_colors = SMILynx_CrtcSetCursorColors_crt;
+ SMILynx_Crtc0Funcs.set_cursor_position = SMILynx_CrtcSetCursorPosition_crt;
+ SMILynx_Crtc0Funcs.show_cursor = SMILynx_CrtcShowCursor_crt;
+ SMILynx_Crtc0Funcs.hide_cursor = SMILynx_CrtcHideCursor_crt;
+ SMILynx_Crtc0Funcs.load_cursor_image = SMILynx_CrtcLoadCursorImage_crt;
+ }
+
crtc0=xf86CrtcCreate(pScrn,&SMILynx_Crtc0Funcs);
if(!crtc0)
RETURN(FALSE);