On Sun, 3 Feb 2002, Will Newton wrote:

>I'm investigating a problem I have been seeing with the tdfx driver. Two 
>questions:
>
>1. Poking around in tdfx_driver.c I spotted this function:
>
>void TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) {
>  ScrnInfoPtr pScrn;
>  TDFXPtr pTDFX;
>  TDFXRegPtr tdfxReg;
>
>  TDFXTRACE("TDFXAdjustFrame start\n");
>  pScrn = xf86Screens[scrnIndex];
>  pTDFX = TDFXPTR(pScrn);
>
>/*  What exactly is happening here? */
>
>  if (pTDFX->ShowCache && y && pScrn->vtSema)
>    y += pScrn->virtualY - 1;
>
>  tdfxReg = &pTDFX->ModeReg;
>  if(pTDFX->ShowCache && y && pScrn->vtSema) 
>     y += pScrn->virtualY - 1;
>
>/* End */
>
>  tdfxReg->startaddr = pTDFX->fbOffset+y*pTDFX->stride+(x*pTDFX->cpp);
>  TDFXTRACE("TDFXAdjustFrame to x=%d y=%d offset=%d\n", x, y, 
>tdfxReg->startaddr);
>  pTDFX->writeLong(pTDFX, VIDDESKTOPSTARTADDR, tdfxReg->startaddr);
>}
>
>I was wondering if anyone could clear up for me what is going on in the 
>marked section? I think I am missing something quite fundamental here.
>
>2. The problem I have is that when switching resolutions sometimes the 
>colours get "messed up"(R). Switching VTs restores the colours. I am curently 
>looking at the functions in tdfx_driver.c TDFXEnterVT and TDFXSwitchMode. Am 
>I probably in the right place or is there something else I should be looking 
>at?

Try this patch and let me know how it goes.  It should fix VT 
switch font corruption problems, and perhaps what you're 
describing as well.



-- 
----------------------------------------------------------------------
Mike A. Harris                  Shipping/mailing address:
OS Systems Engineer             190 Pittsburgh Ave., Sault Ste. Marie,
XFree86 maintainer              Ontario, Canada, P6C 5B3
Red Hat Inc.                    Phone: (705)949-2136
http://www.redhat.com           ftp://people.redhat.com/mharris
Red Hat XFree86 mailing list:   [EMAIL PROTECTED]
General open IRC discussion:    #xfree86 on irc.openprojects.net
----------------------------------------------------------------------
This patch reorders the code in the EnterVT function in the tdfx driver
in an attempt to fix VT switch font corruption problems that are easily
reproduceable, and often reported.  The code is currently untested.  It
may also fix other VTswitch problems as well.

Mike A. Harris <[EMAIL PROTECTED]>

--- 
xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c.tdfx-fix-vtswitch-font-corruption
 Sun Feb  3 08:40:10 2002
+++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c   Sun Feb  3 08:42:21 
+2002
@@ -2326,12 +2326,15 @@
   TDFXTRACE("TDFXLeaveVT start\n");
   pScrn = xf86Screens[scrnIndex];
   hwp=VGAHWPTR(pScrn);
-  TDFXRestore(pScrn);
-  vgaHWLock(hwp);
   pScreen = screenInfo.screens[scrnIndex];
+
   pTDFX = TDFXPTR(pScrn);
   pTDFX->sync(pScrn);
+
+  TDFXRestore(pScrn);
+  vgaHWLock(hwp);
   TDFXShutdownFifo(pScreen);
+
 #ifdef XF86DRI
   if (pTDFX->directRenderingEnabled) {
     DRILock(pScreen, 0);

Reply via email to