Ticket #5643: adjust_rate6-fixes.patch

File adjust_rate6-fixes.patch, 233.2 KB (added by jyavenard@…, 3 years ago)

patch for 0.21-fixes

  • mythtv/libs/libmyth/DisplayRes.cpp

    old new  
    99#include "DisplayResOSX.h" 
    1010#endif 
    1111 
     12 
    1213DisplayRes * DisplayRes::instance = NULL; 
    1314 
    1415DisplayRes * DisplayRes::GetDisplayRes(void) 
     
    2829{ 
    2930    int tW = 0, tH = 0, tW_mm = 0, tH_mm = 0; 
    3031    double tAspect = 0.0; 
    31     short tRate = 0; 
     32    double tRate = 0.0; 
    3233 
    3334    last.Init(); 
    3435    cur_mode = GUI; 
     
    3738    // Initialize GUI mode 
    3839    mode[GUI].Init(); 
    3940    tW = tH = 0; 
    40     gContext->GetResolutionSetting("GuiVidMode", tW, tH); 
     41    gContext->GetResolutionSetting("GuiVidMode", tW, tH, tAspect, tRate); 
    4142    GetDisplaySize(tW_mm, tH_mm); 
    4243    gContext->GetResolutionSetting("DisplaySize", tW_mm, tH_mm); 
    43     mode[GUI] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, 0); 
     44    mode[GUI] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, tRate); 
    4445 
    4546 
    4647    // Initialize default VIDEO mode 
     
    5556    { 
    5657        int iw = 0, ih = 0, ow = 0, oh = 0; 
    5758        double iaspect = 0.0, oaspect = 0.0; 
    58         short irate = 0, orate = 0; 
     59        double irate = 0.0, orate = 0.0; 
    5960 
    6061        gContext->GetResolutionSetting("VidMode", iw, ih, iaspect, irate, i); 
    6162        gContext->GetResolutionSetting("TVVidMode", ow, oh, oaspect, orate, i); 
     
    8283    return true; 
    8384} 
    8485 
    85 bool DisplayRes::SwitchToVideo(int iwidth, int iheight, short irate) 
     86bool DisplayRes::SwitchToVideo(int iwidth, int iheight, double frate) 
    8687{ 
    8788    tmode next_mode = VIDEO; // default VIDEO mode 
    8889    DisplayResScreen next = mode[next_mode]; 
    8990 
     91    // If requested refresh rate is 0, attempt to match video fps 
     92    if ((int) next.RefreshRate() == 0) 
     93    { 
     94        VERBOSE(VB_PLAYBACK, QString("*** Trying to match best refresh rate %1Hz") .arg(frate)); 
     95        next.AddRefreshRate(frate); 
     96    } 
     97 
    9098    // try to find video override mode 
    91     uint key = DisplayResScreen::CalcKey(iwidth, iheight, irate); 
     99    uint key = DisplayResScreen::CalcKey(iwidth, iheight, frate); 
    92100    DisplayResMapCIt it = in_size_to_output_mode.find(key); 
    93101    if (it != in_size_to_output_mode.end()) 
    94102        mode[next_mode = CUSTOM_VIDEO] = next = it->second; 
    95103 
    96104    // need to change video mode? 
    97     short target_rate = 0; 
     105    double target_rate = 0.0; 
    98106    DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); 
    99     bool chg = !(next == last) || !(last.RefreshRate() == target_rate); 
     107    bool chg = !(next == last) || !(DisplayResScreen::compare_rates(last.RefreshRate(),target_rate)); 
    100108 
    101109    VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 
    102110            .arg(next.Width()).arg(next.Height()).arg(target_rate)); 
     
    128136    DisplayResScreen next = mode[next_mode]; 
    129137 
    130138    // need to change video mode? 
    131     short target_rate = 0; 
     139    double target_rate = 0.0; 
    132140    DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); 
    133     bool chg = !(next == last) || !(last.RefreshRate() == target_rate); 
     141    // If GuiVidModeRefreshRate is 0, assume any refresh rate is good enough. 
     142    bool chg = (!(next == last) || (((int) next.RefreshRate()) !=0 
     143                && !(DisplayResScreen::compare_rates(last.RefreshRate(), target_rate))));  
    134144 
    135145    VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 
    136146            .arg(next.Width()).arg(next.Height()).arg(target_rate)); 
    137147 
    138148    if (chg && !SwitchToVideoMode(next.Width(), next.Height(), target_rate)) 
    139149    { 
    140         VERBOSE(VB_IMPORTANT, QString("SwitchToGUI: xrandr failed for %1 x %2") 
    141                 .arg(next.Width()).arg(next.Height())); 
     150        VERBOSE(VB_IMPORTANT, 
     151                QString("SwitchToGUI: xrandr failed for %1x%2 %3  Hz") 
     152                .arg(next.Width()).arg(next.Height()).arg(next.RefreshRate())); 
    142153        return false; 
    143154    } 
    144155 
    145156    cur_mode = next_mode; 
    146157    last = next; 
    147158 
    148     VERBOSE(VB_PLAYBACK, QString("SwitchToGUI: Switched to %1 x %2") 
    149             .arg(GetWidth()).arg(GetHeight())); 
     159    VERBOSE(VB_PLAYBACK, QString("SwitchToGUI: Switched to %1x%2 %3 Hz") 
     160            .arg(GetWidth()).arg(GetHeight()).arg(GetRefreshRate())); 
    150161 
    151162    return chg; 
    152163} 
     
    154165bool DisplayRes::SwitchToCustomGUI(int width, int height, short rate) 
    155166{ 
    156167    mode[CUSTOM_GUI] = DisplayResScreen(width, height, mode[GUI].Width_mm(), 
    157                                         mode[GUI].Height_mm(), -1.0, rate); 
     168                                        mode[GUI].Height_mm(), -1.0, (double)rate); 
    158169    return SwitchToGUI(CUSTOM_GUI); 
    159170} 
    160171 
    161 const vector<short> DisplayRes::GetRefreshRates(int width, int height) const { 
    162     short tr; 
    163     vector<short> empty; 
     172const vector<double> DisplayRes::GetRefreshRates(int width, int height) const { 
     173    double tr; 
     174    vector<double> empty; 
    164175 
    165     const DisplayResScreen drs(width, height, 0, 0, -1.0, 0); 
     176    const DisplayResScreen drs(width, height, 0, 0, -1.0, 0.0); 
    166177    const DisplayResVector& drv = GetVideoModes(); 
    167178    int t = DisplayResScreen::FindBestMatch(drv, drs, tr); 
    168179    if (t < 0) 
  • mythtv/libs/libmyth/DisplayRes.h

    old new  
    4242     * @{ 
    4343     */ 
    4444 
    45     /** \fn SwitchToVideo(int iwidth, int iheight, short irate = 0) 
     45    /** \fn SwitchToVideo(int iwidth, int iheight, double irate = 0) 
    4646     *  \brief Switches to the resolution and refresh rate defined in the 
    4747     *         database for the specified video resolution and frame rate. 
    4848     */ 
    49     bool SwitchToVideo(int iwidth, int iheight, short irate = 0); 
     49    bool SwitchToVideo(int iwidth, int iheight, double frate = 0.0); 
    5050    /** \brief Switches to the GUI resolution specified. 
    5151     * 
    5252     *   If which_gui is GUI then this switches to the resolution 
     
    8989    int GetPhysicalHeight(void) const { return last.Height_mm(); } 
    9090 
    9191    /** \brief Returns current screen refresh rate. */ 
    92     int GetRefreshRate(void)    const { return last.RefreshRate(); } 
     92    double GetRefreshRate(void)    const { return last.RefreshRate(); } 
    9393    /** \brief Returns current screen aspect ratio. 
    9494     * 
    9595     *  If there is an aspect overide in the database that aspect 
     
    110110    /// \brief Returns all video modes supported by the display. 
    111111    virtual const vector<DisplayResScreen>& GetVideoModes() const = 0; 
    112112    /// \brief Returns refresh rates available at a specific screen resolution. 
    113     const vector<short> GetRefreshRates(int width, int height) const; 
     113    const vector<double> GetRefreshRates(int width, int height) const; 
    114114    /** @} */ 
    115115 
    116116  protected: 
     
    120120     
    121121    // These methods are implemented by the subclasses 
    122122    virtual bool GetDisplaySize(int &width_mm, int &height_mm) const = 0; 
    123     virtual bool SwitchToVideoMode(int width, int height, short framerate) = 0; 
     123    virtual bool SwitchToVideoMode(int width, int height, double framerate) = 0; 
    124124 
    125125  private: 
    126126    DisplayRes(const DisplayRes & rhs); // disable copy constructor; 
  • mythtv/libs/libmyth/DisplayResOSX.cpp

    old new  
    6666    return d; 
    6767} 
    6868 
    69 bool DisplayResOSX::SwitchToVideoMode(int width, int height, short refreshrate) 
     69bool DisplayResOSX::SwitchToVideoMode(int width, int height, double refreshrate) 
    7070{ 
    7171    CGDirectDisplayID d = mythtv_display(); 
    7272    CFDictionaryRef dispMode = NULL; 
     
    7575    // find mode that matches the desired size 
    7676    if (refreshrate) 
    7777        dispMode = CGDisplayBestModeForParametersAndRefreshRate( 
    78             d, 32, width, height, (CGRefreshRate)(refreshrate), &match); 
     78            d, 32, width, height, (CGRefreshRate)((short)refreshrate), &match); 
    7979 
    8080    if (!match) 
    8181        dispMode =  
     
    118118        int height  = get_int_CF(displayMode, kCGDisplayHeight); 
    119119        int refresh = get_int_CF(displayMode, kCGDisplayRefreshRate); 
    120120 
    121         uint key = DisplayResScreen::CalcKey(width, height, 0); 
     121        uint key = DisplayResScreen::CalcKey(width, height, 0.0); 
    122122 
    123123        if (screen_map.find(key)==screen_map.end()) 
    124124            screen_map[key] = DisplayResScreen(width, height, 
    125                                                0, 0, -1.0, refresh); 
     125                                               0, 0, -1.0, (double) refresh); 
    126126        else 
    127127            screen_map[key].AddRefreshRate(refresh); 
    128128    } 
  • mythtv/libs/libmyth/DisplayResOSX.h

    old new  
    1212 
    1313  protected: 
    1414    bool GetDisplaySize(int &width_mm, int &height_mm) const; 
    15     bool SwitchToVideoMode(int width, int height, short framerate); 
     15    bool SwitchToVideoMode(int width, int height, double framerate); 
    1616     
    1717  private: 
    1818    mutable vector<DisplayResScreen> m_video_modes; 
  • mythtv/libs/libmyth/DisplayResScreen.cpp

    old new  
    11#include "DisplayResScreen.h" 
    22#include "mythcontext.h" 
    33 
     4#include <cmath> 
     5 
    46DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 
    5                                    double aspectRatio, short refreshRate) 
    6     : width(w), height(h), width_mm(mw), height_mm(mh) 
     7                                   double aspectRatio, double refreshRate) 
     8    : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) 
    79{ 
    810    SetAspectRatio(aspectRatio); 
    911    if (refreshRate > 0) 
     
    1113} 
    1214 
    1315DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 
    14                                    const vector<short>& rr) 
    15     : width(w), height(h), width_mm(mw), height_mm(mh), refreshRates(rr) 
     16                                   const vector<double>& rr) 
     17    : width(w), height(h), width_mm(mw), height_mm(mh), refreshRates(rr), custom(false) 
    1618{ 
    1719    SetAspectRatio(-1.0); 
    1820} 
    1921 
    2022DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 
    21                                    const short* rr, uint rr_length) 
    22     : width(w), height(h), width_mm(mw), height_mm(mh) 
     23                                   const vector<double>& rr, const map<double, short>& rr2) 
     24: width(w), height(h), width_mm(mw), height_mm(mh), refreshRates(rr), realRates(rr2), custom(true) 
     25{ 
     26    SetAspectRatio(-1.0); 
     27} 
     28 
     29DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 
     30                                   const double* rr, uint rr_length) 
     31    : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) 
    2332{ 
    2433    SetAspectRatio(-1.0); 
    2534    for (uint i = 0; i < rr_length; ++i) 
     
    2837    sort(refreshRates.begin(), refreshRates.end()); 
    2938} 
    3039 
     40DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 
     41                                   const short* rr, uint rr_length) 
     42    : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) 
     43{ 
     44    SetAspectRatio(-1.0); 
     45    for (uint i = 0; i < rr_length; ++i) 
     46        refreshRates.push_back((double)rr[i]); 
     47    sort(refreshRates.begin(), refreshRates.end()); 
     48} 
     49 
    3150DisplayResScreen::DisplayResScreen(const QString &str) 
    32     : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0) 
     51    : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0), custom(false) 
    3352{ 
    3453    refreshRates.clear(); 
    3554    QStringList slist = QStringList::split(":", str); 
    3655    if (slist.size()<4) 
    3756        slist = QStringList::split(",", str); // for backward compatibility 
    38     if (slist.size() >= 4) 
    39     { 
     57    if (slist.size() >= 4) { 
    4058        width = slist[0].toInt(); 
    4159        height = slist[1].toInt(); 
    4260        width_mm = slist[2].toInt(); 
    4361        height_mm = slist[3].toInt(); 
    4462        aspect = slist[4].toDouble(); 
    4563        for (uint i = 5; i<slist.size(); ++i) 
    46             refreshRates.push_back(slist[i].toShort()); 
     64            refreshRates.push_back(slist[i].toDouble()); 
    4765    } 
    4866} 
    4967 
     
    8098    return dsr; 
    8199} 
    82100 
     101//compares if the double f1 is equal with f2 and returns 1 if true and 0 if false 
     102bool DisplayResScreen::compare_rates(double f1, double f2, double precision) 
     103{ 
     104    if (((f1 - precision) < f2) &&  
     105        ((f1 + precision) > f2)) 
     106        return true; 
     107    else 
     108        return false; 
     109} 
     110 
    83111int DisplayResScreen::FindBestMatch(const vector<DisplayResScreen>& dsr, 
    84112                                    const DisplayResScreen& d, 
    85                                     short& target_rate) 
     113                                    double& target_rate) 
    86114{ 
    87     for (uint i=0; i<dsr.size(); ++i) 
    88     { 
    89         if (dsr[i].Width()==d.Width() && dsr[i].Height()==d.Height()) 
    90         { 
    91             const vector<short>& rates = dsr[i].RefreshRates(); 
    92             if (rates.size()) 
    93             { 
    94                 vector<short>::const_iterator it = 
    95                     find(rates.begin(), rates.end(), d.RefreshRate()); 
    96                 target_rate = (it == rates.end()) ? *(--rates.end()) : *it; 
    97                 return i; 
     115    double videorate = d.RefreshRate(); 
     116    bool rate2x = false; 
     117    bool end = false; 
     118 
     119    // We will give priority to refresh rates that a twice what is looked for 
     120    if ((videorate > 24.5) && (videorate < 30.5)) { 
     121        rate2x = true; 
     122        videorate *= 2.0; 
     123    } 
     124    
     125    // Amend vector with custom list 
     126    for (uint i=0; i<dsr.size(); ++i) { 
     127        if (dsr[i].Width()==d.Width() && dsr[i].Height()==d.Height()) { 
     128            const vector<double>& rates = dsr[i].RefreshRates(); 
     129            if (rates.size() && videorate != 0) { 
     130                while (!end) { 
     131                    for (double precision = 0.001; precision < 1.0; precision *= 10.0) { 
     132                        for (uint j=0; j < rates.size(); ++j) { 
     133                            // Multiple of target_rate will do 
     134                            if (compare_rates(videorate,rates[j], precision) || 
     135                                (fabs(videorate - fmod(rates[j],videorate)) <= precision) || 
     136                                (fmod(rates[j],videorate) <= precision)) { 
     137                                target_rate = rates[j]; 
     138                                return i; 
     139                            } 
     140                        } 
     141                    } 
     142                    // Can't find exact frame rate, so try rounding to the nearest integer, so 23.97Hz will work with 24Hz etc 
     143                    for (uint j=0; j < rates.size(); ++j) { 
     144                        double rounded = (double) ((int) (videorate + 0.5)); 
     145                        // Multiple of target_rate will do 
     146                        if (compare_rates(rounded,rates[j]) || 
     147                            (fabs(rounded - fmod(rates[j],rounded)) <= 0.01) || 
     148                            (fmod(rates[j],rounded) <= 0.01)) { 
     149                            target_rate = rates[j]; 
     150                            return i; 
     151                        } 
     152                    } 
     153                    if (rate2x) { 
     154                        videorate /= 2.0; 
     155                        rate2x = false; 
     156                    } else 
     157                        end = true; 
     158                } 
     159                target_rate = rates[rates.size() - 1]; 
    98160            } 
     161            return i; 
    99162        } 
    100163    } 
    101164    return -1; 
  • mythtv/libs/libmyth/DisplayResScreen.h

    old new  
    1414  public: 
    1515    // Constructors, initializers 
    1616    DisplayResScreen() 
    17         : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0) {;} 
     17        : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0), custom(false) {;} 
    1818    DisplayResScreen(int w, int h, int mw, int mh, 
    19                      double aspectRatio/* = -1.0*/, short refreshRate/* = 0*/); 
     19                     double aspectRatio/* = -1.0*/, double refreshRate/* = 0*/); 
    2020    DisplayResScreen(int w, int h, int mw, int mh, 
    21                      const vector<short>& refreshRates); 
     21                     const vector<double>& refreshRates); 
     22    DisplayResScreen(int w, int h, int mw, int mh, 
     23                     const vector<double>& refreshRates, const map<double, short>& realrates); 
     24    DisplayResScreen(int w, int h, int mw, int mh, 
     25                     const double* refreshRates, uint rr_length); 
    2226    DisplayResScreen(int w, int h, int mw, int mh, 
    2327                     const short* refreshRates, uint rr_length); 
    2428    DisplayResScreen(const QString &str); 
     
    2933    int Height() const { return height; } 
    3034    int Width_mm() const { return width_mm; } 
    3135    int Height_mm() const { return height_mm; } 
     36    bool Custom() const { return custom; } 
     37 
    3238    inline double AspectRatio() const; 
    33     inline short RefreshRate() const; 
    34     const vector<short>& RefreshRates() const { return refreshRates; } 
     39    inline double RefreshRate() const; 
     40    const vector<double>& RefreshRates() const { return refreshRates; } 
    3541 
    3642    // Sets, adds 
    3743    void SetAspectRatio(double a); 
    38     void AddRefreshRate(short rr) { 
     44    void AddRefreshRate(double rr) { 
    3945        refreshRates.push_back(rr); 
    4046        sort(refreshRates.begin(), refreshRates.end()); 
    4147    } 
     48    void ClearRefreshRates(void) { 
     49        refreshRates.clear(); 
     50    } 
     51    void SetCustom(bool b) { 
     52        custom = b; 
     53    } 
     54 
     55    // Map for matching real rates and xrandr rate; 
     56    map<double, short> realRates; 
    4257 
    4358    // Converters & comparitors 
    4459    QString toString() const; 
     
    5065    static vector<DisplayResScreen> Convert(const QStringList& slist); 
    5166    static int FindBestMatch(const vector<DisplayResScreen>& dsr, 
    5267                             const DisplayResScreen& d, 
    53                              short& target_rate); 
    54     static inline int CalcKey(int w, int h, int rate); 
     68                             double& target_rate); 
     69    static inline int CalcKey(int w, int h, double rate); 
     70    static bool compare_rates(double f1, double f2, double precision = 0.01); 
    5571 
    5672  private: 
    5773    int width, height; // size in pixels 
    5874    int width_mm, height_mm; // physical size in millimeters 
    5975    double aspect; // aspect ratio, calculated or set 
    60     vector<short> refreshRates; 
     76    vector<double> refreshRates; 
     77    bool custom;        // Set if resolution was defined manually 
    6178}; 
    6279 
     80 
    6381typedef vector<DisplayResScreen>          DisplayResVector; 
    6482typedef DisplayResVector::iterator        DisplayResVectorIt; 
    6583typedef DisplayResVector::const_iterator  DisplayResVectorCIt; 
     
    85103    return aspect; 
    86104} 
    87105 
    88 inline short DisplayResScreen::RefreshRate() const 
     106inline double DisplayResScreen::RefreshRate() const 
    89107{ 
    90108    if (refreshRates.size() >= 1) 
    91109        return refreshRates[0]; 
    92     else return 0; 
     110    else return 0.0; 
    93111} 
    94112 
    95113inline bool DisplayResScreen::operator < (const DisplayResScreen& b) const 
     
    106124    return width == b.width && height == b.height; 
    107125 
    108126 
    109 inline int DisplayResScreen::CalcKey(int w, int h, int rate) 
     127inline int DisplayResScreen::CalcKey(int w, int h, double rate) 
    110128{ 
    111     return (w << 17) | (h << 3) | rate; 
     129    int irate = (int) (rate * 1000.0); 
     130    return (w << 19) | (h << 5) | irate; 
    112131} 
    113132 
    114133#endif // __DISPLAYRESCREEN_H__ 
  • mythtv/libs/libmyth/DisplayResX.cpp

    old new  
    33#include <cstdio> 
    44#include <cstring> 
    55#include <cstdlib> 
     6#include <cmath> 
     7 
     8#include "mythcontext.h" 
     9#include <qregexp.h> 
     10#include <qfile.h> 
     11#include <qfileinfo.h> 
    612 
    713#include "util-x11.h" 
     14#include "util-nvidia.h" 
    815 
    916#include <X11/extensions/Xrandr.h> // this has to be after util-x11.h (Qt bug) 
    1017 
     
    3239    return false; 
    3340} 
    3441 
    35 bool DisplayResX::SwitchToVideoMode(int width, int height, short desired_rate) 
     42bool DisplayResX::SwitchToVideoMode(int width, int height, double desired_rate) 
    3643{ 
    37     short rate; 
     44    double rate; 
     45    short finalrate; 
     46 
    3847    DisplayResScreen desired_screen(width, height, 0, 0, -1.0, desired_rate); 
    3948    int idx = DisplayResScreen::FindBestMatch(m_video_modes_unsorted, 
    4049                                              desired_screen, rate); 
     
    4958        Rotation rot; 
    5059        XRRConfigCurrentConfiguration(cfg, &rot); 
    5160         
     61        // Search real xrandr rate for desired_rate 
     62        finalrate = (short) rate; 
     63        for (uint i=0; i < m_video_modes.size(); i++) { 
     64            if ((m_video_modes[i].Width() == width) && (m_video_modes[i].Height() == height)) 
     65            { 
     66                if (m_video_modes[i].Custom()) 
     67                { 
     68                    finalrate = m_video_modes[i].realRates[rate]; 
     69                    VERBOSE(VB_PLAYBACK, QString("Dynamic TwinView rate found, set %1Hz as XRandR %2") .arg(rate) .arg(finalrate)); 
     70                } 
     71                break; 
     72            } 
     73        } 
     74                
    5275        Window root = DefaultRootWindow(display); 
    5376        Status status = XRRSetScreenConfigAndRate(display, cfg, root, idx, 
    54                                                   rot, rate, CurrentTime); 
     77                                                  rot, finalrate, CurrentTime); 
    5578         
    5679        XRRFreeScreenConfigInfo(cfg); 
    5780        XCloseDisplay(display); 
     
    87110                             rates, num_rates); 
    88111        m_video_modes.push_back(scr); 
    89112    } 
     113 
     114    t_screenrate screenmap; 
     115    int nvidiarate = GetNvidiaRates(screenmap); 
     116 
     117    if (nvidiarate > 0); 
     118    { 
     119        // Update existing DisplayResScreen vector, and update it with new frequencies 
     120        for (uint i=0; i < m_video_modes.size(); i++) 
     121        { 
     122            DisplayResScreen scr = m_video_modes[i]; 
     123            int w = scr.Width(); 
     124            int h = scr.Height(); 
     125            int mw = scr.Width_mm(); 
     126            int mh = scr.Height_mm(); 
     127            vector<double> newrates; 
     128            map<double, short> realRates; 
     129            const vector<double>& rates = scr.RefreshRates(); 
     130            bool found = false; 
     131            for (vector<double>::const_iterator it = rates.begin() ; it !=  rates.end();  it++) 
     132            { 
     133                uint key = DisplayResScreen::CalcKey(w, h, *it); 
     134                if (screenmap.find(key) != screenmap.end()) 
     135                { 
     136                    // Rate is defined in NV-CONTROL extension, use it 
     137                    newrates.push_back(screenmap[key]); 
     138                    realRates[screenmap[key]] = (int) round(*it); 
     139                    found = true; 
     140                    // VERBOSE(VB_PLAYBACK, QString("CustomRate Found, set %1x%2@%3 as %4Hz") .arg(w) .arg(h) .arg(*it) .arg(screenmap[key])); 
     141                } 
     142            } 
     143            if (found) 
     144            { 
     145                m_video_modes.erase(m_video_modes.begin() + i); 
     146                sort(newrates.begin(), newrates.end()); 
     147                m_video_modes.insert(m_video_modes.begin() + i, DisplayResScreen(w, h, mw, mh, newrates, realRates)); 
     148            } 
     149        } 
     150    } 
     151 
    90152    m_video_modes_unsorted = m_video_modes; 
    91153    sort(m_video_modes.begin(), m_video_modes.end()); 
    92154 
  • mythtv/libs/libmyth/DisplayResX.h

    old new  
    1212 
    1313  protected: 
    1414    bool GetDisplaySize(int &width_mm, int &height_mm) const; 
    15     bool SwitchToVideoMode(int width, int height, short framerate); 
     15    bool SwitchToVideoMode(int width, int height, double framerate); 
    1616 
    1717  private: 
    1818    mutable vector<DisplayResScreen> m_video_modes; 
  • mythtv/libs/libmythtv/NuppelVideoPlayer.cpp

    old new  
    635635            GetDecoder()->GetVideoCodecID(), 
    636636            GetDecoder()->GetVideoCodecPrivate(), 
    637637            video_disp_dim, video_aspect, 
    638             widget->winId(), display_rect, 0 /*embedid*/); 
     638            widget->winId(), display_rect, (video_frame_rate * play_speed),  
     639            0 /*embedid*/); 
    639640 
    640641        if (!videoOutput) 
    641642        { 
  • mythtv/libs/libmythtv/videoout_xv.cpp

    old new  
    405405    if ((width == 1920 || width == 1440) && height == 1088) 
    406406        height = 1080; // ATSC 1920x1080 
    407407 
    408     if (display_res && display_res->SwitchToVideo(width, height)) 
     408    if (display_res && display_res->SwitchToVideo(width, height, video_prate)) 
    409409    { 
    410410        // Switching to custom display resolution succeeded 
    411411        // Make a note of the new size 
  • mythtv/libs/libmythtv/videooutbase.cpp

    old new  
    6868        void          *codec_priv, 
    6969        const QSize   &video_dim, float        video_aspect, 
    7070        WId            win_id,    const QRect &display_rect, 
    71         WId            embed_id) 
     71        float          video_prate,     WId     embed_id) 
    7272{ 
    7373    (void) codec_priv; 
    7474 
     
    167167 
    168168        if (vo) 
    169169        { 
     170            vo->video_prate = video_prate; 
    170171            if (vo->Init( 
    171172                    video_dim.width(), video_dim.height(), video_aspect, 
    172173                    win_id, display_rect.x(), display_rect.y(), 
     
    406407 
    407408void VideoOutput::SetVideoFrameRate(float playback_fps) 
    408409{ 
     410    video_prate = playback_fps; 
    409411    db_vdisp_profile->SetOutput(playback_fps); 
    410412} 
    411413 
  • mythtv/libs/libmythtv/videooutbase.h

    old new  
    3636        void          *codec_priv, 
    3737        const QSize   &video_dim, float        video_aspect, 
    3838        WId            win_id,    const QRect &display_rect, 
    39         WId            embed_id); 
     39        float video_prate,        WId          embed_id); 
    4040 
    4141    VideoOutput(); 
    4242    virtual ~VideoOutput(); 
     
    276276    QSize   video_dim;        ///< Pixel dimensions of video buffer 
    277277    QSize   video_disp_dim;   ///< Pixel dimensions of video display area 
    278278    float   video_aspect;     ///< Physical aspect ratio of video 
     279    float   video_prate;      ///< Playback frame rate of video 
    279280 
    280281    /// Normally this is the same as videoAspect, but may not be 
    281282    /// if the user has toggled the aspect override mode. 
  • new file 0.21-fixes/mythtv/libs/libmyth/nvidia/NVCtrl.c

    - +  
     1/* 
     2 * Copyright (c) 2008 NVIDIA, Corporation 
     3 * 
     4 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     5 * of this software and associated documentation files (the "Software"), to deal 
     6 * in the Software without restriction, including without limitation the rights 
     7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     8 * copies of the Software, and to permit persons to whom the Software is 
     9 * furnished to do so, subject to the following conditions: 
     10 * 
     11 * The above copyright notice and this permission notice (including the next 
     12 * paragraph) shall be included in all copies or substantial portions of the 
     13 * Software. 
     14 * 
     15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE 
     18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
     21 * SOFTWARE. 
     22 */ 
     23 
     24/* 
     25 * Make sure that XTHREADS is defined, so that the 
     26 * LockDisplay/UnlockDisplay macros are expanded properly and the 
     27 * libXNVCtrl library properly protects the Display connection. 
     28 */ 
     29 
     30#if !defined(XTHREADS) 
     31#define XTHREADS 
     32#endif /* XTHREADS */ 
     33 
     34#define NEED_EVENTS 
     35#define NEED_REPLIES 
     36#include <stdlib.h> 
     37#include <X11/Xlibint.h> 
     38#include <X11/Xutil.h> 
     39#include <X11/extensions/Xext.h> 
     40#include <X11/extensions/extutil.h> 
     41#include "NVCtrlLib.h" 
     42#include "nv_control.h" 
     43 
     44#define NVCTRL_EXT_NEED_CHECK          (XPointer)(~0) 
     45#define NVCTRL_EXT_NEED_NOTHING        (XPointer)(0) 
     46#define NVCTRL_EXT_NEED_TARGET_SWAP    (XPointer)(1) 
     47 
     48static XExtensionInfo _nvctrl_ext_info_data; 
     49static XExtensionInfo *nvctrl_ext_info = &_nvctrl_ext_info_data; 
     50static /* const */ char *nvctrl_extension_name = NV_CONTROL_NAME; 
     51 
     52#define XNVCTRLCheckExtension(dpy,i,val) \ 
     53  XextCheckExtension (dpy, i, nvctrl_extension_name, val) 
     54#define XNVCTRLSimpleCheckExtension(dpy,i) \ 
     55  XextSimpleCheckExtension (dpy, i, nvctrl_extension_name) 
     56 
     57static int close_display(); 
     58static Bool wire_to_event(); 
     59static /* const */ XExtensionHooks nvctrl_extension_hooks = { 
     60    NULL,                               /* create_gc */ 
     61    NULL,                               /* copy_gc */ 
     62    NULL,                               /* flush_gc */ 
     63    NULL,                               /* free_gc */ 
     64    NULL,                               /* create_font */ 
     65    NULL,                               /* free_font */ 
     66    close_display,                      /* close_display */ 
     67    wire_to_event,                      /* wire_to_event */ 
     68    NULL,                               /* event_to_wire */ 
     69    NULL,                               /* error */ 
     70    NULL,                               /* error_string */ 
     71}; 
     72 
     73static XEXT_GENERATE_FIND_DISPLAY (find_display, nvctrl_ext_info, 
     74                                   nvctrl_extension_name,  
     75                                   &nvctrl_extension_hooks, 
     76                                   NV_CONTROL_EVENTS, NVCTRL_EXT_NEED_CHECK) 
     77 
     78static XEXT_GENERATE_CLOSE_DISPLAY (close_display, nvctrl_ext_info) 
     79 
     80/* 
     81 * NV-CONTROL versions 1.8 and 1.9 pack the target_type and target_id 
     82 * fields in reversed order.  In order to talk to one of these servers, 
     83 * we need to swap these fields. 
     84 */ 
     85static void XNVCTRLCheckTargetData(Display *dpy, XExtDisplayInfo *info, 
     86                                   int *target_type, int *target_id) 
     87{ 
     88    /* Find out what the server's NV-CONTROL version is and 
     89     * setup for swapping if we need to. 
     90     */ 
     91    if (info->data == NVCTRL_EXT_NEED_CHECK) { 
     92        int major, minor; 
     93 
     94        if (XNVCTRLQueryVersion(dpy, &major, &minor)) { 
     95            if (major == 1 && 
     96                (minor == 8 || minor == 9)) { 
     97                info->data = NVCTRL_EXT_NEED_TARGET_SWAP; 
     98            } else { 
     99                info->data = NVCTRL_EXT_NEED_NOTHING; 
     100            } 
     101        } else { 
     102            info->data = NVCTRL_EXT_NEED_NOTHING; 
     103        } 
     104    } 
     105 
     106    /* We need to swap the target_type and target_id */ 
     107    if (info->data == NVCTRL_EXT_NEED_TARGET_SWAP) { 
     108        int tmp; 
     109        tmp = *target_type; 
     110        *target_type = *target_id; 
     111        *target_id = tmp; 
     112    } 
     113} 
     114 
     115 
     116Bool XNVCTRLQueryExtension ( 
     117    Display *dpy, 
     118    int *event_basep, 
     119    int *error_basep 
     120){ 
     121    XExtDisplayInfo *info = find_display (dpy); 
     122 
     123    if (XextHasExtension(info)) { 
     124        if (event_basep) *event_basep = info->codes->first_event; 
     125        if (error_basep) *error_basep = info->codes->first_error; 
     126        return True; 
     127    } else { 
     128        return False; 
     129    } 
     130} 
     131 
     132 
     133Bool XNVCTRLQueryVersion ( 
     134    Display *dpy, 
     135    int *major, 
     136    int *minor 
     137){ 
     138    XExtDisplayInfo *info = find_display (dpy); 
     139    xnvCtrlQueryExtensionReply rep; 
     140    xnvCtrlQueryExtensionReq   *req; 
     141 
     142    if(!XextHasExtension(info)) 
     143        return False; 
     144 
     145    XNVCTRLCheckExtension (dpy, info, False); 
     146 
     147    LockDisplay (dpy); 
     148    GetReq (nvCtrlQueryExtension, req); 
     149    req->reqType = info->codes->major_opcode; 
     150    req->nvReqType = X_nvCtrlQueryExtension; 
     151    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { 
     152        UnlockDisplay (dpy); 
     153        SyncHandle (); 
     154        return False; 
     155    } 
     156    if (major) *major = rep.major; 
     157    if (minor) *minor = rep.minor; 
     158    UnlockDisplay (dpy); 
     159    SyncHandle (); 
     160    return True; 
     161} 
     162 
     163 
     164Bool XNVCTRLIsNvScreen ( 
     165    Display *dpy, 
     166    int screen 
     167){ 
     168    XExtDisplayInfo *info = find_display (dpy); 
     169    xnvCtrlIsNvReply rep; 
     170    xnvCtrlIsNvReq   *req; 
     171    Bool isnv; 
     172 
     173    if(!XextHasExtension(info)) 
     174        return False; 
     175 
     176    XNVCTRLCheckExtension (dpy, info, False); 
     177 
     178    LockDisplay (dpy); 
     179    GetReq (nvCtrlIsNv, req); 
     180    req->reqType = info->codes->major_opcode; 
     181    req->nvReqType = X_nvCtrlIsNv; 
     182    req->screen = screen; 
     183    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { 
     184        UnlockDisplay (dpy); 
     185        SyncHandle (); 
     186        return False; 
     187    } 
     188    isnv = rep.isnv; 
     189    UnlockDisplay (dpy); 
     190    SyncHandle (); 
     191    return isnv; 
     192} 
     193 
     194 
     195Bool XNVCTRLQueryTargetCount ( 
     196    Display *dpy, 
     197    int target_type, 
     198    int *value 
     199){ 
     200    XExtDisplayInfo *info = find_display (dpy); 
     201    xnvCtrlQueryTargetCountReply  rep; 
     202    xnvCtrlQueryTargetCountReq   *req; 
     203 
     204    if(!XextHasExtension(info)) 
     205        return False; 
     206 
     207    XNVCTRLCheckExtension (dpy, info, False); 
     208 
     209    LockDisplay (dpy); 
     210    GetReq (nvCtrlQueryTargetCount, req); 
     211    req->reqType = info->codes->major_opcode; 
     212    req->nvReqType = X_nvCtrlQueryTargetCount; 
     213    req->target_type = target_type; 
     214    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { 
     215        UnlockDisplay (dpy); 
     216        SyncHandle (); 
     217        return False; 
     218    } 
     219    if (value) *value = rep.count; 
     220    UnlockDisplay (dpy); 
     221    SyncHandle (); 
     222    return True; 
     223} 
     224 
     225 
     226void XNVCTRLSetTargetAttribute ( 
     227    Display *dpy, 
     228    int target_type, 
     229    int target_id, 
     230    unsigned int display_mask, 
     231    unsigned int attribute, 
     232    int value 
     233){ 
     234    XExtDisplayInfo *info = find_display (dpy); 
     235    xnvCtrlSetAttributeReq *req; 
     236 
     237    XNVCTRLSimpleCheckExtension (dpy, info); 
     238    XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id); 
     239 
     240    LockDisplay (dpy); 
     241    GetReq (nvCtrlSetAttribute, req); 
     242    req->reqType = info->codes->major_opcode; 
     243    req->nvReqType = X_nvCtrlSetAttribute; 
     244    req->target_type = target_type; 
     245    req->target_id = target_id; 
     246    req->display_mask = display_mask; 
     247    req->attribute = attribute; 
     248    req->value = value; 
     249    UnlockDisplay (dpy); 
     250    SyncHandle (); 
     251} 
     252 
     253void XNVCTRLSetAttribute ( 
     254    Display *dpy, 
     255    int screen, 
     256    unsigned int display_mask, 
     257    unsigned int attribute, 
     258    int value 
     259){ 
     260    XNVCTRLSetTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, screen, 
     261                               display_mask, attribute, value); 
     262} 
     263 
     264 
     265Bool XNVCTRLSetAttributeAndGetStatus ( 
     266    Display *dpy, 
     267    int screen, 
     268    unsigned int display_mask, 
     269    unsigned int attribute, 
     270    int value 
     271){ 
     272    XExtDisplayInfo *info = find_display (dpy); 
     273    xnvCtrlSetAttributeAndGetStatusReq *req; 
     274    xnvCtrlSetAttributeAndGetStatusReply rep; 
     275    Bool success; 
     276 
     277    if(!XextHasExtension(info)) 
     278        return False; 
     279 
     280    XNVCTRLCheckExtension (dpy, info, False); 
     281 
     282    LockDisplay (dpy); 
     283    GetReq (nvCtrlSetAttributeAndGetStatus, req); 
     284    req->reqType = info->codes->major_opcode; 
     285    req->nvReqType = X_nvCtrlSetAttributeAndGetStatus; 
     286    req->screen = screen; 
     287    req->display_mask = display_mask; 
     288    req->attribute = attribute; 
     289    req->value = value; 
     290    if (!_XReply (dpy, (xReply *) &rep, 0, False)) { 
     291        UnlockDisplay (dpy); 
     292        SyncHandle (); 
     293        return False; 
     294    } 
     295    UnlockDisplay (dpy); 
     296    SyncHandle (); 
     297     
     298    success = rep.flags; 
     299    return success; 
     300} 
     301 
     302 
     303 
     304Bool XNVCTRLQueryTargetAttribute ( 
     305    Display *dpy, 
     306    int target_type, 
     307    int target_id, 
     308    unsigned int display_mask, 
     309    unsigned int attribute, 
     310    int *value 
     311){ 
     312    XExtDisplayInfo *info = find_display (dpy); 
     313    xnvCtrlQueryAttributeReply rep; 
     314    xnvCtrlQueryAttributeReq   *req; 
     315    Bool exists; 
     316 
     317    if(!XextHasExtension(info)) 
     318        return False; 
     319 
     320    XNVCTRLCheckExtension (dpy, info, False); 
     321    XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id); 
     322 
     323    LockDisplay (dpy); 
     324    GetReq (nvCtrlQueryAttribute, req); 
     325    req->reqType = info->codes->major_opcode; 
     326    req->nvReqType = X_nvCtrlQueryAttribute; 
     327    req->target_type = target_type; 
     328    req->target_id = target_id; 
     329    req->display_mask = display_mask; 
     330    req->attribute = attribute; 
     331    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { 
     332        UnlockDisplay (dpy); 
     333        SyncHandle (); 
     334        return False; 
     335    } 
     336    if (value) *value = rep.value; 
     337    exists = rep.flags; 
     338    UnlockDisplay (dpy); 
     339    SyncHandle (); 
     340    return exists; 
     341} 
     342 
     343Bool XNVCTRLQueryAttribute ( 
     344    Display *dpy, 
     345    int screen, 
     346    unsigned int display_mask, 
     347    unsigned int attribute, 
     348    int *value 
     349){ 
     350    return XNVCTRLQueryTargetAttribute(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 
     351                                       screen, display_mask, attribute, value); 
     352} 
     353 
     354 
     355Bool XNVCTRLQueryTargetStringAttribute ( 
     356    Display *dpy, 
     357    int target_type, 
     358    int target_id, 
     359    unsigned int display_mask, 
     360    unsigned int attribute, 
     361    char **ptr 
     362){ 
     363    XExtDisplayInfo *info = find_display (dpy); 
     364    xnvCtrlQueryStringAttributeReply rep; 
     365    xnvCtrlQueryStringAttributeReq   *req; 
     366    Bool exists; 
     367    int length, numbytes, slop; 
     368 
     369    if (!ptr) return False; 
     370 
     371    if(!XextHasExtension(info)) 
     372        return False; 
     373 
     374    XNVCTRLCheckExtension (dpy, info, False); 
     375    XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id); 
     376 
     377    LockDisplay (dpy); 
     378    GetReq (nvCtrlQueryStringAttribute, req); 
     379    req->reqType = info->codes->major_opcode; 
     380    req->nvReqType = X_nvCtrlQueryStringAttribute; 
     381    req->target_type = target_type; 
     382    req->target_id = target_id; 
     383    req->display_mask = display_mask; 
     384    req->attribute = attribute; 
     385    if (!_XReply (dpy, (xReply *) &rep, 0, False)) { 
     386        UnlockDisplay (dpy); 
     387        SyncHandle (); 
     388        return False; 
     389    } 
     390    length = rep.length; 
     391    numbytes = rep.n; 
     392    slop = numbytes & 3; 
     393    *ptr = (char *) Xmalloc(numbytes); 
     394    if (! *ptr) { 
     395        _XEatData(dpy, length); 
     396        UnlockDisplay (dpy); 
     397        SyncHandle (); 
     398        return False; 
     399    } else { 
     400        _XRead(dpy, (char *) *ptr, numbytes); 
     401        if (slop) _XEatData(dpy, 4-slop); 
     402    } 
     403    exists = rep.flags; 
     404    UnlockDisplay (dpy); 
     405    SyncHandle (); 
     406    return exists; 
     407} 
     408 
     409Bool XNVCTRLQueryStringAttribute ( 
     410    Display *dpy, 
     411    int screen, 
     412    unsigned int display_mask, 
     413    unsigned int attribute, 
     414    char **ptr 
     415){ 
     416    return XNVCTRLQueryTargetStringAttribute(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 
     417                                             screen, display_mask, 
     418                                             attribute, ptr); 
     419} 
     420 
     421 
     422Bool XNVCTRLSetStringAttribute ( 
     423    Display *dpy, 
     424    int screen, 
     425    unsigned int display_mask, 
     426    unsigned int attribute, 
     427    char *ptr 
     428){ 
     429    XExtDisplayInfo *info = find_display (dpy); 
     430    xnvCtrlSetStringAttributeReq *req; 
     431    xnvCtrlSetStringAttributeReply rep; 
     432    int size; 
     433    Bool success; 
     434     
     435    if(!XextHasExtension(info)) 
     436        return False; 
     437 
     438    XNVCTRLCheckExtension (dpy, info, False); 
     439 
     440    size = strlen(ptr)+1; 
     441 
     442    LockDisplay (dpy); 
     443    GetReq (nvCtrlSetStringAttribute, req); 
     444    req->reqType = info->codes->major_opcode; 
     445    req->nvReqType = X_nvCtrlSetStringAttribute; 
     446    req->screen = screen; 
     447    req->display_mask = display_mask; 
     448    req->attribute = attribute; 
     449    req->length += ((size + 3) & ~3) >> 2; 
     450    req->num_bytes = size; 
     451    Data(dpy, ptr, size); 
     452     
     453    if (!_XReply (dpy, (xReply *) &rep, 0, False)) { 
     454        UnlockDisplay (dpy); 
     455        SyncHandle (); 
     456        return False; 
     457    } 
     458    UnlockDisplay (dpy); 
     459    SyncHandle (); 
     460     
     461    success = rep.flags; 
     462    return success; 
     463} 
     464 
     465 
     466Bool XNVCTRLQueryValidTargetAttributeValues ( 
     467    Display *dpy, 
     468    int target_type, 
     469    int target_id, 
     470    unsigned int display_mask, 
     471    unsigned int attribute,                                  
     472    NVCTRLAttributeValidValuesRec *values 
     473){ 
     474    XExtDisplayInfo *info = find_display (dpy); 
     475    xnvCtrlQueryValidAttributeValuesReply rep; 
     476    xnvCtrlQueryValidAttributeValuesReq   *req; 
     477    Bool exists; 
     478     
     479    if (!values) return False; 
     480 
     481    if(!XextHasExtension(info)) 
     482        return False; 
     483 
     484    XNVCTRLCheckExtension (dpy, info, False); 
     485    XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id); 
     486 
     487    LockDisplay (dpy); 
     488    GetReq (nvCtrlQueryValidAttributeValues, req); 
     489    req->reqType = info->codes->major_opcode; 
     490    req->nvReqType = X_nvCtrlQueryValidAttributeValues; 
     491    req->target_type = target_type; 
     492    req->target_id = target_id; 
     493    req->display_mask = display_mask; 
     494    req->attribute = attribute; 
     495    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { 
     496        UnlockDisplay (dpy); 
     497        SyncHandle (); 
     498        return False; 
     499    } 
     500    exists = rep.flags; 
     501    values->type = rep.attr_type; 
     502    if (rep.attr_type == ATTRIBUTE_TYPE_RANGE) { 
     503        values->u.range.min = rep.min; 
     504        values->u.range.max = rep.max; 
     505    } 
     506    if (rep.attr_type == ATTRIBUTE_TYPE_INT_BITS) { 
     507        values->u.bits.ints = rep.bits; 
     508    } 
     509    values->permissions = rep.perms; 
     510    UnlockDisplay (dpy); 
     511    SyncHandle (); 
     512    return exists; 
     513} 
     514 
     515Bool XNVCTRLQueryValidAttributeValues ( 
     516    Display *dpy, 
     517    int screen, 
     518    unsigned int display_mask, 
     519    unsigned int attribute,                                  
     520    NVCTRLAttributeValidValuesRec *values 
     521){ 
     522    return XNVCTRLQueryValidTargetAttributeValues(dpy, 
     523                                                  NV_CTRL_TARGET_TYPE_X_SCREEN, 
     524                                                  screen, display_mask, 
     525                                                  attribute, values); 
     526} 
     527 
     528 
     529void XNVCTRLSetGvoColorConversion ( 
     530    Display *dpy, 
     531    int screen, 
     532    float colorMatrix[3][3], 
     533    float colorOffset[3], 
     534    float colorScale[3] 
     535){ 
     536    XExtDisplayInfo *info = find_display (dpy); 
     537    xnvCtrlSetGvoColorConversionReq *req; 
     538 
     539    XNVCTRLSimpleCheckExtension (dpy, info); 
     540 
     541    LockDisplay (dpy); 
     542    GetReq (nvCtrlSetGvoColorConversion, req); 
     543    req->reqType = info->codes->major_opcode; 
     544    req->nvReqType = X_nvCtrlSetGvoColorConversion; 
     545    req->screen = screen; 
     546 
     547    req->cscMatrix_y_r = colorMatrix[0][0]; 
     548    req->cscMatrix_y_g = colorMatrix[0][1]; 
     549    req->cscMatrix_y_b = colorMatrix[0][2]; 
     550 
     551    req->cscMatrix_cr_r = colorMatrix[1][0]; 
     552    req->cscMatrix_cr_g = colorMatrix[1][1]; 
     553    req->cscMatrix_cr_b = colorMatrix[1][2]; 
     554 
     555    req->cscMatrix_cb_r = colorMatrix[2][0]; 
     556    req->cscMatrix_cb_g = colorMatrix[2][1]; 
     557    req->cscMatrix_cb_b = colorMatrix[2][2]; 
     558 
     559    req->cscOffset_y  = colorOffset[0]; 
     560    req->cscOffset_cr = colorOffset[1]; 
     561    req->cscOffset_cb = colorOffset[2]; 
     562 
     563    req->cscScale_y  = colorScale[0]; 
     564    req->cscScale_cr = colorScale[1]; 
     565    req->cscScale_cb = colorScale[2]; 
     566 
     567    UnlockDisplay (dpy); 
     568    SyncHandle (); 
     569} 
     570 
     571 
     572Bool XNVCTRLQueryGvoColorConversion ( 
     573    Display *dpy, 
     574    int screen, 
     575    float colorMatrix[3][3], 
     576    float colorOffset[3], 
     577    float colorScale[3] 
     578){ 
     579    XExtDisplayInfo *info = find_display (dpy); 
     580    xnvCtrlQueryGvoColorConversionReply rep; 
     581    xnvCtrlQueryGvoColorConversionReq *req; 
     582     
     583    if(!XextHasExtension(info)) 
     584        return False; 
     585 
     586    XNVCTRLCheckExtension (dpy, info, False); 
     587 
     588    LockDisplay (dpy); 
     589 
     590    GetReq (nvCtrlQueryGvoColorConversion, req); 
     591    req->reqType = info->codes->major_opcode; 
     592    req->nvReqType = X_nvCtrlQueryGvoColorConversion; 
     593    req->screen = screen; 
     594 
     595    if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { 
     596        UnlockDisplay (dpy); 
     597        SyncHandle (); 
     598        return False; 
     599    } 
     600 
     601    _XRead(dpy, (char *)(colorMatrix), 36); 
     602    _XRead(dpy, (char *)(colorOffset), 12); 
     603    _XRead(dpy, (char *)(colorScale), 12); 
     604 
     605    UnlockDisplay (dpy); 
     606    SyncHandle (); 
     607 
     608    return True; 
     609} 
     610 
     611 
     612Bool XNVCtrlSelectTargetNotify ( 
     613    Display *dpy, 
     614    int target_type, 
     615    int target_id, 
     616    int notify_type, 
     617    Bool onoff 
     618){ 
     619    XExtDisplayInfo *info = find_display (dpy); 
     620    xnvCtrlSelectTargetNotifyReq *req; 
     621 
     622    if(!XextHasExtension (info)) 
     623        return False; 
     624 
     625    XNVCTRLCheckExtension (dpy, info, False); 
     626 
     627    LockDisplay (dpy); 
     628    GetReq (nvCtrlSelectTargetNotify, req); 
     629    req->reqType = info->codes->major_opcode; 
     630    req->nvReqType = X_nvCtrlSelectTargetNotify; 
     631    req->target_type = target_type; 
     632    req->target_id = target_id; 
     633    req->notifyType = notify_type; 
     634    req->onoff = onoff; 
     635    UnlockDisplay (dpy); 
     636    SyncHandle (); 
     637 
     638    return True; 
     639} 
     640 
     641 
     642Bool XNVCtrlSelectNotify ( 
     643    Display *dpy, 
     644    int screen, 
     645    int type, 
     646    Bool onoff 
     647){ 
     648    XExtDisplayInfo *info = find_display (dpy); 
     649    xnvCtrlSelectNotifyReq *req; 
     650 
     651    if(!XextHasExtension (info)) 
     652        return False; 
     653 
     654    XNVCTRLCheckExtension (dpy, info, False); 
     655 
     656    LockDisplay (dpy); 
     657    GetReq (nvCtrlSelectNotify, req); 
     658    req->reqType = info->codes->major_opcode; 
     659    req->nvReqType = X_nvCtrlSelectNotify; 
     660    req->screen = screen; 
     661    req->notifyType = type; 
     662    req->onoff = onoff; 
     663    UnlockDisplay (dpy); 
     664    SyncHandle (); 
     665 
     666    return True; 
     667} 
     668 
     669Bool XNVCTRLQueryTargetBinaryData ( 
     670    Display *dpy, 
     671    int target_type, 
     672    int target_id, 
     673    unsigned int display_mask, 
     674    unsigned int attribute, 
     675    unsigned char **ptr, 
     676    int *len 
     677){ 
     678    XExtDisplayInfo *info = find_display (dpy); 
     679    xnvCtrlQueryBinaryDataReply rep; 
     680    xnvCtrlQueryBinaryDataReq   *req; 
     681    Bool exists; 
     682    int length, numbytes, slop; 
     683 
     684    if (!ptr) return False; 
     685 
     686    if(!XextHasExtension(info)) 
     687        return False; 
     688 
     689    XNVCTRLCheckExtension (dpy, info, False); 
     690    XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id); 
     691 
     692    LockDisplay (dpy); 
     693    GetReq (nvCtrlQueryBinaryData, req); 
     694    req->reqType = info->codes->major_opcode; 
     695    req->nvReqType = X_nvCtrlQueryBinaryData; 
     696    req->target_type = target_type; 
     697    req->target_id = target_id; 
     698    req->display_mask = display_mask; 
     699    req->attribute = attribute; 
     700    if (!_XReply (dpy, (xReply *) &rep, 0, False)) { 
     701        UnlockDisplay (dpy); 
     702        SyncHandle (); 
     703        return False; 
     704    } 
     705    length = rep.length; 
     706    numbytes = rep.n; 
     707    slop = numbytes & 3; 
     708    *ptr = (char *) Xmalloc(numbytes); 
     709    if (! *ptr) { 
     710        _XEatData(dpy, length); 
     711        UnlockDisplay (dpy); 
     712        SyncHandle (); 
     713        return False; 
     714    } else { 
     715        _XRead(dpy, (char *) *ptr, numbytes); 
     716        if (slop) _XEatData(dpy, 4-slop); 
     717    } 
     718    exists = rep.flags; 
     719    if (len) *len = numbytes; 
     720    UnlockDisplay (dpy); 
     721    SyncHandle (); 
     722    return exists; 
     723} 
     724 
     725Bool XNVCTRLQueryBinaryData ( 
     726    Display *dpy, 
     727    int screen, 
     728    unsigned int display_mask, 
     729    unsigned int attribute, 
     730    unsigned char **ptr, 
     731    int *len 
     732){ 
     733    return XNVCTRLQueryTargetBinaryData(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 
     734                                        screen, display_mask, 
     735                                        attribute, ptr, len); 
     736} 
     737 
     738Bool XNVCTRLStringOperation ( 
     739    Display *dpy, 
     740    int target_type, 
     741    int target_id, 
     742    unsigned int display_mask, 
     743    unsigned int attribute, 
     744    char *pIn, 
     745    char **ppOut 
     746) { 
     747    XExtDisplayInfo *info = find_display(dpy); 
     748    xnvCtrlStringOperationReq *req; 
     749    xnvCtrlStringOperationReply rep; 
     750    Bool ret; 
     751    int inSize, outSize, length, slop; 
     752 
     753    if (!XextHasExtension(info)) 
     754        return False; 
     755     
     756    if (!ppOut) 
     757        return False; 
     758 
     759    *ppOut = NULL; 
     760     
     761    XNVCTRLCheckExtension(dpy, info, False); 
     762    XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id); 
     763     
     764    if (pIn) { 
     765        inSize = strlen(pIn) + 1; 
     766    } else { 
     767        inSize = 0; 
     768    } 
     769     
     770    LockDisplay(dpy); 
     771    GetReq(nvCtrlStringOperation, req); 
     772     
     773    req->reqType = info->codes->major_opcode; 
     774    req->nvReqType = X_nvCtrlStringOperation; 
     775    req->target_type = target_type; 
     776    req->target_id = target_id; 
     777    req->display_mask = display_mask; 
     778    req->attribute = attribute; 
     779 
     780    req->length += ((inSize + 3) & ~3) >> 2; 
     781    req->num_bytes = inSize; 
     782     
     783    if (pIn) { 
     784        Data(dpy, pIn, inSize); 
     785    } 
     786     
     787    if (!_XReply (dpy, (xReply *) &rep, 0, False)) { 
     788        UnlockDisplay(dpy); 
     789        SyncHandle(); 
     790        return False; 
     791    } 
     792     
     793    length = rep.length; 
     794    outSize = rep.num_bytes; 
     795    slop = outSize & 3; 
     796 
     797    if (outSize) *ppOut = (char *) Xmalloc(outSize); 
     798     
     799    if (!*ppOut) { 
     800        _XEatData(dpy, length); 
     801    } else { 
     802        _XRead(dpy, (char *) *ppOut, outSize); 
     803        if (slop) _XEatData(dpy, 4-slop); 
     804    } 
     805     
     806    ret = rep.ret; 
     807     
     808    UnlockDisplay(dpy); 
     809    SyncHandle(); 
     810     
     811    return ret; 
     812} 
     813 
     814 
     815static Bool wire_to_event (Display *dpy, XEvent *host, xEvent *wire) 
     816{ 
     817    XExtDisplayInfo *info = find_display (dpy); 
     818    XNVCtrlEvent *re; 
     819    xnvctrlEvent *event; 
     820    XNVCtrlEventTarget *reTarget; 
     821    xnvctrlEventTarget *eventTarget; 
     822    XNVCtrlEventTargetAvailability *reTargetAvailability; 
     823    XNVCtrlStringEventTarget *reTargetString; 
     824    XNVCtrlBinaryEventTarget *reTargetBinary; 
     825 
     826    XNVCTRLCheckExtension (dpy, info, False); 
     827     
     828    switch ((wire->u.u.type & 0x7F) - info->codes->first_event) { 
     829    case ATTRIBUTE_CHANGED_EVENT: 
     830        re = (XNVCtrlEvent *) host; 
     831        event = (xnvctrlEvent *) wire; 
     832        re->attribute_changed.type = event->u.u.type & 0x7F; 
     833        re->attribute_changed.serial = 
     834            _XSetLastRequestRead(dpy, (xGenericReply*) event); 
     835        re->attribute_changed.send_event = ((event->u.u.type & 0x80) != 0); 
     836        re->attribute_changed.display = dpy; 
     837        re->attribute_changed.time = event->u.attribute_changed.time; 
     838        re->attribute_changed.screen = event->u.attribute_changed.screen; 
     839        re->attribute_changed.display_mask = 
     840            event->u.attribute_changed.display_mask; 
     841        re->attribute_changed.attribute = event->u.attribute_changed.attribute; 
     842        re->attribute_changed.value = event->u.attribute_changed.value; 
     843        break; 
     844    case TARGET_ATTRIBUTE_CHANGED_EVENT: 
     845        reTarget = (XNVCtrlEventTarget *) host; 
     846        eventTarget = (xnvctrlEventTarget *) wire; 
     847        reTarget->attribute_changed.type = eventTarget->u.u.type & 0x7F; 
     848        reTarget->attribute_changed.serial = 
     849            _XSetLastRequestRead(dpy, (xGenericReply*) eventTarget); 
     850        reTarget->attribute_changed.send_event = 
     851            ((eventTarget->u.u.type & 0x80) != 0); 
     852        reTarget->attribute_changed.display = dpy; 
     853        reTarget->attribute_changed.time = 
     854            eventTarget->u.attribute_changed.time; 
     855        reTarget->attribute_changed.target_type = 
     856            eventTarget->u.attribute_changed.target_type; 
     857        reTarget->attribute_changed.target_id = 
     858            eventTarget->u.attribute_changed.target_id; 
     859        reTarget->attribute_changed.display_mask = 
     860            eventTarget->u.attribute_changed.display_mask; 
     861        reTarget->attribute_changed.attribute = 
     862            eventTarget->u.attribute_changed.attribute; 
     863        reTarget->attribute_changed.value = 
     864            eventTarget->u.attribute_changed.value; 
     865        break; 
     866    case TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENT: 
     867        reTargetAvailability = (XNVCtrlEventTargetAvailability *) host; 
     868        eventTarget = (xnvctrlEventTarget *) wire; 
     869        reTargetAvailability->attribute_changed.type = 
     870            eventTarget->u.u.type & 0x7F; 
     871        reTargetAvailability->attribute_changed.serial = 
     872            _XSetLastRequestRead(dpy, (xGenericReply*) eventTarget); 
     873        reTargetAvailability->attribute_changed.send_event = 
     874            ((eventTarget->u.u.type & 0x80) != 0); 
     875        reTargetAvailability->attribute_changed.display = dpy; 
     876        reTargetAvailability->attribute_changed.time = 
     877            eventTarget->u.availability_changed.time; 
     878        reTargetAvailability->attribute_changed.target_type = 
     879            eventTarget->u.availability_changed.target_type; 
     880        reTargetAvailability->attribute_changed.target_id = 
     881            eventTarget->u.availability_changed.target_id; 
     882        reTargetAvailability->attribute_changed.display_mask = 
     883            eventTarget->u.availability_changed.display_mask; 
     884        reTargetAvailability->attribute_changed.attribute = 
     885            eventTarget->u.availability_changed.attribute; 
     886        reTargetAvailability->attribute_changed.availability = 
     887            eventTarget->u.availability_changed.availability; 
     888        reTargetAvailability->attribute_changed.value = 
     889            eventTarget->u.availability_changed.value; 
     890        break; 
     891    case TARGET_STRING_ATTRIBUTE_CHANGED_EVENT: 
     892        reTargetString = (XNVCtrlStringEventTarget *) host; 
     893        eventTarget = (xnvctrlEventTarget *) wire; 
     894        reTargetString->attribute_changed.type = eventTarget->u.u.type & 0x7F; 
     895        reTargetString->attribute_changed.serial = 
     896            _XSetLastRequestRead(dpy, (xGenericReply*) eventTarget); 
     897        reTargetString->attribute_changed.send_event = 
     898            ((eventTarget->u.u.type & 0x80) != 0); 
     899        reTargetString->attribute_changed.display = dpy; 
     900        reTargetString->attribute_changed.time = 
     901            eventTarget->u.attribute_changed.time; 
     902        reTargetString->attribute_changed.target_type = 
     903            eventTarget->u.attribute_changed.target_type; 
     904        reTargetString->attribute_changed.target_id = 
     905            eventTarget->u.attribute_changed.target_id; 
     906        reTargetString->attribute_changed.display_mask = 
     907            eventTarget->u.attribute_changed.display_mask; 
     908        reTargetString->attribute_changed.attribute = 
     909            eventTarget->u.attribute_changed.attribute; 
     910        break; 
     911    case TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT: 
     912        reTargetBinary = (XNVCtrlBinaryEventTarget *) host; 
     913        eventTarget = (xnvctrlEventTarget *) wire; 
     914        reTargetBinary->attribute_changed.type = eventTarget->u.u.type & 0x7F; 
     915        reTargetBinary->attribute_changed.serial = 
     916            _XSetLastRequestRead(dpy, (xGenericReply*) eventTarget); 
     917        reTargetBinary->attribute_changed.send_event = 
     918            ((eventTarget->u.u.type & 0x80) != 0); 
     919        reTargetBinary->attribute_changed.display = dpy; 
     920        reTargetBinary->attribute_changed.time = 
     921            eventTarget->u.attribute_changed.time; 
     922        reTargetBinary->attribute_changed.target_type = 
     923            eventTarget->u.attribute_changed.target_type; 
     924        reTargetBinary->attribute_changed.target_id = 
     925            eventTarget->u.attribute_changed.target_id; 
     926        reTargetBinary->attribute_changed.display_mask = 
     927            eventTarget->u.attribute_changed.display_mask; 
     928        reTargetBinary->attribute_changed.attribute = 
     929            eventTarget->u.attribute_changed.attribute; 
     930        break; 
     931 
     932    default: 
     933        return False; 
     934    } 
     935     
     936    return True; 
     937} 
     938 
  • new file 0.21-fixes/mythtv/libs/libmyth/nvidia/NVCtrl.h

    - +  
     1/* 
     2 * Copyright (c) 2008 NVIDIA, Corporation 
     3 * 
     4 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     5 * of this software and associated documentation files (the "Software"), to deal 
     6 * in the Software without restriction, including without limitation the rights 
     7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     8 * copies of the Software, and to permit persons to whom the Software is 
     9 * furnished to do so, subject to the following conditions: 
     10 * 
     11 * The above copyright notice and this permission notice (including the next 
     12 * paragraph) shall be included in all copies or substantial portions of the 
     13 * Software. 
     14 * 
     15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE 
     18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
     21 * SOFTWARE. 
     22 */ 
     23 
     24#ifndef __NVCTRL_H 
     25#define __NVCTRL_H 
     26 
     27 
     28/**************************************************************************/ 
     29 
     30/* 
     31 * Attribute Targets 
     32 * 
     33 * Targets define attribute groups.  For example, some attributes are only 
     34 * valid to set on a GPU, others are only valid when talking about an 
     35 * X Screen.  Target types are then what is used to identify the target 
     36 * group of the attribute you wish to set/query. 
     37 * 
     38 * Here are the supported target types: 
     39 */ 
     40 
     41#define NV_CTRL_TARGET_TYPE_X_SCREEN   0 
     42#define NV_CTRL_TARGET_TYPE_GPU        1 
     43#define NV_CTRL_TARGET_TYPE_FRAMELOCK  2 
     44#define NV_CTRL_TARGET_TYPE_VCSC       3 /* Visual Computing System */ 
     45 
     46 
     47/**************************************************************************/ 
     48 
     49/* 
     50 * Attributes 
     51 * 
     52 * Some attributes may only be read; some may require a display_mask 
     53 * argument and others may be valid only for specific target types. 
     54 * This information is encoded in the "permission" comment after each 
     55 * attribute #define, and can be queried at run time with 
     56 * XNVCTRLQueryValidAttributeValues() and/or 
     57 * XNVCTRLQueryValidTargetAttributeValues() 
     58 * 
     59 * Key to Integer Attribute "Permissions": 
     60 * 
     61 * R: The attribute is readable (in general, all attributes will be 
     62 *    readable) 
     63 * 
     64 * W: The attribute is writable (attributes may not be writable for 
     65 *    various reasons: they represent static system information, they 
     66 *    can only be changed by changing an XF86Config option, etc). 
     67 * 
     68 * D: The attribute requires the display mask argument.  The 
     69 *    attributes NV_CTRL_CONNECTED_DISPLAYS and NV_CTRL_ENABLED_DISPLAYS 
     70 *    will be a bitmask of what display devices are connected and what 
     71 *    display devices are enabled for use in X, respectively.  Each bit 
     72 *    in the bitmask represents a display device; it is these bits which 
     73 *    should be used as the display_mask when dealing with attributes 
     74 *    designated with "D" below.  For attributes that do not require the 
     75 *    display mask, the argument is ignored. 
     76 * 
     77 * G: The attribute may be queried using an NV_CTRL_TARGET_TYPE_GPU 
     78 *    target type via XNVCTRLQueryTargetAttribute(). 
     79 * 
     80 * F: The attribute may be queried using an NV_CTRL_TARGET_TYPE_FRAMELOCK 
     81 *    target type via XNVCTRLQueryTargetAttribute(). 
     82 * 
     83 * X: When Xinerama is enabled, this attribute is kept consistent across 
     84 *    all Physical X Screens;  Assignment of this attribute will be 
     85 *    broadcast by the NVIDIA X Driver to all X Screens. 
     86 * 
     87 * V: The attribute may be queried using an NV_CTRL_TARGET_TYPE_VCSC 
     88 *    target type via XNVCTRLQueryTargetXXXAttribute(). 
     89 *  
     90 * NOTE: Unless mentioned otherwise, all attributes may be queried using 
     91 *       an NV_CTRL_TARGET_TYPE_X_SCREEN target type via  
     92 *       XNVCTRLQueryTargetAttribute(). 
     93 */ 
     94 
     95 
     96/**************************************************************************/ 
     97 
     98/* 
     99 * Integer attributes: 
     100 * 
     101 * Integer attributes can be queried through the XNVCTRLQueryAttribute() and 
     102 * XNVCTRLQueryTargetAttribute() function calls. 
     103 *  
     104 * Integer attributes can be set through the XNVCTRLSetAttribute() and 
     105 * XNVCTRLSetTargetAttribute() function calls. 
     106 * 
     107 * Unless otherwise noted, all integer attributes can be queried/set 
     108 * using an NV_CTRL_TARGET_TYPE_X_SCREEN target.  Attributes that cannot 
     109 * take an NV_CTRL_TARGET_TYPE_X_SCREEN also cannot be queried/set through 
     110 * XNVCTRLQueryAttribute()/XNVCTRLSetAttribute() (Since these assume 
     111 * an X Screen target). 
     112 */ 
     113 
     114 
     115/* 
     116 * NV_CTRL_FLATPANEL_SCALING - the current flat panel scaling state; 
     117 * possible values are: 
     118 * 
     119 * 0: default (the driver will use whatever state is current) 
     120 * 1: native (the driver will use the panel's scaler, if possible) 
     121 * 2: scaled (the driver will use the GPU's scaler, if possible) 
     122 * 3: centered (the driver will center the image) 
     123 * 4: aspect scaled (scale with the GPU's scaler, but keep the aspect 
     124 *    ratio correct) 
     125 * 
     126 * USAGE NOTE: This attribute has been deprecated in favor of the new 
     127 *             NV_CTRL_FLATPANEL_GPU_SCALING attribute. 
     128 */ 
     129 
     130#define NV_CTRL_FLATPANEL_SCALING                               2  /* RWDG */ 
     131#define NV_CTRL_FLATPANEL_SCALING_DEFAULT                       0 
     132#define NV_CTRL_FLATPANEL_SCALING_NATIVE                        1 
     133#define NV_CTRL_FLATPANEL_SCALING_SCALED                        2 
     134#define NV_CTRL_FLATPANEL_SCALING_CENTERED                      3 
     135#define NV_CTRL_FLATPANEL_SCALING_ASPECT_SCALED                 4 
     136 
     137 
     138/* 
     139 * NV_CTRL_FLATPANEL_DITHERING - the current flat panel dithering 
     140 * state; possible values are: 
     141 * 
     142 * 0: default  (the driver will decide when to dither) 
     143 * 1: enabled  (the driver will always dither when possible) 
     144 * 2: disabled (the driver will never dither) 
     145 * 
     146 * USAGE NOTE: This attribute had been deprecated. 
     147 */ 
     148 
     149#define NV_CTRL_FLATPANEL_DITHERING                             3  /* RWDG */ 
     150#define NV_CTRL_FLATPANEL_DITHERING_DEFAULT                     0 
     151#define NV_CTRL_FLATPANEL_DITHERING_ENABLED                     1 
     152#define NV_CTRL_FLATPANEL_DITHERING_DISABLED                    2 
     153 
     154 
     155/* 
     156 * NV_CTRL_DIGITAL_VIBRANCE - sets the digital vibrance level for the 
     157 * specified display device. 
     158 */ 
     159 
     160#define NV_CTRL_DIGITAL_VIBRANCE                                4  /* RWDG */ 
     161 
     162 
     163/* 
     164 * NV_CTRL_BUS_TYPE - returns the Bus type through which the GPU 
     165 * driving the specified X screen is connected to the computer. 
     166 */ 
     167 
     168#define NV_CTRL_BUS_TYPE                                        5  /* R--G */ 
     169#define NV_CTRL_BUS_TYPE_AGP                                    0 
     170#define NV_CTRL_BUS_TYPE_PCI                                    1 
     171#define NV_CTRL_BUS_TYPE_PCI_EXPRESS                            2 
     172#define NV_CTRL_BUS_TYPE_INTEGRATED                             3 
     173 
     174 
     175/* 
     176 * NV_CTRL_VIDEO_RAM - returns the total amount of memory available 
     177 * to the specified GPU (or the GPU driving the specified X 
     178 * screen).  Note: if the GPU supports TurboCache(TM), the value 
     179 * reported may exceed the amount of video memory installed on the 
     180 * GPU.  The value reported for integrated GPUs may likewise exceed 
     181 * the amount of dedicated system memory set aside by the system 
     182 * BIOS for use by the integrated GPU. 
     183 */ 
     184 
     185#define NV_CTRL_VIDEO_RAM                                       6  /* R--G */ 
     186 
     187 
     188/* 
     189 * NV_CTRL_IRQ - returns the interrupt request line used by the GPU 
     190 * driving the specified X screen. 
     191 */ 
     192 
     193#define NV_CTRL_IRQ                                             7  /* R--G */ 
     194 
     195 
     196/* 
     197 * NV_CTRL_OPERATING_SYSTEM - returns the operating system on which 
     198 * the X server is running. 
     199 */ 
     200 
     201#define NV_CTRL_OPERATING_SYSTEM                                8  /* R--G */ 
     202#define NV_CTRL_OPERATING_SYSTEM_LINUX                          0 
     203#define NV_CTRL_OPERATING_SYSTEM_FREEBSD                        1 
     204#define NV_CTRL_OPERATING_SYSTEM_SUNOS                          2 
     205 
     206 
     207/* 
     208 * NV_CTRL_SYNC_TO_VBLANK - enables sync to vblank for OpenGL clients. 
     209 * This setting is only applied to OpenGL clients that are started 
     210 * after this setting is applied. 
     211 */ 
     212 
     213#define NV_CTRL_SYNC_TO_VBLANK                                  9  /* RW-X */ 
     214#define NV_CTRL_SYNC_TO_VBLANK_OFF                              0 
     215#define NV_CTRL_SYNC_TO_VBLANK_ON                               1 
     216 
     217 
     218/* 
     219 * NV_CTRL_LOG_ANISO - enables anisotropic filtering for OpenGL 
     220 * clients; on some NVIDIA hardware, this can only be enabled or 
     221 * disabled; on other hardware different levels of anisotropic 
     222 * filtering can be specified.  This setting is only applied to OpenGL 
     223 * clients that are started after this setting is applied. 
     224 */ 
     225 
     226#define NV_CTRL_LOG_ANISO                                       10 /* RW-X */ 
     227 
     228 
     229/* 
     230 * NV_CTRL_FSAA_MODE - the FSAA setting for OpenGL clients; possible 
     231 * FSAA modes: 
     232 *  
     233 * NV_CTRL_FSAA_MODE_2x     "2x Bilinear Multisampling" 
     234 * NV_CTRL_FSAA_MODE_2x_5t  "2x Quincunx Multisampling" 
     235 * NV_CTRL_FSAA_MODE_15x15  "1.5 x 1.5 Supersampling" 
     236 * NV_CTRL_FSAA_MODE_2x2    "2 x 2 Supersampling" 
     237 * NV_CTRL_FSAA_MODE_4x     "4x Bilinear Multisampling" 
     238 * NV_CTRL_FSAA_MODE_4x_9t  "4x Gaussian Multisampling" 
     239 * NV_CTRL_FSAA_MODE_8x     "2x Bilinear Multisampling by 4x Supersampling" 
     240 * NV_CTRL_FSAA_MODE_16x    "4x Bilinear Multisampling by 4x Supersampling" 
     241 * NV_CTRL_FSAA_MODE_8xS    "4x Multisampling by 2x Supersampling" 
     242 * 
     243 * This setting is only applied to OpenGL clients that are started 
     244 * after this setting is applied. 
     245 */ 
     246 
     247#define NV_CTRL_FSAA_MODE                                       11 /* RW-X */ 
     248#define NV_CTRL_FSAA_MODE_NONE                                  0 
     249#define NV_CTRL_FSAA_MODE_2x                                    1 
     250#define NV_CTRL_FSAA_MODE_2x_5t                                 2 
     251#define NV_CTRL_FSAA_MODE_15x15                                 3 
     252#define NV_CTRL_FSAA_MODE_2x2                                   4 
     253#define NV_CTRL_FSAA_MODE_4x                                    5 
     254#define NV_CTRL_FSAA_MODE_4x_9t                                 6 
     255#define NV_CTRL_FSAA_MODE_8x                                    7 
     256#define NV_CTRL_FSAA_MODE_16x                                   8 
     257#define NV_CTRL_FSAA_MODE_8xS                                   9 
     258#define NV_CTRL_FSAA_MODE_8xQ                                  10 
     259#define NV_CTRL_FSAA_MODE_16xS                                 11 
     260#define NV_CTRL_FSAA_MODE_16xQ                                 12 
     261#define NV_CTRL_FSAA_MODE_32xS                                 13 
     262#define NV_CTRL_FSAA_MODE_MAX NV_CTRL_FSAA_MODE_32xS 
     263 
     264 
     265/* 
     266 * NV_CTRL_TEXTURE_SHARPEN - enables texture sharpening for OpenGL 
     267 * clients.  This setting is only applied to OpenGL clients that are 
     268 * started after this setting is applied. 
     269 */ 
     270 
     271#define NV_CTRL_TEXTURE_SHARPEN                                 12 /* RW-X */ 
     272#define NV_CTRL_TEXTURE_SHARPEN_OFF                             0 
     273#define NV_CTRL_TEXTURE_SHARPEN_ON                              1 
     274 
     275 
     276/* 
     277 * NV_CTRL_UBB - returns whether UBB is enabled for the specified X 
     278 * screen. 
     279 */ 
     280 
     281#define NV_CTRL_UBB                                             13 /* R-- */ 
     282#define NV_CTRL_UBB_OFF                                         0 
     283#define NV_CTRL_UBB_ON                                          1 
     284 
     285 
     286/* 
     287 * NV_CTRL_OVERLAY - returns whether the RGB overlay is enabled for 
     288 * the specified X screen. 
     289 */ 
     290 
     291#define NV_CTRL_OVERLAY                                         14 /* R-- */ 
     292#define NV_CTRL_OVERLAY_OFF                                     0 
     293#define NV_CTRL_OVERLAY_ON                                      1 
     294 
     295 
     296/* 
     297 * NV_CTRL_STEREO - returns whether stereo (and what type) is enabled 
     298 * for the specified X screen. 
     299 */ 
     300 
     301#define NV_CTRL_STEREO                                          16 /* R-- */ 
     302#define NV_CTRL_STEREO_OFF                                      0 
     303#define NV_CTRL_STEREO_DDC                                      1 
     304#define NV_CTRL_STEREO_BLUELINE                                 2 
     305#define NV_CTRL_STEREO_DIN                                      3 
     306#define NV_CTRL_STEREO_TWINVIEW                                 4 
     307 
     308 
     309/* 
     310 * NV_CTRL_EMULATE - controls OpenGL software emulation of future 
     311 * NVIDIA GPUs. 
     312 */ 
     313 
     314#define NV_CTRL_EMULATE                                         17 /* RW- */ 
     315#define NV_CTRL_EMULATE_NONE                                    0 
     316 
     317 
     318/* 
     319 * NV_CTRL_TWINVIEW - returns whether TwinView is enabled for the 
     320 * specified X screen. 
     321 */ 
     322 
     323#define NV_CTRL_TWINVIEW                                        18 /* R-- */ 
     324#define NV_CTRL_TWINVIEW_NOT_ENABLED                            0 
     325#define NV_CTRL_TWINVIEW_ENABLED                                1 
     326 
     327 
     328/* 
     329 * NV_CTRL_CONNECTED_DISPLAYS - returns a display mask indicating the last 
     330 * cached state of the display devices connected to the GPU or GPU driving 
     331 * the specified X screen. 
     332 * 
     333 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     334 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     335 */ 
     336 
     337#define NV_CTRL_CONNECTED_DISPLAYS                              19 /* R--G */ 
     338 
     339 
     340/* 
     341 * NV_CTRL_ENABLED_DISPLAYS - returns a display mask indicating what 
     342 * display devices are enabled for use on the specified X screen or 
     343 * GPU. 
     344 * 
     345 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     346 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     347 */ 
     348 
     349#define NV_CTRL_ENABLED_DISPLAYS                                20 /* R--G */ 
     350 
     351/**************************************************************************/ 
     352/* 
     353 * Integer attributes specific to configuring Frame Lock on boards that 
     354 * support it. 
     355 */ 
     356 
     357 
     358/* 
     359 * NV_CTRL_FRAMELOCK - returns whether the underlying GPU supports 
     360 * Frame Lock.  All of the other frame lock attributes are only 
     361 * applicable if NV_CTRL_FRAMELOCK is _SUPPORTED. 
     362 * 
     363 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     364 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     365 */ 
     366 
     367#define NV_CTRL_FRAMELOCK                                       21 /* R--G */ 
     368#define NV_CTRL_FRAMELOCK_NOT_SUPPORTED                         0 
     369#define NV_CTRL_FRAMELOCK_SUPPORTED                             1 
     370 
     371 
     372/* 
     373 * NV_CTRL_FRAMELOCK_MASTER - get/set which display device to use 
     374 * as the frame lock master for the entire sync group.  Note that only 
     375 * one node in the sync group should be configured as the master. 
     376 * 
     377 * This attribute can only be queried through XNVCTRLQueryTargetAttribute() 
     378 * using a NV_CTRL_TARGET_TYPE_GPU target.  This attribute cannot be 
     379 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN. 
     380 */ 
     381 
     382#define NV_CTRL_FRAMELOCK_MASTER                                22 /* RW-G */ 
     383 
     384/* These are deprecated.  NV_CTRL_FRAMELOCK_MASTER now takes and 
     385   returns a display mask as value. */ 
     386#define NV_CTRL_FRAMELOCK_MASTER_FALSE                          0 
     387#define NV_CTRL_FRAMELOCK_MASTER_TRUE                           1 
     388 
     389 
     390/* 
     391 * NV_CTRL_FRAMELOCK_POLARITY - sync either to the rising edge of the 
     392 * frame lock pulse, the falling edge of the frame lock pulse or both. 
     393 * 
     394 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     395 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     396 * target. 
     397 */ 
     398 
     399#define NV_CTRL_FRAMELOCK_POLARITY                              23 /* RW-F */ 
     400#define NV_CTRL_FRAMELOCK_POLARITY_RISING_EDGE                  0x1 
     401#define NV_CTRL_FRAMELOCK_POLARITY_FALLING_EDGE                 0x2 
     402#define NV_CTRL_FRAMELOCK_POLARITY_BOTH_EDGES                   0x3 
     403 
     404 
     405/* 
     406 * NV_CTRL_FRAMELOCK_SYNC_DELAY - delay between the frame lock pulse 
     407 * and the GPU sync.  This value must be multiplied by  
     408 * NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION to determine the sync delay in 
     409 * nanoseconds. 
     410 * 
     411 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     412 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     413 * target. 
     414 * 
     415 * USAGE NODE: NV_CTRL_FRAMELOCK_SYNC_DELAY_MAX and 
     416 *             NV_CTRL_FRAMELOCK_SYNC_DELAY_FACTOR are deprecated. 
     417 *             The Sync Delay _MAX and _FACTOR are different for different 
     418 *             GSync products and so, to be correct, the valid values for 
     419 *             NV_CTRL_FRAMELOCK_SYNC_DELAY must be queried to get the range 
     420 *             of acceptable sync delay values, and  
     421 *             NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION must be queried to 
     422 *             obtain the correct factor. 
     423 */ 
     424 
     425#define NV_CTRL_FRAMELOCK_SYNC_DELAY                            24 /* RW-F */ 
     426#define NV_CTRL_FRAMELOCK_SYNC_DELAY_MAX                        2047 // deprecated 
     427#define NV_CTRL_FRAMELOCK_SYNC_DELAY_FACTOR                     7.81 // deprecated 
     428 
     429 
     430/* 
     431 * NV_CTRL_FRAMELOCK_SYNC_INTERVAL - how many house sync pulses 
     432 * between the frame lock sync generation (0 == sync every house sync); 
     433 * this only applies to the master when receiving house sync. 
     434 * 
     435 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     436 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     437 * target. 
     438 */ 
     439 
     440#define NV_CTRL_FRAMELOCK_SYNC_INTERVAL                         25 /* RW-F */ 
     441 
     442 
     443/* 
     444 * NV_CTRL_FRAMELOCK_PORT0_STATUS - status of the rj45 port0. 
     445 * 
     446 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     447 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     448 * target. 
     449 */ 
     450 
     451#define NV_CTRL_FRAMELOCK_PORT0_STATUS                          26 /* R--F */ 
     452#define NV_CTRL_FRAMELOCK_PORT0_STATUS_INPUT                    0 
     453#define NV_CTRL_FRAMELOCK_PORT0_STATUS_OUTPUT                   1 
     454 
     455 
     456/* 
     457 * NV_CTRL_FRAMELOCK_PORT1_STATUS - status of the rj45 port1. 
     458 * 
     459 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     460 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     461 * target. 
     462 */ 
     463 
     464#define NV_CTRL_FRAMELOCK_PORT1_STATUS                          27 /* R--F */ 
     465#define NV_CTRL_FRAMELOCK_PORT1_STATUS_INPUT                    0 
     466#define NV_CTRL_FRAMELOCK_PORT1_STATUS_OUTPUT                   1 
     467 
     468 
     469/* 
     470 * NV_CTRL_FRAMELOCK_HOUSE_STATUS - returns whether or not the house 
     471 * sync signal was detected on the BNC connector of the frame lock 
     472 * board. 
     473 * 
     474 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     475 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     476 * target. 
     477 */ 
     478 
     479#define NV_CTRL_FRAMELOCK_HOUSE_STATUS                          28 /* R--F */ 
     480#define NV_CTRL_FRAMELOCK_HOUSE_STATUS_NOT_DETECTED             0 
     481#define NV_CTRL_FRAMELOCK_HOUSE_STATUS_DETECTED                 1 
     482 
     483 
     484/* 
     485 * NV_CTRL_FRAMELOCK_SYNC - enable/disable the syncing of display 
     486 * devices to the frame lock pulse as specified by previous calls to 
     487 * NV_CTRL_FRAMELOCK_MASTER and NV_CTRL_FRAMELOCK_SLAVES. 
     488 * 
     489 * This attribute can only be queried through XNVCTRLQueryTargetAttribute() 
     490 * using a NV_CTRL_TARGET_TYPE_GPU target.  This attribute cannot be 
     491 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN. 
     492 */ 
     493 
     494#define NV_CTRL_FRAMELOCK_SYNC                                  29 /* RW-G */ 
     495#define NV_CTRL_FRAMELOCK_SYNC_DISABLE                          0 
     496#define NV_CTRL_FRAMELOCK_SYNC_ENABLE                           1 
     497 
     498 
     499/* 
     500 * NV_CTRL_FRAMELOCK_SYNC_READY - reports whether a slave frame lock 
     501 * board is receiving sync (regardless of whether or not any display 
     502 * devices are using the sync). 
     503 * 
     504 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     505 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     506 * target. 
     507 */ 
     508 
     509#define NV_CTRL_FRAMELOCK_SYNC_READY                            30 /* R--F */ 
     510#define NV_CTRL_FRAMELOCK_SYNC_READY_FALSE                      0 
     511#define NV_CTRL_FRAMELOCK_SYNC_READY_TRUE                       1 
     512 
     513 
     514/* 
     515 * NV_CTRL_FRAMELOCK_STEREO_SYNC - this indicates that the GPU stereo 
     516 * signal is in sync with the frame lock stereo signal. 
     517 * 
     518 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     519 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN 
     520 * target. 
     521 */ 
     522 
     523#define NV_CTRL_FRAMELOCK_STEREO_SYNC                           31 /* R--G */ 
     524#define NV_CTRL_FRAMELOCK_STEREO_SYNC_FALSE                     0 
     525#define NV_CTRL_FRAMELOCK_STEREO_SYNC_TRUE                      1 
     526 
     527 
     528/* 
     529 * NV_CTRL_FRAMELOCK_TEST_SIGNAL - to test the connections in the sync 
     530 * group, tell the master to enable a test signal, then query port[01] 
     531 * status and sync_ready on all slaves.  When done, tell the master to 
     532 * disable the test signal.  Test signal should only be manipulated 
     533 * while NV_CTRL_FRAMELOCK_SYNC is enabled. 
     534 * 
     535 * The TEST_SIGNAL is also used to reset the Universal Frame Count (as 
     536 * returned by the glXQueryFrameCountNV() function in the 
     537 * GLX_NV_swap_group extension).  Note: for best accuracy of the 
     538 * Universal Frame Count, it is recommended to toggle the TEST_SIGNAL 
     539 * on and off after enabling frame lock. 
     540 * 
     541 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     542 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     543 */ 
     544 
     545#define NV_CTRL_FRAMELOCK_TEST_SIGNAL                           32 /* RW-G */ 
     546#define NV_CTRL_FRAMELOCK_TEST_SIGNAL_DISABLE                   0 
     547#define NV_CTRL_FRAMELOCK_TEST_SIGNAL_ENABLE                    1 
     548 
     549 
     550/* 
     551 * NV_CTRL_FRAMELOCK_ETHERNET_DETECTED - The frame lock boards are 
     552 * cabled together using regular cat5 cable, connecting to rj45 ports 
     553 * on the backplane of the card.  There is some concern that users may 
     554 * think these are ethernet ports and connect them to a 
     555 * router/hub/etc.  The hardware can detect this and will shut off to 
     556 * prevent damage (either to itself or to the router). 
     557 * NV_CTRL_FRAMELOCK_ETHERNET_DETECTED may be called to find out if 
     558 * ethernet is connected to one of the rj45 ports.  An appropriate 
     559 * error message should then be displayed.  The _PORT0 and _PORT1 
     560 * values may be or'ed together. 
     561 * 
     562 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     563 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     564 * target. 
     565 */ 
     566 
     567#define NV_CTRL_FRAMELOCK_ETHERNET_DETECTED                     33 /* R--F */ 
     568#define NV_CTRL_FRAMELOCK_ETHERNET_DETECTED_NONE                0 
     569#define NV_CTRL_FRAMELOCK_ETHERNET_DETECTED_PORT0               0x1 
     570#define NV_CTRL_FRAMELOCK_ETHERNET_DETECTED_PORT1               0x2 
     571 
     572 
     573/* 
     574 * NV_CTRL_FRAMELOCK_VIDEO_MODE - get/set what video mode is used 
     575 * to interperate the house sync signal.  This should only be set 
     576 * on the master. 
     577 * 
     578 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     579 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     580 * target. 
     581 */ 
     582 
     583#define NV_CTRL_FRAMELOCK_VIDEO_MODE                            34 /* RW-F */ 
     584#define NV_CTRL_FRAMELOCK_VIDEO_MODE_NONE                       0 
     585#define NV_CTRL_FRAMELOCK_VIDEO_MODE_TTL                        1 
     586#define NV_CTRL_FRAMELOCK_VIDEO_MODE_NTSCPALSECAM               2 
     587#define NV_CTRL_FRAMELOCK_VIDEO_MODE_HDTV                       3 
     588 
     589/* 
     590 * During FRAMELOCK bring-up, the above values were redefined to 
     591 * these: 
     592 */ 
     593 
     594#define NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_AUTO             0 
     595#define NV_CTRL_FRAMELOCK_VIDEO_MODE_TTL                        1 
     596#define NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_BI_LEVEL         2 
     597#define NV_CTRL_FRAMELOCK_VIDEO_MODE_COMPOSITE_TRI_LEVEL        3 
     598 
     599 
     600/* 
     601 * NV_CTRL_FRAMELOCK_SYNC_RATE - this is the refresh rate that the 
     602 * frame lock board is sending to the GPU, in milliHz. 
     603 * 
     604 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     605 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     606 * target. 
     607 */ 
     608 
     609#define NV_CTRL_FRAMELOCK_SYNC_RATE                             35 /* R--F */ 
     610 
     611 
     612 
     613/**************************************************************************/ 
     614 
     615/* 
     616 * NV_CTRL_FORCE_GENERIC_CPU - inhibit the use of CPU specific 
     617 * features such as MMX, SSE, or 3DNOW! for OpenGL clients; this 
     618 * option may result in performance loss, but may be useful in 
     619 * conjunction with software such as the Valgrind memory debugger. 
     620 * This setting is only applied to OpenGL clients that are started 
     621 * after this setting is applied. 
     622 * 
     623 * USAGE NOTE: This attribute is deprecated. CPU compatibility is now 
     624 *             checked each time during initialization. 
     625 */ 
     626 
     627#define NV_CTRL_FORCE_GENERIC_CPU                               37 /* RW-X */ 
     628#define NV_CTRL_FORCE_GENERIC_CPU_DISABLE                        0 
     629#define NV_CTRL_FORCE_GENERIC_CPU_ENABLE                         1 
     630 
     631 
     632/* 
     633 * NV_CTRL_OPENGL_AA_LINE_GAMMA - for OpenGL clients, allow 
     634 * Gamma-corrected antialiased lines to consider variances in the 
     635 * color display capabilities of output devices when rendering smooth 
     636 * lines.  Only available on recent Quadro GPUs.  This setting is only 
     637 * applied to OpenGL clients that are started after this setting is 
     638 * applied. 
     639 */ 
     640 
     641#define NV_CTRL_OPENGL_AA_LINE_GAMMA                            38 /* RW-X */ 
     642#define NV_CTRL_OPENGL_AA_LINE_GAMMA_DISABLE                     0 
     643#define NV_CTRL_OPENGL_AA_LINE_GAMMA_ENABLE                      1 
     644 
     645 
     646/* 
     647 * NV_CTRL_FRAMELOCK_TIMING - this is TRUE when the gpu is both receiving 
     648 * and locked to an input timing signal. Timing information may come from 
     649 * the following places: Another frame lock device that is set to master,  
     650 * the house sync signal, or the GPU's internal timing from a display 
     651 * device. 
     652 * 
     653 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     654 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     655 */ 
     656 
     657#define NV_CTRL_FRAMELOCK_TIMING                                39 /* R--G */ 
     658#define NV_CTRL_FRAMELOCK_TIMING_FALSE                           0 
     659#define NV_CTRL_FRAMELOCK_TIMING_TRUE                            1 
     660 
     661/* 
     662 * NV_CTRL_FLIPPING_ALLOWED - when TRUE, OpenGL will swap by flipping 
     663 * when possible; when FALSE, OpenGL will alway swap by blitting.  XXX 
     664 * can this be enabled dynamically? 
     665 */ 
     666 
     667#define NV_CTRL_FLIPPING_ALLOWED                                40 /* RW-X */ 
     668#define NV_CTRL_FLIPPING_ALLOWED_FALSE                           0 
     669#define NV_CTRL_FLIPPING_ALLOWED_TRUE                            1 
     670 
     671/* 
     672 * NV_CTRL_ARCHITECTURE - returns the architecture on which the X server is 
     673 * running. 
     674 */ 
     675 
     676#define NV_CTRL_ARCHITECTURE                                    41  /* R-- */ 
     677#define NV_CTRL_ARCHITECTURE_X86                                 0 
     678#define NV_CTRL_ARCHITECTURE_X86_64                              1 
     679#define NV_CTRL_ARCHITECTURE_IA64                                2 
     680 
     681 
     682/* 
     683 * NV_CTRL_TEXTURE_CLAMPING - texture clamping mode in OpenGL.  By 
     684 * default, NVIDIA's OpenGL implementation uses CLAMP_TO_EDGE, which 
     685 * is not strictly conformant, but some applications rely on the 
     686 * non-conformant behavior, and not all GPUs support conformant 
     687 * texture clamping in hardware.  _SPEC forces OpenGL texture clamping 
     688 * to be conformant, but may introduce slower performance on older 
     689 * GPUS, or incorrect texture clamping in certain applications. 
     690 */ 
     691 
     692#define NV_CTRL_TEXTURE_CLAMPING                                42  /* RW-X */ 
     693#define NV_CTRL_TEXTURE_CLAMPING_EDGE                            0 
     694#define NV_CTRL_TEXTURE_CLAMPING_SPEC                            1 
     695 
     696 
     697 
     698#define NV_CTRL_CURSOR_SHADOW                                   43  /* RW- */ 
     699#define NV_CTRL_CURSOR_SHADOW_DISABLE                            0 
     700#define NV_CTRL_CURSOR_SHADOW_ENABLE                             1 
     701 
     702#define NV_CTRL_CURSOR_SHADOW_ALPHA                             44  /* RW- */ 
     703#define NV_CTRL_CURSOR_SHADOW_RED                               45  /* RW- */ 
     704#define NV_CTRL_CURSOR_SHADOW_GREEN                             46  /* RW- */ 
     705#define NV_CTRL_CURSOR_SHADOW_BLUE                              47  /* RW- */ 
     706 
     707#define NV_CTRL_CURSOR_SHADOW_X_OFFSET                          48  /* RW- */ 
     708#define NV_CTRL_CURSOR_SHADOW_Y_OFFSET                          49  /* RW- */ 
     709 
     710 
     711 
     712/* 
     713 * When Application Control for FSAA is enabled, then what the 
     714 * application requests is used, and NV_CTRL_FSAA_MODE is ignored.  If 
     715 * this is disabled, then any application setting is overridden with 
     716 * NV_CTRL_FSAA_MODE 
     717 */ 
     718 
     719#define NV_CTRL_FSAA_APPLICATION_CONTROLLED                     50  /* RW-X */ 
     720#define NV_CTRL_FSAA_APPLICATION_CONTROLLED_ENABLED              1 
     721#define NV_CTRL_FSAA_APPLICATION_CONTROLLED_DISABLED             0 
     722 
     723 
     724/* 
     725 * When Application Control for LogAniso is enabled, then what the 
     726 * application requests is used, and NV_CTRL_LOG_ANISO is ignored.  If 
     727 * this is disabled, then any application setting is overridden with 
     728 * NV_CTRL_LOG_ANISO 
     729 */ 
     730 
     731#define NV_CTRL_LOG_ANISO_APPLICATION_CONTROLLED                51  /* RW-X */ 
     732#define NV_CTRL_LOG_ANISO_APPLICATION_CONTROLLED_ENABLED         1 
     733#define NV_CTRL_LOG_ANISO_APPLICATION_CONTROLLED_DISABLED        0 
     734 
     735 
     736/* 
     737 * IMAGE_SHARPENING adjusts the sharpness of the display's image 
     738 * quality by amplifying high frequency content.  Valid values will 
     739 * normally be in the range [0,32).  Only available on GeForceFX or 
     740 * newer. 
     741 */ 
     742 
     743#define NV_CTRL_IMAGE_SHARPENING                                52  /* RWDG */ 
     744 
     745 
     746/* 
     747 * NV_CTRL_TV_OVERSCAN adjusts the amount of overscan on the specified 
     748 * display device. 
     749 */ 
     750 
     751#define NV_CTRL_TV_OVERSCAN                                     53  /* RWDG */ 
     752 
     753 
     754/* 
     755 * NV_CTRL_TV_FLICKER_FILTER adjusts the amount of flicker filter on 
     756 * the specified display device. 
     757 */ 
     758 
     759#define NV_CTRL_TV_FLICKER_FILTER                               54  /* RWDG */ 
     760 
     761 
     762/* 
     763 * NV_CTRL_TV_BRIGHTNESS adjusts the amount of brightness on the 
     764 * specified display device. 
     765 */ 
     766 
     767#define NV_CTRL_TV_BRIGHTNESS                                   55  /* RWDG */ 
     768 
     769 
     770/* 
     771 * NV_CTRL_TV_HUE adjusts the amount of hue on the specified display 
     772 * device. 
     773 */ 
     774 
     775#define NV_CTRL_TV_HUE                                          56  /* RWDG */ 
     776 
     777 
     778/* 
     779 * NV_CTRL_TV_CONTRAST adjusts the amount of contrast on the specified 
     780 * display device. 
     781 */ 
     782 
     783#define NV_CTRL_TV_CONTRAST                                     57  /* RWDG */ 
     784 
     785 
     786/* 
     787 * NV_CTRL_TV_SATURATION adjusts the amount of saturation on the 
     788 * specified display device. 
     789 */ 
     790 
     791#define NV_CTRL_TV_SATURATION                                   58  /* RWDG */ 
     792 
     793 
     794/* 
     795 * NV_CTRL_TV_RESET_SETTINGS - this write-only attribute can be used 
     796 * to request that all TV Settings be reset to their default values; 
     797 * typical usage would be that this attribute be sent, and then all 
     798 * the TV attributes be queried to retrieve their new values. 
     799 */ 
     800 
     801#define NV_CTRL_TV_RESET_SETTINGS                               59  /* -WDG */ 
     802 
     803 
     804/* 
     805 * NV_CTRL_GPU_CORE_TEMPERATURE reports the current core temperature 
     806 * of the GPU driving the X screen. 
     807 */ 
     808 
     809#define NV_CTRL_GPU_CORE_TEMPERATURE                            60  /* R--G */ 
     810 
     811 
     812/* 
     813 * NV_CTRL_GPU_CORE_THRESHOLD reports the current GPU core slowdown 
     814 * threshold temperature, NV_CTRL_GPU_DEFAULT_CORE_THRESHOLD and 
     815 * NV_CTRL_GPU_MAX_CORE_THRESHOLD report the default and MAX core 
     816 * slowdown threshold temperatures. 
     817 * 
     818 * NV_CTRL_GPU_CORE_THRESHOLD reflects the temperature at which the 
     819 * GPU is throttled to prevent overheating. 
     820 */ 
     821 
     822#define NV_CTRL_GPU_CORE_THRESHOLD                              61  /* R--G */ 
     823#define NV_CTRL_GPU_DEFAULT_CORE_THRESHOLD                      62  /* R--G */ 
     824#define NV_CTRL_GPU_MAX_CORE_THRESHOLD                          63  /* R--G */ 
     825 
     826 
     827/* 
     828 * NV_CTRL_AMBIENT_TEMPERATURE reports the current temperature in the 
     829 * immediate neighbourhood of the GPU driving the X screen. 
     830 */ 
     831 
     832#define NV_CTRL_AMBIENT_TEMPERATURE                             64  /* R--G */ 
     833 
     834 
     835/* 
     836 * NV_CTRL_PBUFFER_SCANOUT_SUPPORTED - returns whether this X screen 
     837 * supports scanout of FP pbuffers; 
     838 *  
     839 * if this screen does not support PBUFFER_SCANOUT, then all other 
     840 * PBUFFER_SCANOUT attributes are unavailable. 
     841 * 
     842 * PBUFFER_SCANOUT is supported if and only if: 
     843 * - Twinview is configured with clone mode.  The secondary screen is used to  
     844 *   scanout the pbuffer.   
     845 * - The desktop is running in with 16 bits per pixel. 
     846 */ 
     847#define NV_CTRL_PBUFFER_SCANOUT_SUPPORTED                       65  /* R-- */ 
     848#define NV_CTRL_PBUFFER_SCANOUT_FALSE                           0 
     849#define NV_CTRL_PBUFFER_SCANOUT_TRUE                            1 
     850 
     851/* 
     852 * NV_CTRL_PBUFFER_SCANOUT_XID indicates the XID of the pbuffer used for 
     853 * scanout. 
     854 */ 
     855#define NV_CTRL_PBUFFER_SCANOUT_XID                             66  /* RW- */ 
     856 
     857/**************************************************************************/ 
     858/* 
     859 * The NV_CTRL_GVO_* integer attributes are used to configure GVO 
     860 * (Graphics to Video Out).  This functionality is available, for 
     861 * example, on the Quadro FX 4000 SDI graphics board. 
     862 * 
     863 * The following is a typical usage pattern for the GVO attributes: 
     864 * 
     865 * - query NV_CTRL_GVO_SUPPORTED to determine if the X screen supports GV0. 
     866 * 
     867 * - specify NV_CTRL_GVO_SYNC_MODE (one of FREE_RUNNING, GENLOCK, or 
     868 * FRAMELOCK); if you specify GENLOCK or FRAMELOCK, you should also 
     869 * specify NV_CTRL_GVO_SYNC_SOURCE. 
     870 *  
     871 * - Use NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED and 
     872 * NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED to detect what input syncs are 
     873 * present. 
     874 *  
     875 * (If no analog sync is detected but it is known that a valid 
     876 * bi-level or tri-level sync is connected set 
     877 * NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE appropriately and 
     878 * retest with NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED). 
     879 * 
     880 * - if syncing to input sync, query the 
     881 * NV_CTRL_GVO_INPUT_VIDEO_FORMAT attribute; note that Input video 
     882 * format can only be queried after SYNC_SOURCE is specified. 
     883 * 
     884 * - specify the NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT 
     885 * 
     886 * - specify the NV_CTRL_GVO_DATA_FORMAT 
     887 * 
     888 * - specify any custom Color Space Conversion (CSC) matrix, offset, 
     889 * and scale with XNVCTRLSetGvoColorConversion(). 
     890 * 
     891 * - if using the GLX_NV_video_out extension to display one or more 
     892 * pbuffers, call glXGetVideoDeviceNV() to lock the GVO output for use 
     893 * by the GLX client; then bind the pbuffer(s) to the GVO output with 
     894 * glXBindVideoImageNV() and send pbuffers to the GVO output with 
     895 * glXSendPbufferToVideoNV(); see the GLX_NV_video_out spec for more 
     896 * details. 
     897 * 
     898 * - if, rather than using the GLX_NV_video_out extension to display 
     899 * GLX pbuffers on the GVO output, you wish display the X screen on 
     900 * the GVO output, set NV_CTRL_GVO_DISPLAY_X_SCREEN to 
     901 * NV_CTRL_GVO_DISPLAY_X_SCREEN_ENABLE. 
     902 * 
     903 * Note that setting most GVO attributes only causes the value to be 
     904 * cached in the X server.  The values will be flushed to the hardware 
     905 * either when NV_CTRL_GVO_DISPLAY_X_SCREEN is enabled, or when a GLX 
     906 * pbuffer is bound to the GVO output (with glXBindVideoImageNV()). 
     907 * 
     908 * Note that GLX_NV_video_out and NV_CTRL_GVO_DISPLAY_X_SCREEN are 
     909 * mutually exclusive.  If NV_CTRL_GVO_DISPLAY_X_SCREEN is enabled, 
     910 * then glXGetVideoDeviceNV will fail.  Similarly, if a GLX client has 
     911 * locked the GVO output (via glXGetVideoDeviceNV), then 
     912 * NV_CTRL_GVO_DISPLAY_X_SCREEN will fail.  The NV_CTRL_GVO_GLX_LOCKED 
     913 * event will be sent when a GLX client locks the GVO output. 
     914 * 
     915 */ 
     916 
     917 
     918/* 
     919 * NV_CTRL_GVO_SUPPORTED - returns whether this X screen supports GVO; 
     920 * if this screen does not support GVO output, then all other GVO 
     921 * attributes are unavailable. 
     922 */ 
     923 
     924#define NV_CTRL_GVO_SUPPORTED                                   67  /* R-- */ 
     925#define NV_CTRL_GVO_SUPPORTED_FALSE                             0 
     926#define NV_CTRL_GVO_SUPPORTED_TRUE                              1 
     927 
     928 
     929/* 
     930 * NV_CTRL_GVO_SYNC_MODE - selects the GVO sync mode; possible values 
     931 * are: 
     932 * 
     933 * FREE_RUNNING - GVO does not sync to any external signal 
     934 * 
     935 * GENLOCK - the GVO output is genlocked to an incoming sync signal; 
     936 * genlocking locks at hsync.  This requires that the output video 
     937 * format exactly match the incoming sync video format. 
     938 * 
     939 * FRAMELOCK - the GVO output is frame locked to an incoming sync 
     940 * signal; frame locking locks at vsync.  This requires that the output 
     941 * video format have the same refresh rate as the incoming sync video 
     942 * format. 
     943 */ 
     944 
     945#define NV_CTRL_GVO_SYNC_MODE                                   68  /* RW- */ 
     946#define NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING                      0 
     947#define NV_CTRL_GVO_SYNC_MODE_GENLOCK                           1 
     948#define NV_CTRL_GVO_SYNC_MODE_FRAMELOCK                         2 
     949 
     950 
     951/* 
     952 * NV_CTRL_GVO_SYNC_SOURCE - if NV_CTRL_GVO_SYNC_MODE is set to either 
     953 * GENLOCK or FRAMELOCK, this controls which sync source is used as 
     954 * the incoming sync signal (either Composite or SDI).  If 
     955 * NV_CTRL_GVO_SYNC_MODE is FREE_RUNNING, this attribute has no 
     956 * effect. 
     957 */ 
     958 
     959#define NV_CTRL_GVO_SYNC_SOURCE                                 69  /* RW- */ 
     960#define NV_CTRL_GVO_SYNC_SOURCE_COMPOSITE                       0 
     961#define NV_CTRL_GVO_SYNC_SOURCE_SDI                             1 
     962 
     963 
     964/* 
     965 * NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT - specifies the output video 
     966 * format.  Note that the valid video formats will vary depending on 
     967 * the NV_CTRL_GVO_SYNC_MODE and the incoming sync video format.  See 
     968 * the definition of NV_CTRL_GVO_SYNC_MODE. 
     969 * 
     970 * Note that when querying the ValidValues for this data type, the 
     971 * values are reported as bits within a bitmask 
     972 * (ATTRIBUTE_TYPE_INT_BITS); unfortunately, there are more valid 
     973 * value bits than will fit in a single 32-bit value.  To solve this, 
     974 * query the ValidValues for NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT to check 
     975 * which of the first 31 VIDEO_FORMATS are valid, then query the 
     976 * ValidValues for NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT2 to check which of 
     977 * the VIDEO_FORMATS with value 32 and higher are valid. 
     978 */ 
     979 
     980#define NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT                         70  /* RW- */ 
     981 
     982#define NV_CTRL_GVO_VIDEO_FORMAT_NONE                           0 
     983#define NV_CTRL_GVO_VIDEO_FORMAT_480I_59_94_SMPTE259_NTSC       1 //deprecated 
     984#define NV_CTRL_GVO_VIDEO_FORMAT_487I_59_94_SMPTE259_NTSC       1 
     985#define NV_CTRL_GVO_VIDEO_FORMAT_576I_50_00_SMPTE259_PAL        2 
     986#define NV_CTRL_GVO_VIDEO_FORMAT_720P_59_94_SMPTE296            3 
     987#define NV_CTRL_GVO_VIDEO_FORMAT_720P_60_00_SMPTE296            4 
     988#define NV_CTRL_GVO_VIDEO_FORMAT_1035I_59_94_SMPTE260           5 
     989#define NV_CTRL_GVO_VIDEO_FORMAT_1035I_60_00_SMPTE260           6 
     990#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_50_00_SMPTE295           7 
     991#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_50_00_SMPTE274           8 
     992#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_59_94_SMPTE274           9 
     993#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_60_00_SMPTE274           10 
     994#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_23_976_SMPTE274          11 
     995#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_24_00_SMPTE274           12 
     996#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_25_00_SMPTE274           13 
     997#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_29_97_SMPTE274           14 
     998#define NV_CTRL_GVO_VIDEO_FORMAT_1080P_30_00_SMPTE274           15 
     999#define NV_CTRL_GVO_VIDEO_FORMAT_720P_50_00_SMPTE296            16 
     1000#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_24_00_SMPTE274           17 //deprecated 
     1001#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_48_00_SMPTE274           17 
     1002#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_23_98_SMPTE274           18 //deprecated 
     1003#define NV_CTRL_GVO_VIDEO_FORMAT_1080I_47_96_SMPTE274           18 
     1004#define NV_CTRL_GVO_VIDEO_FORMAT_720P_30_00_SMPTE296            19  
     1005#define NV_CTRL_GVO_VIDEO_FORMAT_720P_29_97_SMPTE296            20   
     1006#define NV_CTRL_GVO_VIDEO_FORMAT_720P_25_00_SMPTE296            21  
     1007#define NV_CTRL_GVO_VIDEO_FORMAT_720P_24_00_SMPTE296            22  
     1008#define NV_CTRL_GVO_VIDEO_FORMAT_720P_23_98_SMPTE296            23   
     1009#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_25_00_SMPTE274         24 
     1010#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_29_97_SMPTE274         25 
     1011#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_30_00_SMPTE274         26 
     1012#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_24_00_SMPTE274         27 
     1013#define NV_CTRL_GVO_VIDEO_FORMAT_1080PSF_23_98_SMPTE274         28 
     1014#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_30_00_SMPTE372           29 
     1015#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_29_97_SMPTE372           30 
     1016#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_60_00_SMPTE372           31 
     1017#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_59_94_SMPTE372           32 
     1018#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_25_00_SMPTE372           33 
     1019#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_50_00_SMPTE372           34 
     1020#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_24_00_SMPTE372           35 
     1021#define NV_CTRL_GVO_VIDEO_FORMAT_2048P_23_98_SMPTE372           36 
     1022#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_48_00_SMPTE372           37 
     1023#define NV_CTRL_GVO_VIDEO_FORMAT_2048I_47_96_SMPTE372           38 
     1024 
     1025/* 
     1026 * NV_CTRL_GVO_INPUT_VIDEO_FORMAT - indicates the input video format 
     1027 * detected; the possible values are the NV_CTRL_GVO_VIDEO_FORMAT 
     1028 * constants. 
     1029 */ 
     1030 
     1031#define NV_CTRL_GVO_INPUT_VIDEO_FORMAT                          71  /* R-- */ 
     1032 
     1033 
     1034/* 
     1035 * NV_CTRL_GVO_DATA_FORMAT - This controls how the data in the source 
     1036 * (either the X screen or the GLX pbuffer) is interpretted and 
     1037 * displayed. 
     1038 * 
     1039 * Note: some of the below DATA_FORMATS have been renamed.  For 
     1040 * example, R8G8B8_TO_RGB444 has been renamed to X8X8X8_444_PASSTHRU. 
     1041 * This is to more accurately reflect DATA_FORMATS where the 
     1042 * per-channel data could be either RGB or YCrCb -- the point is that 
     1043 * the driver and GVO hardware do not perform any implicit color space 
     1044 * conversion on the data; it is passed through to the SDI out. 
     1045 */ 
     1046 
     1047#define NV_CTRL_GVO_DATA_FORMAT                                 72  /* RW- */ 
     1048#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_YCRCB444              0 
     1049#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8A8_TO_YCRCBA4444          1 
     1050#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8Z10_TO_YCRCBZ4444         2 
     1051#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_YCRCB422              3 
     1052#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8A8_TO_YCRCBA4224          4 
     1053#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8Z10_TO_YCRCBZ4224         5 
     1054#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_RGB444                6 // renamed 
     1055#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8_444_PASSTHRU             6 
     1056#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8A8_TO_RGBA4444            7 // renamed 
     1057#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8A8_4444_PASSTHRU          7 
     1058#define NV_CTRL_GVO_DATA_FORMAT_R8G8B8Z10_TO_RGBZ4444           8 // renamed 
     1059#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8Z8_4444_PASSTHRU          8 
     1060#define NV_CTRL_GVO_DATA_FORMAT_Y10CR10CB10_TO_YCRCB444         9 // renamed 
     1061#define NV_CTRL_GVO_DATA_FORMAT_X10X10X10_444_PASSTHRU          9 
     1062#define NV_CTRL_GVO_DATA_FORMAT_Y10CR8CB8_TO_YCRCB444           10 // renamed 
     1063#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8_444_PASSTHRU            10 
     1064#define NV_CTRL_GVO_DATA_FORMAT_Y10CR8CB8A10_TO_YCRCBA4444      11 // renamed 
     1065#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8A10_4444_PASSTHRU        11 
     1066#define NV_CTRL_GVO_DATA_FORMAT_Y10CR8CB8Z10_TO_YCRCBZ4444      12 // renamed 
     1067#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8Z10_4444_PASSTHRU        12 
     1068#define NV_CTRL_GVO_DATA_FORMAT_DUAL_R8G8B8_TO_DUAL_YCRCB422    13 
     1069#define NV_CTRL_GVO_DATA_FORMAT_DUAL_Y8CR8CB8_TO_DUAL_YCRCB422  14 // renamed 
     1070#define NV_CTRL_GVO_DATA_FORMAT_DUAL_X8X8X8_TO_DUAL_422_PASSTHRU 14 
     1071#define NV_CTRL_GVO_DATA_FORMAT_R10G10B10_TO_YCRCB422           15 
     1072#define NV_CTRL_GVO_DATA_FORMAT_R10G10B10_TO_YCRCB444           16 
     1073#define NV_CTRL_GVO_DATA_FORMAT_Y12CR12CB12_TO_YCRCB444         17 // renamed 
     1074#define NV_CTRL_GVO_DATA_FORMAT_X12X12X12_444_PASSTHRU          17 
     1075#define NV_CTRL_GVO_DATA_FORMAT_R12G12B12_TO_YCRCB444           18 
     1076#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8_422_PASSTHRU             19 
     1077#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8A8_4224_PASSTHRU          20 
     1078#define NV_CTRL_GVO_DATA_FORMAT_X8X8X8Z8_4224_PASSTHRU          21 
     1079#define NV_CTRL_GVO_DATA_FORMAT_X10X10X10_422_PASSTHRU          22 
     1080#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8_422_PASSTHRU            23 
     1081#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8A10_4224_PASSTHRU        24 
     1082#define NV_CTRL_GVO_DATA_FORMAT_X10X8X8Z10_4224_PASSTHRU        25 
     1083#define NV_CTRL_GVO_DATA_FORMAT_X12X12X12_422_PASSTHRU          26 
     1084#define NV_CTRL_GVO_DATA_FORMAT_R12G12B12_TO_YCRCB422           27 
     1085 
     1086/* 
     1087 * NV_CTRL_GVO_DISPLAY_X_SCREEN - enable/disable GVO output of the X 
     1088 * screen (in Clone mode).  At this point, all the GVO attributes that 
     1089 * have been cached in the X server are flushed to the hardware and GVO is 
     1090 * enabled.  Note that this attribute can fail to be set if a GLX 
     1091 * client has locked the GVO output (via glXGetVideoDeviceNV).  Note 
     1092 * that due to the inherit race conditions in this locking strategy, 
     1093 * NV_CTRL_GVO_DISPLAY_X_SCREEN can fail unexpectantly.  In the 
     1094 * failing situation, X will not return an X error.  Instead, you 
     1095 * should query the value of NV_CTRL_GVO_DISPLAY_X_SCREEN after 
     1096 * setting it to confirm that the setting was applied. 
     1097 * 
     1098 * NOTE: This attribute is related to the NV_CTRL_GVO_LOCK_OWNER 
     1099 *       attribute.  When NV_CTRL_GVO_DISPLAY_X_SCREEN is enabled, 
     1100 *       the GVO device will be locked by NV_CTRL_GVO_LOCK_OWNER_CLONE. 
     1101 *       see NV_CTRL_GVO_LOCK_OWNER for detais. 
     1102 */ 
     1103 
     1104#define NV_CTRL_GVO_DISPLAY_X_SCREEN                            73  /* RW- */ 
     1105#define NV_CTRL_GVO_DISPLAY_X_SCREEN_ENABLE                     1 
     1106#define NV_CTRL_GVO_DISPLAY_X_SCREEN_DISABLE                    0 
     1107 
     1108 
     1109/* 
     1110 * NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED - indicates whether 
     1111 * Composite Sync input is detected. 
     1112 */ 
     1113 
     1114#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED               74  /* R-- */ 
     1115#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED_FALSE         0 
     1116#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED_TRUE          1 
     1117 
     1118 
     1119/* 
     1120 * NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE - get/set the 
     1121 * Composite Sync input detect mode. 
     1122 */ 
     1123 
     1124#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE            75  /* RW- */ 
     1125#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE_AUTO       0 
     1126#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE_BI_LEVEL   1 
     1127#define NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE_TRI_LEVEL  2 
     1128 
     1129 
     1130/* 
     1131 * NV_CTRL_GVO_SYNC_INPUT_DETECTED - indicates whether SDI Sync input 
     1132 * is detected, and what type. 
     1133 */ 
     1134 
     1135#define NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED                     76  /* R-- */ 
     1136#define NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_NONE                0 
     1137#define NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_HD                  1 
     1138#define NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_SD                  2 
     1139 
     1140 
     1141/* 
     1142 * NV_CTRL_GVO_VIDEO_OUTPUTS - indicates which GVO video output 
     1143 * connectors are currently outputing data. 
     1144 */ 
     1145 
     1146#define NV_CTRL_GVO_VIDEO_OUTPUTS                               77  /* R-- */ 
     1147#define NV_CTRL_GVO_VIDEO_OUTPUTS_NONE                          0 
     1148#define NV_CTRL_GVO_VIDEO_OUTPUTS_VIDEO1                        1 
     1149#define NV_CTRL_GVO_VIDEO_OUTPUTS_VIDEO2                        2 
     1150#define NV_CTRL_GVO_VIDEO_OUTPUTS_VIDEO_BOTH                    3 
     1151 
     1152 
     1153/* 
     1154 * NV_CTRL_GVO_FPGA_VERSION - indicates the version of the Firmware on 
     1155 * the GVO device.  Deprecated; use 
     1156 * NV_CTRL_STRING_GVO_FIRMWARE_VERSION instead. 
     1157 */ 
     1158 
     1159#define NV_CTRL_GVO_FIRMWARE_VERSION                            78  /* R-- */ 
     1160 
     1161 
     1162/* 
     1163 * NV_CTRL_GVO_SYNC_DELAY_PIXELS - controls the delay between the 
     1164 * input sync and the output sync in numbers of pixels from hsync; 
     1165 * this is a 12 bit value. 
     1166 * 
     1167 * If the NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW bit is set, 
     1168 * then setting this value will set an advance instead of a delay. 
     1169 */ 
     1170 
     1171#define NV_CTRL_GVO_SYNC_DELAY_PIXELS                           79  /* RW- */ 
     1172 
     1173 
     1174/* 
     1175 * NV_CTRL_GVO_SYNC_DELAY_LINES - controls the delay between the input 
     1176 * sync and the output sync in numbers of lines from vsync; this is a 
     1177 * 12 bit value. 
     1178 * 
     1179 * If the NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW bit is set, 
     1180 * then setting this value will set an advance instead of a delay. 
     1181 */ 
     1182 
     1183#define NV_CTRL_GVO_SYNC_DELAY_LINES                            80  /* RW- */ 
     1184 
     1185 
     1186/* 
     1187 * NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE - must be set for a period 
     1188 * of about 2 seconds for the new InputVideoFormat to be properly 
     1189 * locked to.  In nvidia-settings, we do a reacquire whenever genlock 
     1190 * or frame lock mode is entered into, when the user clicks the 
     1191 * "detect" button.  This value can be written, but always reads back 
     1192 * _FALSE. 
     1193 */ 
     1194 
     1195#define NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE                81  /* -W- */ 
     1196#define NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE_FALSE          0 
     1197#define NV_CTRL_GVO_INPUT_VIDEO_FORMAT_REACQUIRE_TRUE           1 
     1198 
     1199 
     1200/* 
     1201 * NV_CTRL_GVO_GLX_LOCKED - indicates that GVO configurability is locked by 
     1202 * GLX;  this occurs when the GLX_NV_video_out function calls 
     1203 * glXGetVideoDeviceNV().  All GVO output resources are locked until 
     1204 * either glXReleaseVideoDeviceNV() is called or the X Display used 
     1205 * when calling glXGetVideoDeviceNV() is closed. 
     1206 * 
     1207 * When GVO is locked, setting of the following GVO NV-CONTROL attributes will 
     1208 * not happen immediately and will instead be cached.  The GVO resource will 
     1209 * need to be disabled/released and re-enabled/claimed for the values to be 
     1210 * flushed. These attributes are: 
     1211 *    NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT 
     1212 *    NV_CTRL_GVO_DATA_FORMAT 
     1213 *    NV_CTRL_GVO_FLIP_QUEUE_SIZE 
     1214 * 
     1215 * XXX This is deprecated, please see NV_CTRL_GVO_LOCK_OWNER 
     1216 */ 
     1217 
     1218#define NV_CTRL_GVO_GLX_LOCKED                                  82  /* R-- */ 
     1219#define NV_CTRL_GVO_GLX_LOCKED_FALSE                            0 
     1220#define NV_CTRL_GVO_GLX_LOCKED_TRUE                             1 
     1221 
     1222 
     1223/* 
     1224 * NV_CTRL_GVO_VIDEO_FORMAT_{WIDTH,HEIGHT,REFRESH_RATE} - query the 
     1225 * width, height, and refresh rate for the specified 
     1226 * NV_CTRL_GVO_VIDEO_FORMAT_*.  So that this can be queried with 
     1227 * existing interfaces, XNVCTRLQueryAttribute() should be used, and 
     1228 * the video format specified in the display_mask field; eg: 
     1229 * 
     1230 * XNVCTRLQueryAttribute (dpy, 
     1231 *                        screen,  
     1232 *                        NV_CTRL_GVO_VIDEO_FORMAT_487I_59_94_SMPTE259_NTSC, 
     1233 *                        NV_CTRL_GVO_VIDEO_FORMAT_WIDTH, 
     1234 *                        &value); 
     1235 * 
     1236 * Note that Refresh Rate is in 1/1000 Hertz values 
     1237 */ 
     1238 
     1239#define NV_CTRL_GVO_VIDEO_FORMAT_WIDTH                          83  /* R-- */ 
     1240#define NV_CTRL_GVO_VIDEO_FORMAT_HEIGHT                         84  /* R-- */ 
     1241#define NV_CTRL_GVO_VIDEO_FORMAT_REFRESH_RATE                   85  /* R-- */ 
     1242 
     1243 
     1244/* 
     1245 * NV_CTRL_GVO_X_SCREEN_PAN_[XY] - when GVO output of the X screen is 
     1246 * enabled, the pan x/y attributes control which portion of the X 
     1247 * screen is displayed by GVO.  These attributes can be updated while 
     1248 * GVO output is enabled, or before enabling GVO output.  The pan 
     1249 * values will be clamped so that GVO output is not panned beyond the 
     1250 * end of the X screen. 
     1251 */ 
     1252 
     1253#define NV_CTRL_GVO_X_SCREEN_PAN_X                              86  /* RW- */ 
     1254#define NV_CTRL_GVO_X_SCREEN_PAN_Y                              87  /* RW- */ 
     1255 
     1256 
     1257/* 
     1258 * NV_CTRL_GPU_OVERCLOCKING_STATE - query the current or set a new 
     1259 * overclocking state; the value of this attribute controls the 
     1260 * availability of additional overclocking attributes (see below). 
     1261 * 
     1262 * Note: this attribute is unavailable unless overclocking support 
     1263 * has been enabled in the X server (by the user). 
     1264 */ 
     1265 
     1266#define NV_CTRL_GPU_OVERCLOCKING_STATE                          88  /* RW-G */ 
     1267#define NV_CTRL_GPU_OVERCLOCKING_STATE_NONE                     0 
     1268#define NV_CTRL_GPU_OVERCLOCKING_STATE_MANUAL                   1 
     1269 
     1270 
     1271/* 
     1272 * NV_CTRL_GPU_{2,3}D_CLOCK_FREQS - query or set the GPU and memory 
     1273 * clocks of the device driving the X screen.  New clock frequencies 
     1274 * are tested before being applied, and may be rejected. 
     1275 * 
     1276 * Note: if the target clocks are too aggressive, their testing may 
     1277 * render the system unresponsive. 
     1278 * 
     1279 * Note: while this attribute can always be queried, it can't be set 
     1280 * unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL.  Since 
     1281 * the target clocks may be rejected, the requester should read this 
     1282 * attribute after the set to determine success or failure. 
     1283 * 
     1284 * NV_CTRL_GPU_{2,3}D_CLOCK_FREQS are "packed" integer attributes; the 
     1285 * GPU clock is stored in the upper 16 bits of the integer, and the 
     1286 * memory clock is stored in the lower 16 bits of the integer.  All 
     1287 * clock values are in MHz. 
     1288 */ 
     1289 
     1290#define NV_CTRL_GPU_2D_CLOCK_FREQS                              89  /* RW-G */ 
     1291#define NV_CTRL_GPU_3D_CLOCK_FREQS                              90  /* RW-G */ 
     1292 
     1293 
     1294/* 
     1295 * NV_CTRL_GPU_DEFAULT_{2,3}D_CLOCK_FREQS - query the default memory 
     1296 * and GPU core clocks of the device driving the X screen. 
     1297 * 
     1298 * NV_CTRL_GPU_DEFAULT_{2,3}D_CLOCK_FREQS are "packed" integer 
     1299 * attributes; the GPU clock is stored in the upper 16 bits of the 
     1300 * integer, and the memory clock is stored in the lower 16 bits of the 
     1301 * integer.  All clock values are in MHz. 
     1302 */ 
     1303 
     1304#define NV_CTRL_GPU_DEFAULT_2D_CLOCK_FREQS                      91  /* R--G */ 
     1305#define NV_CTRL_GPU_DEFAULT_3D_CLOCK_FREQS                      92  /* R--G */ 
     1306 
     1307 
     1308/* 
     1309 * NV_CTRL_GPU_CURRENT_CLOCK_FREQS - query the current GPU and memory 
     1310 * clocks of the graphics device driving the X screen. 
     1311 * 
     1312 * NV_CTRL_GPU_CURRENT_CLOCK_FREQS is a "packed" integer attribute; 
     1313 * the GPU clock is stored in the upper 16 bits of the integer, and 
     1314 * the memory clock is stored in the lower 16 bits of the integer. 
     1315 * All clock values are in MHz.  All clock values are in MHz. 
     1316 */ 
     1317 
     1318#define NV_CTRL_GPU_CURRENT_CLOCK_FREQS                         93  /* R--G */ 
     1319 
     1320 
     1321/* 
     1322 * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS - Holds the last calculated 
     1323 * optimal 3D clock frequencies found by the 
     1324 * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION process.  Querying this 
     1325 * attribute before having probed for the optimal clocks will return 
     1326 * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_INVALID 
     1327 * 
     1328 * Note: unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL, the 
     1329 * optimal clock detection process is unavailable. 
     1330 */ 
     1331 
     1332#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS                         94  /* R--G */ 
     1333#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_INVALID                  0 
     1334 
     1335 
     1336/* 
     1337 * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION - set to _START to 
     1338 * initiate testing for the optimal 3D clock frequencies.  Once 
     1339 * found, the optimal clock frequencies will be returned by the 
     1340 * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS attribute asynchronously 
     1341 * (using an X event, see XNVCtrlSelectNotify). 
     1342 * 
     1343 * To cancel an ongoing test for the optimal clocks, set the 
     1344 * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION attribute to _CANCEL 
     1345 * 
     1346 * Note: unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL, the 
     1347 * optimal clock detection process is unavailable. 
     1348 */ 
     1349 
     1350#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION               95  /* -W-G */ 
     1351#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_START          0 
     1352#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_CANCEL         1 
     1353 
     1354 
     1355/* 
     1356 * NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE - query this 
     1357 * variable to know if a test is currently being run to 
     1358 * determine the optimal 3D clock frequencies.  _BUSY means a 
     1359 * test is currently running, _IDLE means the test is not running. 
     1360 * 
     1361 * Note: unless NV_CTRL_GPU_OVERCLOCKING_STATE is set to _MANUAL, the 
     1362 * optimal clock detection process is unavailable. 
     1363 */ 
     1364 
     1365#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE         96  /* R--G */ 
     1366#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_IDLE     0 
     1367#define NV_CTRL_GPU_OPTIMAL_CLOCK_FREQS_DETECTION_STATE_BUSY     1 
     1368 
     1369 
     1370/* 
     1371 * NV_CTRL_FLATPANEL_CHIP_LOCATION - for the specified display device, 
     1372 * report whether the flat panel is driven by the on-chip controller, 
     1373 * or a separate controller chip elsewhere on the graphics board. 
     1374 * This attribute is only available for flat panels. 
     1375 */ 
     1376 
     1377#define NV_CTRL_FLATPANEL_CHIP_LOCATION                         215/* R-DG */ 
     1378#define NV_CTRL_FLATPANEL_CHIP_LOCATION_INTERNAL                  0 
     1379#define NV_CTRL_FLATPANEL_CHIP_LOCATION_EXTERNAL                  1 
     1380 
     1381/* 
     1382 * NV_CTRL_FLATPANEL_LINK - report the number of links for a DVI connection, or 
     1383 * the main link's active lane count for DisplayPort. 
     1384 * This attribute is only available for flat panels. 
     1385 */ 
     1386 
     1387#define NV_CTRL_FLATPANEL_LINK                                  216/* R-DG */ 
     1388#define NV_CTRL_FLATPANEL_LINK_SINGLE                             0 
     1389#define NV_CTRL_FLATPANEL_LINK_DUAL                               1 
     1390#define NV_CTRL_FLATPANEL_LINK_QUAD                               3 
     1391 
     1392/* 
     1393 * NV_CTRL_FLATPANEL_SIGNAL - for the specified display device, report 
     1394 * whether the flat panel is driven by an LVDS, TMDS, or DisplayPort signal. 
     1395 * This attribute is only available for flat panels. 
     1396 */ 
     1397 
     1398#define NV_CTRL_FLATPANEL_SIGNAL                                217/* R-DG */ 
     1399#define NV_CTRL_FLATPANEL_SIGNAL_LVDS                             0 
     1400#define NV_CTRL_FLATPANEL_SIGNAL_TMDS                             1 
     1401#define NV_CTRL_FLATPANEL_SIGNAL_DISPLAYPORT                      2 
     1402 
     1403 
     1404/* 
     1405 * NV_CTRL_USE_HOUSE_SYNC - when TRUE, the server (master) frame lock 
     1406 * device will propagate the incoming house sync signal as the outgoing 
     1407 * frame lock sync signal.  If the frame lock device cannot detect a 
     1408 * frame lock sync signal, it will default to using the internal timings 
     1409 * from the GPU connected to the primary connector. 
     1410 * 
     1411 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     1412 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK or NV_CTRL_TARGET_TYPE_X_SCREEN 
     1413 * target. 
     1414 */ 
     1415 
     1416#define NV_CTRL_USE_HOUSE_SYNC                                  218/* RW-F */ 
     1417#define NV_CTRL_USE_HOUSE_SYNC_FALSE                            0 
     1418#define NV_CTRL_USE_HOUSE_SYNC_TRUE                             1 
     1419 
     1420/* 
     1421 * NV_CTRL_EDID_AVAILABLE - report if an EDID is available for the 
     1422 * specified display device. 
     1423 * 
     1424 * This attribute may also be queried through XNVCTRLQueryTargetAttribute() 
     1425 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN 
     1426 * target. 
     1427 */ 
     1428 
     1429#define NV_CTRL_EDID_AVAILABLE                                  219 /* R-DG */ 
     1430#define NV_CTRL_EDID_AVAILABLE_FALSE                            0 
     1431#define NV_CTRL_EDID_AVAILABLE_TRUE                             1 
     1432 
     1433/* 
     1434 * NV_CTRL_FORCE_STEREO - when TRUE, OpenGL will force stereo flipping 
     1435 * even when no stereo drawables are visible (if the device is configured 
     1436 * to support it, see the "Stereo" X config option). 
     1437 * When false, fall back to the default behavior of only flipping when a 
     1438 * stereo drawable is visible. 
     1439 */ 
     1440 
     1441#define NV_CTRL_FORCE_STEREO                                    220 /* RW- */ 
     1442#define NV_CTRL_FORCE_STEREO_FALSE                              0 
     1443#define NV_CTRL_FORCE_STEREO_TRUE                               1 
     1444 
     1445 
     1446/* 
     1447 * NV_CTRL_IMAGE_SETTINGS - the image quality setting for OpenGL clients. 
     1448 * 
     1449 * This setting is only applied to OpenGL clients that are started 
     1450 * after this setting is applied. 
     1451 */ 
     1452 
     1453#define NV_CTRL_IMAGE_SETTINGS                                  221 /* RW-X */ 
     1454#define NV_CTRL_IMAGE_SETTINGS_HIGH_QUALITY                     0 
     1455#define NV_CTRL_IMAGE_SETTINGS_QUALITY                          1 
     1456#define NV_CTRL_IMAGE_SETTINGS_PERFORMANCE                      2 
     1457#define NV_CTRL_IMAGE_SETTINGS_HIGH_PERFORMANCE                 3 
     1458 
     1459 
     1460/* 
     1461 * NV_CTRL_XINERAMA - return whether xinerama is enabled 
     1462 */ 
     1463 
     1464#define NV_CTRL_XINERAMA                                        222 /* R--G */ 
     1465#define NV_CTRL_XINERAMA_OFF                                    0 
     1466#define NV_CTRL_XINERAMA_ON                                     1 
     1467 
     1468/* 
     1469 * NV_CTRL_XINERAMA_STEREO - when TRUE, OpenGL will allow stereo flipping 
     1470 * on multiple X screens configured with Xinerama. 
     1471 * When FALSE, flipping is allowed only on one X screen at a time. 
     1472 */ 
     1473 
     1474#define NV_CTRL_XINERAMA_STEREO                                  223 /* RW- */ 
     1475#define NV_CTRL_XINERAMA_STEREO_FALSE                            0 
     1476#define NV_CTRL_XINERAMA_STEREO_TRUE                             1 
     1477 
     1478/* 
     1479 * NV_CTRL_BUS_RATE - if the bus type of the GPU driving the specified 
     1480 * screen is AGP, then NV_CTRL_BUS_RATE returns the configured AGP 
     1481 * transfer rate.  If the bus type is PCI Express, then this attribute 
     1482 * returns the width of the physical link. 
     1483 */ 
     1484 
     1485#define NV_CTRL_BUS_RATE                                         224  /* R--G */ 
     1486 
     1487/* 
     1488 * NV_CTRL_SHOW_SLI_HUD - when TRUE, OpenGL will draw information about the 
     1489 * current SLI mode. 
     1490 */ 
     1491 
     1492#define NV_CTRL_SHOW_SLI_HUD                                     225  /* RW-X */ 
     1493#define NV_CTRL_SHOW_SLI_HUD_FALSE                               0 
     1494#define NV_CTRL_SHOW_SLI_HUD_TRUE                                1 
     1495 
     1496/* 
     1497 * NV_CTRL_XV_SYNC_TO_DISPLAY - this control is valid when TwinView and  
     1498 * XVideo Sync To VBlank are enabled. 
     1499 * It controls which display device will be synched to. 
     1500 */ 
     1501 
     1502#define NV_CTRL_XV_SYNC_TO_DISPLAY                               226  /* RW- */ 
     1503 
     1504/* 
     1505 * NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT2 - this attribute is only intended 
     1506 * to be used to query the ValidValues for 
     1507 * NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT above the first 31 VIDEO_FORMATS. 
     1508 * See NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT for details. 
     1509 */ 
     1510 
     1511#define NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT2                         227  /* --- */ 
     1512 
     1513/* 
     1514 * NV_CTRL_GVO_OVERRIDE_HW_CSC - Override the SDI hardware's Color Space 
     1515 * Conversion with the values controlled through 
     1516 * XNVCTRLSetGvoColorConversion() and XNVCTRLGetGvoColorConversion().  If 
     1517 * this attribute is FALSE, then the values specified through 
     1518 * XNVCTRLSetGvoColorConversion() are ignored. 
     1519 */ 
     1520 
     1521#define NV_CTRL_GVO_OVERRIDE_HW_CSC                              228  /* RW- */ 
     1522#define NV_CTRL_GVO_OVERRIDE_HW_CSC_FALSE                        0 
     1523#define NV_CTRL_GVO_OVERRIDE_HW_CSC_TRUE                         1 
     1524 
     1525 
     1526/* 
     1527 * NV_CTRL_GVO_CAPABILITIES - this read-only attribute describes GVO 
     1528 * capabilities that differ between NVIDIA SDI products.  This value 
     1529 * is a bitmask where each bit indicates whether that capability is 
     1530 * available. 
     1531 * 
     1532 * APPLY_CSC_IMMEDIATELY - whether the CSC matrix, offset, and scale 
     1533 * specified through XNVCTRLSetGvoColorConversion() will take affect 
     1534 * immediately, or only after SDI output is disabled and enabled 
     1535 * again. 
     1536 * 
     1537 * APPLY_CSC_TO_X_SCREEN - whether the CSC matrix, offset, and scale 
     1538 * specified through XNVCTRLSetGvoColorConversion() will also apply 
     1539 * to GVO output of an X screen, or only to OpenGL GVO output, as 
     1540 * enabled through the GLX_NV_video_out extension. 
     1541 * 
     1542 * COMPOSITE_TERMINATION - whether the 75 ohm termination of the 
     1543 * SDI composite input signal can be programmed through the 
     1544 * NV_CTRL_GVO_COMPOSITE_TERMINATION attribute. 
     1545 * 
     1546 * SHARED_SYNC_BNC - whether the SDI device has a single BNC 
     1547 * connector used for both (SDI & Composite) incoming signals. 
     1548 * 
     1549 * MULTIRATE_SYNC - whether the SDI device supports synchronization 
     1550 * of input and output video modes that match in being odd or even 
     1551 * modes (ie, AA.00 Hz modes can be synched to other BB.00 Hz modes and 
     1552 * AA.XX Hz can match to BB.YY Hz where .XX and .YY are not .00) 
     1553 */ 
     1554 
     1555#define NV_CTRL_GVO_CAPABILITIES                                 229  /* R-- */ 
     1556#define NV_CTRL_GVO_CAPABILITIES_APPLY_CSC_IMMEDIATELY           0x00000001 
     1557#define NV_CTRL_GVO_CAPABILITIES_APPLY_CSC_TO_X_SCREEN           0x00000002 
     1558#define NV_CTRL_GVO_CAPABILITIES_COMPOSITE_TERMINATION           0x00000004 
     1559#define NV_CTRL_GVO_CAPABILITIES_SHARED_SYNC_BNC                 0x00000008 
     1560#define NV_CTRL_GVO_CAPABILITIES_MULTIRATE_SYNC                  0x00000010 
     1561#define NV_CTRL_GVO_CAPABILITIES_ADVANCE_SYNC_SKEW               0x00000020 
     1562 
     1563 
     1564/* 
     1565 * NV_CTRL_GVO_COMPOSITE_TERMINATION - enable or disable 75 ohm 
     1566 * termination of the SDI composite input signal. 
     1567 */ 
     1568 
     1569#define NV_CTRL_GVO_COMPOSITE_TERMINATION                        230  /* RW- */ 
     1570#define NV_CTRL_GVO_COMPOSITE_TERMINATION_ENABLE                   1 
     1571#define NV_CTRL_GVO_COMPOSITE_TERMINATION_DISABLE                  0 
     1572 
     1573 
     1574/* 
     1575 * NV_CTRL_ASSOCIATED_DISPLAY_DEVICES - display device mask indicating 
     1576 * which display devices are "associated" with the specified X screen 
     1577 * (ie: are available to the X screen for displaying the X screen). 
     1578 */ 
     1579  
     1580#define NV_CTRL_ASSOCIATED_DISPLAY_DEVICES                       231 /* RW- */ 
     1581 
     1582/* 
     1583 * NV_CTRL_FRAMELOCK_SLAVES - get/set whether the display device(s) 
     1584 * given should listen or ignore the master's sync signal. 
     1585 * 
     1586 * This attribute can only be queried through XNVCTRLQueryTargetAttribute() 
     1587 * using a NV_CTRL_TARGET_TYPE_GPU target.  This attribute cannot be 
     1588 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN. 
     1589 */ 
     1590 
     1591#define NV_CTRL_FRAMELOCK_SLAVES                                 232 /* RW-G */ 
     1592 
     1593/* 
     1594 * NV_CTRL_FRAMELOCK_MASTERABLE - Can this Display Device be set 
     1595 * as the master of the frame lock group.  Returns MASTERABLE_TRUE if 
     1596 * the GPU driving the display device is connected to the "primary" 
     1597 * connector on the frame lock board. 
     1598 * 
     1599 * This attribute can only be queried through XNVCTRLQueryTargetAttribute() 
     1600 * using a NV_CTRL_TARGET_TYPE_GPU target.  This attribute cannot be 
     1601 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN. 
     1602 */ 
     1603 
     1604#define NV_CTRL_FRAMELOCK_MASTERABLE                             233 /* R-DG */ 
     1605#define NV_CTRL_FRAMELOCK_MASTERABLE_FALSE                       0 
     1606#define NV_CTRL_FRAMELOCK_MASTERABLE_TRUE                        1 
     1607 
     1608 
     1609/* 
     1610 * NV_CTRL_PROBE_DISPLAYS - re-probes the hardware to detect what 
     1611 * display devices are connected to the GPU or GPU driving the 
     1612 * specified X screen.  Returns a display mask. 
     1613 * 
     1614 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     1615 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     1616 */ 
     1617 
     1618#define NV_CTRL_PROBE_DISPLAYS                                   234 /* R--G */ 
     1619 
     1620 
     1621/* 
     1622 * NV_CTRL_REFRESH_RATE - Returns the refresh rate of the specified 
     1623 * display device in 100 * Hz (ie. to get the refresh rate in Hz, divide 
     1624 * the returned value by 100.) 
     1625 * 
     1626 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     1627 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     1628 */ 
     1629 
     1630#define NV_CTRL_REFRESH_RATE                                     235 /* R-DG */ 
     1631 
     1632 
     1633/* 
     1634 * NV_CTRL_GVO_FLIP_QUEUE_SIZE - The Graphics to Video Out interface 
     1635 * exposed through NV-CONTROL and the GLX_NV_video_out extension uses 
     1636 * an internal flip queue when pbuffers are sent to the video device 
     1637 * (via glXSendPbufferToVideoNV()).  The NV_CTRL_GVO_FLIP_QUEUE_SIZE 
     1638 * can be used to query and assign the flip queue size.  This 
     1639 * attribute is applied to GLX when glXGetVideoDeviceNV() is called by 
     1640 * the application. 
     1641 */ 
     1642 
     1643#define NV_CTRL_GVO_FLIP_QUEUE_SIZE                              236 /* RW- */ 
     1644 
     1645 
     1646/* 
     1647 * NV_CTRL_CURRENT_SCANLINE - query the current scanline for the 
     1648 * specified display device. 
     1649 */ 
     1650 
     1651#define NV_CTRL_CURRENT_SCANLINE                                 237 /* R-DG */ 
     1652 
     1653 
     1654/* 
     1655 * NV_CTRL_INITIAL_PIXMAP_PLACEMENT - Controls where X pixmaps are initially 
     1656 * created. 
     1657 * 
     1658 * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_FORCE_SYSMEM causes to pixmaps to stay in 
     1659 * system memory. 
     1660 * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_SYSMEM creates pixmaps in system memory 
     1661 * initially, but allows them to migrate to video memory. 
     1662 * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_VIDMEM creates pixmaps in video memory 
     1663 * when enough resources are available. 
     1664 * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_RESERVED is currently reserved for future 
     1665 * use.  Behavior is undefined. 
     1666 * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_GPU_SYSMEM creates pixmaps in GPU accessible 
     1667 * system memory when enough resources are available. 
     1668 */ 
     1669 
     1670#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT                         238 /* RW- */ 
     1671#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_FORCE_SYSMEM            0 
     1672#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_SYSMEM                  1 
     1673#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_VIDMEM                  2 
     1674#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_RESERVED                3 
     1675#define NV_CTRL_INITIAL_PIXMAP_PLACEMENT_GPU_SYSMEM              4 
     1676 
     1677 
     1678/* 
     1679 * NV_CTRL_PCI_BUS - Returns the PCI bus number the GPU is using. 
     1680 */ 
     1681 
     1682#define NV_CTRL_PCI_BUS                                          239 /* R--G */ 
     1683 
     1684 
     1685/* 
     1686 * NV_CTRL_PCI_DEVICE - Returns the PCI device number the GPU is using. 
     1687 */ 
     1688 
     1689#define NV_CTRL_PCI_DEVICE                                       240 /* R--G */ 
     1690 
     1691 
     1692/* 
     1693 * NV_CTRL_PCI_FUNCTION - Returns the PCI function number the GPU is using. 
     1694 */ 
     1695 
     1696#define NV_CTRL_PCI_FUNCTION                                     241 /* R--G */ 
     1697 
     1698 
     1699/* 
     1700 * NV_CTRL_FRAMELOCK_FPGA_REVISION - Querys the FPGA revision of the 
     1701 * Frame Lock device. 
     1702 * 
     1703 * This attribute must be queried through XNVCTRLQueryTargetAttribute() 
     1704 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK target. 
     1705 */ 
     1706 
     1707#define NV_CTRL_FRAMELOCK_FPGA_REVISION                          242 /* R--F */ 
     1708 
     1709/* 
     1710 * NV_CTRL_MAX_SCREEN_{WIDTH,HEIGHT} - the maximum allowable size, in 
     1711 * pixels, of either the specified X screen (if the target_type of the 
     1712 * query is an X screen), or any X screen on the specified GPU (if the 
     1713 * target_type of the query is a GPU). 
     1714 */ 
     1715 
     1716#define NV_CTRL_MAX_SCREEN_WIDTH                                 243 /* R--G */ 
     1717#define NV_CTRL_MAX_SCREEN_HEIGHT                                244 /* R--G */ 
     1718 
     1719 
     1720/* 
     1721 * NV_CTRL_MAX_DISPLAYS - the maximum number of display devices that 
     1722 * can be driven simultaneously on a GPU (e.g., that can be used in a 
     1723 * MetaMode at once).  Note that this does not indicate the maximum 
     1724 * number of bits that can be set in NV_CTRL_CONNECTED_DISPLAYS, 
     1725 * because more display devices can be connected than are actively in 
     1726 * use. 
     1727 */ 
     1728 
     1729#define NV_CTRL_MAX_DISPLAYS                                     245 /* R--G */ 
     1730 
     1731 
     1732/* 
     1733 * NV_CTRL_DYNAMIC_TWINVIEW - Returns whether or not the screen 
     1734 * supports dynamic twinview. 
     1735 */ 
     1736 
     1737#define NV_CTRL_DYNAMIC_TWINVIEW                                 246 /* R-- */ 
     1738 
     1739 
     1740/* 
     1741 * NV_CTRL_MULTIGPU_DISPLAY_OWNER - Returns the GPU ID of the GPU 
     1742 * that has the display device(s) used for showing the X Screen. 
     1743 */ 
     1744 
     1745#define NV_CTRL_MULTIGPU_DISPLAY_OWNER                           247 /* R-- */ 
     1746 
     1747 
     1748/*  
     1749 * NV_CTRL_GPU_SCALING - Controls what the GPU scales to and how. 
     1750 * This attribute is a packed integer; the scaling target (native/best fit) 
     1751 * is packed in the upper 16-bits and the scaling method is packed in the 
     1752 * lower 16-bits. 
     1753 * 
     1754 * 'Best fit' scaling will make the GPU scale the frontend (current) mode to 
     1755 * the closest larger resolution in the flat panel's EDID and allow the 
     1756 * flat panel to do its own scaling to the native resolution. 
     1757 * 
     1758 * 'Native' scaling will make the GPU scale the frontend (current) mode to 
     1759 * the flat panel's native resolution, thus disabling any internal scaling 
     1760 * the flat panel might have. 
     1761 */ 
     1762 
     1763#define NV_CTRL_GPU_SCALING                                      248 /* RWDG */ 
     1764 
     1765#define NV_CTRL_GPU_SCALING_TARGET_INVALID                       0 
     1766#define NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT            1 
     1767#define NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE              2 
     1768 
     1769#define NV_CTRL_GPU_SCALING_METHOD_INVALID                       0 
     1770#define NV_CTRL_GPU_SCALING_METHOD_STRETCHED                     1 
     1771#define NV_CTRL_GPU_SCALING_METHOD_CENTERED                      2 
     1772#define NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED                 3 
     1773 
     1774 
     1775/* 
     1776 * NV_CTRL_FRONTEND_RESOLUTION - Returns the dimensions of the frontend 
     1777 * (current) resolution as determined by the NVIDIA X Driver. 
     1778 * 
     1779 * This attribute is a packed integer; the width is packed in the upper 
     1780 * 16-bits and the height is packed in the lower 16-bits. 
     1781 */ 
     1782 
     1783#define NV_CTRL_FRONTEND_RESOLUTION                              249 /* R-DG */ 
     1784 
     1785 
     1786/* 
     1787 * NV_CTRL_BACKEND_RESOLUTION - Returns the dimensions of the 
     1788 * backend resolution as determined by the NVIDIA X Driver.   
     1789 * 
     1790 * The backend resolution is the resolution (supported by the display 
     1791 * device) the GPU is set to scale to.  If this resolution matches the 
     1792 * frontend resolution, GPU scaling will not be needed/used. 
     1793 * 
     1794 * This attribute is a packed integer; the width is packed in the upper 
     1795 * 16-bits and the height is packed in the lower 16-bits. 
     1796 */ 
     1797 
     1798#define NV_CTRL_BACKEND_RESOLUTION                               250 /* R-DG */ 
     1799 
     1800 
     1801/* 
     1802 * NV_CTRL_FLATPANEL_NATIVE_RESOLUTION - Returns the dimensions of the 
     1803 * native resolution of the flat panel as determined by the 
     1804 * NVIDIA X Driver. 
     1805 * 
     1806 * The native resolution is the resolution at which a flat panel 
     1807 * must display any image.  All other resolutions must be scaled to this 
     1808 * resolution through GPU scaling or the DFP's native scaling capabilities  
     1809 * in order to be displayed. 
     1810 * 
     1811 * This attribute is only valid for flat panel (DFP) display devices. 
     1812 * 
     1813 * This attribute is a packed integer; the width is packed in the upper 
     1814 * 16-bits and the height is packed in the lower 16-bits. 
     1815 */ 
     1816 
     1817#define NV_CTRL_FLATPANEL_NATIVE_RESOLUTION                      251 /* R-DG */ 
     1818 
     1819 
     1820/* 
     1821 * NV_CTRL_FLATPANEL_BEST_FIT_RESOLUTION - Returns the dimensions of the 
     1822 * resolution, selected by the X driver, from the DFP's EDID that most 
     1823 * closely matches the frontend resolution of the current mode.  The best 
     1824 * fit resolution is selected on a per-mode basis. 
     1825 * NV_CTRL_GPU_SCALING_TARGET is used to select between 
     1826 * NV_CTRL_FLATPANEL_BEST_FIT_RESOLUTION and NV_CTRL_NATIVE_RESOLUTION. 
     1827 * 
     1828 * This attribute is only valid for flat panel (DFP) display devices. 
     1829 * 
     1830 * This attribute is a packed integer; the width is packed in the upper 
     1831 * 16-bits and the height is packed in the lower 16-bits. 
     1832 */ 
     1833 
     1834#define NV_CTRL_FLATPANEL_BEST_FIT_RESOLUTION                    252 /* R-DG */ 
     1835 
     1836 
     1837/* 
     1838 * NV_CTRL_GPU_SCALING_ACTIVE - Returns the current state of 
     1839 * GPU scaling.  GPU scaling is mode-specific (meaning it may vary 
     1840 * depending on which mode is currently set).  GPU scaling is active if 
     1841 * the frontend timing (current resolution) is different than the target 
     1842 * resolution.  The target resolution is either the native resolution of 
     1843 * the flat panel or the best fit resolution supported by the flat panel. 
     1844 * What (and how) the GPU should scale to is controlled through the 
     1845 * NV_CTRL_GPU_SCALING attribute. 
     1846 */ 
     1847 
     1848#define NV_CTRL_GPU_SCALING_ACTIVE                               253 /* R-DG */ 
     1849 
     1850 
     1851/* 
     1852 * NV_CTRL_DFP_SCALING_ACTIVE - Returns the current state of 
     1853 * DFP scaling.  DFP scaling is mode-specific (meaning it may vary 
     1854 * depending on which mode is currently set).  DFP scaling is active if 
     1855 * the GPU is set to scale to the best fit resolution (NV_CTRL_GPU_SCALING 
     1856 * is set to NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT) and the best fit 
     1857 * and native resolutions are different. 
     1858 */ 
     1859 
     1860#define NV_CTRL_DFP_SCALING_ACTIVE                               254 /* R-DG */ 
     1861 
     1862 
     1863/* 
     1864 * NV_CTRL_FSAA_APPLICATION_ENHANCED - Controls how the NV_CTRL_FSAA_MODE 
     1865 * is applied when NV_CTRL_FSAA_APPLICATION_CONTROLLED is set to 
     1866 * NV_CTRL_APPLICATION_CONTROLLED_DISABLED.  When 
     1867 * NV_CTRL_FSAA_APPLICATION_ENHANCED is _DISABLED, OpenGL applications will 
     1868 * be forced to use the FSAA mode specified by NV_CTRL_FSAA_MODE.  when set 
     1869 * to _ENABLED, only those applications that have selected a multisample 
     1870 * FBConfig will be made to use the NV_CTRL_FSAA_MODE specified. 
     1871 * 
     1872 * This attribute is ignored when NV_CTRL_FSAA_APPLICATION_CONTROLLED is 
     1873 * set to NV_CTRL_FSAA_APPLICATION_CONTROLLED_ENABLED. 
     1874 */ 
     1875 
     1876#define NV_CTRL_FSAA_APPLICATION_ENHANCED                       255  /* RW-X */ 
     1877#define NV_CTRL_FSAA_APPLICATION_ENHANCED_ENABLED                 1 
     1878#define NV_CTRL_FSAA_APPLICATION_ENHANCED_DISABLED                0 
     1879 
     1880 
     1881/* 
     1882 * NV_CTRL_FRAMELOCK_SYNC_RATE_4 - This is the refresh rate that the 
     1883 * frame lock board is sending to the GPU with 4 digits of precision. 
     1884 * 
     1885 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     1886 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK. 
     1887 */ 
     1888 
     1889#define NV_CTRL_FRAMELOCK_SYNC_RATE_4                           256 /* R--F */ 
     1890 
     1891 
     1892/* 
     1893 * NV_CTRL_GVO_LOCK_OWNER - indicates that the GVO device is available 
     1894 * or in use (by GLX, Clone Mode, TwinView etc). 
     1895 * 
     1896 * The GVO device is locked by GLX when the GLX_NV_video_out function 
     1897 * calls glXGetVideoDeviceNV().  The GVO device is then unlocked when 
     1898 * glXReleaseVideoDeviceNV() is called, or the X Display used when calling 
     1899 * glXGetVideoDeviceNV() is closed. 
     1900 * 
     1901 * The GVO device is locked/unlocked for Clone mode use when the 
     1902 * attribute NV_CTRL_GVO_DISPLAY_X_SCREEN is enabled/disabled. 
     1903 * 
     1904 * The GVO device is locked/unlocked by TwinView mode, when the GVO device is 
     1905 * associated/unassociated to/from an X screen through the 
     1906 * NV_CTRL_ASSOCIATED_DISPLAY_DEVICES attribute directly. 
     1907 * 
     1908 * When the GVO device is locked, setting of the following GVO NV-CONTROL 
     1909 * attributes will not happen immediately and will instead be cached.  The 
     1910 * GVO resource will need to be disabled/released and re-enabled/claimed for 
     1911 * the values to be flushed. These attributes are: 
     1912 * 
     1913 *    NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT 
     1914 *    NV_CTRL_GVO_DATA_FORMAT 
     1915 *    NV_CTRL_GVO_FLIP_QUEUE_SIZE 
     1916 */ 
     1917 
     1918#define NV_CTRL_GVO_LOCK_OWNER                                  257 /* R-- */ 
     1919#define NV_CTRL_GVO_LOCK_OWNER_NONE                               0 
     1920#define NV_CTRL_GVO_LOCK_OWNER_GLX                                1 
     1921#define NV_CTRL_GVO_LOCK_OWNER_CLONE                              2 
     1922#define NV_CTRL_GVO_LOCK_OWNER_X_SCREEN                           3 
     1923 
     1924 
     1925/* 
     1926 * NV_CTRL_HWOVERLAY - when a workstation overlay is in use, reports 
     1927 * whether the hardware overlay is used, or if the overlay is emulated. 
     1928 */ 
     1929 
     1930#define NV_CTRL_HWOVERLAY                                       258 /* R-- */ 
     1931#define NV_CTRL_HWOVERLAY_FALSE                                   0 
     1932#define NV_CTRL_HWOVERLAY_TRUE                                    1 
     1933 
     1934/* 
     1935 * NV_CTRL_NUM_GPU_ERRORS_RECOVERED - Returns the number of GPU errors 
     1936 * occured. This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     1937 * using a NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     1938 */ 
     1939 
     1940#define NV_CTRL_NUM_GPU_ERRORS_RECOVERED                        259 /* R--- */ 
     1941 
     1942 
     1943/* 
     1944 * NV_CTRL_REFRESH_RATE_3 - Returns the refresh rate of the specified 
     1945 * display device in 1000 * Hz (ie. to get the refresh rate in Hz, divide 
     1946 * the returned value by 1000.) 
     1947 * 
     1948 * This attribute may be queried through XNVCTRLQueryTargetAttribute() 
     1949 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     1950 */ 
     1951 
     1952#define NV_CTRL_REFRESH_RATE_3                                  260 /* R-DG */ 
     1953 
     1954 
     1955/* 
     1956 * NV_CTRL_ONDEMAND_VBLANK_INTERRUPTS - if the OnDemandVBlankInterrupts 
     1957 * X driver option is set to true, this attribute can be used to 
     1958 * determine if on-demand VBlank interrupt control is enabled on the 
     1959 * specified GPU, as well as to enable or disable this feature. 
     1960 */ 
     1961 
     1962#define NV_CTRL_ONDEMAND_VBLANK_INTERRUPTS                      261 /* RW-G */ 
     1963#define NV_CTRL_ONDEMAND_VBLANK_INTERRUPTS_OFF                    0 
     1964#define NV_CTRL_ONDEMAND_VBLANK_INTERRUPTS_ON                     1 
     1965 
     1966 
     1967/* 
     1968 * NV_CTRL_GPU_POWER_SOURCE reports the type of power source 
     1969 * of the GPU driving the X screen. 
     1970 */ 
     1971 
     1972#define NV_CTRL_GPU_POWER_SOURCE                                262 /* R--G */ 
     1973#define NV_CTRL_GPU_POWER_SOURCE_AC                               0 
     1974#define NV_CTRL_GPU_POWER_SOURCE_BATTERY                          1 
     1975 
     1976 
     1977/* 
     1978 * NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE reports the current 
     1979 * Performance mode of the GPU driving the X screen.  Running 
     1980 * a 3D app for example, will change this performance mode, 
     1981 * if Adaptive Clocking is enabled. 
     1982 */ 
     1983 
     1984#define NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE                    263 /* R--G */ 
     1985#define NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE_DESKTOP              0 
     1986#define NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE_MAXPERF              1 
     1987 
     1988 
     1989/* NV_CTRL_GLYPH_CACHE - Enables RENDER Glyph Caching to VRAM */ 
     1990 
     1991#define NV_CTRL_GLYPH_CACHE                                     264 /* RW- */ 
     1992#define NV_CTRL_GLYPH_CACHE_DISABLED                              0 
     1993#define NV_CTRL_GLYPH_CACHE_ENABLED                               1 
     1994 
     1995 
     1996/* 
     1997 * NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL reports the current 
     1998 * Performance level of the GPU driving the X screen.  Each 
     1999 * Performance level has associated NVClock and Mem Clock values. 
     2000 */ 
     2001 
     2002#define NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL                   265 /* R--G */ 
     2003 
     2004 
     2005/* 
     2006 * NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE reports if Adaptive Clocking 
     2007 * is Enabled on the GPU driving the X screen. 
     2008 */ 
     2009 
     2010#define NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE                        266 /* R--G */ 
     2011#define NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE_DISABLED                 0 
     2012#define NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE_ENABLED                  1 
     2013 
     2014 
     2015/* 
     2016 * NV_CTRL_GVO_OUTPUT_VIDEO_LOCKED - Returns whether or not the GVO output 
     2017 * video is locked to the GPU. 
     2018 */ 
     2019 
     2020#define NV_CTRL_GVO_OUTPUT_VIDEO_LOCKED                         267 /* R--- */ 
     2021#define NV_CTRL_GVO_OUTPUT_VIDEO_LOCKED_FALSE                     0 
     2022#define NV_CTRL_GVO_OUTPUT_VIDEO_LOCKED_TRUE                      1 
     2023 
     2024 
     2025/* 
     2026 * NV_CTRL_GVO_SYNC_LOCK_STATUS - Returns whether or not the GVO device 
     2027 * is locked to the input ref signal.  If the sync mode is set to 
     2028 * NV_CTRL_GVO_SYNC_MODE_GENLOCK, then this returns the genlock 
     2029 * sync status, and if the sync mode is set to NV_CTRL_GVO_SYNC_MODE_FRAMELOCK, 
     2030 * then this reports the frame lock status. 
     2031 */ 
     2032 
     2033#define NV_CTRL_GVO_SYNC_LOCK_STATUS                            268 /* R--- */ 
     2034#define NV_CTRL_GVO_SYNC_LOCK_STATUS_UNLOCKED                     0 
     2035#define NV_CTRL_GVO_SYNC_LOCK_STATUS_LOCKED                       1 
     2036 
     2037 
     2038/* 
     2039 * NV_CTRL_GVO_ANC_TIME_CODE_GENERATION - Allows SDI device to generate 
     2040 * time codes in the ANC region of the SDI video output stream. 
     2041 */ 
     2042 
     2043#define NV_CTRL_GVO_ANC_TIME_CODE_GENERATION                    269 /* RW-- */ 
     2044#define NV_CTRL_GVO_ANC_TIME_CODE_GENERATION_DISABLE              0 
     2045#define NV_CTRL_GVO_ANC_TIME_CODE_GENERATION_ENABLE               1 
     2046 
     2047 
     2048/* 
     2049 * NV_CTRL_GVO_COMPOSITE - Enables/Disables SDI compositing.  This attribute 
     2050 * is only available when an SDI input source is detected and is in genlock 
     2051 * mode. 
     2052 */ 
     2053 
     2054#define NV_CTRL_GVO_COMPOSITE                                   270 /* RW-- */ 
     2055#define NV_CTRL_GVO_COMPOSITE_DISABLE                             0 
     2056#define NV_CTRL_GVO_COMPOSITE_ENABLE                              1 
     2057 
     2058 
     2059/* 
     2060 * NV_CTRL_GVO_COMPOSITE_ALPHA_KEY - When compositing is enabled, this 
     2061 * enables/disables alpha blending. 
     2062 */ 
     2063 
     2064#define NV_CTRL_GVO_COMPOSITE_ALPHA_KEY                         271 /* RW-- */ 
     2065#define NV_CTRL_GVO_COMPOSITE_ALPHA_KEY_DISABLE                   0 
     2066#define NV_CTRL_GVO_COMPOSITE_ALPHA_KEY_ENABLE                    1 
     2067 
     2068 
     2069/* 
     2070 * NV_CTRL_GVO_COMPOSITE_LUMA_KEY_RANGE - Set the values of a luma 
     2071 * channel range.  This is a packed int that has the following format 
     2072 * (in order of high-bits to low bits): 
     2073 * 
     2074 * Range # (11 bits), (Enabled 1 bit), min value (10 bits), max value (10 bits) 
     2075 * 
     2076 * To query the current values, pass the range # throught he display_mask 
     2077 * variable. 
     2078 */ 
     2079 
     2080#define NV_CTRL_GVO_COMPOSITE_LUMA_KEY_RANGE                    272 /* RW-- */ 
     2081 
     2082#define NV_CTRL_GVO_COMPOSITE_MAKE_RANGE(range, enable, min, max) \ 
     2083    ((((min) & 0x3FF)   <<  0) |  \ 
     2084     (((max) & 0x3FF)   << 10) |  \ 
     2085     (((enable) & 0x1)  << 20) |  \ 
     2086     (((range) & 0x7FF) << 21)) 
     2087 
     2088#define NV_CTRL_GVO_COMPOSITE_GET_RANGE(val, range, enable, min, max) \ 
     2089    (min)    = ((val) >> 0)  & 0x3FF; \ 
     2090    (max)    = ((val) >> 10) & 0x3FF; \ 
     2091    (enable) = ((val) >> 20) & 0x1;   \ 
     2092    (range)  = ((val) >> 21) & 0x7FF; 
     2093 
     2094 
     2095/* 
     2096 * NV_CTRL_GVO_COMPOSITE_CR_KEY_RANGE - Set the values of a CR 
     2097 * channel range.  This is a packed int that has the following format 
     2098 * (in order of high-bits to low bits): 
     2099 * 
     2100 * Range # (11 bits), (Enabled 1 bit), min value (10 bits), max value (10 bits) 
     2101 * 
     2102 * To query the current values, pass the range # throught he display_mask 
     2103 * variable. 
     2104 */ 
     2105 
     2106#define NV_CTRL_GVO_COMPOSITE_CR_KEY_RANGE                      273 /* RW-- */ 
     2107 
     2108 
     2109/* 
     2110 * NV_CTRL_GVO_COMPOSITE_CB_KEY_RANGE - Set the values of a CB 
     2111 * channel range.  This is a packed int that has the following format 
     2112 * (in order of high-bits to low bits): 
     2113 * 
     2114 * Range # (11 bits), (Enabled 1 bit), min value (10 bits), max value (10 bits) 
     2115 * 
     2116 * To query the current values, pass the range # throught he display_mask 
     2117 * variable. 
     2118 */ 
     2119 
     2120#define NV_CTRL_GVO_COMPOSITE_CB_KEY_RANGE                      274 /* RW-- */ 
     2121 
     2122 
     2123/* 
     2124 * NV_CTRL_GVO_COMPOSITE_NUM_KEY_RANGES - Returns the number of ranges 
     2125 * available for each channel (Y/Luma, Cr, and Cb.) 
     2126 */ 
     2127 
     2128#define NV_CTRL_GVO_COMPOSITE_NUM_KEY_RANGES                    275 /* R--- */ 
     2129 
     2130 
     2131/* 
     2132 * NV_CTRL_SWITCH_TO_DISPLAYS - Can be used to select which displays 
     2133 * to switch to (as a hotkey event). 
     2134 */ 
     2135 
     2136#define NV_CTRL_SWITCH_TO_DISPLAYS                              276 /* -W- */ 
     2137 
     2138 
     2139/* 
     2140 * NV_CTRL_NOTEBOOK_DISPLAY_CHANGE_LID_EVENT - Event that notifies 
     2141 * when a notebook lid change occurs (i.e. when the lid is opened or 
     2142 * closed.)  This attribute can be queried to retrieve the current 
     2143 * notebook lid status (opened/closed.) 
     2144 */ 
     2145 
     2146#define NV_CTRL_NOTEBOOK_DISPLAY_CHANGE_LID_EVENT               277 /* RW- */ 
     2147#define NV_CTRL_NOTEBOOK_DISPLAY_CHANGE_LID_EVENT_CLOSE           0 
     2148#define NV_CTRL_NOTEBOOK_DISPLAY_CHANGE_LID_EVENT_OPEN            1 
     2149 
     2150/* 
     2151 * NV_CTRL_NOTEBOOK_INTERNAL_LCD - Returns the display device mask of 
     2152 * the intenal LCD of a notebook. 
     2153 */ 
     2154 
     2155#define NV_CTRL_NOTEBOOK_INTERNAL_LCD                           278 /* R-- */ 
     2156 
     2157/* 
     2158 * NV_CTRL_DEPTH_30_ALLOWED - returns whether the NVIDIA X driver supports 
     2159 * depth 30 on the specified X screen or GPU. 
     2160 */ 
     2161 
     2162#define NV_CTRL_DEPTH_30_ALLOWED                                279 /* R--G */ 
     2163 
     2164 
     2165/* 
     2166 * NV_CTRL_MODE_SET_EVENT This attribute is sent as an event 
     2167 * when hotkey, ctrl-alt-+/- or randr event occurs.  Note that 
     2168 * This attribute cannot be set or queried and is meant to 
     2169 * be received by clients that wish to be notified of when 
     2170 * mode set events occur. 
     2171 */ 
     2172 
     2173#define NV_CTRL_MODE_SET_EVENT                                  280 /* --- */ 
     2174 
     2175 
     2176/* 
     2177 * NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE - the gamma value used by 
     2178 * OpenGL when NV_CTRL_OPENGL_AA_LINE_GAMMA is enabled 
     2179 */ 
     2180 
     2181#define NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE                      281 /* RW-X */ 
     2182 
     2183 
     2184/* 
     2185 * NV_CTRL_VCSC_HIGH_PERF_MODE - Is used to both query High Performance Mode 
     2186 * status on the Visual Computing System, and also to enable or disable High 
     2187 * Performance Mode. 
     2188 */ 
     2189 
     2190#define NV_CTRL_VCSC_HIGH_PERF_MODE                             282 /* RW-V */ 
     2191#define NV_CTRL_VCSC_HIGH_PERF_MODE_DISABLE                       0 
     2192#define NV_CTRL_VCSC_HIGH_PERF_MODE_ENABLE                        1 
     2193 
     2194 
     2195/* 
     2196 * NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE - the gamma value used by 
     2197 * OpenGL when NV_CTRL_OPENGL_AA_LINE_GAMMA is enabled 
     2198 */ 
     2199 
     2200#define NV_CTRL_OPENGL_AA_LINE_GAMMA_VALUE                      281 /* RW-X */ 
     2201 
     2202/* 
     2203 * NV_CTRL_DISPLAYPORT_LINK_RATE - returns the negotiated lane bandwidth of the 
     2204 * DisplayPort main link. 
     2205 * This attribute is only available for DisplayPort flat panels. 
     2206 */ 
     2207 
     2208#define NV_CTRL_DISPLAYPORT_LINK_RATE                           291 /* R-DG */ 
     2209#define NV_CTRL_DISPLAYPORT_LINK_RATE_DISABLED                  0x0 
     2210#define NV_CTRL_DISPLAYPORT_LINK_RATE_1_62GBPS                  0x6 
     2211#define NV_CTRL_DISPLAYPORT_LINK_RATE_2_70GBPS                  0xA 
     2212 
     2213/* 
     2214 * NV_CTRL_STEREO_EYES_EXCHANGE - Controls whether or not the left and right 
     2215 * eyes of a stereo image are flipped. 
     2216 */ 
     2217 
     2218#define NV_CTRL_STEREO_EYES_EXCHANGE                            292  /* RW-X */ 
     2219#define NV_CTRL_STEREO_EYES_EXCHANGE_OFF                          0 
     2220#define NV_CTRL_STEREO_EYES_EXCHANGE_ON                           1 
     2221 
     2222/* 
     2223 * NV_CTRL_NO_SCANOUT - returns whether the special "NoScanout" mode is 
     2224 * enabled on the specified X screen or GPU; for details on this mode, 
     2225 * see the description of the "none" value for the "UseDisplayDevice" 
     2226 * X configuration option in the NVIDIA driver README. 
     2227 */ 
     2228 
     2229#define NV_CTRL_NO_SCANOUT                                      293 /* R--G */ 
     2230#define NV_CTRL_NO_SCANOUT_DISABLED                             0 
     2231#define NV_CTRL_NO_SCANOUT_ENABLED                              1 
     2232 
     2233/* 
     2234 * NV_CTRL_GVO_CSC_CHANGED_EVENT This attribute is sent as an event 
     2235 * when the color space conversion matrix has been altered by another 
     2236 * client. 
     2237 */ 
     2238 
     2239#define NV_CTRL_GVO_CSC_CHANGED_EVENT                           294 /* --- */ 
     2240 
     2241/*  
     2242 * NV_CTRL_FRAMELOCK_SLAVEABLE - Returns a bitmask of the display devices 
     2243 * that are (currently) allowed to be selected as slave devices for the 
     2244 * given GPU 
     2245 */ 
     2246 
     2247#define NV_CTRL_FRAMELOCK_SLAVEABLE                             295 /* R-DG */ 
     2248 
     2249/* 
     2250 * NV_CTRL_GVO_SYNC_TO_DISPLAY This attribute controls whether or not 
     2251 * the non-SDI display device will be sync'ed to the SDI display device 
     2252 * (when configured in TwinView, Clone Mode or when using the SDI device 
     2253 * with OpenGL). 
     2254 */ 
     2255 
     2256#define NV_CTRL_GVO_SYNC_TO_DISPLAY                             296 /* --- */ 
     2257#define NV_CTRL_GVO_SYNC_TO_DISPLAY_DISABLE                     0 
     2258#define NV_CTRL_GVO_SYNC_TO_DISPLAY_ENABLE                      1 
     2259 
     2260/* 
     2261 * NV_CTRL_X_SERVER_UNIQUE_ID - returns a pseudo-unique identifier for this 
     2262 * X server. Intended for use in cases where an NV-CONTROL client communicates 
     2263 * with multiple X servers, and wants some level of confidence that two 
     2264 * X Display connections correspond to the same or different X servers. 
     2265 */ 
     2266 
     2267#define NV_CTRL_X_SERVER_UNIQUE_ID                              297 /* R--- */ 
     2268 
     2269/* 
     2270 * NV_CTRL_PIXMAP_CACHE - This attribute controls whether the driver attempts to 
     2271 * store video memory pixmaps in a cache.  The cache speeds up allocation and 
     2272 * deallocation of pixmaps, but could use more memory than when the cache is 
     2273 * disabled. 
     2274 */ 
     2275 
     2276#define NV_CTRL_PIXMAP_CACHE                                    298 /* RW-X */ 
     2277#define NV_CTRL_PIXMAP_CACHE_DISABLE                              0 
     2278#define NV_CTRL_PIXMAP_CACHE_ENABLE                               1 
     2279 
     2280/* 
     2281 * NV_CTRL_PIXMAP_CACHE_ROUNDING_SIZE_KB - When the pixmap cache is enabled and 
     2282 * there is not enough free space in the cache to fit a new pixmap, the driver 
     2283 * will round up to the next multiple of this number of kilobytes when 
     2284 * allocating more memory for the cache. 
     2285 */ 
     2286 
     2287#define NV_CTRL_PIXMAP_CACHE_ROUNDING_SIZE_KB                   299 /* RW-X */ 
     2288 
     2289/* 
     2290 * NV_CTRL_IS_GVO_DISPLAY - returns whether or not a given display is an 
     2291 * SDI device. 
     2292 */ 
     2293 
     2294#define NV_CTRL_IS_GVO_DISPLAY                                  300 /* R-D */ 
     2295#define NV_CTRL_IS_GVO_DISPLAY_FALSE                              0 
     2296#define NV_CTRL_IS_GVO_DISPLAY_TRUE                               1 
     2297 
     2298/* 
     2299 * NV_CTRL_PCI_ID - Returns the PCI vendor and device ID of the GPU. 
     2300 * 
     2301 * NV_CTRL_PCI_ID is a "packed" integer attribute; the PCI vendor ID is stored 
     2302 * in the upper 16 bits of the integer, and the PCI device ID is stored in the 
     2303 * lower 16 bits of the integer. 
     2304 */ 
     2305 
     2306#define NV_CTRL_PCI_ID                                          301 /* R--G */ 
     2307 
     2308/* 
     2309 * NV_CTRL_GVO_FULL_RANGE_COLOR - Allow full range color data [4-1019] 
     2310 * without clamping to [64-940]. 
     2311 */ 
     2312 
     2313#define NV_CTRL_GVO_FULL_RANGE_COLOR                            302 /* RW- */ 
     2314#define NV_CTRL_GVO_FULL_RANGE_COLOR_DISABLED                     0 
     2315#define NV_CTRL_GVO_FULL_RANGE_COLOR_ENABLED                      1 
     2316 
     2317/* 
     2318 * NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE - returns whether or not 
     2319 * SLI Mosaic Mode supported. 
     2320 */ 
     2321 
     2322#define NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE                       303 /* R-- */ 
     2323#define NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE_FALSE                   0 
     2324#define NV_CTRL_SLI_MOSAIC_MODE_AVAILABLE_TRUE                    1 
     2325 
     2326/* 
     2327 * NV_CTRL_GVO_ENABLE_RGB_DATA - Allows clients to specify when 
     2328 * the GVO board should process colors as RGB when the output data 
     2329 * format is one of the NV_CTRL_GVO_DATA_FORMAT_???_PASSTRHU modes. 
     2330 */ 
     2331 
     2332#define NV_CTRL_GVO_ENABLE_RGB_DATA                             304 /* RW- */ 
     2333#define NV_CTRL_GVO_ENABLE_RGB_DATA_DISABLE                       0 
     2334#define NV_CTRL_GVO_ENABLE_RGB_DATA_ENABLE                        1 
     2335 
     2336/*  
     2337 * NV_CTRL_IMAGE_SHARPENING_DEFAULT - Returns default value of 
     2338 * Image Sharpening. 
     2339 */ 
     2340 
     2341#define NV_CTRL_IMAGE_SHARPENING_DEFAULT                        305 /* R-- */ 
     2342 
     2343/* 
     2344 * NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION - Returns the number of nanoseconds 
     2345 * that one unit of NV_CTRL_FRAMELOCK_SYNC_DELAY corresponds to. 
     2346 */ 
     2347#define NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION                 318 /* R-- */ 
     2348 
     2349#define NV_CTRL_LAST_ATTRIBUTE  NV_CTRL_FRAMELOCK_SYNC_DELAY_RESOLUTION 
     2350 
     2351 
     2352/**************************************************************************/ 
     2353 
     2354/* 
     2355 * String Attributes: 
     2356 * 
     2357 * String attributes can be queryied through the XNVCTRLQueryStringAttribute() 
     2358 * and XNVCTRLQueryTargetStringAttribute() function calls. 
     2359 *  
     2360 * String attributes can be set through the XNVCTRLSetStringAttribute() 
     2361 * function call.  (There are currently no string attributes that can be 
     2362 * set on non-X Screen targets.) 
     2363 * 
     2364 * Unless otherwise noted, all string attributes can be queried/set using an 
     2365 * NV_CTRL_TARGET_TYPE_X_SCREEN target.  Attributes that cannot take an 
     2366 * NV_CTRL_TARGET_TYPE_X_SCREEN target also cannot be queried/set through 
     2367 * XNVCTRLQueryStringAttribute()/XNVCTRLSetStringAttribute() (Since 
     2368 * these assume an X Screen target). 
     2369 */ 
     2370 
     2371 
     2372/* 
     2373 * NV_CTRL_STRING_PRODUCT_NAME - the GPU product name on which the 
     2374 * specified X screen is running. 
     2375 * 
     2376 * This attribute may be queried through XNVCTRLQueryTargetStringAttribute() 
     2377 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     2378 */ 
     2379 
     2380#define NV_CTRL_STRING_PRODUCT_NAME                             0  /* R--G */ 
     2381 
     2382 
     2383/* 
     2384 * NV_CTRL_STRING_VBIOS_VERSION - the video bios version on the GPU on 
     2385 * which the specified X screen is running. 
     2386 */ 
     2387 
     2388#define NV_CTRL_STRING_VBIOS_VERSION                            1  /* R--G */ 
     2389 
     2390 
     2391/* 
     2392 * NV_CTRL_STRING_NVIDIA_DRIVER_VERSION - string representation of the 
     2393 * NVIDIA driver version number for the NVIDIA X driver in use. 
     2394 */ 
     2395 
     2396#define NV_CTRL_STRING_NVIDIA_DRIVER_VERSION                    3  /* R--G */ 
     2397 
     2398 
     2399/* 
     2400 * NV_CTRL_STRING_DISPLAY_DEVICE_NAME - name of the display device 
     2401 * specified in the display_mask argument. 
     2402 * 
     2403 * This attribute may be queried through XNVCTRLQueryTargetStringAttribute() 
     2404 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     2405 */ 
     2406 
     2407#define NV_CTRL_STRING_DISPLAY_DEVICE_NAME                      4  /* R-DG */ 
     2408 
     2409 
     2410/* 
     2411 * NV_CTRL_STRING_TV_ENCODER_NAME - name of the TV encoder used by the 
     2412 * specified display device; only valid if the display device is a TV. 
     2413 */ 
     2414 
     2415#define NV_CTRL_STRING_TV_ENCODER_NAME                          5  /* R-DG */ 
     2416 
     2417 
     2418/* 
     2419 * NV_CTRL_STRING_GVO_FIRMWARE_VERSION - indicates the version of the 
     2420 * Firmware on the GVO device. 
     2421 */ 
     2422 
     2423#define NV_CTRL_STRING_GVO_FIRMWARE_VERSION                     8  /* R-- */ 
     2424 
     2425 
     2426/*  
     2427 * NV_CTRL_STRING_CURRENT_MODELINE - Return the ModeLine currently 
     2428 * being used by the specified display device. 
     2429 * 
     2430 * This attribute may be queried through XNVCTRLQueryTargetStringAttribute() 
     2431 * using an NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     2432 * 
     2433 * The ModeLine string may be prepended with a comma-separated list of 
     2434 * "token=value" pairs, separated from the ModeLine string by "::". 
     2435 * This "token=value" syntax is the same as that used in 
     2436 * NV_CTRL_BINARY_DATA_MODELINES 
     2437 */ 
     2438 
     2439#define NV_CTRL_STRING_CURRENT_MODELINE                         9   /* R-DG */ 
     2440 
     2441 
     2442/*  
     2443 * NV_CTRL_STRING_ADD_MODELINE - Adds a ModeLine to the specified 
     2444 * display device.  The ModeLine is not added if validation fails. 
     2445 * 
     2446 * The ModeLine string should have the same syntax as a ModeLine in 
     2447 * the X configuration file; e.g., 
     2448 * 
     2449 * "1600x1200"  229.5  1600 1664 1856 2160  1200 1201 1204 1250  +HSync +VSync 
     2450 */ 
     2451 
     2452#define NV_CTRL_STRING_ADD_MODELINE                            10   /* -WDG */ 
     2453 
     2454 
     2455/* 
     2456 * NV_CTRL_STRING_DELETE_MODELINE - Deletes an existing ModeLine 
     2457 * from the specified display device.  The currently selected 
     2458 * ModeLine cannot be deleted.  (This also means you cannot delete 
     2459 * the last ModeLine.) 
     2460 * 
     2461 * The ModeLine string should have the same syntax as a ModeLine in 
     2462 * the X configuration file; e.g., 
     2463 * 
     2464 * "1600x1200"  229.5  1600 1664 1856 2160  1200 1201 1204 1250  +HSync +VSync 
     2465 */ 
     2466 
     2467#define NV_CTRL_STRING_DELETE_MODELINE                         11   /* -WDG */ 
     2468 
     2469 
     2470/*  
     2471 * NV_CTRL_STRING_CURRENT_METAMODE - Returns the metamode currently 
     2472 * being used by the specified X screen.  The MetaMode string has the 
     2473 * same syntax as the MetaMode X configuration option, as documented 
     2474 * in the NVIDIA driver README. 
     2475 * 
     2476 * The returned string may be prepended with a comma-separated list of 
     2477 * "token=value" pairs, separated from the MetaMode string by "::". 
     2478 * This "token=value" syntax is the same as that used in 
     2479 * NV_CTRL_BINARY_DATA_METAMODES. 
     2480 */ 
     2481 
     2482#define NV_CTRL_STRING_CURRENT_METAMODE                        12   /* R--- */ 
     2483 
     2484 
     2485/*  
     2486 * NV_CTRL_STRING_ADD_METAMODE - Adds a MetaMode to the specified 
     2487 * X Screen. 
     2488 * 
     2489 * It is recommended to not use this attribute, but instead use 
     2490 * NV_CTRL_STRING_OPERATION_ADD_METAMODE. 
     2491 */ 
     2492 
     2493#define NV_CTRL_STRING_ADD_METAMODE                            13   /* -W-- */ 
     2494 
     2495 
     2496/* 
     2497 * NV_CTRL_STRING_DELETE_METAMODE - Deletes an existing MetaMode from 
     2498 * the specified X Screen.  The currently selected MetaMode cannot be 
     2499 * deleted.  (This also means you cannot delete the last MetaMode). 
     2500 * The MetaMode string should have the same syntax as the MetaMode X 
     2501 * configuration option, as documented in the NVIDIA driver README. 
     2502 */ 
     2503 
     2504#define NV_CTRL_STRING_DELETE_METAMODE                         14   /* -WD-- */ 
     2505 
     2506 
     2507/* 
     2508 * NV_CTRL_STRING_VCSC_PRODUCT_NAME - Querys the product name of the 
     2509 * VCSC device. 
     2510 * 
     2511 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2512 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2513 */ 
     2514 
     2515#define NV_CTRL_STRING_VCSC_PRODUCT_NAME                       15   /* R---V */ 
     2516 
     2517 
     2518/* 
     2519 * NV_CTRL_STRING_VCSC_PRODUCT_ID - Querys the product ID of the VCSC device. 
     2520 * 
     2521 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2522 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2523 */ 
     2524 
     2525#define NV_CTRL_STRING_VCSC_PRODUCT_ID                         16   /* R---V */ 
     2526 
     2527 
     2528/* 
     2529 * NV_CTRL_STRING_VCSC_SERIAL_NUMBER - Querys the unique serial number 
     2530 * of the VCS device. 
     2531 * 
     2532 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2533 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2534 */ 
     2535 
     2536#define NV_CTRL_STRING_VCSC_SERIAL_NUMBER                      17   /* R---V */ 
     2537 
     2538 
     2539/* 
     2540 * NV_CTRL_STRING_VCSC_BUILD_DATE - Querys the date of the VCS device. 
     2541 * the returned string is in the following format: "Week.Year" 
     2542 * 
     2543 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2544 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2545 */ 
     2546 
     2547#define NV_CTRL_STRING_VCSC_BUILD_DATE                         18   /* R---V */ 
     2548 
     2549 
     2550/* 
     2551 * NV_CTRL_STRING_VCSC_FIRMWARE_VERSION - Querys the firmware version 
     2552 * of the VCS device. 
     2553 * 
     2554 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2555 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2556 */ 
     2557 
     2558#define NV_CTRL_STRING_VCSC_FIRMWARE_VERSION                   19   /* R---V */ 
     2559 
     2560 
     2561/* 
     2562 * NV_CTRL_STRING_VCSC_FIRMWARE_REVISION - Querys the firmware revision 
     2563 * of the VCS device. 
     2564 * 
     2565 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2566 * using a NV_CTRL_TARGET_TYPE_VCS target. 
     2567 */ 
     2568 
     2569#define NV_CTRL_STRING_VCSC_FIRMWARE_REVISION                  20   /* R---V */ 
     2570 
     2571 
     2572/* 
     2573 * NV_CTRL_STRING_VCSC_HARDWARE_VERSION - Querys the hardware version 
     2574 * of the VCS device. 
     2575 * 
     2576 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2577 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2578 */ 
     2579 
     2580#define NV_CTRL_STRING_VCSC_HARDWARE_VERSION                   21   /* R---V */ 
     2581 
     2582 
     2583/* 
     2584 * NV_CTRL_STRING_VCSC_HARDWARE_REVISION - Querys the hardware revision 
     2585 * of the VCS device. 
     2586 * 
     2587 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2588 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2589 */ 
     2590 
     2591#define NV_CTRL_STRING_VCSC_HARDWARE_REVISION                  22   /* R---V */ 
     2592 
     2593 
     2594/*  
     2595 * NV_CTRL_STRING_MOVE_METAMODE - Moves a MetaMode to the specified 
     2596 * index location.  The MetaMode must already exist in the X Screen's 
     2597 * list of MetaModes (as returned by the NV_CTRL_BINARY_DATA_METAMODES 
     2598 * attribute).  If the index is larger than the number of MetaModes in 
     2599 * the list, the MetaMode is moved to the end of the list.  The 
     2600 * MetaMode string should have the same syntax as the MetaMode X 
     2601 * configuration option, as documented in the NVIDIA driver README. 
     2602 
     2603 * The MetaMode string must be prepended with a comma-separated list 
     2604 * of "token=value" pairs, separated from the MetaMode string by "::". 
     2605 * Currently, the only valid token is "index", which indicates where 
     2606 * in the MetaMode list the MetaMode should be moved to. 
     2607 * 
     2608 * Other tokens may be added in the future. 
     2609 * 
     2610 * E.g., 
     2611 *  "index=5 :: CRT-0: 1024x768 @1024x768 +0+0" 
     2612 */ 
     2613 
     2614#define NV_CTRL_STRING_MOVE_METAMODE                           23   /* -W-- */ 
     2615 
     2616 
     2617/* 
     2618 * NV_CTRL_STRING_VALID_HORIZ_SYNC_RANGES - returns the valid 
     2619 * horizontal sync ranges used to perform mode validation for the 
     2620 * specified display device.  The ranges are in the same format as the 
     2621 * "HorizSync" X config option: 
     2622 * 
     2623 *   "horizsync-range may be a comma separated list of either discrete 
     2624 *   values or ranges of values.  A range of values is two values 
     2625 *   separated by a dash." 
     2626 * 
     2627 * The values are in kHz. 
     2628 * 
     2629 * Additionally, the string may be prepended with a comma-separated 
     2630 * list of "token=value" pairs, separated from the HorizSync string by 
     2631 * "::".  Valid tokens: 
     2632 * 
     2633 *    Token     Value 
     2634 *   "source"  "edid"     - HorizSync is from the display device's EDID 
     2635 *             "xconfig"  - HorizSync is from the "HorizSync" entry in 
     2636 *                          the Monitor section of the X config file 
     2637 *             "option"   - HorizSync is from the "HorizSync" NVIDIA X 
     2638 *                          config option 
     2639 *             "twinview" - HorizSync is from the "SecondMonitorHorizSync" 
     2640 *                          NVIDIA X config option 
     2641 *             "builtin"  - HorizSync is from NVIDIA X driver builtin 
     2642 *                          default values 
     2643 * 
     2644 * Additional tokens and/or values may be added in the future. 
     2645 * 
     2646 * Example: "source=edid :: 30.000-62.000" 
     2647 */ 
     2648 
     2649#define NV_CTRL_STRING_VALID_HORIZ_SYNC_RANGES                 24   /* R-DG */ 
     2650 
     2651 
     2652/* 
     2653 * NV_CTRL_STRING_VALID_VERT_REFRESH_RANGES - returns the valid 
     2654 * vertical refresh ranges used to perform mode validation for the 
     2655 * specified display device.  The ranges are in the same format as the 
     2656 * "VertRefresh" X config option: 
     2657 * 
     2658 *   "vertrefresh-range may be a comma separated list of either discrete 
     2659 *    values or ranges of values.  A range of values is two values 
     2660 *    separated by a dash." 
     2661 * 
     2662 * The values are in Hz. 
     2663 * 
     2664 * Additionally, the string may be prepended with a comma-separated 
     2665 * list of "token=value" pairs, separated from the VertRefresh string by 
     2666 * "::".  Valid tokens: 
     2667 * 
     2668 *    Token     Value 
     2669 *   "source"  "edid"     - VertRefresh is from the display device's EDID 
     2670 *             "xconfig"  - VertRefresh is from the "VertRefresh" entry in 
     2671 *                          the Monitor section of the X config file 
     2672 *             "option"   - VertRefresh is from the "VertRefresh" NVIDIA X 
     2673 *                          config option 
     2674 *             "twinview" - VertRefresh is from the "SecondMonitorVertRefresh" 
     2675 *                          NVIDIA X config option 
     2676 *             "builtin"  - VertRefresh is from NVIDIA X driver builtin 
     2677 *                          default values 
     2678 * 
     2679 * Additional tokens and/or values may be added in the future. 
     2680 * 
     2681 * Example: "source=edid :: 50.000-75.000" 
     2682 */ 
     2683 
     2684#define NV_CTRL_STRING_VALID_VERT_REFRESH_RANGES               25   /* R-DG */ 
     2685 
     2686 
     2687/* 
     2688 * NV_CTRL_STRING_XINERAMA_SCREEN_INFO - returns the physical X Screen's 
     2689 * initial position and size (in absolute coordinates) within the Xinerama 
     2690 * desktop as the "token=value" string:  "x=#, y=#, width=#, height=#" 
     2691 * 
     2692 * Querying this attribute returns FALSE if NV_CTRL_XINERAMA is not 
     2693 * NV_CTRL_XINERAMA_ON. 
     2694 */ 
     2695 
     2696#define NV_CTRL_STRING_XINERAMA_SCREEN_INFO                    26   /* R--- */ 
     2697 
     2698 
     2699/* 
     2700 * NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER - used to specify the 
     2701 * order that display devices will be returned via Xinerama when 
     2702 * TwinViewXineramaInfo is enabled.  Follows the same syntax as the 
     2703 * TwinViewXineramaInfoOrder X config option. 
     2704 */ 
     2705 
     2706#define NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER            27   /* RW-- */ 
     2707 
     2708 
     2709/* 
     2710 * NV_CTRL_STRING_SLI_MODE - returns a string describing the current 
     2711 * SLI mode, if any, or FALSE if SLI is not currently enabled. 
     2712 * 
     2713 * This string should be used for informational purposes only, and 
     2714 * should not be used to distinguish between SLI modes, other than to 
     2715 * recognize when SLI is disabled (FALSE is returned) or 
     2716 * enabled (the returned string is non-NULL and describes the current 
     2717 * SLI configuration). 
     2718 */ 
     2719 
     2720#define NV_CTRL_STRING_SLI_MODE                                28   /* R---*/ 
     2721 
     2722 
     2723/* 
     2724 * NV_CTRL_STRING_PERFORMANCE_MODES - returns a string with all the 
     2725 * performance modes defined for this GPU along with their associated 
     2726 * NV Clock and Memory Clock values. 
     2727 * 
     2728 * Each performance modes are returned as a comma-separated list of 
     2729 * "token=value" pairs.  Each set of performance mode tokens are separated 
     2730 * by a ";".  Valid tokens: 
     2731 * 
     2732 *    Token      Value 
     2733 *   "perf"      integer   - the Performance level 
     2734 *   "nvClock"   integer   - the GPU clocks (in MHz) for the perf level 
     2735 *   "memClock"  integer   - the memory clocks (in MHz) for the perf level 
     2736 * 
     2737 * 
     2738 * Example: 
     2739 * 
     2740 *   perf=0, nvclock=500, memclock=505 ; perf=1, nvclock=650, memclock=505 
     2741 * 
     2742 * This attribute may be queried through XNVCTRLQueryTargetStringAttribute() 
     2743 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     2744 */ 
     2745 
     2746#define NV_CTRL_STRING_PERFORMANCE_MODES                      29   /* R--G */ 
     2747 
     2748 
     2749/* 
     2750 * NV_CTRL_STRING_VCSC_FAN_STATUS - returns a string with status of all the 
     2751 * fans in the Visual Computing System, if such a query is supported.  Fan 
     2752 * information is reported along with its tachometer reading (in RPM) and a  
     2753 * flag indicating whether the fan has failed or not. 
     2754 *  
     2755 * Valid tokens: 
     2756 * 
     2757 *    Token      Value 
     2758 *   "fan"       integer   - the Fan index 
     2759 *   "speed"     integer   - the tachometer reading of the fan in rpm 
     2760 *   "fail"      integer   - flag to indicate whether the fan has failed 
     2761 * 
     2762 * Example: 
     2763 * 
     2764 *   fan=0, speed=694, fail=0 ; fan=1, speed=693, fail=0 
     2765 * 
     2766 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2767 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2768 * 
     2769 */ 
     2770 
     2771#define NV_CTRL_STRING_VCSC_FAN_STATUS                         30   /* R---V */ 
     2772 
     2773 
     2774/* 
     2775 * NV_CTRL_STRING_VCSC_TEMPERATURES - returns a string with all Temperature 
     2776 * readings in the Visual Computing System, if such a query is supported.   
     2777 * Intake, Exhaust and Board Temperature values are reported in Celcius. 
     2778 *  
     2779 * Valid tokens: 
     2780 * 
     2781 *    Token      Value 
     2782 *   "intake"    integer   - the intake temperature for the VCS 
     2783 *   "exhaust"   integer   - the exhaust temperature for the VCS 
     2784 *   "board"     integer   - the board temperature of the VCS 
     2785 * 
     2786 * Example: 
     2787 * 
     2788 *   intake=29, exhaust=46, board=41 
     2789 * 
     2790 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2791 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2792 * 
     2793 */ 
     2794 
     2795#define NV_CTRL_STRING_VCSC_TEMPERATURES                       31   /* R---V */ 
     2796 
     2797 
     2798/* 
     2799 * NV_CTRL_STRING_VCSC_PSU_INFO - returns a string with all Power Supply Unit 
     2800 * related readings in the Visual Computing System, if such a query is  
     2801 * supported.  Current in amperes, Power in watts, Voltage in volts and PSU  
     2802 * state may be reported.  Not all PSU types support all of these values, and 
     2803 * therefore some readings may be unknown. 
     2804 *  
     2805 * Valid tokens: 
     2806 * 
     2807 *    Token      Value 
     2808 *   "current"   integer   - the current drawn in amperes by the VCS 
     2809 *   "power"     integer   - the power drawn in watts by the VCS 
     2810 *   "voltage"   integer   - the voltage reading of the VCS 
     2811 *   "state"     integer   - flag to indicate whether PSU is operating normally 
     2812 * 
     2813 * Example: 
     2814 * 
     2815 *   current=10, power=15, voltage=unknown, state=normal 
     2816 * 
     2817 * This attribute must be queried through XNVCTRLQueryTargetStringAttribute() 
     2818 * using a NV_CTRL_TARGET_TYPE_VCSC target. 
     2819 * 
     2820 */ 
     2821 
     2822 
     2823#define NV_CTRL_STRING_VCSC_PSU_INFO                           32   /* R---V */ 
     2824 
     2825 
     2826/* 
     2827 * NV_CTRL_STRING_GVO_VIDEO_FORMAT_NAME - query the name for the specified 
     2828 * NV_CTRL_GVO_VIDEO_FORMAT_*.  So that this can be queried with existing 
     2829 * interfaces, XNVCTRLQueryStringAttribute() should be used, and the video 
     2830 * format specified in the display_mask field; eg: 
     2831 * 
     2832 * XNVCTRLQueryStringAttribute(dpy, 
     2833 *                             screen,  
     2834 *                             NV_CTRL_GVO_VIDEO_FORMAT_720P_60_00_SMPTE296, 
     2835 *                             NV_CTRL_GVO_VIDEO_FORMAT_NAME, 
     2836 *                             &name); 
     2837 */ 
     2838 
     2839#define NV_CTRL_STRING_GVO_VIDEO_FORMAT_NAME                   33  /* R--- */ 
     2840 
     2841#define NV_CTRL_STRING_LAST_ATTRIBUTE \ 
     2842        NV_CTRL_STRING_GVO_VIDEO_FORMAT_NAME 
     2843 
     2844 
     2845/**************************************************************************/ 
     2846 
     2847/* 
     2848 * Binary Data Attributes: 
     2849 * 
     2850 * Binary data attributes can be queryied through the XNVCTRLQueryBinaryData() 
     2851 * and XNVCTRLQueryTargetBinaryData() function calls. 
     2852 *  
     2853 * There are currently no binary data attributes that can be set. 
     2854 * 
     2855 * Unless otherwise noted, all Binary data attributes can be queried 
     2856 * using an NV_CTRL_TARGET_TYPE_X_SCREEN target.  Attributes that cannot take 
     2857 * an NV_CTRL_TARGET_TYPE_X_SCREEN target also cannot be queried through 
     2858 * XNVCTRLQueryBinaryData() (Since an X Screen target is assumed). 
     2859 */ 
     2860 
     2861 
     2862/* 
     2863 * NV_CTRL_BINARY_DATA_EDID - Returns a display device's EDID information 
     2864 * data. 
     2865 * 
     2866 * This attribute may be queried through XNVCTRLQueryTargetBinaryData() 
     2867 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     2868 */ 
     2869 
     2870#define NV_CTRL_BINARY_DATA_EDID                                0  /* R-DG */ 
     2871 
     2872 
     2873/*  
     2874 * NV_CTRL_BINARY_DATA_MODELINES - Returns a display device's supported 
     2875 * ModeLines.  ModeLines are returned in a buffer, separated by a single 
     2876 * '\0' and terminated by two consecutive '\0' s like so: 
     2877 * 
     2878 *  "ModeLine 1\0ModeLine 2\0ModeLine 3\0Last ModeLine\0\0" 
     2879 * 
     2880 * This attribute may be queried through XNVCTRLQueryTargetBinaryData() 
     2881 * using a NV_CTRL_TARGET_TYPE_GPU or NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     2882 * 
     2883 * Each ModeLine string may be prepended with a comma-separated list 
     2884 * of "token=value" pairs, separated from the ModeLine string with a 
     2885 * "::".  Valid tokens: 
     2886 * 
     2887 *    Token    Value 
     2888 *   "source" "xserver"    - the ModeLine is from the core X server 
     2889 *            "xconfig"    - the ModeLine was specified in the X config file 
     2890 *            "builtin"    - the NVIDIA driver provided this builtin ModeLine 
     2891 *            "vesa"       - this is a VESA standard ModeLine 
     2892 *            "edid"       - the ModeLine was in the display device's EDID 
     2893 *            "nv-control" - the ModeLine was specified via NV-CONTROL 
     2894 *             
     2895 *   "xconfig-name"        - for ModeLines that were specified in the X config 
     2896 *                           file, this is the name the X config file 
     2897 *                           gave for the ModeLine. 
     2898 * 
     2899 * Note that a ModeLine can have several sources; the "source" token 
     2900 * can appear multiple times in the "token=value" pairs list. 
     2901 * Additional source values may be specified in the future. 
     2902 * 
     2903 * Additional tokens may be added in the future, so it is recommended 
     2904 * that any token parser processing the returned string from 
     2905 * NV_CTRL_BINARY_DATA_MODELINES be implemented to gracefully ignore 
     2906 * unrecognized tokens. 
     2907 * 
     2908 * E.g., 
     2909 * 
     2910 * "source=xserver, source=vesa, source=edid :: "1024x768_70"  75.0  1024 1048 1184 1328  768 771 777 806  -HSync -VSync" 
     2911 * "source=xconfig, xconfig-name=1600x1200_60.00 :: "1600x1200_60_0"  161.0  1600 1704 1880 2160  1200 1201 1204 1242  -HSync +VSync" 
     2912 */ 
     2913 
     2914#define NV_CTRL_BINARY_DATA_MODELINES                           1   /* R-DG */ 
     2915 
     2916 
     2917/*  
     2918 * NV_CTRL_BINARY_DATA_METAMODES - Returns an X Screen's supported 
     2919 * MetaModes.  MetaModes are returned in a buffer separated by a 
     2920 * single '\0' and terminated by two consecutive '\0' s like so: 
     2921 * 
     2922 *  "MetaMode 1\0MetaMode 2\0MetaMode 3\0Last MetaMode\0\0" 
     2923 * 
     2924 * The MetaMode string should have the same syntax as the MetaMode X 
     2925 * configuration option, as documented in the NVIDIA driver README. 
     2926 
     2927 * Each MetaMode string may be prepended with a comma-separated list 
     2928 * of "token=value" pairs, separated from the MetaMode string with 
     2929 * "::".  Currently, valid tokens are: 
     2930 * 
     2931 *    Token        Value 
     2932 *   "id"         <number>     - the id of this MetaMode; this is stored in 
     2933 *                               the Vertical Refresh field, as viewed 
     2934 *                               by the XRandR and XF86VidMode X * 
     2935 *                               extensions. 
     2936 * 
     2937 *   "switchable" "yes"/"no"   - whether this MetaMode may be switched to via 
     2938 *                               ctrl-alt-+/-; Implicit MetaModes (see 
     2939 *                               the "IncludeImplicitMetaModes" X 
     2940 *                               config option), for example, are not 
     2941 *                               normally made available through 
     2942 *                               ctrl-alt-+/-. 
     2943 * 
     2944 *   "source"     "xconfig"    - the MetaMode was specified in the X 
     2945 *                               config file. 
     2946 *                "implicit"   - the MetaMode was implicitly added; see the 
     2947 *                               "IncludeImplicitMetaModes" X config option 
     2948 *                               for details. 
     2949 *                "nv-control" - the MetaMode was added via the NV-CONTROL X 
     2950 *                               extension to the currently running X server. 
     2951 * 
     2952 * Additional tokens may be added in the future, so it is recommended 
     2953 * that any token parser processing the returned string from 
     2954 * NV_CTRL_BINARY_DATA_METAMODES be implemented to gracefully ignore 
     2955 * unrecognized tokens. 
     2956 * 
     2957 * E.g., 
     2958 * 
     2959 *   "id=50, switchable=yes, source=xconfig :: CRT-0: 1024x768 @1024x768 +0+0" 
     2960 */ 
     2961 
     2962#define NV_CTRL_BINARY_DATA_METAMODES                           2   /* R-D- */ 
     2963 
     2964 
     2965/* 
     2966 * NV_CTRL_BINARY_DATA_XSCREENS_USING_GPU - Returns the list of X 
     2967 * screens currently driven by the given GPU. 
     2968 * 
     2969 * The format of the returned data is: 
     2970 * 
     2971 *     4       CARD32 number of screens 
     2972 *     4 * n   CARD32 screen indices 
     2973 * 
     2974 * This attribute can only be queried through XNVCTRLQueryTargetBinaryData() 
     2975 * using a NV_CTRL_TARGET_TYPE_GPU target.  This attribute cannot be 
     2976 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN. 
     2977 */ 
     2978 
     2979#define NV_CTRL_BINARY_DATA_XSCREENS_USING_GPU                  3   /* R-DG */ 
     2980 
     2981 
     2982/* 
     2983 * NV_CTRL_BINARY_DATA_GPUS_USED_BY_XSCREEN - Returns the list of GPUs 
     2984 * currently in use by the given X screen. 
     2985 * 
     2986 * The format of the returned data is: 
     2987 * 
     2988 *     4       CARD32 number of GPUs 
     2989 *     4 * n   CARD32 GPU indices 
     2990 */ 
     2991 
     2992#define NV_CTRL_BINARY_DATA_GPUS_USED_BY_XSCREEN                4   /* R--- */ 
     2993 
     2994 
     2995/* 
     2996 * NV_CTRL_BINARY_DATA_GPUS_USING_FRAMELOCK - Returns the list of 
     2997 * GPUs currently connected to the given frame lock board. 
     2998 * 
     2999 * The format of the returned data is: 
     3000 * 
     3001 *     4       CARD32 number of GPUs 
     3002 *     4 * n   CARD32 GPU indices 
     3003 * 
     3004 * This attribute can only be queried through XNVCTRLQueryTargetBinaryData() 
     3005 * using a NV_CTRL_TARGET_TYPE_FRAMELOCK target.  This attribute cannot be 
     3006 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN. 
     3007 */ 
     3008 
     3009#define NV_CTRL_BINARY_DATA_GPUS_USING_FRAMELOCK                5   /* R-DF */ 
     3010 
     3011 
     3012/* 
     3013 * NV_CTRL_BINARY_DATA_DISPLAY_VIEWPORT - Returns the Display Device's 
     3014 * viewport box into the given X Screen (in X Screen coordinates.) 
     3015 * 
     3016 * The format of the returned data is: 
     3017 * 
     3018 *     4       CARD32 Offset X 
     3019 *     4       CARD32 Offset Y 
     3020 *     4       CARD32 Width 
     3021 *     4       CARD32 Height 
     3022 */ 
     3023 
     3024#define NV_CTRL_BINARY_DATA_DISPLAY_VIEWPORT                    6   /* R-DG */ 
     3025 
     3026 
     3027/* 
     3028 * NV_CTRL_BINARY_DATA_FRAMELOCKS_USED_BY_GPU - Returns the list of 
     3029 * Framelock devices currently connected to the given GPU. 
     3030 * 
     3031 * The format of the returned data is: 
     3032 * 
     3033 *     4       CARD32 number of Framelocks 
     3034 *     4 * n   CARD32 Framelock indices 
     3035 * 
     3036 * This attribute can only be queried through XNVCTRLQueryTargetBinaryData() 
     3037 * using a NV_CTRL_TARGET_TYPE_GPU target.  This attribute cannot be 
     3038 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN. 
     3039 */ 
     3040 
     3041#define NV_CTRL_BINARY_DATA_FRAMELOCKS_USED_BY_GPU              7   /* R-DG */ 
     3042 
     3043 
     3044/* 
     3045 * NV_CTRL_BINARY_DATA_GPUS_USING_VCSC - Returns the list of 
     3046 * GPU devices connected to the given VCS. 
     3047 * 
     3048 * The format of the returned data is: 
     3049 * 
     3050 *     4       CARD32 number of GPUs 
     3051 *     4 * n   CARD32 GPU indices 
     3052 * 
     3053 * This attribute can only be queried through XNVCTRLQueryTargetBinaryData() 
     3054 * using a NV_CTRL_TARGET_TYPE_VCSC target.  This attribute cannot be 
     3055 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN and cannot be queried using 
     3056 * a  NV_CTRL_TARGET_TYPE_X_GPU 
     3057 */ 
     3058 
     3059#define NV_CTRL_BINARY_DATA_GPUS_USING_VCSC                    8   /* R-DV */ 
     3060 
     3061 
     3062/* 
     3063 * NV_CTRL_BINARY_DATA_VCSCS_USED_BY_GPU - Returns the VCSC device 
     3064 * that is controlling the given GPU. 
     3065 * 
     3066 * The format of the returned data is: 
     3067 * 
     3068 *     4       CARD32 number of VCS (always 1) 
     3069 *     4 * n   CARD32 VCS indices 
     3070 * 
     3071 * This attribute can only be queried through XNVCTRLQueryTargetBinaryData() 
     3072 * using a NV_CTRL_TARGET_TYPE_GPU target.  This attribute cannot be 
     3073 * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN 
     3074 */ 
     3075 
     3076#define NV_CTRL_BINARY_DATA_VCSCS_USED_BY_GPU                  9   /* R-DG */ 
     3077 
     3078#define NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE \ 
     3079        NV_CTRL_BINARY_DATA_VCSCS_USED_BY_GPU 
     3080 
     3081 
     3082/**************************************************************************/ 
     3083 
     3084/* 
     3085 * String Operation Attributes: 
     3086 * 
     3087 * These attributes are used with the XNVCTRLStringOperation() 
     3088 * function; a string is specified as input, and a string is returned 
     3089 * as output. 
     3090 * 
     3091 * Unless otherwise noted, all attributes can be operated upon using 
     3092 * an NV_CTRL_TARGET_TYPE_X_SCREEN target. 
     3093 */ 
     3094 
     3095 
     3096/* 
     3097 * NV_CTRL_STRING_OPERATION_ADD_METAMODE - provide a MetaMode string 
     3098 * as input, and returns a string containing comma-separated list of 
     3099 * "token=value" pairs as output.  Currently, the only output token is 
     3100 * "id", which indicates the id that was assigned to the MetaMode. 
     3101 * 
     3102 * All ModeLines referenced in the MetaMode must already exist for 
     3103 * each display device (as returned by the 
     3104 * NV_CTRL_BINARY_DATA_MODELINES attribute). 
     3105 * 
     3106 * The MetaMode string should have the same syntax as the MetaMode X 
     3107 * configuration option, as documented in the NVIDIA driver README. 
     3108 * 
     3109 * The input string can optionally be prepended with a string of 
     3110 * comma-separated "token=value" pairs, separated from the MetaMode 
     3111 * string by "::".  Currently, the only valid token is "index" which 
     3112 * indicates the insertion index for the MetaMode. 
     3113 * 
     3114 * E.g., 
     3115 * 
     3116 * Input: "index=5 :: 1600x1200+0+0, 1600x1200+1600+0" 
     3117 * Output: "id=58" 
     3118 * 
     3119 * which causes the MetaMode to be inserted at position 5 in the 
     3120 * MetaMode list (all entries after 5 will be shifted down one slot in 
     3121 * the list), and the X server's containing mode stores 58 as the 
     3122 * VRefresh, so that the MetaMode can be uniquely identifed through 
     3123 * XRandR and XF86VidMode. 
     3124 */ 
     3125 
     3126#define NV_CTRL_STRING_OPERATION_ADD_METAMODE                  0 
     3127 
     3128 
     3129/* 
     3130 * NV_CTRL_STRING_OPERATION_GTF_MODELINE - provide as input a string 
     3131 * of comma-separated "token=value" pairs, and returns a ModeLine 
     3132 * string, computed using the GTF formula using the parameters from 
     3133 * the input string.  Valid tokens for the input string are "width", 
     3134 * "height", and "refreshrate". 
     3135 * 
     3136 * E.g., 
     3137 * 
     3138 * Input: "width=1600, height=1200, refreshrate=60" 
     3139 * Output: "160.96  1600 1704 1880 2160  1200 1201 1204 1242  -HSync +VSync" 
     3140 * 
     3141 * This operation does not have any impact on any display device's 
     3142 * modePool, and the ModeLine is not validated; it is simply intended 
     3143 * for generating ModeLines. 
     3144 */ 
     3145 
     3146#define NV_CTRL_STRING_OPERATION_GTF_MODELINE                  1 
     3147 
     3148 
     3149/* 
     3150 * NV_CTRL_STRING_OPERATION_CVT_MODELINE - provide as input a string 
     3151 * of comma-separated "token=value" pairs, and returns a ModeLine 
     3152 * string, computed using the CVT formula using the parameters from 
     3153 * the input string.  Valid tokens for the input string are "width", 
     3154 * "height", "refreshrate", and "reduced-blanking".  The 
     3155 * "reduced-blanking" argument can be "0" or "1", to enable or disable 
     3156 * use of reduced blanking for the CVT formula. 
     3157 * 
     3158 * E.g., 
     3159 * 
     3160 * Input: "width=1600, height=1200, refreshrate=60, reduced-blanking=1" 
     3161 * Output: "130.25  1600 1648 1680 1760  1200 1203 1207 1235  +HSync -VSync" 
     3162 * 
     3163 * This operation does not have any impact on any display device's 
     3164 * modePool, and the ModeLine is not validated; it is simply intended 
     3165 * for generating ModeLines. 
     3166 */ 
     3167 
     3168#define NV_CTRL_STRING_OPERATION_CVT_MODELINE                  2 
     3169 
     3170 
     3171/* 
     3172 * NV_CTRL_STRING_OPERATION_BUILD_MODEPOOL - build a ModePool for the 
     3173 * specified display device on the specified target (either an X 
     3174 * screen or a GPU).  This is typically used to generate a ModePool 
     3175 * for a display device on a GPU on which no X screens are present. 
     3176 * 
     3177 * Currently, a display device's ModePool is static for the life of 
     3178 * the X server, so XNVCTRLStringOperation will return FALSE if 
     3179 * requested to build a ModePool on a display device that already has 
     3180 * a ModePool. 
     3181 * 
     3182 * The string input to BUILD_MODEPOOL may be NULL.  If it is not NULL, 
     3183 * then it is interpreted as a double-semicolon ("::") separated list 
     3184 * of "option=value" pairs, where the options and the syntax of their 
     3185 * values are the X configuration options that impact the behavior of 
     3186 * modePool construction; namely: 
     3187 * 
     3188 *    "ModeValidation" 
     3189 *    "HorizSync" 
     3190 *    "VertRefresh" 
     3191 *    "FlatPanelProperties" 
     3192 *    "TVStandard" 
     3193 *    "ExactModeTimingsDVI" 
     3194 *    "UseEdidFreqs" 
     3195 * 
     3196 * An example input string might look like: 
     3197 * 
     3198 *   "ModeValidation=NoVesaModes :: HorizSync=50-110 :: VertRefresh=50-150" 
     3199 * 
     3200 * This request currently does not return a string. 
     3201 */ 
     3202 
     3203#define NV_CTRL_STRING_OPERATION_BUILD_MODEPOOL                3 /* DG */ 
     3204 
     3205 
     3206#define NV_CTRL_STRING_OPERATION_LAST_ATTRIBUTE \ 
     3207        NV_CTRL_STRING_OPERATION_BUILD_MODEPOOL 
     3208 
     3209 
     3210 
     3211/**************************************************************************/ 
     3212 
     3213/* 
     3214 * CTRLAttributeValidValuesRec - 
     3215 * 
     3216 * structure and related defines used by 
     3217 * XNVCTRLQueryValidAttributeValues() to describe the valid values of 
     3218 * a particular attribute.  The type field will be one of: 
     3219 * 
     3220 * ATTRIBUTE_TYPE_INTEGER : the attribute is an integer value; there 
     3221 * is no fixed range of valid values. 
     3222 * 
     3223 * ATTRIBUTE_TYPE_BITMASK : the attribute is an integer value, 
     3224 * interpretted as a bitmask. 
     3225 * 
     3226 * ATTRIBUTE_TYPE_BOOL : the attribute is a boolean, valid values are 
     3227 * either 1 (on/true) or 0 (off/false). 
     3228 * 
     3229 * ATTRIBUTE_TYPE_RANGE : the attribute can have any integer value 
     3230 * between NVCTRLAttributeValidValues.u.range.min and 
     3231 * NVCTRLAttributeValidValues.u.range.max (inclusive). 
     3232 * 
     3233 * ATTRIBUTE_TYPE_INT_BITS : the attribute can only have certain 
     3234 * integer values, indicated by which bits in 
     3235 * NVCTRLAttributeValidValues.u.bits.ints are on (for example: if bit 
     3236 * 0 is on, then 0 is a valid value; if bit 5 is on, then 5 is a valid 
     3237 * value, etc).  This is useful for attributes like NV_CTRL_FSAA_MODE, 
     3238 * which can only have certain values, depending on GPU. 
     3239 * 
     3240 * 
     3241 * The permissions field of NVCTRLAttributeValidValuesRec is a bitmask 
     3242 * that may contain: 
     3243 * 
     3244 * ATTRIBUTE_TYPE_READ      - Attribute may be read (queried.) 
     3245 * ATTRIBUTE_TYPE_WRITE     - Attribute may be written to (set.) 
     3246 * ATTRIBUTE_TYPE_DISPLAY   - Attribute requires a display mask. 
     3247 * ATTRIBUTE_TYPE_GPU       - Attribute is valid for GPU target types. 
     3248 * ATTRIBUTE_TYPE_FRAMELOCK - Attribute is valid for Frame Lock target types. 
     3249 * ATTRIBUTE_TYPE_X_SCREEN  - Attribute is valid for X Screen target types. 
     3250 * ATTRIBUTE_TYPE_XINERAMA  - Attribute will be made consistent for all 
     3251 *                            X Screens when the Xinerama extension is enabled. 
     3252 * 
     3253 * 
     3254 * See 'Key to Integer Attribute "Permissions"' at the top of this 
     3255 * file for a description of what these permission bits mean. 
     3256 */ 
     3257 
     3258#define ATTRIBUTE_TYPE_UNKNOWN   0 
     3259#define ATTRIBUTE_TYPE_INTEGER   1 
     3260#define ATTRIBUTE_TYPE_BITMASK   2 
     3261#define ATTRIBUTE_TYPE_BOOL      3 
     3262#define ATTRIBUTE_TYPE_RANGE     4 
     3263#define ATTRIBUTE_TYPE_INT_BITS  5 
     3264 
     3265#define ATTRIBUTE_TYPE_READ       0x01 
     3266#define ATTRIBUTE_TYPE_WRITE      0x02 
     3267#define ATTRIBUTE_TYPE_DISPLAY    0x04 
     3268#define ATTRIBUTE_TYPE_GPU        0x08 
     3269#define ATTRIBUTE_TYPE_FRAMELOCK  0x10 
     3270#define ATTRIBUTE_TYPE_X_SCREEN   0x20 
     3271#define ATTRIBUTE_TYPE_XINERAMA   0x40 
     3272#define ATTRIBUTE_TYPE_VCSC       0x80 
     3273 
     3274typedef struct _NVCTRLAttributeValidValues { 
     3275    int type; 
     3276    union { 
     3277        struct { 
     3278            int min; 
     3279            int max; 
     3280        } range; 
     3281        struct { 
     3282            unsigned int ints; 
     3283        } bits; 
     3284    } u; 
     3285    unsigned int permissions; 
     3286} NVCTRLAttributeValidValuesRec; 
     3287 
     3288 
     3289/**************************************************************************/ 
     3290 
     3291/* 
     3292 * NV-CONTROL X event notification. 
     3293 * 
     3294 * To receive X event notifications dealing with NV-CONTROL, you should 
     3295 * call XNVCtrlSelectNotify() with one of the following set as the type 
     3296 * of event to receive (see NVCtrlLib.h for more information): 
     3297 */ 
     3298 
     3299#define ATTRIBUTE_CHANGED_EVENT                     0 
     3300#define TARGET_ATTRIBUTE_CHANGED_EVENT              1 
     3301#define TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENT 2 
     3302#define TARGET_STRING_ATTRIBUTE_CHANGED_EVENT       3 
     3303#define TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT       4 
     3304 
     3305 
     3306#endif /* __NVCTRL_H */ 
  • new file 0.21-fixes/mythtv/libs/libmyth/nvidia/NVCtrlLib.h

    - +  
     1/* 
     2 * Copyright (c) 2008 NVIDIA, Corporation 
     3 * 
     4 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     5 * of this software and associated documentation files (the "Software"), to deal 
     6 * in the Software without restriction, including without limitation the rights 
     7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     8 * copies of the Software, and to permit persons to whom the Software is 
     9 * furnished to do so, subject to the following conditions: 
     10 * 
     11 * The above copyright notice and this permission notice (including the next 
     12 * paragraph) shall be included in all copies or substantial portions of the 
     13 * Software. 
     14 * 
     15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE 
     18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
     21 * SOFTWARE. 
     22 */ 
     23 
     24#ifndef __NVCTRLLIB_H 
     25#define __NVCTRLLIB_H 
     26 
     27#include "NVCtrl.h" 
     28 
     29#if defined __cplusplus 
     30extern "C" { 
     31#endif  
     32 
     33/* 
     34 *  XNVCTRLQueryExtension - 
     35 * 
     36 *  Returns True if the extension exists, returns False otherwise. 
     37 *  event_basep and error_basep are the extension event and error 
     38 *  bases.  Currently, no extension specific errors or events are 
     39 *  defined. 
     40 */ 
     41 
     42Bool XNVCTRLQueryExtension ( 
     43    Display *dpy, 
     44    int *event_basep, 
     45    int *error_basep 
     46); 
     47 
     48 
     49/* 
     50 *  XNVCTRLQueryVersion - 
     51 * 
     52 *  Returns True if the extension exists, returns False otherwise. 
     53 *  major and minor are the extension's major and minor version 
     54 *  numbers. 
     55 */ 
     56 
     57Bool XNVCTRLQueryVersion ( 
     58    Display *dpy, 
     59    int *major, 
     60    int *minor 
     61); 
     62 
     63 
     64/* 
     65 *  XNVCTRLIsNvScreen 
     66 * 
     67 *  Returns True is the specified screen is controlled by the NVIDIA 
     68 *  driver.  Returns False otherwise. 
     69 */ 
     70 
     71Bool XNVCTRLIsNvScreen ( 
     72    Display *dpy, 
     73    int screen 
     74); 
     75 
     76 
     77/* 
     78 *  XNVCTRLQueryTargetCount - 
     79 * 
     80 *  Returns True if the target type exists.  Returns False otherwise. 
     81 *  If XNVCTRLQueryTargetCount returns True, value will contain the 
     82 *  count of existing targets on the server of the specified target 
     83 *  type. 
     84 * 
     85 *  Please see "Attribute Targets" in NVCtrl.h for the list of valid 
     86 *  target types. 
     87 * 
     88 *  Possible errors: 
     89 *     BadValue - The target doesn't exist. 
     90 */ 
     91 
     92Bool XNVCTRLQueryTargetCount ( 
     93    Display *dpy, 
     94    int target_type, 
     95    int *value 
     96); 
     97 
     98 
     99/* 
     100 *  XNVCTRLSetAttribute - 
     101 * 
     102 *  Sets the attribute to the given value.  The attributes and their 
     103 *  possible values are listed in NVCtrl.h. 
     104 * 
     105 *  Not all attributes require the display_mask parameter; see 
     106 *  NVCtrl.h for details. 
     107 * 
     108 *  Calling this function is equivalent to calling XNVCTRLSetTargetAttribute() 
     109 *  with the target_type set to NV_CTRL_TARGET_TYPE_X_SCREEN and 
     110 *  target_id set to 'screen'. 
     111 * 
     112 *  Possible errors: 
     113 *     BadValue - The screen or attribute doesn't exist. 
     114 *     BadMatch - The NVIDIA driver is not present on that screen. 
     115 */ 
     116 
     117void XNVCTRLSetAttribute ( 
     118    Display *dpy, 
     119    int screen, 
     120    unsigned int display_mask, 
     121    unsigned int attribute, 
     122    int value 
     123); 
     124 
     125 
     126/* 
     127 *  XNVCTRLSetTargetAttribute - 
     128 * 
     129 *  Sets the attribute to the given value.  The attributes and their 
     130 *  possible values are listed in NVCtrl.h. 
     131 * 
     132 *  Not all attributes require the display_mask parameter; see 
     133 *  NVCtrl.h for details. 
     134 * 
     135 *  Possible errors: 
     136 *     BadValue - The target or attribute doesn't exist. 
     137 *     BadMatch - The NVIDIA driver is not present on that target. 
     138 */ 
     139 
     140void XNVCTRLSetTargetAttribute ( 
     141    Display *dpy, 
     142    int target_type, 
     143    int target_id, 
     144    unsigned int display_mask, 
     145    unsigned int attribute, 
     146    int value 
     147); 
     148 
     149 
     150/* 
     151 *  XNVCTRLSetAttributeAndGetStatus - 
     152 * 
     153 * Same as XNVCTRLSetAttribute(). 
     154 * In addition, XNVCTRLSetAttributeAndGetStatus() returns  
     155 * True if the operation succeeds, False otherwise. 
     156 * 
     157 */ 
     158 
     159Bool XNVCTRLSetAttributeAndGetStatus ( 
     160    Display *dpy, 
     161    int screen, 
     162    unsigned int display_mask, 
     163    unsigned int attribute, 
     164    int value 
     165); 
     166 
     167 
     168/* 
     169 *  XNVCTRLQueryAttribute - 
     170 * 
     171 *  Returns True if the attribute exists.  Returns False otherwise. 
     172 *  If XNVCTRLQueryAttribute returns True, value will contain the 
     173 *  value of the specified attribute. 
     174 * 
     175 *  Not all attributes require the display_mask parameter; see 
     176 *  NVCtrl.h for details. 
     177 * 
     178 *  Calling this function is equivalent to calling 
     179 *  XNVCTRLQueryTargetAttribute() with the target_type set to 
     180 *  NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'. 
     181 * 
     182 *  Possible errors: 
     183 *     BadValue - The screen doesn't exist. 
     184 *     BadMatch - The NVIDIA driver is not present on that screen. 
     185 */ 
     186 
     187Bool XNVCTRLQueryAttribute ( 
     188    Display *dpy, 
     189    int screen, 
     190    unsigned int display_mask, 
     191    unsigned int attribute, 
     192    int *value 
     193); 
     194 
     195 
     196/* 
     197 * XNVCTRLQueryTargetAttribute - 
     198 * 
     199 *  Returns True if the attribute exists.  Returns False otherwise. 
     200 *  If XNVCTRLQueryTargetAttribute returns True, value will contain the 
     201 *  value of the specified attribute. 
     202 * 
     203 *  Not all attributes require the display_mask parameter; see 
     204 *  NVCtrl.h for details. 
     205 * 
     206 *  Possible errors: 
     207 *     BadValue - The target doesn't exist. 
     208 *     BadMatch - The NVIDIA driver does not control the target. 
     209 */ 
     210 
     211Bool XNVCTRLQueryTargetAttribute ( 
     212    Display *dpy, 
     213    int target_Type, 
     214    int target_id, 
     215    unsigned int display_mask, 
     216    unsigned int attribute, 
     217    int *value 
     218); 
     219 
     220 
     221/* 
     222 *  XNVCTRLQueryStringAttribute - 
     223 * 
     224 *  Returns True if the attribute exists.  Returns False otherwise. 
     225 *  If XNVCTRLQueryStringAttribute returns True, *ptr will point to an 
     226 *  allocated string containing the string attribute requested.  It is 
     227 *  the caller's responsibility to free the string when done. 
     228 * 
     229 *  Calling this function is equivalent to calling 
     230 *  XNVCTRLQueryTargetStringAttribute() with the target_type set to 
     231 *  NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'. 
     232 * 
     233 *  Possible errors: 
     234 *     BadValue - The screen doesn't exist. 
     235 *     BadMatch - The NVIDIA driver is not present on that screen. 
     236 *     BadAlloc - Insufficient resources to fulfill the request. 
     237 */ 
     238 
     239Bool XNVCTRLQueryStringAttribute ( 
     240    Display *dpy, 
     241    int screen, 
     242    unsigned int display_mask, 
     243    unsigned int attribute, 
     244    char **ptr 
     245); 
     246 
     247 
     248/* 
     249 *  XNVCTRLQueryTargetStringAttribute - 
     250 * 
     251 *  Returns True if the attribute exists.  Returns False otherwise. 
     252 *  If XNVCTRLQueryTargetStringAttribute returns True, *ptr will point 
     253 *  to an allocated string containing the string attribute requested. 
     254 *  It is the caller's responsibility to free the string when done. 
     255 * 
     256 *  Possible errors: 
     257 *     BadValue - The target doesn't exist. 
     258 *     BadMatch - The NVIDIA driver does not control the target. 
     259 *     BadAlloc - Insufficient resources to fulfill the request. 
     260 */ 
     261 
     262Bool XNVCTRLQueryTargetStringAttribute ( 
     263    Display *dpy, 
     264    int target_type, 
     265    int target_id, 
     266    unsigned int display_mask, 
     267    unsigned int attribute, 
     268    char **ptr 
     269); 
     270 
     271 
     272/* 
     273 *  XNVCTRLSetStringAttribute - 
     274 * 
     275 *  Returns True if the operation succeded.  Returns False otherwise. 
     276 * 
     277 *  Possible X errors: 
     278 *     BadValue - The screen doesn't exist. 
     279 *     BadMatch - The NVIDIA driver is not present on that screen. 
     280 *     BadAlloc - Insufficient resources to fulfill the request. 
     281 */ 
     282  
     283Bool XNVCTRLSetStringAttribute ( 
     284    Display *dpy, 
     285    int screen, 
     286    unsigned int display_mask, 
     287    unsigned int attribute, 
     288    char *ptr 
     289); 
     290 
     291 
     292/* 
     293 * XNVCTRLQueryValidAttributeValues - 
     294 * 
     295 * Returns True if the attribute exists.  Returns False otherwise.  If 
     296 * XNVCTRLQueryValidAttributeValues returns True, values will indicate 
     297 * the valid values for the specified attribute; see the description 
     298 * of NVCTRLAttributeValidValues in NVCtrl.h. 
     299 * 
     300 *  Calling this function is equivalent to calling 
     301 *  XNVCTRLQueryValidTargetAttributeValues() with the target_type set to 
     302 *  NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'. 
     303 */ 
     304 
     305Bool XNVCTRLQueryValidAttributeValues ( 
     306    Display *dpy, 
     307    int screen, 
     308    unsigned int display_mask, 
     309    unsigned int attribute,                                  
     310    NVCTRLAttributeValidValuesRec *values 
     311); 
     312 
     313 
     314 
     315/* 
     316 * XNVCTRLQueryValidTargetAttributeValues - 
     317 * 
     318 * Returns True if the attribute exists.  Returns False otherwise.  If 
     319 * XNVCTRLQueryValidTargetAttributeValues returns True, values will indicate 
     320 * the valid values for the specified attribute. 
     321 */ 
     322 
     323Bool XNVCTRLQueryValidTargetAttributeValues ( 
     324    Display *dpy, 
     325    int target_type, 
     326    int target_id, 
     327    unsigned int display_mask, 
     328    unsigned int attribute,                                  
     329    NVCTRLAttributeValidValuesRec *values 
     330); 
     331 
     332 
     333/* 
     334 *  XNVCTRLSetGvoColorConversion - 
     335 * 
     336 *  Sets the color conversion matrix, offset, and scale that should be 
     337 *  used for GVO (Graphic to Video Out). 
     338 * 
     339 *  The Color Space Conversion data is ordered like this: 
     340 * 
     341 *   colorMatrix[0][0] // r.Y 
     342 *   colorMatrix[0][1] // g.Y 
     343 *   colorMatrix[0][2] // b.Y 
     344 * 
     345 *   colorMatrix[1][0] // r.Cr 
     346 *   colorMatrix[1][1] // g.Cr 
     347 *   colorMatrix[1][2] // b.Cr 
     348 * 
     349 *   colorMatrix[2][0] // r.Cb 
     350 *   colorMatrix[2][1] // g.Cb 
     351 *   colorMatrix[2][2] // b.Cb 
     352 * 
     353 *   colorOffset[0]    // Y 
     354 *   colorOffset[1]    // Cr 
     355 *   colorOffset[2]    // Cb 
     356 * 
     357 *   colorScale[0]     // Y 
     358 *   colorScale[1]     // Cr 
     359 *   colorScale[2]     // Cb 
     360 * 
     361 *  where the data is used according to the following formulae: 
     362 * 
     363 *   Y  =  colorOffset[0] + colorScale[0] * 
     364 *           (R * colorMatrix[0][0] + 
     365 *            G * colorMatrix[0][1] + 
     366 *            B * colorMatrix[0][2]); 
     367 * 
     368 *   Cr =  colorOffset[1] + colorScale[1] * 
     369 *           (R * colorMatrix[1][0] + 
     370 *            G * colorMatrix[1][1] + 
     371 *            B * colorMatrix[1][2]); 
     372 * 
     373 *   Cb =  colorOffset[2] + colorScale[2] * 
     374 *           (R * colorMatrix[2][0] + 
     375 *            G * colorMatrix[2][1] + 
     376 *            B * colorMatrix[2][2]); 
     377 * 
     378 *  Possible errors: 
     379 *     BadMatch - The NVIDIA driver is not present on that screen. 
     380 *     BadImplementation - GVO is not available on that screen. 
     381 */ 
     382 
     383void XNVCTRLSetGvoColorConversion ( 
     384    Display *dpy, 
     385    int screen, 
     386    float colorMatrix[3][3], 
     387    float colorOffset[3], 
     388    float colorScale[3] 
     389); 
     390 
     391 
     392 
     393/* 
     394 *  XNVCTRLQueryGvoColorConversion - 
     395 * 
     396 *  Retrieves the color conversion matrix and color offset 
     397 *  that are currently being used for GVO (Graphic to Video Out). 
     398 * 
     399 *  The values are ordered within the arrays according to the comments 
     400 *  for XNVCTRLSetGvoColorConversion(). 
     401 * 
     402 *  Possible errors: 
     403 *     BadMatch - The NVIDIA driver is not present on that screen. 
     404 *     BadImplementation - GVO is not available on that screen. 
     405 */ 
     406 
     407Bool XNVCTRLQueryGvoColorConversion ( 
     408    Display *dpy, 
     409    int screen, 
     410    float colorMatrix[3][3], 
     411    float colorOffset[3], 
     412    float colorScale[3] 
     413); 
     414 
     415 
     416/* 
     417 *  XNVCTRLQueryBinaryData - 
     418 * 
     419 *  Returns True if the attribute exists.  Returns False otherwise. 
     420 *  If XNVCTRLQueryBinaryData returns True, *ptr will point to an 
     421 *  allocated block of memory containing the binary data attribute 
     422 *  requested.  It is the caller's responsibility to free the data 
     423 *  when done.  len will list the length of the binary data. 
     424 * 
     425 *  Calling this function is equivalent to calling 
     426 *  XNVCTRLQueryTargetBinaryData() with the target_type set to 
     427 *  NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'. 
     428 * 
     429 *  Possible errors: 
     430 *     BadValue - The screen doesn't exist. 
     431 *     BadMatch - The NVIDIA driver is not present on that screen. 
     432 *     BadAlloc - Insufficient resources to fulfill the request. 
     433 */ 
     434 
     435Bool XNVCTRLQueryBinaryData ( 
     436    Display *dpy, 
     437    int screen, 
     438    unsigned int display_mask, 
     439    unsigned int attribute, 
     440    unsigned char **ptr, 
     441    int *len 
     442); 
     443 
     444 
     445/* 
     446 * XNVCTRLQueryTargetBinaryData - 
     447 * 
     448 *  Returns True if the attribute exists.  Returns False otherwise. 
     449 *  If XNVCTRLQueryTargetBinaryData returns True, *ptr will point to an 
     450 *  allocated block of memory containing the binary data attribute 
     451 *  requested.  It is the caller's responsibility to free the data 
     452 *  when done.  len will list the length of the binary data. 
     453 * 
     454 *  Possible errors: 
     455 *     BadValue - The target doesn't exist. 
     456 *     BadMatch - The NVIDIA driver does not control the target. 
     457 *     BadAlloc - Insufficient resources to fulfill the request. 
     458 */ 
     459 
     460Bool XNVCTRLQueryTargetBinaryData ( 
     461    Display *dpy, 
     462    int target_type, 
     463    int target_id, 
     464    unsigned int display_mask, 
     465    unsigned int attribute, 
     466    unsigned char **ptr, 
     467    int *len 
     468); 
     469 
     470 
     471/* 
     472 * XNVCTRLStringOperation - 
     473 * 
     474 * Takes a string as input and returns a Xmalloc'ed string as output. 
     475 * Returns True on success and False on failure. 
     476 */ 
     477 
     478Bool XNVCTRLStringOperation ( 
     479    Display *dpy, 
     480    int target_type, 
     481    int target_id, 
     482    unsigned int display_mask, 
     483    unsigned int attribute, 
     484    char *pIn, 
     485    char **ppOut 
     486); 
     487 
     488 
     489 
     490/* 
     491 * XNVCtrlSelectNotify - 
     492 * 
     493 * This enables/disables receiving of NV-CONTROL events.  The type 
     494 * specifies the type of event to enable (currently, the only 
     495 * type that can be requested per-screen with XNVCtrlSelectNotify() 
     496 * is ATTRIBUTE_CHANGED_EVENT); onoff controls whether receiving this 
     497 * type of event should be enabled (True) or disabled (False). 
     498 * 
     499 * Returns True if successful, or False if the screen is not 
     500 * controlled by the NVIDIA driver. 
     501 */ 
     502 
     503Bool XNVCtrlSelectNotify ( 
     504    Display *dpy, 
     505    int screen, 
     506    int type, 
     507    Bool onoff 
     508); 
     509 
     510 
     511/* 
     512 * XNVCtrlSelectTargetNotify - 
     513 * 
     514 * This enables/disables receiving of NV-CONTROL events that happen on 
     515 * the specified target.  The notify_type specifies the type of event to 
     516 * enable (currently, the only type that can be requested per-target with 
     517 * XNVCtrlSelectTargetNotify() is TARGET_ATTRIBUTE_CHANGED_EVENT); onoff 
     518 * controls whether receiving this type of event should be enabled (True) 
     519 * or disabled (False). 
     520 * 
     521 * Returns True if successful, or False if the target is not 
     522 * controlled by the NVIDIA driver. 
     523 */ 
     524 
     525Bool XNVCtrlSelectTargetNotify ( 
     526    Display *dpy, 
     527    int target_type, 
     528    int target_id, 
     529    int notify_type, 
     530    Bool onoff 
     531); 
     532 
     533 
     534/* 
     535 * XNVCtrlEvent structure 
     536 */ 
     537 
     538typedef struct { 
     539    int type; 
     540    unsigned long serial; 
     541    Bool send_event;  /* always FALSE, we don't allow send_events */ 
     542    Display *display; 
     543    Time time; 
     544    int screen; 
     545    unsigned int display_mask; 
     546    unsigned int attribute; 
     547    int value; 
     548} XNVCtrlAttributeChangedEvent; 
     549 
     550typedef union { 
     551    int type; 
     552    XNVCtrlAttributeChangedEvent attribute_changed; 
     553    long pad[24]; 
     554} XNVCtrlEvent; 
     555 
     556 
     557/* 
     558 * XNVCtrlEventTarget structure 
     559 */ 
     560 
     561typedef struct { 
     562    int type; 
     563    unsigned long serial; 
     564    Bool send_event;  /* always FALSE, we don't allow send_events */ 
     565    Display *display; 
     566    Time time; 
     567    int target_type; 
     568    int target_id; 
     569    unsigned int display_mask; 
     570    unsigned int attribute; 
     571    int value; 
     572} XNVCtrlAttributeChangedEventTarget; 
     573 
     574typedef union { 
     575    int type; 
     576    XNVCtrlAttributeChangedEventTarget attribute_changed; 
     577    long pad[24]; 
     578} XNVCtrlEventTarget; 
     579 
     580 
     581/* 
     582 * XNVCtrlEventTargetAvailability structure 
     583 */ 
     584 
     585typedef struct { 
     586    int type; 
     587    unsigned long serial; 
     588    Bool send_event;  /* always FALSE, we don't allow send_events */ 
     589    Display *display; 
     590    Time time; 
     591    int target_type; 
     592    int target_id; 
     593    unsigned int display_mask; 
     594    unsigned int attribute; 
     595    int value; 
     596    Bool availability; 
     597} XNVCtrlAttributeChangedEventTargetAvailability; 
     598 
     599typedef union { 
     600    int type; 
     601    XNVCtrlAttributeChangedEventTargetAvailability attribute_changed; 
     602    long pad[24]; 
     603} XNVCtrlEventTargetAvailability; 
     604 
     605 
     606/* 
     607 * XNVCtrlStringEventTarget structure 
     608 */ 
     609 
     610typedef struct { 
     611    int type; 
     612    unsigned long serial; 
     613    Bool send_event;  /* always FALSE, we don't allow send_events */ 
     614    Display *display; 
     615    Time time; 
     616    int target_type; 
     617    int target_id; 
     618    unsigned int display_mask; 
     619    unsigned int attribute; 
     620} XNVCtrlStringAttributeChangedEventTarget; 
     621 
     622typedef union { 
     623    int type; 
     624    XNVCtrlStringAttributeChangedEventTarget attribute_changed; 
     625    long pad[24]; 
     626} XNVCtrlStringEventTarget; 
     627 
     628 
     629 
     630/* 
     631 * XNVCtrlBinaryEventTarget structure 
     632 */ 
     633 
     634typedef struct { 
     635    int type; 
     636    unsigned long serial; 
     637    Bool send_event;  /* always FALSE, we don't allow send_events */ 
     638    Display *display; 
     639    Time time; 
     640    int target_type; 
     641    int target_id; 
     642    unsigned int display_mask; 
     643    unsigned int attribute; 
     644} XNVCtrlBinaryAttributeChangedEventTarget; 
     645 
     646typedef union { 
     647    int type; 
     648    XNVCtrlBinaryAttributeChangedEventTarget attribute_changed; 
     649    long pad[24]; 
     650} XNVCtrlBinaryEventTarget; 
     651 
     652#if defined __cplusplus 
     653} /* extern "C" */ 
     654#endif  
     655 
     656#endif /* __NVCTRLLIB_H */ 
  • new file 0.21-fixes/mythtv/libs/libmyth/nvidia/nv_control.h

    - +  
     1/* 
     2 * Copyright (c) 2008 NVIDIA, Corporation 
     3 * 
     4 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     5 * of this software and associated documentation files (the "Software"), to deal 
     6 * in the Software without restriction, including without limitation the rights 
     7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     8 * copies of the Software, and to permit persons to whom the Software is 
     9 * furnished to do so, subject to the following conditions: 
     10 * 
     11 * The above copyright notice and this permission notice (including the next 
     12 * paragraph) shall be included in all copies or substantial portions of the 
     13 * Software. 
     14 * 
     15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE 
     18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
     21 * SOFTWARE. 
     22 * 
     23 * 
     24 * NV-CONTROL Protocol Version History 
     25 * 
     26 * 1.0 - 1.5   NVIDIA Internal development versions 
     27 * 1.6         Initial public version 
     28 * 1.7         Added QueryBinaryData request 
     29 * 1.8         Added TargetTypes 
     30 * 1.9         Added QueryTargetCount request 
     31 * 1.10        Fixed target type/id byte ordering for compatibility with 
     32 *             pre-1.8 NV-CONTROL clients 
     33 * 1.11        NVIDIA Internal development version 
     34 * 1.12        Added StringOperation request 
     35 * 1.13        NVIDIA Internal development version 
     36 * 1.14        Fixed an NV_CTRL_BINARY_DATA_MODELINES double scan modeline 
     37 *             reporting bug (vsyncstart, vsyncend, and vtotal were incorrectly 
     38 *             doubled) 
     39 * 1.15        Added AVAILABILITY_TARGET_ATTRIBUTE_CHANGED_EVENT 
     40 * 1.16        Added TARGET_STRING_ATTRIBUTE_CHANGED_EVENT 
     41 * 1.17        Added TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT 
     42 * 1.18        Updated QueryTargetCount to return a count of 0, rather than 
     43 *             BadMatch, if an unknown TargetType is specified 
     44 */ 
     45 
     46#ifndef __NVCONTROL_H 
     47#define __NVCONTROL_H 
     48 
     49#define NV_CONTROL_ERRORS 0 
     50#define NV_CONTROL_EVENTS 5 
     51#define NV_CONTROL_NAME "NV-CONTROL" 
     52 
     53#define NV_CONTROL_MAJOR 1 
     54#define NV_CONTROL_MINOR 18 
     55 
     56#define X_nvCtrlQueryExtension                      0 
     57#define X_nvCtrlIsNv                                1 
     58#define X_nvCtrlQueryAttribute                      2 
     59#define X_nvCtrlSetAttribute                        3 
     60#define X_nvCtrlQueryStringAttribute                4 
     61#define X_nvCtrlQueryValidAttributeValues           5 
     62#define X_nvCtrlSelectNotify                        6 
     63#define X_nvCtrlSetGvoColorConversion_deprecated    7 
     64#define X_nvCtrlQueryGvoColorConversion_deprecated  8 
     65#define X_nvCtrlSetStringAttribute                  9 
     66/* STUB X_nvCtrlQueryDDCCILutSize                   10 */ 
     67/* STUB X_nvCtrlQueryDDCCISinglePointLutOperation   11 */ 
     68/* STUB X_nvCtrlSetDDCCISinglePointLutOperation     12 */ 
     69/* STUB X_nvCtrlQueryDDCCIBlockLutOperation         13 */ 
     70/* STUB X_nvCtrlSetDDCCIBlockLutOperation           14 */ 
     71/* STUB X_nvCtrlSetDDCCIRemoteProcedureCall         15 */ 
     72/* STUB X_nvCtrlQueryDDCCIDisplayControllerType     16 */ 
     73/* STUB X_nvCtrlQueryDDCCICapabilities              17 */ 
     74/* STUB X_nvCtrlQueryDDCCITimingReport              18 */ 
     75#define X_nvCtrlSetAttributeAndGetStatus            19 
     76#define X_nvCtrlQueryBinaryData                     20 
     77#define X_nvCtrlSetGvoColorConversion               21 
     78#define X_nvCtrlQueryGvoColorConversion             22 
     79#define X_nvCtrlSelectTargetNotify                  23 
     80#define X_nvCtrlQueryTargetCount                    24 
     81#define X_nvCtrlStringOperation                     25 
     82#define X_nvCtrlLastRequest  (X_nvCtrlStringOperation + 1) 
     83 
     84 
     85/* Define 32 bit floats */ 
     86typedef float FLOAT32; 
     87#ifndef F32 
     88#define F32 
     89#endif 
     90 
     91 
     92typedef struct { 
     93    CARD8 reqType; 
     94    CARD8 nvReqType; 
     95    CARD16 length B16; 
     96} xnvCtrlQueryExtensionReq; 
     97#define sz_xnvCtrlQueryExtensionReq 4 
     98 
     99typedef struct { 
     100    BYTE type;   /* X_Reply */ 
     101    CARD8 padb1; 
     102    CARD16 sequenceNumber B16; 
     103    CARD32 length B32; 
     104    CARD16 major B16; 
     105    CARD16 minor B16; 
     106    CARD32 padl4 B32; 
     107    CARD32 padl5 B32; 
     108    CARD32 padl6 B32; 
     109    CARD32 padl7 B32; 
     110    CARD32 padl8 B32; 
     111} xnvCtrlQueryExtensionReply; 
     112#define sz_xnvCtrlQueryExtensionReply 32 
     113 
     114typedef struct { 
     115    CARD8 reqType; 
     116    CARD8 nvReqType; 
     117    CARD16 length B16; 
     118    CARD32 screen B32; 
     119} xnvCtrlIsNvReq; 
     120#define sz_xnvCtrlIsNvReq 8 
     121 
     122typedef struct { 
     123    BYTE type;   /* X_Reply */ 
     124    CARD8 padb1; 
     125    CARD16 sequenceNumber B16; 
     126    CARD32 length B32; 
     127    CARD32 isnv B32; 
     128    CARD32 padl4 B32; 
     129    CARD32 padl5 B32; 
     130    CARD32 padl6 B32; 
     131    CARD32 padl7 B32; 
     132    CARD32 padl8 B32; 
     133} xnvCtrlIsNvReply; 
     134#define sz_xnvCtrlIsNvReply 32 
     135 
     136typedef struct { 
     137    CARD8 reqType; 
     138    CARD8 nvReqType; 
     139    CARD16 length B16; 
     140    CARD32 target_type B32; 
     141} xnvCtrlQueryTargetCountReq; 
     142#define sz_xnvCtrlQueryTargetCountReq 8 
     143 
     144typedef struct { 
     145    BYTE type;   /* X_Reply */ 
     146    CARD8 padb1; 
     147    CARD16 sequenceNumber B16; 
     148    CARD32 length B32; 
     149    CARD32 count B32; 
     150    CARD32 padl4 B32; 
     151    CARD32 padl5 B32; 
     152    CARD32 padl6 B32; 
     153    CARD32 padl7 B32; 
     154    CARD32 padl8 B32; 
     155} xnvCtrlQueryTargetCountReply; 
     156#define sz_xnvCtrlQueryTargetCountReply 32 
     157 
     158typedef struct { 
     159    CARD8 reqType; 
     160    CARD8 nvReqType; 
     161    CARD16 length B16; 
     162    CARD16 target_id B16;    /* X screen number or GPU number */ 
     163    CARD16 target_type B16;  /* X screen or GPU */ 
     164    CARD32 display_mask B32; 
     165    CARD32 attribute B32; 
     166} xnvCtrlQueryAttributeReq; 
     167#define sz_xnvCtrlQueryAttributeReq 16 
     168 
     169typedef struct { 
     170    BYTE type; 
     171    BYTE pad0; 
     172    CARD16 sequenceNumber B16; 
     173    CARD32 length B32; 
     174    CARD32 flags B32; 
     175    INT32  value B32; 
     176    CARD32 pad4 B32; 
     177    CARD32 pad5 B32; 
     178    CARD32 pad6 B32; 
     179    CARD32 pad7 B32; 
     180} xnvCtrlQueryAttributeReply; 
     181#define sz_xnvCtrlQueryAttributeReply 32 
     182 
     183typedef struct { 
     184    CARD8 reqType; 
     185    CARD8 nvReqType; 
     186    CARD16 length B16; 
     187    CARD16 target_id B16; 
     188    CARD16 target_type B16; 
     189    CARD32 display_mask B32; 
     190    CARD32 attribute B32; 
     191    INT32 value B32; 
     192} xnvCtrlSetAttributeReq; 
     193#define sz_xnvCtrlSetAttributeReq 20 
     194 
     195typedef struct { 
     196    CARD8 reqType; 
     197    CARD8 nvReqType; 
     198    CARD16 length B16; 
     199    CARD32 screen B32; 
     200    CARD32 display_mask B32; 
     201    CARD32 attribute B32; 
     202    INT32 value B32; 
     203} xnvCtrlSetAttributeAndGetStatusReq; 
     204#define sz_xnvCtrlSetAttributeAndGetStatusReq 20 
     205 
     206typedef struct { 
     207    BYTE type; 
     208    BYTE pad0; 
     209    CARD16 sequenceNumber B16; 
     210    CARD32 length B32; 
     211    CARD32 flags B32; 
     212    CARD32 pad3 B32; 
     213    CARD32 pad4 B32; 
     214    CARD32 pad5 B32; 
     215    CARD32 pad6 B32; 
     216    CARD32 pad7 B32; 
     217} xnvCtrlSetAttributeAndGetStatusReply; 
     218#define sz_xnvCtrlSetAttributeAndGetStatusReply 32 
     219 
     220typedef struct { 
     221    CARD8 reqType; 
     222    CARD8 nvReqType; 
     223    CARD16 length B16; 
     224    CARD16 target_id B16;    /* X screen number or GPU number */ 
     225    CARD16 target_type B16;  /* X screen or GPU */ 
     226    CARD32 display_mask B32; 
     227    CARD32 attribute B32; 
     228} xnvCtrlQueryStringAttributeReq; 
     229#define sz_xnvCtrlQueryStringAttributeReq 16 
     230 
     231typedef struct { 
     232    BYTE type; 
     233    BYTE pad0; 
     234    CARD16 sequenceNumber B16; 
     235    CARD32 length B32; 
     236    CARD32 flags B32; 
     237    CARD32 n B32;    /* Length of string */ 
     238    CARD32 pad4 B32; 
     239    CARD32 pad5 B32; 
     240    CARD32 pad6 B32; 
     241    CARD32 pad7 B32; 
     242} xnvCtrlQueryStringAttributeReply; 
     243#define sz_xnvCtrlQueryStringAttributeReply 32 
     244 
     245 
     246typedef struct { 
     247    CARD8 reqType; 
     248    CARD8 nvReqType; 
     249    CARD16 length B16; 
     250    CARD32 screen B32; 
     251    CARD32 display_mask B32; 
     252    CARD32 attribute B32; 
     253    CARD32 num_bytes B32; 
     254} xnvCtrlSetStringAttributeReq; 
     255#define sz_xnvCtrlSetStringAttributeReq 20 
     256 
     257typedef struct { 
     258    BYTE type; 
     259    BYTE pad0; 
     260    CARD16 sequenceNumber B16; 
     261    CARD32 length B32; 
     262    CARD32 flags B32; 
     263    CARD32 pad3 B32; 
     264    CARD32 pad4 B32; 
     265    CARD32 pad5 B32; 
     266    CARD32 pad6 B32; 
     267    CARD32 pad7 B32; 
     268} xnvCtrlSetStringAttributeReply; 
     269#define sz_xnvCtrlSetStringAttributeReply 32 
     270 
     271typedef struct { 
     272    CARD8 reqType; 
     273    CARD8 nvReqType; 
     274    CARD16 length B16; 
     275    CARD16 target_id B16;    /* X screen number or GPU number */ 
     276    CARD16 target_type B16;  /* X screen or GPU */ 
     277    CARD32 display_mask B32; 
     278    CARD32 attribute B32; 
     279} xnvCtrlQueryValidAttributeValuesReq; 
     280#define sz_xnvCtrlQueryValidAttributeValuesReq 16 
     281 
     282typedef struct { 
     283    BYTE type; 
     284    BYTE pad0; 
     285    CARD16 sequenceNumber B16; 
     286    CARD32 length B32; 
     287    CARD32 flags B32; 
     288    INT32  attr_type B32; 
     289    INT32  min B32; 
     290    INT32  max B32; 
     291    CARD32 bits B32; 
     292    CARD32 perms B32; 
     293} xnvCtrlQueryValidAttributeValuesReply; 
     294#define sz_xnvCtrlQueryValidAttributeValuesReply 32 
     295 
     296/* Set GVO Color Conversion request (deprecated) */ 
     297typedef struct { 
     298    CARD8 reqType; 
     299    CARD8 nvReqType; 
     300    CARD16 length B16; 
     301    CARD32 screen B32; 
     302    FLOAT32 row1_col1 F32; 
     303    FLOAT32 row1_col2 F32; 
     304    FLOAT32 row1_col3 F32; 
     305    FLOAT32 row1_col4 F32; 
     306    FLOAT32 row2_col1 F32; 
     307    FLOAT32 row2_col2 F32; 
     308    FLOAT32 row2_col3 F32; 
     309    FLOAT32 row2_col4 F32; 
     310    FLOAT32 row3_col1 F32; 
     311    FLOAT32 row3_col2 F32; 
     312    FLOAT32 row3_col3 F32; 
     313    FLOAT32 row3_col4 F32; 
     314} xnvCtrlSetGvoColorConversionDeprecatedReq; 
     315#define sz_xnvCtrlSetGvoColorConversionDeprecatedReq 56 
     316 
     317/* Query GVO Color Conversion request (deprecated) */ 
     318typedef struct { 
     319    CARD8 reqType; 
     320    CARD8 nvReqType; 
     321    CARD16 length B16; 
     322    CARD32 screen B32; 
     323} xnvCtrlQueryGvoColorConversionDeprecatedReq; 
     324#define sz_xnvCtrlQueryGvoColorConversionDeprecatedReq 8 
     325 
     326/* Query GVO Color Conversion reply (deprecated) */ 
     327typedef struct { 
     328    BYTE type;   /* X_Reply */ 
     329    BYTE pad0; 
     330    CARD16 sequenceNumber B16; 
     331    CARD32 length B32; 
     332    CARD32 pad3 B32; 
     333    CARD32 pad4 B32; 
     334    CARD32 pad5 B32; 
     335    CARD32 pad6 B32; 
     336    CARD32 pad7 B32; 
     337    CARD32 pad8 B32; 
     338} xnvCtrlQueryGvoColorConversionDeprecatedReply; 
     339#define sz_xnvCtrlQueryGvoColorConversionDeprecatedReply 32 
     340 
     341 
     342/* Set GVO Color Conversion request */ 
     343typedef struct { 
     344    CARD8 reqType; 
     345    CARD8 nvReqType; 
     346    CARD16 length B16; 
     347    CARD32 screen B32; 
     348 
     349    FLOAT32 cscMatrix_y_r F32; 
     350    FLOAT32 cscMatrix_y_g F32; 
     351    FLOAT32 cscMatrix_y_b F32; 
     352 
     353    FLOAT32 cscMatrix_cr_r F32; 
     354    FLOAT32 cscMatrix_cr_g F32; 
     355    FLOAT32 cscMatrix_cr_b F32; 
     356 
     357    FLOAT32 cscMatrix_cb_r F32; 
     358    FLOAT32 cscMatrix_cb_g F32; 
     359    FLOAT32 cscMatrix_cb_b F32; 
     360     
     361    FLOAT32 cscOffset_y  F32; 
     362    FLOAT32 cscOffset_cr F32; 
     363    FLOAT32 cscOffset_cb F32; 
     364     
     365    FLOAT32 cscScale_y  F32; 
     366    FLOAT32 cscScale_cr F32; 
     367    FLOAT32 cscScale_cb F32; 
     368     
     369} xnvCtrlSetGvoColorConversionReq; 
     370#define sz_xnvCtrlSetGvoColorConversionReq 68 
     371 
     372/* Query GVO Color Conversion request */ 
     373typedef struct { 
     374    CARD8 reqType; 
     375    CARD8 nvReqType; 
     376    CARD16 length B16; 
     377    CARD32 screen B32; 
     378} xnvCtrlQueryGvoColorConversionReq; 
     379#define sz_xnvCtrlQueryGvoColorConversionReq 8 
     380 
     381/* Query GVO Color Conversion reply */ 
     382typedef struct { 
     383    BYTE type;   /* X_Reply */ 
     384    BYTE pad0; 
     385    CARD16 sequenceNumber B16; 
     386    CARD32 length B32; 
     387    CARD32 pad3 B32; 
     388    CARD32 pad4 B32; 
     389    CARD32 pad5 B32; 
     390    CARD32 pad6 B32; 
     391    CARD32 pad7 B32; 
     392    CARD32 pad8 B32; 
     393} xnvCtrlQueryGvoColorConversionReply; 
     394#define sz_xnvCtrlQueryGvoColorConversionReply 32 
     395 
     396typedef struct { 
     397    CARD8 reqType; 
     398    CARD8 nvReqType; 
     399    CARD16 length B16; 
     400    CARD16 target_id B16;    /* X screen number or GPU number */ 
     401    CARD16 target_type B16;  /* X screen or GPU */ 
     402    CARD32 display_mask B32; 
     403    CARD32 attribute B32; 
     404} xnvCtrlQueryBinaryDataReq; 
     405#define sz_xnvCtrlQueryBinaryDataReq 16 
     406 
     407typedef struct { 
     408    BYTE type; 
     409    BYTE pad0; 
     410    CARD16 sequenceNumber B16; 
     411    CARD32 length B32; 
     412    CARD32 flags B32; 
     413    CARD32 n B32; 
     414    CARD32 pad4 B32; 
     415    CARD32 pad5 B32; 
     416    CARD32 pad6 B32; 
     417    CARD32 pad7 B32; 
     418} xnvCtrlQueryBinaryDataReply; 
     419#define sz_xnvCtrlQueryBinaryDataReply 32 
     420 
     421 
     422typedef struct { 
     423    CARD8 reqType; 
     424    CARD8 nvReqType; 
     425    CARD16 length B16; 
     426    CARD32 screen B32; 
     427    CARD16 notifyType B16; 
     428    CARD16 onoff B16; 
     429} xnvCtrlSelectNotifyReq; 
     430#define sz_xnvCtrlSelectNotifyReq 12 
     431 
     432typedef struct { 
     433    CARD8 reqType; 
     434    CARD8 nvReqType; 
     435    CARD16 length B16; 
     436    CARD16 target_id B16;    /* X screen number or GPU number */ 
     437    CARD16 target_type B16;  /* X screen or GPU */ 
     438    CARD32 display_mask B32; 
     439    CARD32 attribute B32; 
     440    CARD32 num_bytes B32; /* Length of string */ 
     441} xnvCtrlStringOperationReq; 
     442#define sz_xnvCtrlStringOperationReq 20 
     443 
     444typedef struct { 
     445    BYTE type;   /* X_Reply */ 
     446    CARD8 padb1; 
     447    CARD16 sequenceNumber B16; 
     448    CARD32 length B32; 
     449    CARD32 ret B32; 
     450    CARD32 num_bytes B32; /* Length of string */ 
     451    CARD32 padl4 B32; 
     452    CARD32 padl5 B32; 
     453    CARD32 padl6 B32; 
     454    CARD32 padl7 B32; 
     455} xnvCtrlStringOperationReply; 
     456#define sz_xnvCtrlStringOperationReply 32 
     457 
     458typedef struct { 
     459    union { 
     460        struct { 
     461            BYTE type; 
     462            BYTE detail; 
     463            CARD16 sequenceNumber B16; 
     464        } u; 
     465        struct { 
     466            BYTE type; 
     467            BYTE detail; 
     468            CARD16 sequenceNumber B16; 
     469            CARD32 time B32; 
     470            CARD32 screen B32; 
     471            CARD32 display_mask B32; 
     472            CARD32 attribute B32; 
     473            CARD32 value B32; 
     474            CARD32 pad0 B32; 
     475            CARD32 pad1 B32; 
     476        } attribute_changed; 
     477    } u; 
     478} xnvctrlEvent; 
     479 
     480 
     481/* 
     482 * Leave target_type before target_id for the 
     483 * xnvCtrlSelectTargetNotifyReq and xnvctrlEventTarget 
     484 * structures, even though other request protocol structures 
     485 * store target_id in the bottom 16-bits of the second DWORD of the 
     486 * structures.  The event-related structures were added in version 
     487 * 1.8, and so there is no prior version with which to maintain 
     488 * compatibility. 
     489 */ 
     490typedef struct { 
     491    CARD8 reqType; 
     492    CARD8 nvReqType; 
     493    CARD16 length B16; 
     494    CARD16 target_type B16; /* Don't swap these */ 
     495    CARD16 target_id B16; 
     496    CARD16 notifyType B16; 
     497    CARD16 onoff B16; 
     498} xnvCtrlSelectTargetNotifyReq; 
     499#define sz_xnvCtrlSelectTargetNotifyReq 12 
     500 
     501typedef struct { 
     502    union { 
     503        struct { 
     504            BYTE type; 
     505            BYTE detail; 
     506            CARD16 sequenceNumber B16; 
     507        } u; 
     508        struct { 
     509            BYTE type; 
     510            BYTE detail; 
     511            CARD16 sequenceNumber B16; 
     512            CARD32 time B32; 
     513            CARD16 target_type B16; /* Don't swap these */ 
     514            CARD16 target_id B16; 
     515            CARD32 display_mask B32; 
     516            CARD32 attribute B32; 
     517            CARD32 value B32; 
     518            CARD32 pad0 B32; 
     519            CARD32 pad1 B32; 
     520        } attribute_changed; 
     521        struct { 
     522            BYTE type; 
     523            BYTE detail; 
     524            CARD16 sequenceNumber B16; 
     525            CARD32 time B32; 
     526            CARD16 target_type B16; /* Don't swap these */ 
     527            CARD16 target_id B16; 
     528            CARD32 display_mask B32; 
     529            CARD32 attribute B32; 
     530            CARD32 value B32; 
     531            CARD8 availability; 
     532            CARD8 pad0; 
     533            CARD16 pad1 B16; 
     534            CARD32 pad2 B32; 
     535        } availability_changed; 
     536    } u; 
     537} xnvctrlEventTarget; 
     538 
     539 
     540#endif /* __NVCONTROL_H */ 
  • mythtv/libs/libmyth/libmyth.pro

    old new  
    232232    DEFINES += USING_XRANDR 
    233233    HEADERS += DisplayResX.h 
    234234    SOURCES += DisplayResX.cpp 
     235    # Add nvidia XV-EXTENSION support 
     236    SOURCES += nvidia/NVCtrl.c 
     237    SOURCES += util-nvidia.cpp 
    235238} 
    236239 
    237240contains( HAVE_MMX, yes ) { 
  • new file 0.21-fixes/mythtv/libs/libmyth/util-nvidia.cpp

    - +  
     1#include <map> 
     2#include <vector> 
     3using namespace std; 
     4 
     5#include "mythcontext.h" 
     6 
     7#include <stdio.h> 
     8#include <stdlib.h> 
     9#include <string.h> 
     10#include <ctype.h> 
     11#include <cmath> 
     12 
     13#include "util-x11.h" 
     14#include "util-nvidia.h" 
     15 
     16#include "nvidia/NVCtrl.h" 
     17#include "nvidia/NVCtrlLib.h" 
     18 
     19#include "DisplayResX.h" 
     20 
     21static unsigned int display_device_mask(char *str); 
     22static void parse_mode_string(char *modeString, char **modeName, int *mask); 
     23static char *find_modeline(char *modeString, char *pModeLines, 
     24                           int ModeLineLen); 
     25static int extract_id_string(char *str); 
     26static int modeline_is_interlaced(char *modeLine); 
     27 
     28 
     29int GetNvidiaRates(t_screenrate& screenmap) 
     30{ 
     31    Display *dpy; 
     32    bool ret; 
     33    int screen, display_devices, mask, major, minor, len, j; 
     34    char *str, *start; 
     35    int nDisplayDevice; 
     36 
     37    char *pMetaModes, *pModeLines[8], *tmp, *modeString; 
     38    char *modeLine, *modeName; 
     39    int MetaModeLen, ModeLineLen[8]; 
     40    int thisMask; 
     41    int id; 
     42    int twinview =  0; 
     43    map<int, map<int,bool> > maprate; 
     44 
     45    /* 
     46     * Open a display connection, and make sure the NV-CONTROL X 
     47     * extension is present on the screen we want to use. 
     48     */ 
     49 
     50    dpy = MythXOpenDisplay(); 
     51    if (!dpy) { 
     52        VERBOSE(VB_PLAYBACK, QString("Cannot open display %1") .arg(XDisplayName(NULL))); 
     53        return -1; 
     54    } 
     55 
     56    screen = DefaultScreen(dpy); 
     57    X11L; 
     58 
     59    if (!XNVCTRLIsNvScreen(dpy, screen)) { 
     60        VERBOSE(VB_PLAYBACK, QString("The NV-CONTROL X extension is not available on screen %1 of '%2'.") 
     61                .arg(screen) .arg(XDisplayName(NULL))); 
     62        XCloseDisplay(dpy); 
     63        X11U; 
     64        return -1; 
     65    } 
     66 
     67    ret = XNVCTRLQueryVersion(dpy, &major, &minor); 
     68    if (ret != True) { 
     69        VERBOSE(VB_PLAYBACK, QString("The NV-CONTROL X extension does not exist on '%1'.") 
     70                .arg(XDisplayName(NULL))); 
     71        XCloseDisplay(dpy); 
     72        X11U; 
     73        return -1; 
     74    } 
     75 
     76    ret = XNVCTRLQueryAttribute(dpy, screen, 0, NV_CTRL_DYNAMIC_TWINVIEW, &twinview); 
     77 
     78    if (!ret) { 
     79        VERBOSE(VB_PLAYBACK, QString("Failed to query if Dynamic Twinview is enabled")); 
     80        XCloseDisplay(dpy); 
     81        return -1; 
     82    } 
     83    if (!twinview) { 
     84        VERBOSE(VB_PLAYBACK, QString("Dynamic Twinview not enabled, ignoring")); 
     85        XCloseDisplay(dpy); 
     86        X11U; 
     87        return 0; 
     88    } 
     89 
     90    /* 
     91     * query the connected display devices on this X screen and print 
     92     * basic information about each X screen 
     93     */ 
     94 
     95    ret = XNVCTRLQueryAttribute(dpy, screen, 0, 
     96                                NV_CTRL_CONNECTED_DISPLAYS, &display_devices); 
     97 
     98    if (!ret) { 
     99        VERBOSE(VB_PLAYBACK, QString("Failed to query the enabled Display Devices.")); 
     100        XCloseDisplay(dpy); 
     101        X11U; 
     102        return -1; 
     103    } 
     104 
     105    /* first, we query the MetaModes on this X screen */ 
     106 
     107    XNVCTRLQueryBinaryData(dpy, screen, 0, // n/a 
     108                           NV_CTRL_BINARY_DATA_METAMODES, 
     109                           (unsigned char **)&pMetaModes, &MetaModeLen); 
     110 
     111    /* 
     112     * then, we query the ModeLines for each display device on 
     113     * this X screen; we'll need these later 
     114     */ 
     115 
     116    nDisplayDevice = 0; 
     117 
     118    for (mask = 1; mask < (1 << 24); mask <<= 1) { 
     119 
     120        if (!(display_devices & mask)) continue; 
     121 
     122        XNVCTRLQueryBinaryData(dpy, screen, mask, 
     123                               NV_CTRL_BINARY_DATA_MODELINES, 
     124                               (unsigned char **)&str, &len); 
     125        pModeLines[nDisplayDevice] = str; 
     126        ModeLineLen[nDisplayDevice] = len; 
     127 
     128        nDisplayDevice++; 
     129    } 
     130 
     131    /* now, parse each MetaMode */ 
     132    str = start = pMetaModes; 
     133 
     134    for (j = 0; j < MetaModeLen; j++) { 
     135        /* 
     136         * if we found the end of a line, treat the string from 
     137         * start to str[j] as a MetaMode 
     138         */ 
     139 
     140        if ((str[j] == '\0') && (str[j+1] != '\0')) { 
     141 
     142            id = extract_id_string(start); 
     143            /* 
     144             * the MetaMode may be preceded with "token=value" 
     145             * pairs, separated by the main MetaMode with "::"; if 
     146             * "::" exists in the string, skip past it 
     147             */ 
     148 
     149            tmp = strstr(start, "::"); 
     150            if (tmp) { 
     151                tmp += 2; 
     152            } else { 
     153                tmp = start; 
     154            } 
     155 
     156            /* split the MetaMode string by comma */ 
     157 
     158            for (modeString = strtok(tmp, ","); 
     159                 modeString; 
     160                 modeString = strtok(NULL, ",")) { 
     161 
     162                /* 
     163                 * retrieve the modeName and display device mask 
     164                 * for this segment of the Metamode 
     165                 */ 
     166 
     167                parse_mode_string(modeString, &modeName, &thisMask); 
     168 
     169                /* lookup the modeline that matches */ 
     170                nDisplayDevice = 0; 
     171                if (thisMask) { 
     172                    for (mask = 1; mask < (1 << 24); mask <<= 1) { 
     173                        if (!(display_devices & mask)) continue; 
     174                        if (thisMask & mask) break; 
     175                        nDisplayDevice++; 
     176                    } 
     177                } 
     178 
     179                modeLine = find_modeline(modeName, 
     180                                         pModeLines[nDisplayDevice], 
     181                                         ModeLineLen[nDisplayDevice]); 
     182 
     183                if (!modeline_is_interlaced(modeLine)) { 
     184                    int w, h, vfl, hfl, i, irate; 
     185                    double dcl, r; 
     186                    char *buf[256]; 
     187                    uint key, key2; 
     188 
     189                    // skip name 
     190                    tmp = strchr(modeLine, '"'); 
     191                    tmp = strchr(tmp+1, '"') +1 ; 
     192                    while (*tmp == ' ') 
     193                        tmp++; 
     194                    i = 0; 
     195                    for (modeString = strtok(tmp, " "); 
     196                         modeString; 
     197                         modeString = strtok(NULL, " ")) { 
     198                        buf[i++] = modeString; 
     199                    } 
     200                    w = strtol(buf[1], NULL, 10); 
     201                    h = strtol(buf[5], NULL, 10); 
     202                    vfl = strtol(buf[8], NULL, 10); 
     203                    hfl = strtol(buf[4], NULL, 10); 
     204                    h = strtol(buf[5], NULL, 10); 
     205                    dcl = strtod(buf[0], NULL); 
     206                    r = (dcl * 1000000.0) / (vfl * hfl); 
     207                    irate = (int) round(r * 1000.0); 
     208                    key = DisplayResScreen::CalcKey(w, h, (double) id); 
     209                    key2 = DisplayResScreen::CalcKey(w, h, 0.0); 
     210                    // We need to eliminate duplicates, giving priority to the first entries found 
     211                    if (maprate.find(key2) == maprate.end()) { 
     212                        // First time we see this resolution, create a map for it 
     213                        maprate[key2] = map<int, bool>(); 
     214                    } 
     215                    if ((maprate[key2].find(irate) == maprate[key2].end()) && 
     216                        (screenmap.find(key) == screenmap.end())) { 
     217                        screenmap[key] = r; 
     218                        maprate[key2][irate] = true; 
     219                    } 
     220                } 
     221                free(modeName); 
     222            } 
     223 
     224            /* move to the next MetaMode */ 
     225            start = &str[j+1]; 
     226        } 
     227    } 
     228    // Free Memory 
     229    for (j=0; j < nDisplayDevice; j++) { 
     230        free(pModeLines[nDisplayDevice]); 
     231    } 
     232 
     233    XCloseDisplay(dpy); 
     234    X11U; 
     235    return 1; 
     236 
     237} 
     238 
     239/* 
     240 * display_device_mask() - given a display device name, translate to 
     241 * the display device mask 
     242 */ 
     243 
     244static unsigned int display_device_mask(char *str) 
     245{ 
     246    if (strcmp(str, "CRT-0") == 0) return (1 <<  0); 
     247    if (strcmp(str, "CRT-1") == 0) return (1 <<  1); 
     248    if (strcmp(str, "CRT-2") == 0) return (1 <<  2); 
     249    if (strcmp(str, "CRT-3") == 0) return (1 <<  3); 
     250    if (strcmp(str, "CRT-4") == 0) return (1 <<  4); 
     251    if (strcmp(str, "CRT-5") == 0) return (1 <<  5); 
     252    if (strcmp(str, "CRT-6") == 0) return (1 <<  6); 
     253    if (strcmp(str, "CRT-7") == 0) return (1 <<  7); 
     254 
     255    if (strcmp(str, "TV-0") == 0)  return (1 <<  8); 
     256    if (strcmp(str, "TV-1") == 0)  return (1 <<  9); 
     257    if (strcmp(str, "TV-2") == 0)  return (1 << 10); 
     258    if (strcmp(str, "TV-3") == 0)  return (1 << 11); 
     259    if (strcmp(str, "TV-4") == 0)  return (1 << 12); 
     260    if (strcmp(str, "TV-5") == 0)  return (1 << 13); 
     261    if (strcmp(str, "TV-6") == 0)  return (1 << 14); 
     262    if (strcmp(str, "TV-7") == 0)  return (1 << 15); 
     263 
     264    if (strcmp(str, "DFP-0") == 0) return (1 << 16); 
     265    if (strcmp(str, "DFP-1") == 0) return (1 << 17); 
     266    if (strcmp(str, "DFP-2") == 0) return (1 << 18); 
     267    if (strcmp(str, "DFP-3") == 0) return (1 << 19); 
     268    if (strcmp(str, "DFP-4") == 0) return (1 << 20); 
     269    if (strcmp(str, "DFP-5") == 0) return (1 << 21); 
     270    if (strcmp(str, "DFP-6") == 0) return (1 << 22); 
     271    if (strcmp(str, "DFP-7") == 0) return (1 << 23); 
     272 
     273    return 0; 
     274 
     275} 
     276 
     277 
     278 
     279/* 
     280 * parse_mode_string() - extract the modeName and the display device 
     281 * mask for the per-display device MetaMode string in 'modeString' 
     282 */ 
     283 
     284static void parse_mode_string(char *modeString, char **modeName, int *mask) 
     285{ 
     286    char *colon, *s, tmp; 
     287 
     288    // Skip space 
     289    while (*modeString == ' ') { 
     290        modeString++; 
     291    } 
     292    colon = strchr(modeString, ':'); 
     293 
     294    if (colon) { 
     295        *colon = '\0'; 
     296        *mask = display_device_mask(modeString); 
     297        *colon = ':'; 
     298        modeString = colon + 1; 
     299    } else { 
     300        *mask = 0; 
     301    } 
     302 
     303    // Skip space 
     304    while (*modeString == ' ') { 
     305        modeString++; 
     306    } 
     307 
     308    /* 
     309     * find the modename; trim off any panning domain or 
     310     * offsets 
     311     */ 
     312 
     313    for (s = modeString; *s; s++) { 
     314        if (*s == ' ') break; 
     315        if ((*s == '+') && isdigit(s[1])) break; 
     316        if ((*s == '-') && isdigit(s[1])) break; 
     317    } 
     318 
     319    tmp = *s; 
     320    *s = '\0'; 
     321    *modeName = strdup(modeString); 
     322    *s = tmp; 
     323} 
     324 
     325 
     326/* 
     327 * find_modeline() - search the pModeLines list of ModeLines for the 
     328 * mode named 'modeName'; return a pointer to the matching ModeLine, 
     329 * or NULL if no match is found 
     330 */ 
     331 
     332static char *find_modeline(char *modeName, char *pModeLines, int ModeLineLen) 
     333{ 
     334    char *start, *beginQuote, *endQuote; 
     335    int j, match = 0; 
     336 
     337    start = pModeLines; 
     338 
     339    for (j = 0; j < ModeLineLen; j++) { 
     340        if (pModeLines[j] == '\0') { 
     341 
     342            /* 
     343             * the modeline will contain the modeName in quotes; find 
     344             * the begin and end of the quoted modeName, so that we 
     345             * can compare it to modeName 
     346             */ 
     347 
     348            beginQuote = strchr(start, '"'); 
     349            endQuote = beginQuote ? strchr(beginQuote+1, '"') : NULL; 
     350 
     351            if (beginQuote && endQuote) { 
     352                *endQuote = '\0'; 
     353                match = (strcmp(modeName, beginQuote+1) == 0); 
     354                *endQuote = '"'; 
     355 
     356                /* 
     357                 * if we found a match, return a pointer to the start 
     358                 * of this modeLine 
     359                 */ 
     360 
     361                if (match) { 
     362                    char *tmp = strstr(start, "::"); 
     363                    if (tmp) { 
     364                        tmp += 2; 
     365                    } else { 
     366                        tmp = start; 
     367                    } 
     368                    return tmp; 
     369                } 
     370            } 
     371            start = &pModeLines[j+1]; 
     372        } 
     373    } 
     374 
     375    return NULL; 
     376 
     377} 
     378 
     379/* 
     380 * extract_id_string() - Extract the xrandr twinview id from modestr and return it as an int. 
     381 */ 
     382static int extract_id_string(char *str) 
     383{ 
     384    char *begin, *end; 
     385    int id; 
     386 
     387    begin = strstr(str, "id="); 
     388    if (!begin) { 
     389        return -1; 
     390    } 
     391    if (!(begin = end = strdup(begin + 3))) { 
     392        return -1; 
     393    } 
     394    while (isdigit(*end)) { 
     395        end++; 
     396    } 
     397    *end = '\0'; 
     398    id = atoi(begin); 
     399    free(begin); 
     400    return id; 
     401} 
     402 
     403/* 
     404 * modeline_is_interlaced() - return true if the Modeline is Interlaced, false otherwise. 
     405 */ 
     406static int modeline_is_interlaced(char *modeLine) 
     407{ 
     408    return (strstr(modeLine, "Interlace") != NULL); 
     409} 
  • new file 0.21-fixes/mythtv/libs/libmyth/util-nvidia.h

    - +  
     1#ifndef __UTIL_NVIDIA_H__ 
     2#define __UTIL_NVIDIA_H__ 
     3 
     4#include <map> 
     5#include <vector> 
     6using namespace std; 
     7 
     8typedef map<uint, double> t_screenrate; 
     9 
     10int GetNvidiaRates(t_screenrate& screenmap); 
     11 
     12#endif 
  • mythtv/programs/mythfrontend/globalsettings.cpp

    old new  
    24632463            (w = 640), (h = 480); 
    24642464 
    24652465        DisplayResScreen dscr(w, h, -1, -1, -1.0, 0); 
    2466         short rate = -1; 
     2466        double rate = -1.0; 
    24672467        int i = DisplayResScreen::FindBestMatch(scr, dscr, rate); 
    24682468        gc->setValue((i >= 0) ? i : scr.size()-1); 
    24692469    } 
     
    25012501static HostRefreshRateComboBox *TVVidModeRefreshRate(int idx=-1) 
    25022502{ 
    25032503    QString dhelp = QObject::tr("Default refresh rate " 
    2504                                 "when watching a video."); 
     2504                                "when watching a video. " 
     2505                                "Leave at \"Any\" to automatically use the best available"); 
    25052506    QString ohelp = QObject::tr("Refresh rate when watching a " 
    2506                                 "video at a specific resolution."); 
     2507                                "video at a specific resolution. " 
     2508                                "Leave at \"Any\" to automatically use the best available"); 
    25072509    QString qstr = (idx<0) ? "TVVidModeRefreshRate" : 
    25082510        QString("TVVidModeRefreshRate%1").arg(idx); 
    25092511    HostRefreshRateComboBox *gc = new HostRefreshRateComboBox(qstr); 
  • mythtv/libs/libmyth/settings.cpp

    old new  
    11// C++ headers 
    22#include <algorithm> 
     3#include <cmath> 
    34using namespace std; 
    45 
    56// POSIX headers 
     
    707708{ 
    708709    clearSelections(); 
    709710     
    710     const vector<short> list = GetRefreshRates(resolution); 
     711    const vector<double> list = GetRefreshRates(resolution); 
    711712    addSelection(QObject::tr("Any"), "0"); 
    712713    int hz50 = -1, hz60 = -1; 
    713714    for (uint i=0; i<list.size(); ++i) 
    714715    {         
    715         QString sel = QString::number(list[i]); 
     716        QString sel = QString::number((double) list[i],'f', 3); 
    716717        addSelection(sel+" Hz", sel); 
    717         hz50 = (50 == list[i]) ? i : hz50; 
    718         hz60 = (60 == list[i]) ? i : hz60; 
     718        hz50 = (fabs(50.0 - list[i]) < 0.01) ? i : hz50; 
     719        hz60 = (fabs(60.0 - list[i]) < 0.01) ? i : hz60; 
    719720    } 
    720721     
    721722    setValue(0); 
     
    727728    setEnabled(list.size()); 
    728729} 
    729730 
    730 const vector<short> HostRefreshRateComboBox::GetRefreshRates(const QString &res) 
     731const vector<double> HostRefreshRateComboBox::GetRefreshRates(const QString &res) 
    731732{ 
    732733    QStringList slist = QStringList::split("x", res); 
    733734    int w = 0, h = 0; 
     
    742743    if (display_res && ok0 && ok1) 
    743744        return display_res->GetRefreshRates(w, h);     
    744745 
    745     vector<short> list; 
     746    vector<double> list; 
    746747    return list; 
    747748} 
    748749 
  • mythtv/libs/libmyth/settings.h

    old new  
    701701    virtual void ChangeResolution(const QString& resolution); 
    702702 
    703703  private: 
    704     static const vector<short> GetRefreshRates(const QString &resolution); 
     704    static const vector<double> GetRefreshRates(const QString &resolution); 
    705705}; 
    706706 
    707707class MPUBLIC HostTimeBox : public ComboBoxSetting, public HostDBStorage 
  • mythtv/libs/libmyth/mythcontext.h

    old new  
    247247    int GetNumSetting(const QString &key, int defaultval = 0); 
    248248    double GetFloatSetting(const QString &key, double defaultval = 0.0); 
    249249    void GetResolutionSetting(const QString &type, int &width, int &height, 
    250                               double& forced_aspect, short &refreshrate, 
     250                              double& forced_aspect, double &refreshrate, 
    251251                              int index=-1); 
    252252    void GetResolutionSetting(const QString &type, int &width, int &height, 
    253253                              int index=-1); 
  • mythtv/libs/libmyth/mythcontext.cpp

    old new  
    23232323void MythContext::GetResolutionSetting(const QString &type, 
    23242324                                       int &width, int &height, 
    23252325                                       double &forced_aspect, 
    2326                                        short &refresh_rate, 
     2326                                       double &refresh_rate, 
    23272327                                       int index) 
    23282328{ 
    23292329    bool ok = false, ok0 = false, ok1 = false; 
     
    23572357        { 
    23582358            width = w; 
    23592359            height = h; 
    2360             refresh_rate = GetNumSetting(sRR); 
     2360            refresh_rate = GetFloatSetting(sRR); 
    23612361            forced_aspect = GetFloatSetting(sAspect); 
    23622362        } 
    23632363    } 
     
    23732373        if (tmpHeight) 
    23742374            height = tmpHeight; 
    23752375 
    2376         refresh_rate = 0; 
     2376        refresh_rate = 0.0; 
    23772377        forced_aspect = 0.0; 
    23782378        //SetSetting(sRes, QString("%1x%2").arg(width).arg(height)); 
    23792379    } 
     
    23822382void MythContext::GetResolutionSetting(const QString &t, int &w, int &h, int i) 
    23832383{ 
    23842384    double forced_aspect = 0; 
    2385     short refresh_rate = 0; 
     2385    double refresh_rate = 0.0; 
    23862386    GetResolutionSetting(t, w, h, forced_aspect, refresh_rate, i); 
    23872387} 
    23882388