diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-03-17 20:30:58 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-03-17 20:30:58 +0000 |
commit | b9efa3c0a76993101e2655bdefc7a8a32f43cb53 (patch) | |
tree | 845c121a2f896d7b98c380990b1abfeac576c0c6 /src/sis_cursor.c | |
parent | 358bf68d49977ee48bdbc0aabec6a2f827dfbf4c (diff) |
merge with XORG-RELEASE-1 (tag XORG-CYGWIN-LAST-MERGE)CYGWIN-RELEASE-1-MERGE
Diffstat (limited to 'src/sis_cursor.c')
-rw-r--r-- | src/sis_cursor.c | 822 |
1 files changed, 394 insertions, 428 deletions
diff --git a/src/sis_cursor.c b/src/sis_cursor.c index 122493f..0ebb44d 100644 --- a/src/sis_cursor.c +++ b/src/sis_cursor.c @@ -1,34 +1,35 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.22 2003/11/03 17:02:53 twini Exp $ */ +/* $XFree86$ */ /* * SiS hardware cursor handling * - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. - * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. * - * 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. + * 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. * - * 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. + * 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. * - * 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" @@ -48,7 +49,6 @@ 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,8 +67,6 @@ 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++; @@ -106,23 +104,23 @@ SiS300HideCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis300DisableHWCursor() - sis300SetCursorPositionY(2000, 0) - } else { - /* TW: Head 1 is always CRT2 */ - sis301DisableHWCursor() - sis301SetCursorPositionY(2000, 0) - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + sis300DisableHWCursor() + sis300SetCursorPositionY(2000, 0) + } else { + /* 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 @@ -137,33 +135,23 @@ SiS310HideCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis310DisableHWCursor() - sis310SetCursorPositionY(2000, 0) - } else { - /* TW: Head 1 is always CRT2 */ - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301DisableHWCursor330() - sis301SetCursorPositionY330(2000, 0) - } else { - sis301DisableHWCursor310() - sis301SetCursorPositionY310(2000, 0) - } - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + sis310DisableHWCursor() + sis310SetCursorPositionY(2000, 0) + } else { + /* Head 1 is always CRT2 */ + sis301DisableHWCursor310() + sis301SetCursorPositionY310(2000, 0) + } } else { #endif - sis310DisableHWCursor() - sis310SetCursorPositionY(2000, 0) - if(pSiS->VBFlags & VB_VIDEOBRIDGE) { - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301DisableHWCursor330() - sis301SetCursorPositionY330(2000, 0) - } else { - sis301DisableHWCursor310() - sis301SetCursorPositionY310(2000, 0) - } - } + sis310DisableHWCursor() + sis310SetCursorPositionY(2000, 0) + if(pSiS->VBFlags & VB_VIDEOBRIDGE) { + sis301DisableHWCursor310() + sis301SetCursorPositionY310(2000, 0) + } #ifdef SISDUALHEAD } #endif @@ -196,50 +184,50 @@ SiS300ShowCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis300EnableHWARGB16Cursor() + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + if(pSiS->UseHWARGBCursor) { +#ifdef SIS300_USE_ARGB16 + sis300EnableHWARGB16Cursor() #else - sis300EnableHWARGBCursor() -#endif - } else { - sis300EnableHWCursor() - } - } else { - /* TW: Head 1 is always CRT2 */ - if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis301EnableHWARGB16Cursor() + sis300EnableHWARGBCursor() +#endif + } else { + sis300EnableHWCursor() + } + } else { + /* 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 @@ -260,49 +248,49 @@ SiS310ShowCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - 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_CRT2HWCKaputt) { - sis301EnableHWCursor330() - } else { - if(pSiS->UseHWARGBCursor) { - sis301EnableHWARGBCursor310() - } else { - sis301EnableHWCursor310() - } - } - } + 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() + } + } + } } 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_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() + } + } + } #ifdef SISDUALHEAD } #endif @@ -312,7 +300,7 @@ static void SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ + DisplayModePtr mode = pSiS->CurrentLayout.mode; unsigned char x_preset = 0; unsigned char y_preset = 0; int temp; @@ -324,14 +312,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; @@ -377,24 +365,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; } @@ -415,13 +403,8 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y) } else { sis310SetCursorPositionX(x1, x1_preset) sis310SetCursorPositionY(y1, y1_preset) - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorPositionX330(x2 + 17, x2_preset) - sis301SetCursorPositionY330(y2, y2_preset) - } else { - sis301SetCursorPositionX310(x2 + 17, x2_preset) - sis301SetCursorPositionY310(y2, y2_preset) - } + sis301SetCursorPositionX310(x2 + 17, x2_preset) + sis301SetCursorPositionY310(y2, y2_preset) } } #endif @@ -441,13 +424,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; @@ -455,23 +438,23 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - 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) - } + 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) + } } 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 @@ -492,13 +475,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; @@ -506,32 +489,22 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - 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_CRT2HWCKaputt) { - sis301SetCursorPositionX330(x + 17, x_preset) - sis301SetCursorPositionY330(y, y_preset) - } else { - sis301SetCursorPositionX310(x + 17, x_preset) - sis301SetCursorPositionY310(y, y_preset) - } - } + 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) + } } else { #endif sis310SetCursorPositionX(x, x_preset) sis310SetCursorPositionY(y, y_preset) if(pSiS->VBFlags & CRT2_ENABLE) { - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorPositionX330(x + 17, x_preset) - sis301SetCursorPositionY330(y, y_preset) - } else { - sis301SetCursorPositionX310(x + 17, x_preset) - sis301SetCursorPositionY310(y, y_preset) - } + sis301SetCursorPositionX310(x + 17, x_preset) + sis301SetCursorPositionY310(y, y_preset) } #ifdef SISDUALHEAD } @@ -579,23 +552,23 @@ SiS300SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis300SetCursorBGColor(bg) - sis300SetCursorFGColor(fg) - } else { - /* TW: Head 1 is always CRT2 */ - sis301SetCursorBGColor(bg) - sis301SetCursorFGColor(fg) - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + sis300SetCursorBGColor(bg) + sis300SetCursorFGColor(fg) + } else { + /* 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 @@ -611,39 +584,39 @@ SiS310SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis310SetCursorBGColor(bg) - sis310SetCursorFGColor(fg) + /* Head 2 is always CRT1 */ + sis310SetCursorBGColor(bg) + sis310SetCursorFGColor(fg) } else { - /* TW: Head 1 is always CRT2 */ - 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) - } - } - } else { -#endif - sis310SetCursorBGColor(bg) - sis310SetCursorFGColor(fg) - - if(pSiS->VBFlags & CRT2_ENABLE) { + /* Head 1 is always CRT2 */ if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { 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 @@ -743,35 +716,33 @@ 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) - sis301SetCursorPatternSelect(0) - if(status2) sis301SetCursorStatus(status2) + if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor(); + } + sis301SetCursorAddress(cursor_addr) + if(status2) sis301SetCursorStatus(status2) } pSiS->UseHWARGBCursor = FALSE; @@ -785,8 +756,19 @@ 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 @@ -800,13 +782,17 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) sizedouble = TRUE; } - cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); /* 1K boundary */ - #ifdef SISDUALHEAD - /* TW: Use the global (real) FbBase in DHM */ + /* 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++) { @@ -831,46 +817,44 @@ 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) { - sis301SetCursorAddress330(cursor_addr2) - sis301SetCursorPatternSelect330(0) + sis301SetCursorAddress310(cursor_addr2) } else { if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { status2 = sis301GetCursorStatus310; @@ -879,7 +863,6 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) sis301SwitchToMONOCursor310(); } sis301SetCursorAddress310(cursor_addr) - sis301SetCursorPatternSelect310(0) if(status2) sis301SetCursorStatus310(status2) } } @@ -892,15 +875,15 @@ SiSUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ - + DisplayModePtr mode = pSiS->CurrentLayout.mode; + 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 @@ -908,7 +891,7 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ + DisplayModePtr mode = pSiS->CurrentLayout.mode; #ifdef SISMERGED DisplayModePtr mode2 = NULL; @@ -923,9 +906,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) @@ -940,12 +923,12 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS315: case PCI_CHIP_SIS315H: case PCI_CHIP_SIS315PRO: - case PCI_CHIP_SIS330: case PCI_CHIP_SIS660: + case PCI_CHIP_SIS330: 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) @@ -954,24 +937,12 @@ SiS300UseHWCursor(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: 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; @@ -985,7 +956,7 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ + DisplayModePtr mode = pSiS->CurrentLayout.mode; #ifdef SISMERGED DisplayModePtr mode2 = NULL; @@ -1000,11 +971,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) @@ -1022,20 +993,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; - if(mode->Flags & V_DBLSCAN) { - if(pCurs->bits->height > 32) - return FALSE; -#ifdef SISDUALHEAD - if((!pSiS->DualHeadMode) || (pSiS->SecondHead)) -#endif - if(pSiS->VBFlags & CRT1_LCDA) - 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; if((pSiS->CurrentLayout.bitsPerPixel == 8) && (pSiS->VBFlags & CRT2_ENABLE)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -1044,20 +1008,8 @@ 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; @@ -1109,10 +1061,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; @@ -1192,35 +1144,34 @@ 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) - sis301SetCursorPatternSelect(0) - 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) + if(status2) sis301SetCursorStatus(status2) } pSiS->UseHWARGBCursor = TRUE; @@ -1235,6 +1186,7 @@ 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 @@ -1250,44 +1202,61 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) sizedouble = TRUE; } - cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2); +#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)); + } if(srcwidth > 64) srcwidth = 64; if(srcheight > 64) srcheight = 64; #ifdef SISDUALHEAD if(pSiS->DualHeadMode) - /* TW: Use the global (real) FbBase in DHM */ - dest = (CARD32 *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024)); + /* 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) { @@ -1322,13 +1291,11 @@ 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) { - sis301SetCursorAddress330(cursor_addr) - sis301SetCursorPatternSelect330(0) + sis301SetCursorAddress310(cursor_addr) } else { if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { status2 = sis301GetCursorStatus310; @@ -1337,7 +1304,6 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) sis301SwitchToRGBCursor310(); } sis301SetCursorAddress310(cursor_addr) - sis301SetCursorPatternSelect310(0) if(status2) sis301SetCursorStatus310(status2) } } @@ -1400,7 +1366,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; |