diff options
Diffstat (limited to 'src/sis_cursor.c')
-rw-r--r-- | src/sis_cursor.c | 826 |
1 files changed, 424 insertions, 402 deletions
diff --git a/src/sis_cursor.c b/src/sis_cursor.c index 0ebb44d..22cc24a 100644 --- a/src/sis_cursor.c +++ b/src/sis_cursor.c @@ -1,35 +1,34 @@ -/* $XFree86$ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.18 2003/09/04 15:32:42 twini Exp $ */ /* * SiS hardware cursor handling * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2) Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3) The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Author: Thomas Winischhofer <thomas@winischhofer.net> - * - * Idea based on code by Can-Ru Yeou, SiS Inc. + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. * + * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. + * Thomas Winischhofer <thomas@winischhofer.net> */ #include "xf86.h" @@ -49,6 +48,7 @@ extern void SISWaitRetraceCRT1(ScrnInfoPtr pScrn); extern void SISWaitRetraceCRT2(ScrnInfoPtr pScrn); +extern Bool InRegion(int x, int y, region r); /* Helper function for Xabre to convert mono image to ARGB */ /* The Xabre's cursor engine for CRT2 is buggy and can't @@ -67,6 +67,8 @@ SiSXConvertMono2ARGB(SISPtr pSiS) if(!dest || !src) return; + if(pSiS->UseHWARGBCursor) return; + for(i = 0; i < 64; i++) { for(j = 0; j < 8; j++) { chunk = *(src + 8); mask = *src++; @@ -104,23 +106,23 @@ SiS300HideCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) { - if(pSiS->SecondHead) { - /* Head 2 is always CRT1 */ - sis300DisableHWCursor() - sis300SetCursorPositionY(2000, 0) - } else { - /* Head 1 is always CRT2 */ - sis301DisableHWCursor() - sis301SetCursorPositionY(2000, 0) - } + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis300DisableHWCursor() + sis300SetCursorPositionY(2000, 0) + } else { + /* TW: Head 1 is always CRT2 */ + sis301DisableHWCursor() + sis301SetCursorPositionY(2000, 0) + } } else { #endif - sis300DisableHWCursor() - sis300SetCursorPositionY(2000, 0) - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301DisableHWCursor() - sis301SetCursorPositionY(2000, 0) - } + sis300DisableHWCursor() + sis300SetCursorPositionY(2000, 0) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301DisableHWCursor() + sis301SetCursorPositionY(2000, 0) + } #ifdef SISDUALHEAD } #endif @@ -135,23 +137,33 @@ SiS310HideCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) { - if(pSiS->SecondHead) { - /* Head 2 is always CRT1 */ - sis310DisableHWCursor() - sis310SetCursorPositionY(2000, 0) - } else { - /* Head 1 is always CRT2 */ - sis301DisableHWCursor310() - sis301SetCursorPositionY310(2000, 0) - } + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis310DisableHWCursor() + sis310SetCursorPositionY(2000, 0) + } else { + /* TW: Head 1 is always CRT2 */ + if(pSiS->ChipFlags & SiSCF_XabreCore) { + sis301DisableHWCursor330() + sis301SetCursorPositionY330(2000, 0) + } else { + sis301DisableHWCursor310() + sis301SetCursorPositionY310(2000, 0) + } + } } else { #endif - sis310DisableHWCursor() - sis310SetCursorPositionY(2000, 0) - if(pSiS->VBFlags & VB_VIDEOBRIDGE) { - sis301DisableHWCursor310() - sis301SetCursorPositionY310(2000, 0) - } + sis310DisableHWCursor() + sis310SetCursorPositionY(2000, 0) + if(pSiS->VBFlags & CRT2_ENABLE) { + if(pSiS->ChipFlags & SiSCF_XabreCore) { + sis301DisableHWCursor330() + sis301SetCursorPositionY330(2000, 0) + } else { + sis301DisableHWCursor310() + sis301SetCursorPositionY310(2000, 0) + } + } #ifdef SISDUALHEAD } #endif @@ -184,50 +196,50 @@ SiS300ShowCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* Head 2 is always CRT1 */ - if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis300EnableHWARGB16Cursor() + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + if(pSiS->UseHWARGBCursor) { +#ifdef SIS300_USE_ARGB16 + sis300EnableHWARGB16Cursor() #else - sis300EnableHWARGBCursor() -#endif - } else { - sis300EnableHWCursor() - } - } else { - /* Head 1 is always CRT2 */ - if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis301EnableHWARGB16Cursor() + sis300EnableHWARGBCursor() +#endif + } else { + sis300EnableHWCursor() + } + } else { + /* TW: Head 1 is always CRT2 */ + if(pSiS->UseHWARGBCursor) { +#ifdef SIS300_USE_ARGB16 + sis301EnableHWARGB16Cursor() #else - sis301EnableHWARGBCursor() -#endif - } else { - sis301EnableHWCursor() - } - } + sis301EnableHWARGBCursor() +#endif + } else { + sis301EnableHWCursor() + } + } } else { #endif - if(pSiS->UseHWARGBCursor) { + if(pSiS->UseHWARGBCursor) { #ifdef SIS300_USE_ARGB16 - sis300EnableHWARGB16Cursor() + sis300EnableHWARGB16Cursor() #else - sis300EnableHWARGBCursor() -#endif - if(pSiS->VBFlags & CRT2_ENABLE) { -#ifdef SIS300_USE_ARGB16 - sis301EnableHWARGB16Cursor() + sis300EnableHWARGBCursor() +#endif + if(pSiS->VBFlags & CRT2_ENABLE) { +#ifdef SIS300_USE_ARGB16 + sis301EnableHWARGB16Cursor() #else - sis301EnableHWARGBCursor() -#endif - } - } else { - sis300EnableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWCursor() - } - } + sis301EnableHWARGBCursor() +#endif + } + } else { + sis300EnableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor() + } + } #ifdef SISDUALHEAD } #endif @@ -248,49 +260,49 @@ SiS310ShowCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* Head 2 is always CRT1 */ - if(pSiS->UseHWARGBCursor) { - sis310EnableHWARGBCursor() - } else { - sis310EnableHWCursor() - } - } else { - /* Head 1 is always CRT2 */ - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301EnableHWCursor330() - } else { - if(pSiS->UseHWARGBCursor) { - sis301EnableHWARGBCursor310() - } else { - sis301EnableHWCursor310() - } - } - } + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + if(pSiS->UseHWARGBCursor) { + sis310EnableHWARGBCursor() + } else { + sis310EnableHWCursor() + } + } else { + /* TW: Head 1 is always CRT2 */ + if(pSiS->ChipFlags & SiSCF_XabreCore) { + sis301EnableHWCursor330() + } else { + if(pSiS->UseHWARGBCursor) { + sis301EnableHWARGBCursor310() + } else { + sis301EnableHWCursor310() + } + } + } } else { #endif - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - if(pSiS->UseHWARGBCursor) { - sis310EnableHWARGBCursor() - } else { - sis310EnableHWCursor() - } - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWCursor330() - } - } else { - if(pSiS->UseHWARGBCursor) { - sis310EnableHWARGBCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWARGBCursor310() - } - } else { - sis310EnableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWCursor310() - } - } - } + if(pSiS->ChipFlags & SiSCF_XabreCore) { + if(pSiS->UseHWARGBCursor) { + sis310EnableHWARGBCursor() + } else { + sis310EnableHWCursor() + } + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor330() + } + } else { + if(pSiS->UseHWARGBCursor) { + sis310EnableHWARGBCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWARGBCursor310() + } + } else { + sis310EnableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor310() + } + } + } #ifdef SISDUALHEAD } #endif @@ -300,7 +312,7 @@ static void SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; + DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ unsigned char x_preset = 0; unsigned char y_preset = 0; int temp; @@ -312,14 +324,14 @@ SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif - if(x < 0) { - x_preset = (-x); - x = 0; + if (x < 0) { + x_preset = (-x); + x = 0; } - if(y < 0) { - y_preset = (-y); - y = 0; + if (y < 0) { + y_preset = (-y); + y = 0; } if(mode->Flags & V_INTERLACE) y /= 2; @@ -365,24 +377,24 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y) if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->UseHWARGBCursor)) maxpreset = 31; if(x1 < 0) { - x1_preset = (-x1); - if(x1_preset > maxpreset) x1_preset = maxpreset; - x1 = 0; + x1_preset = (-x1); + if(x1_preset > maxpreset) x1_preset = maxpreset; + x1 = 0; } if(y1 < 0) { - y1_preset = (-y1); - if(y1_preset > maxpreset) y1_preset = maxpreset; - y1 = 0; + y1_preset = (-y1); + if(y1_preset > maxpreset) y1_preset = maxpreset; + y1 = 0; } if(x2 < 0) { - x2_preset = (-x2); - if(x2_preset > maxpreset) x2_preset = maxpreset; - x2 = 0; + x2_preset = (-x2); + if(x2_preset > maxpreset) x2_preset = maxpreset; + x2 = 0; } if(y2 < 0) { - y2_preset = (-y2); - if(y2_preset > maxpreset) y2_preset = maxpreset; - y2 = 0; + y2_preset = (-y2); + if(y2_preset > maxpreset) y2_preset = maxpreset; + y2 = 0; } if(mode1->Flags & V_INTERLACE) { y1 /= 2; y1_preset /= 2; } @@ -391,10 +403,6 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y) if(mode2->Flags & V_INTERLACE) { y2 /= 2; y2_preset /= 2; } else if(mode2->Flags & V_DBLSCAN) { y2 *= 2; y2_preset *= 2; } - /* Work around bug in Cursor engine */ - if(x1 > mode1->HDisplay) { y1 = 2000; y1_preset = 0; } - if(x2 > mode2->HDisplay) { y2 = 2000; y2_preset = 0; } - if(pSiS->VGAEngine == SIS_300_VGA) { sis300SetCursorPositionX(x1, x1_preset) sis300SetCursorPositionY(y1, y1_preset) @@ -403,8 +411,13 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y) } else { sis310SetCursorPositionX(x1, x1_preset) sis310SetCursorPositionY(y1, y1_preset) - sis301SetCursorPositionX310(x2 + 17, x2_preset) - sis301SetCursorPositionY310(y2, y2_preset) + if(pSiS->ChipFlags & SiSCF_XabreCore) { + sis301SetCursorPositionX330(x2 + 17, x2_preset) + sis301SetCursorPositionY330(y2, y2_preset) + } else { + sis301SetCursorPositionX310(x2 + 17, x2_preset) + sis301SetCursorPositionY310(y2, y2_preset) + } } } #endif @@ -424,13 +437,13 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) } #endif - if(x < 0) { - x_preset = (-x); - x = 0; + if (x < 0) { + x_preset = (-x); + x = 0; } - if(y < 0) { - y_preset = (-y); - y = 0; + if (y < 0) { + y_preset = (-y); + y = 0; } if(mode->Flags & V_INTERLACE) y /= 2; @@ -438,23 +451,23 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* Head 2 is always CRT1 */ - sis300SetCursorPositionX(x, x_preset) - sis300SetCursorPositionY(y, y_preset) - } else { - /* Head 1 is always CRT2 */ - sis301SetCursorPositionX(x + 13, x_preset) - sis301SetCursorPositionY(y, y_preset) - } + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis300SetCursorPositionX(x, x_preset) + sis300SetCursorPositionY(y, y_preset) + } else { + /* TW: Head 1 is always CRT2 */ + sis301SetCursorPositionX(x + 13, x_preset) + sis301SetCursorPositionY(y, y_preset) + } } else { #endif - sis300SetCursorPositionX(x, x_preset) - sis300SetCursorPositionY(y, y_preset) - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorPositionX(x + 13, x_preset) - sis301SetCursorPositionY(y, y_preset) - } + sis300SetCursorPositionX(x, x_preset) + sis300SetCursorPositionY(y, y_preset) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorPositionX(x + 13, x_preset) + sis301SetCursorPositionY(y, y_preset) + } #ifdef SISDUALHEAD } #endif @@ -475,13 +488,13 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) } #endif - if(x < 0) { - x_preset = (-x); - x = 0; + if (x < 0) { + x_preset = (-x); + x = 0; } - if(y < 0) { - y_preset = (-y); - y = 0; + if (y < 0) { + y_preset = (-y); + y = 0; } if(mode->Flags & V_INTERLACE) y /= 2; @@ -489,22 +502,32 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* Head 2 is always CRT1 */ - sis310SetCursorPositionX(x, x_preset) - sis310SetCursorPositionY(y, y_preset) - } else { - /* Head 1 is always CRT2 */ - sis301SetCursorPositionX310(x + 17, x_preset) - sis301SetCursorPositionY310(y, y_preset) - } + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis310SetCursorPositionX(x, x_preset) + sis310SetCursorPositionY(y, y_preset) + } else { + /* TW: Head 1 is always CRT2 */ + if(pSiS->ChipFlags & SiSCF_XabreCore) { + sis301SetCursorPositionX330(x + 17, x_preset) + sis301SetCursorPositionY330(y, y_preset) + } else { + sis301SetCursorPositionX310(x + 17, x_preset) + sis301SetCursorPositionY310(y, y_preset) + } + } } else { #endif sis310SetCursorPositionX(x, x_preset) sis310SetCursorPositionY(y, y_preset) if(pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorPositionX310(x + 17, x_preset) - sis301SetCursorPositionY310(y, y_preset) + if(pSiS->ChipFlags & SiSCF_XabreCore) { + sis301SetCursorPositionX330(x + 17, x_preset) + sis301SetCursorPositionY330(y, y_preset) + } else { + sis301SetCursorPositionX310(x + 17, x_preset) + sis301SetCursorPositionY310(y, y_preset) + } } #ifdef SISDUALHEAD } @@ -552,23 +575,23 @@ SiS300SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* Head 2 is always CRT1 */ - sis300SetCursorBGColor(bg) - sis300SetCursorFGColor(fg) - } else { - /* Head 1 is always CRT2 */ - sis301SetCursorBGColor(bg) - sis301SetCursorFGColor(fg) - } + if(pSiS->SecondHead) { + /* TW: Head 2 is always CRT1 */ + sis300SetCursorBGColor(bg) + sis300SetCursorFGColor(fg) + } else { + /* TW: Head 1 is always CRT2 */ + sis301SetCursorBGColor(bg) + sis301SetCursorFGColor(fg) + } } else { #endif - sis300SetCursorBGColor(bg) - sis300SetCursorFGColor(fg) - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorBGColor(bg) - sis301SetCursorFGColor(fg) - } + sis300SetCursorBGColor(bg) + sis300SetCursorFGColor(fg) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorBGColor(bg) + sis301SetCursorFGColor(fg) + } #ifdef SISDUALHEAD } #endif @@ -584,39 +607,39 @@ SiS310SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { if(pSiS->SecondHead) { - /* Head 2 is always CRT1 */ - sis310SetCursorBGColor(bg) - sis310SetCursorFGColor(fg) + /* TW: Head 2 is always CRT1 */ + sis310SetCursorBGColor(bg) + sis310SetCursorFGColor(fg) } else { - /* Head 1 is always CRT2 */ - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { + /* TW: Head 1 is always CRT2 */ + if(pSiS->ChipFlags & SiSCF_XabreCore) { + if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) { + pSiS->CurFGCol = fg; + pSiS->CurBGCol = bg; + SiSXConvertMono2ARGB(pSiS); + } + } else { + sis301SetCursorBGColor310(bg) + sis301SetCursorFGColor310(fg) + } + } + } else { +#endif + sis310SetCursorBGColor(bg) + sis310SetCursorFGColor(fg) + + if(pSiS->VBFlags & CRT2_ENABLE) { + if(pSiS->ChipFlags & SiSCF_XabreCore) { if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) { - pSiS->CurFGCol = fg; - pSiS->CurBGCol = bg; - SiSXConvertMono2ARGB(pSiS); + pSiS->CurFGCol = fg; + pSiS->CurBGCol = bg; + SiSXConvertMono2ARGB(pSiS); } } else { sis301SetCursorBGColor310(bg) sis301SetCursorFGColor310(fg) } - } - } else { -#endif - sis310SetCursorBGColor(bg) - sis310SetCursorFGColor(fg) - - if(pSiS->VBFlags & CRT2_ENABLE) { - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) { - pSiS->CurFGCol = fg; - pSiS->CurBGCol = bg; - SiSXConvertMono2ARGB(pSiS); - } - } else { - sis301SetCursorBGColor310(bg) - sis301SetCursorFGColor310(fg) - } - } + } #ifdef SISDUALHEAD } #endif @@ -716,33 +739,35 @@ SiS300LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) } if(pSiS->UseHWARGBCursor) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - status1 = sis300GetCursorStatus; - sis300DisableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - status2 = sis301GetCursorStatus; - sis301DisableHWCursor() - } - SISWaitRetraceCRT1(pScrn); - sis300SwitchToMONOCursor(); - if(pSiS->VBFlags & CRT2_ENABLE) { - SISWaitRetraceCRT2(pScrn); - sis301SwitchToMONOCursor(); - } - } + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis300GetCursorStatus; + sis300DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + } + SISWaitRetraceCRT1(pScrn); + sis300SwitchToMONOCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor(); + } + } } sis300SetCursorAddress(cursor_addr); + sis300SetCursorPatternSelect(0); if(status1) sis300SetCursorStatus(status1) if(pSiS->VBFlags & CRT2_ENABLE) { - if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { - status2 = sis301GetCursorStatus; - sis301DisableHWCursor() - SISWaitRetraceCRT2(pScrn); - sis301SwitchToMONOCursor(); - } - sis301SetCursorAddress(cursor_addr) - if(status2) sis301SetCursorStatus(status2) + if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor(); + } + sis301SetCursorAddress(cursor_addr) + sis301SetCursorPatternSelect(0) + if(status2) sis301SetCursorStatus(status2) } pSiS->UseHWARGBCursor = FALSE; @@ -756,19 +781,8 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) CARD32 status1 = 0, status2 = 0; unsigned char *dest = pSiS->FbBase; BOOLEAN sizedouble = FALSE; - int bufnum; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; - - if(pSiS->DualHeadMode) { - pSiSEnt->HWCursorMBufNum ^= 1; - bufnum = 1 << pSiSEnt->HWCursorMBufNum; - } else { -#endif - pSiS->HWCursorMBufNum ^= 1; - bufnum = 1 << pSiS->HWCursorMBufNum; -#ifdef SISDUALHEAD - } #endif #ifdef SISMERGED @@ -782,17 +796,13 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) sizedouble = TRUE; } + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); /* 1K boundary */ + #ifdef SISDUALHEAD - /* Use the global (real) FbBase in DHM */ + /* TW: Use the global (real) FbBase in DHM */ if(pSiS->DualHeadMode) dest = pSiSEnt->FbBase; #endif - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); - } else { - cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * bufnum); - } - if(sizedouble) { int i; for(i = 0; i < 32; i++) { @@ -805,7 +815,7 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) memcpy((unsigned char *)dest + (cursor_addr * 1024), src, 1024); } - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { + if(pSiS->ChipFlags & SiSCF_XabreCore) { /* Convert Mono image to color image */ @@ -817,44 +827,46 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) SiSXConvertMono2ARGB(pSiS); if(pSiS->UseHWARGBCursor) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - status1 = sis310GetCursorStatus; - sis310DisableHWCursor(); - SISWaitRetraceCRT1(pScrn); - sis310SwitchToMONOCursor(); - } - } + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis310GetCursorStatus; + sis310DisableHWCursor(); + SISWaitRetraceCRT1(pScrn); + sis310SwitchToMONOCursor(); + } + } } else { if(pSiS->UseHWARGBCursor) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - status1 = sis310GetCursorStatus; - sis310DisableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - status2 = sis301GetCursorStatus310; - sis301DisableHWCursor310() - } - SISWaitRetraceCRT1(pScrn); - sis310SwitchToMONOCursor(); - if(pSiS->VBFlags & CRT2_ENABLE) { - SISWaitRetraceCRT2(pScrn); - sis301SwitchToMONOCursor310(); - } - } - } else if(pSiS->Chipset == PCI_CHIP_SIS315H) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - SISWaitRetraceCRT1(pScrn); - } - } + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis310GetCursorStatus; + sis310DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus310; + sis301DisableHWCursor310() + } + SISWaitRetraceCRT1(pScrn); + sis310SwitchToMONOCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor310(); + } + } + } else if(pSiS->Chipset == PCI_CHIP_SIS315H) { + if(pSiS->VBFlags & DISPTYPE_CRT1) { + SISWaitRetraceCRT1(pScrn); + } + } } sis310SetCursorAddress(cursor_addr); + sis310SetCursorPatternSelect(0); if(status1) sis310SetCursorStatus(status1) if(pSiS->VBFlags & CRT2_ENABLE) { - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorAddress310(cursor_addr2) + if(pSiS->ChipFlags & SiSCF_XabreCore) { + sis301SetCursorAddress330(cursor_addr2) + sis301SetCursorPatternSelect330(0) } else { if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { status2 = sis301GetCursorStatus310; @@ -863,6 +875,7 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) sis301SwitchToMONOCursor310(); } sis301SetCursorAddress310(cursor_addr) + sis301SetCursorPatternSelect310(0) if(status2) sis301SetCursorStatus310(status2) } } @@ -875,15 +888,15 @@ SiSUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; - + DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ + if(pSiS->Chipset != PCI_CHIP_SIS6326) return TRUE; if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return TRUE; if((strcmp(mode->name, "PAL800x600U") == 0) || (strcmp(mode->name, "NTSC640x480U") == 0)) - return FALSE; + return FALSE; else - return TRUE; + return TRUE; } static Bool @@ -891,7 +904,7 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; + DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ #ifdef SISMERGED DisplayModePtr mode2 = NULL; @@ -906,9 +919,9 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS630: case PCI_CHIP_SIS540: if(mode->Flags & V_INTERLACE) - return FALSE; + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -923,12 +936,12 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS315: case PCI_CHIP_SIS315H: case PCI_CHIP_SIS315PRO: - case PCI_CHIP_SIS660: case PCI_CHIP_SIS330: + case PCI_CHIP_SIS660: if(mode->Flags & V_INTERLACE) - return FALSE; + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -937,12 +950,23 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) return FALSE; } #endif + if(pSiS->Chipset == PCI_CHIP_SIS330) { + if((pSiS->VBFlags & CRT2_TV) && + (pSiS->VBFlags & (TV_NTSC|TV_PALM))) { +#ifdef SISMERGED + if(pSiS->MergedFB) { + if(mode2->HDisplay == 1024) return FALSE; + } else +#endif + if(mode->HDisplay == 1024) return FALSE; + } + } break; default: if(mode->Flags & V_INTERLACE) - return FALSE; + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; + return FALSE; break; } return TRUE; @@ -956,7 +980,7 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; + DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ #ifdef SISMERGED DisplayModePtr mode2 = NULL; @@ -971,11 +995,11 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS630: case PCI_CHIP_SIS540: if(mode->Flags & V_INTERLACE) - return FALSE; - if((pCurs->bits->height > 32) || (pCurs->bits->width > 32)) - return FALSE; + return FALSE; + if(pCurs->bits->height > 32 || pCurs->bits->width > 32) + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 16)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -993,13 +1017,13 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS330: case PCI_CHIP_SIS660: if(mode->Flags & V_INTERLACE) - return FALSE; - if((pCurs->bits->height > 64) || (pCurs->bits->width > 64)) - return FALSE; + return FALSE; + if(pCurs->bits->height > 64 || pCurs->bits->width > 64) + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; + return FALSE; if((pSiS->CurrentLayout.bitsPerPixel == 8) && (pSiS->VBFlags & CRT2_ENABLE)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -1008,8 +1032,20 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) return FALSE; } #endif + if(pSiS->Chipset == PCI_CHIP_SIS330) { + if((pSiS->VBFlags & VB_SISBRIDGE) && + (pSiS->VBFlags & CRT2_TV) && + (pSiS->VBFlags & (TV_NTSC|TV_PALM))) { +#ifdef SISMERGED + if(pSiS->MergedFB) { + if(mode2->HDisplay == 1024) return FALSE; + } else +#endif + if(mode->HDisplay == 1024) return FALSE; + } + } break; - default: + default: return FALSE; } return TRUE; @@ -1061,10 +1097,10 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) dest = (MYSISPTRTYPE *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024)); if(sizedouble) { - if(srcheight > 16) srcheight = 16; - maxheight = 16; + if(srcheight > 16) srcheight = 16; + maxheight = 16; } - + #ifdef SIS300_USE_ARGB16 /* Use 16 Bit RGB pointer */ for(i = 0; i < srcheight; i++) { p = src; @@ -1144,34 +1180,35 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) #endif if(!pSiS->UseHWARGBCursor) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - status1 = sis300GetCursorStatus; - sis300DisableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - status2 = sis301GetCursorStatus; - sis301DisableHWCursor() - } - SISWaitRetraceCRT1(pScrn); - sis300SwitchToRGBCursor(); - if(pSiS->VBFlags & CRT2_ENABLE) { - SISWaitRetraceCRT2(pScrn); - sis301SwitchToRGBCursor(); - } - } + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis300GetCursorStatus; + sis300DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + } + SISWaitRetraceCRT1(pScrn); + sis300SwitchToRGBCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToRGBCursor(); + } + } } - sis300SetCursorAddress(cursor_addr); + sis300SetCursorPatternSelect(0); if(status1) sis300SetCursorStatus(status1) - if(pSiS->VBFlags & CRT2_ENABLE) { - if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { - status2 = sis301GetCursorStatus; - sis301DisableHWCursor() - SISWaitRetraceCRT2(pScrn); - sis301SwitchToRGBCursor(); - } - sis301SetCursorAddress(cursor_addr) - if(status2) sis301SetCursorStatus(status2) + if(pSiS->VBFlags & CRT2_ENABLE) { + if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToRGBCursor(); + } + sis301SetCursorAddress(cursor_addr) + sis301SetCursorPatternSelect(0) + if(status2) sis301SetCursorStatus(status2) } pSiS->UseHWARGBCursor = TRUE; @@ -1186,7 +1223,6 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) int srcheight = pCurs->bits->height; CARD32 status1 = 0, status2 = 0; BOOLEAN sizedouble = FALSE; - int bufnum; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif @@ -1202,64 +1238,47 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) sizedouble = TRUE; } -#ifdef SISDUALHEAD - if(pSiS->DualHeadMode) { - pSiSEnt->HWCursorCBufNum ^= 1; - bufnum = 1 << pSiSEnt->HWCursorCBufNum; - } else { -#endif - pSiS->HWCursorCBufNum ^= 1; - bufnum = 1 << pSiS->HWCursorCBufNum; -#ifdef SISDUALHEAD - } -#endif - - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2); - } else { - cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * (2 + bufnum)); - } + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2); if(srcwidth > 64) srcwidth = 64; if(srcheight > 64) srcheight = 64; #ifdef SISDUALHEAD if(pSiS->DualHeadMode) - /* Use the global (real) FbBase in DHM */ - dest = (CARD32 *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024)); + /* TW: Use the global (real) FbBase in DHM */ + dest = (CARD32 *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024)); else #endif - dest = (CARD32 *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024)); + dest = (CARD32 *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024)); if(sizedouble) { - if(srcheight > 32) srcheight = 32; - maxheight = 32; + if(srcheight > 32) srcheight = 32; + maxheight = 32; } for(i = 0; i < srcheight; i++) { - p = src; - pb = dest; - src += pCurs->bits->width; - for(j = 0; j < srcwidth; j++) *dest++ = *p++; - if(srcwidth < 64) { - for(; j < 64; j++) *dest++ = 0; - } - if(sizedouble) { - for(j = 0; j < 64; j++) { - *dest++ = *pb++; - } - } + p = src; + pb = dest; + src += pCurs->bits->width; + for(j = 0; j < srcwidth; j++) *dest++ = *p++; + if(srcwidth < 64) { + for(; j < 64; j++) *dest++ = 0; + } + if(sizedouble) { + for(j = 0; j < 64; j++) { + *dest++ = *pb++; + } + } } if(srcheight < maxheight) { - for(; i < maxheight; i++) { - for(j = 0; j < 64; j++) *dest++ = 0; - if(sizedouble) { - for(j = 0; j < 64; j++) *dest++ = 0; - } - } + for(; i < maxheight; i++) + for(j = 0; j < 64; j++) *dest++ = 0; + if(sizedouble) { + for(j = 0; j < 64; j++) *dest++ = 0; + } } - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { + if(pSiS->ChipFlags & SiSCF_XabreCore) { if(!pSiS->UseHWARGBCursor) { if(pSiS->VBFlags & DISPTYPE_CRT1) { @@ -1291,11 +1310,13 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) } sis310SetCursorAddress(cursor_addr); + sis310SetCursorPatternSelect(0); if(status1) sis310SetCursorStatus(status1) if(pSiS->VBFlags & CRT2_ENABLE) { - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorAddress310(cursor_addr) + if(pSiS->ChipFlags & SiSCF_XabreCore) { + sis301SetCursorAddress330(cursor_addr) + sis301SetCursorPatternSelect330(0) } else { if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { status2 = sis301GetCursorStatus310; @@ -1304,6 +1325,7 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) sis301SwitchToRGBCursor310(); } sis301SetCursorAddress310(cursor_addr) + sis301SetCursorPatternSelect310(0) if(status2) sis301SetCursorStatus310(status2) } } @@ -1366,7 +1388,7 @@ SiSHWCursorInit(ScreenPtr pScreen) case PCI_CHIP_SIS315PRO: case PCI_CHIP_SIS330: case PCI_CHIP_SIS660: - infoPtr->MaxWidth = 64; + infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; infoPtr->ShowCursor = SiS310ShowCursor; infoPtr->HideCursor = SiS310HideCursor; |