diff options
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/regsmi.h | 12 | ||||
-rw-r--r-- | src/smi.h | 1 | ||||
-rw-r--r-- | src/smi501_crtc.c | 136 | ||||
-rw-r--r-- | src/smi_accel.c | 9 | ||||
-rw-r--r-- | src/smi_crtc.c | 6 | ||||
-rw-r--r-- | src/smi_driver.c | 47 | ||||
-rw-r--r-- | src/smi_hwcurs.c | 391 | ||||
-rw-r--r-- | src/smi_video.c | 19 | ||||
-rw-r--r-- | src/smi_xaa.c | 42 |
10 files changed, 167 insertions, 497 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 282fbae..87ca97f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,7 +39,6 @@ siliconmotion_drv_la_SOURCES = \ smi_dga.c \ smi_driver.c \ smi.h \ - smi_hwcurs.c \ smi_i2c.c \ smi_pcirename.h \ smi_video.c \ diff --git a/src/regsmi.h b/src/regsmi.h index 2626f2e..35344c3 100644 --- a/src/regsmi.h +++ b/src/regsmi.h @@ -138,18 +138,6 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data) } while (0) #define READ_SCR(pSmi, scr) MMIO_IN32(pSmi->SCRBase, scr) -#define CHECK_SECONDARY(pSmi) \ - if(IS_MSOC(pSmi)){ \ - if ((pSmi)->IsSecondary) { \ - WRITE_DPR(pSmi, 0x40, pScrn->fbOffset / 16 << 4); \ - WRITE_DPR(pSmi, 0x44, pScrn->fbOffset / 16 << 4); \ - } \ - else { \ - WRITE_DPR(pSmi, 0x40, 0); \ - WRITE_DPR(pSmi, 0x44, 0); \ - } \ - } - /* 2D Engine commands */ #define SMI_TRANSPARENT_SRC 0x00000100 #define SMI_TRANSPARENT_DEST 0x00000300 @@ -124,7 +124,6 @@ typedef struct int Chipset; /* Chip info, set using PCI above */ int ChipRev; - Bool IsSecondary; OptionInfoPtr Options; Bool Dualhead; diff --git a/src/smi501_crtc.c b/src/smi501_crtc.c index 589b088..606a169 100644 --- a/src/smi501_crtc.c +++ b/src/smi501_crtc.c @@ -327,6 +327,126 @@ SMI501_CrtcLoadLUT(xf86CrtcPtr crtc) LEAVE(); } +static void +SMI501_CrtcSetCursorColors(xf86CrtcPtr crtc, int bg, int fg) +{ + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + xf86CrtcConfigPtr crtcConf = XF86_CRTC_CONFIG_PTR(pScrn); + int32_t port, value; + + ENTER(); + + /* for the SMI501 HWCursor, there are 4 possible colors, one of which + * is transparent: M,S: 0,0 = Transparent + * 0,1 = color 1 + * 1,0 = color 2 + * 1,1 = color 3 + * To simplify implementation, we use color2 == bg and + * color3 == fg + * Color 1 is don't care, so we set it to color 2's value + */ + + /* Pack the true color components into 16 bit RGB -- 5:6:5 */ + value = ((bg & 0xF80000) >> 8 | + (bg & 0x00FC00) >> 5 | + (bg & 0x0000F8) >> 3); + + value |= ((bg & 0xF80000) << 8 | + (bg & 0x00FC00) << 11 | + (bg & 0x0000F8) << 13); + port = crtc == crtcConf->crtc[0] ? 0x00f8 : 0x0238; + WRITE_DCR(pSmi, port, value); + + value = ((fg & 0xF80000) >> 8 | + (fg & 0x00FC00) >> 5 | + (fg & 0x0000F8) >> 3); + port = crtc == crtcConf->crtc[0] ? 0x00fc : 0x023c; + WRITE_DCR(pSmi, port, value); + + LEAVE(); +} + +static void +SMI501_CrtcSetCursorPosition(xf86CrtcPtr crtc, int x, int y) +{ + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + xf86CrtcConfigPtr crtcConf = XF86_CRTC_CONFIG_PTR(pScrn); + int32_t port, offset; + + ENTER(); + + if (x >= 0) + offset = x & SMI501_MASK_MAXBITS; + else + offset = (-x & SMI501_MASK_MAXBITS) | SMI501_MASK_BOUNDARY; + + if (y >= 0) + offset |= (y & SMI501_MASK_MAXBITS) << 16; + else + offset |= ((-y & SMI501_MASK_MAXBITS) | SMI501_MASK_BOUNDARY) << 16; + + port = crtc == crtcConf->crtc[0] ? 0x00f4 : 0x0234; + WRITE_DCR(pSmi, port, offset); + + LEAVE(); +} + +static void +SMI501_CrtcShowCursor(xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + xf86CrtcConfigPtr crtcConf = XF86_CRTC_CONFIG_PTR(pScrn); + int32_t port, value; + + ENTER(); + + port = crtc == crtcConf->crtc[0] ? 0x00f0 : 0x0230; + value = READ_DCR(pSmi, port); + value |= SMI501_MASK_HWCENABLE; + WRITE_DCR(pSmi, port, value); + + LEAVE(); +} + +static void +SMI501_CrtcHideCursor(xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + xf86CrtcConfigPtr crtcConf = XF86_CRTC_CONFIG_PTR(pScrn); + int32_t port, value; + + ENTER(); + + port = crtc == crtcConf->crtc[0] ? 0x00f0 : 0x0230; + value = READ_DCR(pSmi, port); + value &= ~SMI501_MASK_HWCENABLE; + WRITE_DCR(pSmi, port, value); + + LEAVE(); +} + +static void +SMI501_CrtcLoadCursorImage(xf86CrtcPtr crtc, CARD8 *image) +{ + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + xf86CrtcConfigPtr crtcConf = XF86_CRTC_CONFIG_PTR(pScrn); + int32_t port, value; + + ENTER(); + + port = crtc == crtcConf->crtc[0] ? 0x00f0 : 0x0230; + value = pSmi->FBCursorOffset + (port == 0x00f0 ? 0 : 1024); + WRITE_DCR(pSmi, port, value); + memcpy(pSmi->FBBase + value, image, 1024); + + LEAVE(); +} + static xf86CrtcFuncsRec SMI501_Crtc0Funcs; static SMICrtcPrivateRec SMI501_Crtc0Priv; static xf86CrtcFuncsRec SMI501_Crtc1Funcs; @@ -347,6 +467,14 @@ SMI501_CrtcPreInit(ScrnInfoPtr pScrn) SMI501_Crtc0Priv.video_init = SMI501_CrtcVideoInit_lcd; SMI501_Crtc0Priv.load_lut = SMI501_CrtcLoadLUT; + if (pSmi->HwCursor) { + SMI501_Crtc0Funcs.set_cursor_colors = SMI501_CrtcSetCursorColors; + SMI501_Crtc0Funcs.set_cursor_position = SMI501_CrtcSetCursorPosition; + SMI501_Crtc0Funcs.show_cursor = SMI501_CrtcShowCursor; + SMI501_Crtc0Funcs.hide_cursor = SMI501_CrtcHideCursor; + SMI501_Crtc0Funcs.load_cursor_image = SMI501_CrtcLoadCursorImage; + } + crtc0 = xf86CrtcCreate(pScrn, &SMI501_Crtc0Funcs); if (!crtc0) RETURN(FALSE); @@ -360,6 +488,14 @@ SMI501_CrtcPreInit(ScrnInfoPtr pScrn) SMI501_Crtc1Priv.video_init = SMI501_CrtcVideoInit_crt; SMI501_Crtc1Priv.load_lut = SMI501_CrtcLoadLUT; + if (pSmi->HwCursor) { + SMI501_Crtc1Funcs.set_cursor_colors = SMI501_CrtcSetCursorColors; + SMI501_Crtc1Funcs.set_cursor_position = SMI501_CrtcSetCursorPosition; + SMI501_Crtc1Funcs.show_cursor = SMI501_CrtcShowCursor; + SMI501_Crtc1Funcs.hide_cursor = SMI501_CrtcHideCursor; + SMI501_Crtc1Funcs.load_cursor_image = SMI501_CrtcLoadCursorImage; + } + crtc1 = xf86CrtcCreate(pScrn, &SMI501_Crtc1Funcs); if (!crtc1) RETURN(FALSE); diff --git a/src/smi_accel.c b/src/smi_accel.c index f3c7974..a98eb3f 100644 --- a/src/smi_accel.c +++ b/src/smi_accel.c @@ -117,8 +117,6 @@ SMI_EngineReset(ScrnInfoPtr pScrn) WRITE_DPR(pSmi, 0x40, pSmi->FBOffset >> 3); WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); - CHECK_SECONDARY(pSmi); - SMI_DisableClipping(pScrn); LEAVE(); @@ -137,13 +135,6 @@ SMI_SetClippingRectangle(ScrnInfoPtr pScrn, int left, int top, int right, ENTER(); DEBUG("left=%d top=%d right=%d bottom=%d\n", left, top, right, bottom); - /* CZ 26.10.2001: this code prevents offscreen pixmaps being drawn ??? - left = max(left, 0); - top = max(top, 0); - right = min(right, pSmi->width); - bottom = min(bottom, pSmi->height); - */ - if (pScrn->bitsPerPixel == 24) { left *= 3; right *= 3; diff --git a/src/smi_crtc.c b/src/smi_crtc.c index d182e37..9c452c9 100644 --- a/src/smi_crtc.c +++ b/src/smi_crtc.c @@ -74,9 +74,13 @@ SMI_CrtcModeFixup(xf86CrtcPtr crtc, static void SMI_CrtcPrepare(xf86CrtcPtr crtc) { + ScrnInfoPtr pScrn = crtc->scrn; + SMIPtr pSmi = SMIPTR(pScrn); + ENTER(); - /* Nothing */ + if (pSmi->HwCursor) + xf86_hide_cursors(pScrn); LEAVE(); } diff --git a/src/smi_driver.c b/src/smi_driver.c index 4e496c6..f7484a6 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -828,7 +828,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) if (IS_MSOC(pSmi)) { pSmi->lcd = TRUE; - pSmi->IsSecondary = FALSE; if (pSmi->Dualhead && pSmi->UseFBDev) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Dual head disabled when using fbdev mode\n"); @@ -1035,9 +1034,8 @@ SMI_EnterVT(int scrnIndex, int flags) RETURN(FALSE); /* Initialize the hardware cursor */ - if(!IS_MSOC(pSmi) && pSmi->HwCursor){ + if (pSmi->HwCursor) xf86_show_cursors(pScrn); - } /* Reset the grapics engine */ if (!pSmi->NoAccel) @@ -1739,24 +1737,26 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * initialization. */ if (pSmi->HwCursor) { - 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"); - } + int size, flags; + + if (IS_MSOC(pSmi)) { + size = SMI501_MAX_CURSOR; + flags = (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 | + HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK); + } + else { + size = SMILYNX_MAX_CURSOR; + 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); } + if (!xf86_cursors_init(pScreen, size, size, flags)) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); } /* Initialise default colormap */ @@ -1781,7 +1781,11 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) !xf86DPMSInit(pScreen, SMILynx_DisplayPowerManagementSet, 0))) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed!\n"); - SMI_InitVideo(pScreen); + /* FIXME This could be an option. + * When not scaling doesn't seem to make much of a difference + * on MSOC, and this way, one can watch video on both screens... */ + if (!IS_MSOC(pSmi) || !pSmi->Dualhead) + SMI_InitVideo(pScreen); if(!xf86CrtcScreenInit(pScreen)) RETURN(FALSE); @@ -1810,9 +1814,8 @@ SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen) ENTER(); - if(!IS_MSOC(pSmi) && pSmi->HwCursor){ + if (pSmi->HwCursor) xf86_cursors_fini(pScreen); - } if (pScrn->vtSema) { if (!IS_MSOC(pSmi)) { diff --git a/src/smi_hwcurs.c b/src/smi_hwcurs.c deleted file mode 100644 index 8e93f9d..0000000 --- a/src/smi_hwcurs.c +++ /dev/null @@ -1,391 +0,0 @@ -/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_hwcurs.c-arc 1.12 27 Nov 2000 15:47:48 Frido $ */ - -/* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. -Copyright (C) 2000 Silicon Motion, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the names of the XFree86 Project and -Silicon Motion shall not be used in advertising or otherwise to promote the -sale, use or other dealings in this Software without prior written -authorization from the XFree86 Project and Silicon Motion. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "cursorstr.h" -#include "smi.h" - -static unsigned short -InterleaveBytes(int source, int mask) -{ - unsigned char ibit; - unsigned short usWord = 0; - unsigned char ucBitMask = 0x01; - - /* - * This function will interleave the bits in the source and mask bytes - * to create a word that looks like this: - * - * [M7 M6 M5 M4 M3 M2 M1 M0] [S7 S6 S5 S4 S3 S2 S1 S0] - * Results in: - * [M7 S7 M6 S6 M5 S5 M4 S4 M3 S3 M2 S2 M1 S1 M0 S0] - */ - - for (ibit = 0; ibit < 8; ibit++) { - usWord |= (source & ucBitMask) << ibit; - usWord |= (mask & ucBitMask) << (ibit + 1); - ucBitMask <<= 1; - } - - return (usWord); -} - -#if 0 -/* From the SMI Windows CE driver */ -static void -SMI501_RotateCursorShape(xf86CursorInfoPtr infoPtr, int angle, - unsigned char *pByte) -{ - BYTE *pCursor; - unsigned long ulBase, ulIndex; - BYTE src[256], dst[256]; /* 128 = 8 x 32 */ - BYTE jMask, j, bitMask; - int x, y, cx = 32, cy = 32; - - pCursor = pByte; - - memset (src, 0x00, sizeof (src)); - memset (dst, 0x00, sizeof (dst)); - - /* Save the original pointer shape into local memory shapeRow[] */ - for (y = 0; y < cy; y++) { - for (x = 0; x < cx / 4; x++) - src[y * 8 + x] = pByte[x]; - pByte += 16; - } - - switch (angle) { - case SMI_ROTATE_CCW: - for (y = 0; y < cy; y++) { - jMask = 0x02 << ((y & 3) * 2); - for (x = 0; x < cx; x++) { - j = src[y * 8 + x / 4]; - bitMask = 0x02 << ((x & 3) * 2); - - ulBase = (31 - x) * 8; - ulIndex = ulBase + y / 4; - - if (j & bitMask) - dst[ulIndex] |= jMask; - if (j & (bitMask >> 1)) - dst[ulIndex] |= jMask >> 1; - } - } - break; - - case SMI_ROTATE_CW: - for (y = 0; y < cy; y++) { - jMask = 0x80 >> ((y & 3) * 2); - - /* Write available bits into shapeRow */ - for (x = 0; x < cx; x++) { - j = src[y * 8 + x / 4]; - bitMask = 0x02 << ((x & 3) * 2); - - ulBase = x * 8; - ulIndex = ulBase + (31 - y) / 4; - - if (j & bitMask) - dst[ulIndex] |= jMask; - if (j & (bitMask >> 1)) - dst[ulIndex] |= jMask >> 1; - } - } - break; - default: - return; - } - - for (y = 0; y < cy; y++) { - for (x = 0; x < cx / 4; x++) - pCursor[x] = dst[y * 8 + x]; - pCursor += 16; - } - -} -#endif - -static unsigned char * -SMI501_RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) -{ - CursorBitsPtr bits = pCurs->bits; - unsigned char *ram; - unsigned short *usram; - unsigned char *psource = bits->source; - unsigned char *pmask = bits->mask; - int x, y, srcwidth, i; - unsigned int MaxCursor; - - ENTER(); - - /* Allocate memory */ - ram = (unsigned char *) xcalloc (1, SMI501_CURSOR_SIZE); - - usram = (unsigned short *) ram; - MaxCursor = SMI501_MAX_CURSOR; - - if (ram == NULL) - RETURN(NULL); - - /* Calculate cursor information */ - srcwidth = ((bits->width + 31) / 8) & ~3; - - i = 0; - - /* Copy cursor image */ - for (y = 0; y < min (MaxCursor, bits->height); y++) { - for (x = 0; x < min (MaxCursor / 8, srcwidth); x++) { - unsigned char mask = *pmask++; - unsigned char source = *psource++ & mask; - - usram[i++] = InterleaveBytes (source, mask); - } - - pmask += srcwidth - x; - psource += srcwidth - x; - - /* Fill remaining part of line with no shape */ - for (; x < MaxCursor / 8; x++) - usram[i++] = 0x0000; - } - - /* Fill remaining part of memory with no shape */ - for (; y < MaxCursor; y++) { - for (x = 0; x < MaxCursor / 8; x++) - usram[i++] = 0x0000; - } - -#if 0 - SMI501_RotateCursorShape(infoPtr, pSmi->rotate, ram); -#endif - - RETURN(ram); -} - -static void -SMI_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - if (IS_MSOC(pSmi)) { - /* Write address, disabling the HW cursor */ - if (!pSmi->IsSecondary) { - /* Panel HWC Addr */ - WRITE_DCR(pSmi, 0x00f0, pSmi->FBCursorOffset); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "Primary FBCursorOffset at 0x%08X\n", - (unsigned int)pSmi->FBCursorOffset); - } - else { - /* CRT HWC Addr */ - WRITE_DCR(pSmi, 0x0230, pSmi->videoRAMBytes + pSmi->FBCursorOffset); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "Secondary FBCursorOffset at 0x%08X\n", - (unsigned int)pSmi->FBCursorOffset); - } - } - - /* Copy cursor image to framebuffer storage */ - memcpy(pSmi->FBBase + pSmi->FBCursorOffset, src, 1024); - - LEAVE(); -} - -static void -SMI_ShowCursor(ScrnInfoPtr pScrn) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - if (IS_MSOC(pSmi)) { - CARD32 uiPanelTmp; - CARD32 uiCrtTmp; - - if (!pSmi->IsSecondary) { - uiPanelTmp = READ_DCR(pSmi, 0x00f0); - uiPanelTmp |= SMI501_MASK_HWCENABLE; - WRITE_DCR(pSmi, 0x00f0, uiPanelTmp); - } - else { - uiCrtTmp = READ_DCR(pSmi, 0x0230); - uiCrtTmp |= SMI501_MASK_HWCENABLE; - WRITE_DCR(pSmi, 0x0230, uiCrtTmp); - } - } - - LEAVE(); -} - -static void -SMI_HideCursor(ScrnInfoPtr pScrn) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - if (IS_MSOC(pSmi)) { - CARD32 uiPanelTmp; - CARD32 uiCrtTmp; - - if (!pSmi->IsSecondary) { - uiPanelTmp = READ_DCR(pSmi, 0x00f0); - uiPanelTmp &= ~SMI501_MASK_HWCENABLE; - WRITE_DCR(pSmi, 0x00f0, uiPanelTmp); - } - else { - uiCrtTmp = READ_DCR(pSmi, 0x0230); - uiCrtTmp &= ~SMI501_MASK_HWCENABLE; - WRITE_DCR(pSmi, 0x0230, uiCrtTmp); - } - } - - LEAVE(); -} - -static void -SMI_SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) -{ - SMIPtr pSmi = SMIPTR(pScrn); - int xoff, yoff; - - ENTER(); - - /* Program coordinates */ - if (IS_MSOC(pSmi)) { - CARD32 hwcLocVal; - - if (xoff >= 0) - hwcLocVal = xoff & SMI501_MASK_MAXBITS; - else - hwcLocVal = (-xoff & SMI501_MASK_MAXBITS) | SMI501_MASK_BOUNDARY; - - if (yoff >= 0) - hwcLocVal |= (yoff & SMI501_MASK_MAXBITS) << 16; - else - hwcLocVal |= ((-yoff & SMI501_MASK_MAXBITS) | - SMI501_MASK_BOUNDARY) << 16; - - /* Program combined coordinates */ - if (!pSmi->IsSecondary) - WRITE_DCR(pSmi, 0x00f4, hwcLocVal); /* Panel HWC Location */ - else - WRITE_DCR(pSmi, 0x0234, hwcLocVal); /* CRT HWC Location */ - } - - LEAVE(); -} - -static void -SMI_SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) -{ - SMIPtr pSmi = SMIPTR(pScrn); - - ENTER(); - - if (IS_MSOC(pSmi)) { - /* for the SMI501 HWCursor, there are 4 possible colors, one of which - * is transparent: M,S: 0,0 = Transparent - * 0,1 = color 1 - * 1,0 = color 2 - * 1,1 = color 3 - * To simplify implementation, we use color2 == bg and - * color3 == fg - * Color 1 is don't care, so we set it to color 2's value - */ - unsigned int packedFGBG; - - /* Pack the true color components into 16 bit RGB -- 5:6:5 */ - packedFGBG = (bg & 0xF80000) >> 8 - | (bg & 0x00FC00) >> 5 | (bg & 0x0000F8) >> 3; - - packedFGBG |= (bg & 0xF80000) << 8 - | (bg & 0x00FC00) << 11 | (bg & 0x0000F8) << 13; - - if (!pSmi->IsSecondary) - WRITE_DCR(pSmi, 0x00f8, packedFGBG); /* Panel HWC Color 1,2 */ - else - WRITE_DCR(pSmi, 0x0238, packedFGBG); /* CRT HWC Color 1,2 */ - - - packedFGBG = (fg & 0xF80000) >> 8 - | (fg & 0x00FC00) >> 5 | (fg & 0x0000F8) >> 3; - if (!pSmi->IsSecondary) - WRITE_DCR(pSmi, 0x00fc, packedFGBG); /* Panel HWC Color 3 */ - else - WRITE_DCR(pSmi, 0x023c, packedFGBG); /* CRT HWC Color 3 */ - } - - LEAVE(); -} - -Bool -SMI_HWCursorInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SMIPtr pSmi = SMIPTR(pScrn); - xf86CursorInfoPtr infoPtr; - Bool ret; - - ENTER(); - - /* Create cursor infor record */ - infoPtr = xf86CreateCursorInfoRec(); - if (infoPtr == NULL) - RETURN(FALSE); - - pSmi->CursorInfoRec = infoPtr; - - /* Fill in the information */ - if (IS_MSOC(pSmi)) { - 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; - } - - infoPtr->SetCursorColors = SMI_SetCursorColors; - infoPtr->SetCursorPosition = SMI_SetCursorPosition; - infoPtr->LoadCursorImage = SMI_LoadCursorImage; - infoPtr->HideCursor = SMI_HideCursor; - infoPtr->ShowCursor = SMI_ShowCursor; - infoPtr->UseHWCursor = NULL; - - /* Proceed with cursor initialization */ - ret = xf86InitCursor(pScreen, infoPtr); - - RETURN(ret); -} - diff --git a/src/smi_video.c b/src/smi_video.c index 4a06d75..89b41ca 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -128,9 +128,6 @@ static void SMI_DisplayVideo0730(ScrnInfoPtr pScrn, int id, int offset, BoxPtr dstBox, short vid_w, short vid_h, short drw_w, short drw_h); static void SMI_BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadMask); -#if 0 -static void SMI_WaitForSync(ScrnInfoPtr pScrn); -#endif /*static int SMI_SendI2C(ScrnInfoPtr pScrn, CARD8 device, char *devName, SMI_I2CDataPtr i2cData);*/ @@ -626,11 +623,6 @@ SMI_InitVideo(ScreenPtr pScreen) ENTER(); - if (IS_MSOC(psmi) && psmi->IsSecondary) { - LEAVE(); - return; - } - numAdaptors = xf86XVListGenericAdaptors(pScrn, &ptrAdaptors); DEBUG("numAdaptors=%d\n", numAdaptors); @@ -1259,9 +1251,6 @@ SMI_PutVideo( VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21) & ~0x04); WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) | 0x00200000); -#if 0 - SMI_WaitForSync(pScrn); -#endif /* Video Window I Left and Top Boundaries */ WRITE_VPR(pSmi, 0x14, dstBox.x1 + (dstBox.y1 << 16)); /* Video Window I Right and Bottom Boundaries */ @@ -1778,9 +1767,7 @@ SMI_DisplayVideo( } else { vstretch = 0; } -#if 0 - SMI_WaitForSync(pScrn); -#endif + WRITE_VPR(pSmi, 0x00, vpr00 | (1 << 3) | (1 << 20)); WRITE_VPR(pSmi, 0x14, (dstBox->x1) | (dstBox->y1 << 16)); WRITE_VPR(pSmi, 0x18, (dstBox->x2) | (dstBox->y2 << 16)); @@ -1849,10 +1836,6 @@ SMI_DisplayVideo0501(ScrnInfoPtr pScrn, vstretch = (4096 * drw_h / vid_h) | 0x8000; } -#if 0 - SMI_WaitForSync(pScrn); -#endif - /* Set Color Key Enable bit */ WRITE_DCR(pSmi, 0x0000, READ_DCR(pSmi, 0x0000) | (1 << 9)); diff --git a/src/smi_xaa.c b/src/smi_xaa.c index c4b8316..30f8608 100644 --- a/src/smi_xaa.c +++ b/src/smi_xaa.c @@ -188,40 +188,7 @@ SMI_XAAInit(ScreenPtr pScreen) SMI_EngineReset(pScrn); - - /* CZ 18.06.2001: moved to smi_driver.c before the NoAccel question - to have offscreen framebuffer in NoAccel mode */ -#if 0 - maxLines = pSmi->FBReserved / (pSmi->width * pSmi->Bpp); - if (pSmi->rotate) { - numLines = maxLines; - } else { -#if SMI_USE_VIDEO - numLines = ((pSmi->FBReserved - pSmi->width * pSmi->Bpp * pSmi->height) - * 25 / 100 + pSmi->width * pSmi->Bpp - 1) - / (pSmi->width * pSmi->Bpp); - numLines += pSmi->height; -#else - numLines = maxLines; -#endif - } - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pSmi->width; - AvailFBArea.y2 = numLines; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FrameBuffer Box: %d,%d - %d,%d\n", - AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2); - xf86InitFBManager(pScreen, &AvailFBArea); -#endif - ret = XAAInit(pScreen, infoPtr); -#if 0 - if (ret && pSmi->shadowFB) /* #671 */ { - pSmi->ValidatePolylines = infoPtr->ValidatePolylines; - infoPtr->ValidatePolylines = SMI_ValidatePolylines; - } -#endif RETURN(ret); } @@ -299,7 +266,6 @@ SMI_SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, } WaitIdle(); - CHECK_SECONDARY(pSmi); WRITE_DPR(pSmi, 0x00, (x1 << 16) + (y1 & 0xFFFF)); WRITE_DPR(pSmi, 0x04, (x2 << 16) + (y2 & 0xFFFF)); WRITE_DPR(pSmi, 0x08, (w << 16) + (h & 0xFFFF)); @@ -378,7 +344,6 @@ SMI_SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) } WaitQueue(); - CHECK_SECONDARY(pSmi); WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); @@ -418,7 +383,6 @@ SMI_SubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, } WaitQueue(); - CHECK_SECONDARY(pSmi); WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); @@ -507,7 +471,6 @@ SMI_SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, WaitQueue(); } } - CHECK_SECONDARY(pSmi); WRITE_DPR(pSmi, 0x00, 0); WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); @@ -548,7 +511,6 @@ SMI_SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg, pSmi->ClipTurnedOn = FALSE; } - CHECK_SECONDARY(pSmi); if (bg == -1) { WaitQueue(); WRITE_DPR(pSmi, 0x14, fg); @@ -589,7 +551,6 @@ SMI_SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, } WaitQueue(); - CHECK_SECONDARY(pSmi); WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); @@ -641,7 +602,6 @@ SMI_SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, int rop, } WaitQueue(); - CHECK_SECONDARY(pSmi); if (trans_color == -1) { pSmi->AccelCmd |= SMI_TRANSPARENT_SRC | SMI_TRANSPARENT_PXL; @@ -678,7 +638,6 @@ SMI_SubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty, } WaitQueue(); - CHECK_SECONDARY(pSmi); WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); /* PDR#950 */ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); @@ -756,7 +715,6 @@ SMI_SubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, WaitQueue(); } } - CHECK_SECONDARY(pSmi); WRITE_DPR(pSmi, 0x00, 0); WRITE_DPR(pSmi, 0x04, (x << 16) | (y * 0xFFFF)); WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); |