I have written a patch that allows the user to tweak the 
Xv hsync/vsync offset values.  It works great on my 
Twinhead Powerslim 600 @ 800x600 with XvHsync=-23.

I think it will work on any trident chip, but I am not 
sure if TridentInit() gets called when the resolution 
changes, in which case this patch may only work for a 
single resolution.

There are two new variables in the XF86Config file:
XvHsync and XvVsync
These variables will adjust the hsync/vsync values by some 
amount (relative to the default, so if hsync would have 
been 100, and you set xvHsync=-10, hsync will be 90)

This is my first patch to X, so if people could look it 
over, and if someone could submit it (or tell me how) 
assuming it is apropriate, that'd be great.

Note that this patch doesn't fix the problem of the offset 
getting messed up when the screen is switched off and on 
from the function keys, but that is a problem for another 
day.

Thanks,
.Geoff

(The patch is against CVS)
--------------------------------------------------------- 
diff -u clean/trident.h modified/trident.h
--- clean/trident.h     Thu Nov 29 08:06:13 2001
+++ modified/trident.h  Thu Nov 29 08:05:41 2001
@@ -141,6 +141,8 @@
     CARD32              videoFlags;
     int                        keyOffset;
 #endif
+    int                 OverrideHsync;
+    int                 OverrideVsync;
     OptionInfoPtr      Options;
 } TRIDENTRec, *TRIDENTPtr;
 
diff -u clean/trident.man modified/trident.man
--- clean/trident.man   Thu Nov 29 08:06:13 2001
+++ modified/trident.man        Thu Nov 29 08:05:41 2001
@@ -82,6 +82,18 @@
 .BI "Option \*qNoPciBurst\*q \*q" boolean \*q
 Turn off PCI burst mode, PCI Bursting is on by default.
 Default: off.
+.TP
+.BI "Option \*qXvHsync\*q \*q" real \*q
+Override the default Horizontal-sync value for the Xv extension.
+This is used to center the Xv image on the screen.  By default the values
+are assigned based on the video card.
+Default: undefined.
+.TP
+.BI "Option \*qXvVsync\*q \*q" real \*q
+Override the default Vertical-sync value for the Xv extension.
+This is used to center the Xv image on the screen.  By default the values
+are assigned based on the video card.
+Default: undefined.
 .SH "SEE ALSO"
 XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), 
X(__miscmansuffix__)
 .SH AUTHOR
diff -u clean/trident_dac.c modified/trident_dac.c
--- clean/trident_dac.c Thu Nov 29 08:06:14 2001
+++ modified/trident_dac.c      Thu Nov 29 08:09:00 2001
@@ -436,6 +436,12 @@
                pTrident->hsync -= 8;
                break;
        }
+       pTrident->hsync+=pTrident->OverrideHsync;
+       pTrident->vsync+=pTrident->OverrideVsync;
     }
     
     /* Enable Chipset specific options */
diff -u clean/trident_driver.c modified/trident_driver.c
--- clean/trident_driver.c      Thu Nov 29 08:06:15 2001
+++ modified/trident_driver.c   Thu Nov 29 08:05:41 2001
@@ -229,7 +229,9 @@
     OPTION_NOMMIO,
     OPTION_NOPCIBURST,
     OPTION_CYBER_SHADOW,
-    OPTION_CYBER_STRETCH
+    OPTION_CYBER_STRETCH,
+    OPTION_XV_HSYNC,
+    OPTION_XV_VSYNC
 } TRIDENTOpts;
 
 static const OptionInfoRec TRIDENTOptions[] = {
@@ -246,6 +248,8 @@
     { OPTION_MMIO_ONLY,                "MMIOonly",     OPTV_BOOLEAN,   {0}, FALSE },
     { OPTION_CYBER_SHADOW,     "CyberShadow",  OPTV_BOOLEAN,   {0}, FALSE },
     { OPTION_CYBER_STRETCH,    "CyberStretch", OPTV_BOOLEAN,   {0}, FALSE },
+    { OPTION_XV_HSYNC,          "XvHsync",      OPTV_INTEGER,   {0}, FALSE },
+    { OPTION_XV_VSYNC,          "XvVsync",      OPTV_INTEGER,   {0}, FALSE },
     { -1,                      NULL,           OPTV_NONE,      {0}, FALSE }
 };
 
@@ -1284,6 +1288,18 @@
                                                &pTrident->MUXThreshold)) {
        xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MUX Threshold set to %d\n",
                                                pTrident->MUXThreshold);
+    }
+    pTrident->OverrideHsync = 0;
+    if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_HSYNC, 
+                                               &pTrident->OverrideHsync)) {
+       xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Hsync set to %d\n",
+                                               pTrident->OverrideHsync);
+    }
+    pTrident->OverrideVsync = 0;
+    if (xf86GetOptValInteger(pTrident->Options, OPTION_XV_VSYNC, 
+                                               &pTrident->OverrideVsync)) {
+       xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv Vsync set to %d\n",
+                                               pTrident->OverrideVsync);
     }
     if (xf86ReturnOptValBool(pTrident->Options, OPTION_SHADOW_FB, FALSE)) {
         if (!pTrident->Linear) 

-----------------------------------------------------
Protect yourself from spam, use http://sneakemail.com
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to