aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-10-25 02:29:13 -0400
committerBen Skeggs <bskeggs@redhat.com>2011-12-21 04:01:23 -0500
commit1cb9469ee7bcdc0f80a3b12a1036352039ada72f (patch)
tree6750a191fff74d79379ffaf51dc0bbe177bf2904 /drivers/gpu/drm
parent616a5f57b634718e87c260820166b11bdcf6a482 (diff)
drm/nv50/disp: fix scaling of doublescan modes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/nv50_crtc.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c
index 998ac7195419..8f6c2ace3adf 100644
--- a/drivers/gpu/drm/nouveau/nv50_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv50_crtc.c
@@ -195,7 +195,8 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update)
195 struct drm_crtc *crtc = &nv_crtc->base; 195 struct drm_crtc *crtc = &nv_crtc->base;
196 struct drm_device *dev = crtc->dev; 196 struct drm_device *dev = crtc->dev;
197 struct nouveau_channel *evo = nv50_display(dev)->master; 197 struct nouveau_channel *evo = nv50_display(dev)->master;
198 struct drm_display_mode *mode = &crtc->mode; 198 struct drm_display_mode *umode = &crtc->mode;
199 struct drm_display_mode *omode;
199 int scaling_mode, ret; 200 int scaling_mode, ret;
200 u32 ctrl = 0, oX, oY; 201 u32 ctrl = 0, oX, oY;
201 202
@@ -212,13 +213,15 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update)
212 /* start off at the resolution we programmed the crtc for, this 213 /* start off at the resolution we programmed the crtc for, this
213 * effectively handles NONE/FULL scaling 214 * effectively handles NONE/FULL scaling
214 */ 215 */
215 if (scaling_mode != DRM_MODE_SCALE_NONE) { 216 if (scaling_mode != DRM_MODE_SCALE_NONE)
216 oX = nv_connector->native_mode->hdisplay; 217 omode = nv_connector->native_mode;
217 oY = nv_connector->native_mode->vdisplay; 218 else
218 } else { 219 omode = umode;
219 oX = mode->hdisplay; 220
220 oY = mode->vdisplay; 221 oX = omode->hdisplay;
221 } 222 oY = omode->vdisplay;
223 if (omode->flags & DRM_MODE_FLAG_DBLSCAN)
224 oY *= 2;
222 225
223 /* add overscan compensation if necessary, will keep the aspect 226 /* add overscan compensation if necessary, will keep the aspect
224 * ratio the same as the backend mode unless overridden by the 227 * ratio the same as the backend mode unless overridden by the
@@ -248,15 +251,15 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update)
248 */ 251 */
249 switch (scaling_mode) { 252 switch (scaling_mode) {
250 case DRM_MODE_SCALE_CENTER: 253 case DRM_MODE_SCALE_CENTER:
251 oX = min((u32)mode->hdisplay, oX); 254 oX = min((u32)umode->hdisplay, oX);
252 oY = min((u32)mode->vdisplay, oY); 255 oY = min((u32)umode->vdisplay, oY);
253 /* fall-through */ 256 /* fall-through */
254 case DRM_MODE_SCALE_ASPECT: 257 case DRM_MODE_SCALE_ASPECT:
255 if (oY < oX) { 258 if (oY < oX) {
256 u32 aspect = (mode->hdisplay << 19) / mode->vdisplay; 259 u32 aspect = (umode->hdisplay << 19) / umode->vdisplay;
257 oX = ((oY * aspect) + (aspect / 2)) >> 19; 260 oX = ((oY * aspect) + (aspect / 2)) >> 19;
258 } else { 261 } else {
259 u32 aspect = (mode->vdisplay << 19) / mode->hdisplay; 262 u32 aspect = (umode->vdisplay << 19) / umode->hdisplay;
260 oY = ((oX * aspect) + (aspect / 2)) >> 19; 263 oY = ((oX * aspect) + (aspect / 2)) >> 19;
261 } 264 }
262 break; 265 break;
@@ -264,9 +267,9 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update)
264 break; 267 break;
265 } 268 }
266 269
267 if (mode->hdisplay != oX || mode->vdisplay != oY || 270 if (umode->hdisplay != oX || umode->vdisplay != oY ||
268 mode->flags & DRM_MODE_FLAG_INTERLACE || 271 umode->flags & DRM_MODE_FLAG_INTERLACE ||
269 mode->flags & DRM_MODE_FLAG_DBLSCAN) 272 umode->flags & DRM_MODE_FLAG_DBLSCAN)
270 ctrl |= NV50_EVO_CRTC_SCALE_CTRL_ACTIVE; 273 ctrl |= NV50_EVO_CRTC_SCALE_CTRL_ACTIVE;
271 274
272 ret = RING_SPACE(evo, 5); 275 ret = RING_SPACE(evo, 5);