[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#240581: Patch to add option for ATI Radeon to force the use of lower dotclocks



Package: xfree86
Severity: wishlist
Tags: patch

Hi!

I have found that my Radeon card as well as many others, says that it can
work from 20Mhz to 400Mhz, this would mean that it is not capable of
producing TV frequencies, which it is, I have found that this problem had
been reported on xfree86 bugtracking system as bug #831 and then added to
their cvs with some changes.

I have made the apropiate changes to the patch so that it could be applied
to our sources and have tested it, it works perfectly and is a clean patch,
I think that it would be good if you could apply it in a future version of
the packages.

Maybe it would also be good to upgrade Radeon's driver a little bit,
following the logs on the cvs there have been many enhancements as well as
bugfixes, new options, ...

Anyway, here are the patches, first the ones I got from the xfree86 cvs:

===================================================================
RCS file: /xf86/anoncvs/cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.man,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.man	2003/10/07 22:47:12	1.4
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.man	2003/10/31 23:03:17	1.5
@@ -298,6 +298,17 @@
 but not work correctly in some rare cases, hence the default is
 .B off.
 
+.TP
+.BI "Option \*qForceMinDotClock\*q \*q" frequency \*q
+Override minimum dot clock. Some Radeon BIOSes report a minimum dot
+clock unsuitable (too high) for use with television sets even when they
+actually can produce lower dot clocks. If this is the case you can
+override the value here.
+.B Note that using this option may damage your hardware.
+You have been warned. The
+.B frequency
+parameter may be specified as a float value with standard suffixes like
+"k", "kHz", "M", "MHz".
 
 .SH SEE ALSO
 XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)

===================================================================
RCS file: /xf86/anoncvs/cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c	2003/10/30 17:36:58	1.110
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c	2003/10/31 23:03:17	1.111
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.109 2003/10/11 00:29:57 daenzer Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.110 2003/10/30 17:36:58 tsi Exp $ */
 /*
  * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
  *                VA Linux Systems Inc., Fremont, California.
@@ -138,7 +138,8 @@
     OPTION_FBDEV,
     OPTION_VIDEO_KEY,
     OPTION_DISP_PRIORITY,
-    OPTION_PANEL_SIZE
+    OPTION_PANEL_SIZE,
+    OPTION_MIN_DOTCLOCK
 } RADEONOpts;
 
 const OptionInfoRec RADEONOptions[] = {
@@ -173,6 +174,7 @@
     { OPTION_VIDEO_KEY,      "VideoKey",         OPTV_INTEGER, {0}, FALSE },
     { OPTION_DISP_PRIORITY,  "DisplayPriority",  OPTV_ANYSTR,  {0}, FALSE },
     { OPTION_PANEL_SIZE,     "PanelSize",        OPTV_ANYSTR,  {0}, FALSE },
+    { OPTION_MIN_DOTCLOCK,   "ForceMinDotClock", OPTV_FREQ,    {0}, FALSE },
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
 
@@ -1774,6 +1776,7 @@
     RADEONPLLPtr   pll  = &info->pll;
     CARD16         bios_header;
     CARD16         pll_info_block;
+    double         min_dotclock;
 
     if (!info->VBIOS) {
 
@@ -1825,6 +1828,26 @@
 	pll->min_pll_freq   = RADEON_BIOS32(pll_info_block + 0x12);
 	pll->max_pll_freq   = RADEON_BIOS32(pll_info_block + 0x16);
 	pll->xclk           = RADEON_BIOS16(pll_info_block + 0x08);
+    }
+
+    /* (Some?) Radeon BIOSes seem too lie about their minimum dot
+     * clocks.  Allow users to override the detected minimum dot clock
+     * value (e.g., and allow it to be suitable for TV sets).
+     */
+    if (xf86GetOptValFreq(info->Options, OPTION_MIN_DOTCLOCK,
+			  OPTUNITS_MHZ, &min_dotclock)) {
+	if (min_dotclock < 12 || min_dotclock*100 >= pll->max_pll_freq) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		       "Illegal minimum dotclock specified %.2f MHz "
+		       "(option ignored)\n",
+		       min_dotclock);
+	} else {
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		       "Forced minimum dotclock to %.2f MHz "
+		       "(instead of detected %.2f MHz)\n",
+		       min_dotclock, ((double)pll->min_pll_freq/1000));
+	    pll->min_pll_freq = min_dotclock * 1000;
+	}
     }
 
     return TRUE;

And now the patch I made from those, changing them so that they could apply
cleanly to our sources:

--- xc.orig/programs/Xserver/hw/xfree86/drivers/ati/radeon.man	2004-03-27 03:04:50.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.man	2004-03-27 02:59:01.000000000 +0100
@@ -235,6 +235,17 @@
 but not work correctly in some rare cases, hence the default is
 .B off.
 
+.TP
+.BI "Option \*qForceMinDotClock\*q \*q" frequency \*q
+Override minimum dot clock. Some Radeon BIOSes report a minimum dot
+clock unsuitable (too high) for use with television sets even when they
+actually can produce lower dot clocks. If this is the case you can
+override the value here.
+.B Note that using this option may damage your hardware.
+You have been warned. The
+.B frequency
+parameter may be specified as a float value with standard suffixes like
+"k", "kHz", "M", "MHz".
 
 .SH SEE ALSO
 XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
--- xc.orig/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c	2004-03-27 03:04:50.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c	2004-03-27 03:02:45.000000000 +0100
@@ -149,7 +149,8 @@
     OPTION_CLONE_HSYNC,
     OPTION_CLONE_VREFRESH,
     OPTION_FBDEV,
-    OPTION_VIDEO_KEY
+    OPTION_VIDEO_KEY,
+    OPTION_MIN_DOTCLOCK
 } RADEONOpts;
 
 const OptionInfoRec RADEONOptions[] = {
@@ -180,6 +181,7 @@
     { OPTION_CLONE_VREFRESH, "CloneVRefresh",    OPTV_ANYSTR,  {0}, FALSE },
     { OPTION_FBDEV,          "UseFBDev",         OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_VIDEO_KEY,      "VideoKey",         OPTV_INTEGER, {0}, FALSE },
+    { OPTION_MIN_DOTCLOCK,   "ForceMinDotClock", OPTV_FREQ,    {0}, FALSE },
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
 
@@ -1727,6 +1729,7 @@
     RADEONPLLPtr   pll  = &info->pll;
     CARD16         bios_header;
     CARD16         pll_info_block;
+    double         min_dotclock;
 
     if (!info->VBIOS) {
 
@@ -1781,6 +1784,26 @@
 	pll->xclk           = RADEON_BIOS16(pll_info_block + 0x08);
     }
 
+    /* (Some?) Radeon BIOSes seem too lie about their minimum dot
+     * clocks.  Allow users to override the detected minimum dot clock
+     * value (e.g., and allow it to be suitable for TV sets).
+     */
+    if (xf86GetOptValFreq(info->Options, OPTION_MIN_DOTCLOCK,
+			  OPTUNITS_MHZ, &min_dotclock)) {
+	if (min_dotclock < 12 || min_dotclock*100 >= pll->max_pll_freq) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		       "Illegal minimum dotclock specified %.2f MHz "
+		       "(option ignored)\n",
+		       min_dotclock);
+	} else {
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		       "Forced minimum dotclock to %.2f MHz "
+		       "(instead of detected %.2f MHz)\n",
+		       min_dotclock, ((double)pll->min_pll_freq/1000));
+	    pll->min_pll_freq = min_dotclock * 1000;
+	}
+    }
+
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 	       "PLL parameters: rf=%d rd=%d min=%d max=%d; xclk=%d\n",
 	       pll->reference_freq,


Hope you like it.

Thanks for this great packages guys, keep up that good work.

Regards!

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i586)
Kernel: Linux 2.6.4
Locale: LANG=C, LC_CTYPE=C



Reply to: