~ubuntu-branches/ubuntu/hardy/xserver-xorg-video-ati/hardy

« back to all changes in this revision

Viewing changes to src/radeon_modes.c

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2007-10-06 12:13:31 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20071006121331-l0jcbuztjsmie3a9
Tags: 1:6.7.195-1ubuntu1
* Merge with Debian experimental, remaining changes:
  - debian/control
    * Ease the Build-Depends on xserver-xorg-dev.
    * Change Maintainer-address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
    ScrnInfoPtr pScrn = output->scrn;
98
98
    RADEONOutputPrivatePtr radeon_output = output->driver_private;
99
99
    DisplayModePtr  new   = NULL;
100
 
    char            stmp[32];
101
100
 
102
101
    if (radeon_output->PanelXRes != 0 &&
103
102
        radeon_output->PanelYRes != 0 &&
104
103
        radeon_output->DotClock != 0) {
105
104
 
106
105
        /* Add native panel size */
107
 
        new             = xnfcalloc(1, sizeof (DisplayModeRec));
108
 
        sprintf(stmp, "%dx%d", radeon_output->PanelXRes, radeon_output->PanelYRes);
109
 
        new->name       = xnfalloc(strlen(stmp) + 1);
110
 
        strcpy(new->name, stmp);
111
 
        new->HDisplay   = radeon_output->PanelXRes;
112
 
        new->VDisplay   = radeon_output->PanelYRes;
113
 
 
114
 
        new->HTotal     = new->HDisplay + radeon_output->HBlank;
115
 
        new->HSyncStart = new->HDisplay + radeon_output->HOverPlus;
116
 
        new->HSyncEnd   = new->HSyncStart + radeon_output->HSyncWidth;
117
 
        new->VTotal     = new->VDisplay + radeon_output->VBlank;
118
 
        new->VSyncStart = new->VDisplay + radeon_output->VOverPlus;
119
 
        new->VSyncEnd   = new->VSyncStart + radeon_output->VSyncWidth;
120
 
 
121
 
        new->Clock      = radeon_output->DotClock;
122
 
        new->Flags      = 0;
123
 
        new->type       = M_T_USERDEF | M_T_PREFERRED;
 
106
        new = xf86CVTMode(radeon_output->PanelXRes, radeon_output->PanelYRes, 60.0, TRUE, FALSE);
 
107
 
 
108
        new->type       = M_T_DRIVER | M_T_PREFERRED;
124
109
 
125
110
        new->next       = NULL;
126
111
        new->prev       = NULL;
132
117
    return new;
133
118
}
134
119
 
 
120
/* this function is basically a hack to add the screen modes */
 
121
static void RADEONAddScreenModes(xf86OutputPtr output, DisplayModePtr *modeList)
 
122
{
 
123
    ScrnInfoPtr pScrn = output->scrn;
 
124
    RADEONOutputPrivatePtr radeon_output = output->driver_private;
 
125
    DisplayModePtr  last       = NULL;
 
126
    DisplayModePtr  new        = NULL;
 
127
    DisplayModePtr  first      = NULL;
 
128
    int             count      = 0;
 
129
    int             i, width, height;
 
130
    char **ppModeName = pScrn->display->modes;
 
131
 
 
132
    first = last = *modeList;
 
133
 
 
134
    /* We have a flat panel connected to the primary display, and we
 
135
     * don't have any DDC info.
 
136
     */
 
137
    for (i = 0; ppModeName[i] != NULL; i++) {
 
138
 
 
139
        if (sscanf(ppModeName[i], "%dx%d", &width, &height) != 2) continue;
 
140
 
 
141
        if (radeon_output->type == OUTPUT_LVDS) {
 
142
            /* already added the native mode */
 
143
            if (width == radeon_output->PanelXRes && height == radeon_output->PanelYRes)
 
144
                continue;
 
145
 
 
146
            /* Note: We allow all non-standard modes as long as they do not
 
147
             * exceed the native resolution of the panel.  Since these modes
 
148
             * need the internal RMX unit in the video chips (and there is
 
149
             * only one per card), this will only apply to the primary head.
 
150
             */
 
151
            if (width < 320 || width > radeon_output->PanelXRes ||
 
152
                height < 200 || height > radeon_output->PanelYRes) {
 
153
                xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 
154
                           "Mode %s is out of range.\n", ppModeName[i]);
 
155
                xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 
156
                           "Valid FP modes must be between 320x200-%dx%d\n",
 
157
                           radeon_output->PanelXRes, radeon_output->PanelYRes);
 
158
                continue;
 
159
            }
 
160
        }
 
161
 
 
162
        new = xf86CVTMode(width, height, 60.0, TRUE, FALSE);
 
163
 
 
164
        new->type      |= M_T_USERDEF;
 
165
 
 
166
        new->next       = NULL;
 
167
        new->prev       = last;
 
168
 
 
169
        if (last) last->next = new;
 
170
        last = new;
 
171
        if (!first) first = new;
 
172
 
 
173
        count++;
 
174
        xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 
175
                   "Adding Screen mode: %s\n", new->name);
 
176
    }
 
177
 
 
178
 
 
179
    /* Close the doubly-linked mode list, if we found any usable modes */
 
180
    if (last) {
 
181
        last->next   = NULL; //first;
 
182
        first->prev  = NULL; //last;
 
183
        *modeList = first;
 
184
    }
 
185
 
 
186
    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 
187
               "Total number of valid Screen mode(s) added: %d\n", count);
 
188
 
 
189
}
 
190
 
135
191
DisplayModePtr
136
192
RADEONProbeOutputModes(xf86OutputPtr output)
137
193
{
138
 
    ScrnInfoPtr     pScrn = output->scrn;
139
194
    RADEONOutputPrivatePtr radeon_output = output->driver_private;
140
195
    xf86MonPtr              edid_mon;
141
196
    DisplayModePtr          modes = NULL;
142
197
 
143
 
#if 0
144
 
    /* force reprobe */
145
 
    radeon_output->MonType = MT_UNKNOWN;
146
 
 
147
 
    RADEONConnectorFindMonitor(pScrn, output);
148
 
#endif
149
198
    ErrorF("in RADEONProbeOutputModes\n");
150
199
 
151
200
    if (output->status == XF86OutputStatusConnected) {
167
216
                xf86OutputSetEDID (output, edid_mon);
168
217
 
169
218
                modes = xf86OutputGetEDIDModes (output);
170
 
                return modes;
171
 
            } else
172
 
                /* add native panel mode */
 
219
            }
 
220
            if (modes == NULL) {
173
221
                modes = RADEONFPNativeMode(output);
 
222
                /* add the screen modes */
 
223
                RADEONAddScreenModes(output, &modes);
 
224
            }
 
225
            return modes;
174
226
        }
175
227
    }
176
228
 
177
 
    if (modes) {
178
 
        xf86ValidateModesUserConfig(pScrn, modes);
179
 
        xf86PruneInvalidModes(pScrn, &modes, FALSE);
180
 
    }
181
 
 
182
229
    return modes;
183
230
}
184
231