Package: nvidia-settings
Version: 1.0+20070502-1
Severity: normal

After some major system "upgrades" (switching RAM sticks, motherboard,
PSU, graphic cards and xservers) I found that nvidia-settings no
longer could auto-detect the optimal overclocking frequencies.
The "Auto Detect" button would always be greyed out even though I had
enabled "Coolbits" in Xorg.conf

I downgraded nvidia-settings to the version in testing
(1.0+20060516-3) and suddenly "Auto Detect" would be available.
After some further digging I think I found the bug;

The problem is that according NVCtrl.h (from nvidia-settings/testing)
NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION is a write-only attribute so
  NvCtrlGetAttribute(..,NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION,..)
will always fail.

There should be a way to discover if the current card support optimal frequency 
detection,
but trying to read a write-only attribute isn't the way. :)
Removing the attempted read of NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION
enables the "Auto Detect" button again.

I haven't checked if this is fixed in the upstream version.


I'll attach quick-and-dirty patch later



- the friendly but rusty hacker Mikael Åkersund


Quotes from relevent files below

File: nvidia-settings-1.0+20070502/src/gtk+-2.x/ctkclocks.c
Line 320:
if ( overclocking_enabled ) {
        ret = NvCtrlGetAttribute(handle,
                                 NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION,
                                 &value);
   if ( ret == NvCtrlSuccess ) {                       # <---- Will always fail
      ret = NvCtrlGetAttribute(handle,
                               NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE,
                               &value);
      if (
          ret != NvCtrlSuccess )
        return NULL;
      probing_optimal =
        (value ==
         NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_BUSY);
      auto_detection_available = TRUE;
   }
}


Here's a snip from   /usr/include/NVCtrl/NVCtrl.h
  [Line 1244]:
/*
 *  * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION - set to _START to
 *  * initiate testing for the optimal 3D clock frequencies.  Once
 *  * found, the optimal clock frequencies will be returned by the
 *  * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS attribute asynchronously
 *  * (using an X event, see XNVCtrlSelectNotify).
 *  *
 *  * To cancel an ongoing test for the optimal clocks, set the
 *  * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION attribute to _CANCEL
 *  *
 *  * Note: unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL, the
 *  * optimal clock detection process is unavailable.
 *  */

#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION               95  /* -W- */   
  # <--- No reading!
#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_START          0
#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_CANCEL         1



--------------------------------------------

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (140, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-4-d3-ul8-1
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages nvidia-settings depends on:
ii  libatk1.0-0                  1.20.0-1    The ATK accessibility toolkit
ii  libc6                        2.6.1-1     GNU C Library: Shared libraries
ii  libcairo2                    1.4.10-1+b2 The Cairo 2D vector graphics libra
ii  libfontconfig1               2.4.2-1.2   generic font configuration library
ii  libglib2.0-0                 2.14.1-5    The GLib library of C routines
ii  libgtk2.0-0                  2.10.13-1   The GTK+ graphical user interface
ii  libpango1.0-0                1.18.2-1    Layout and rendering of internatio
ii  libx11-6                     2:1.0.3-7   X11 client-side library
ii  libxcursor1                  1:1.1.9-1   X cursor management library
ii  libxext6                     1:1.0.3-2   X11 miscellaneous extension librar
ii  libxfixes3                   1:4.0.3-2   X11 miscellaneous 'fixes' extensio
ii  libxi6                       2:1.1.3-1   X11 Input extension library
ii  libxinerama1                 1:1.0.2-1   X11 Xinerama extension library
ii  libxrandr2                   2:1.2.2-1   X11 RandR extension library
ii  libxrender1                  1:0.9.4-1   X Rendering Extension client libra

Versions of packages nvidia-settings recommends:
ii  nvidia-glx                   100.14.19-1 NVIDIA binary Xorg driver

-- no debconf information


_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE
--- ctkclocks.c.orig	2007-10-21 21:29:28.000000000 +0200
+++ ctkclocks.c	2007-10-21 21:38:34.000000000 +0200
@@ -319,18 +319,13 @@
     
     if ( overclocking_enabled ) {
         ret = NvCtrlGetAttribute(handle,
-                                 NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION,
-                                 &value);
-        if ( ret == NvCtrlSuccess ) {
-            ret = NvCtrlGetAttribute(handle,
-                                     NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE,
-                                     &value);
-            if ( ret != NvCtrlSuccess )
-                return NULL;
-            probing_optimal =
-                (value == NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_BUSY);
-            auto_detection_available = TRUE;
-        }
+				 NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE,
+				 &value);
+	if ( ret != NvCtrlSuccess )
+	    return NULL;
+	probing_optimal =
+	    (value == NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_BUSY);
+	auto_detection_available = TRUE;
     }
 
     /* Can we access the 2D clocks? */

Reply via email to