aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-11-11 08:39:22 -0500
committerBen Skeggs <bskeggs@redhat.com>2011-12-21 04:01:35 -0500
commit2d1d898b4684ab86fb27ece7d69e4e145a7be9d2 (patch)
tree7ef332bcfe3e9fbb5e98670840c44b6e267e2b80 /drivers/gpu
parentf62b27db6b5479efe376b408802a081a834ef50e (diff)
drm/nvd0/disp: update crtc timing calculations for interlace/doublescan
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nvd0_display.c52
1 files changed, 34 insertions, 18 deletions
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c
index 614c6520a520..7c2defdcc8f3 100644
--- a/drivers/gpu/drm/nouveau/nvd0_display.c
+++ b/drivers/gpu/drm/nouveau/nvd0_display.c
@@ -352,21 +352,35 @@ nvd0_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode,
352{ 352{
353 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 353 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
354 struct nouveau_connector *nv_connector; 354 struct nouveau_connector *nv_connector;
355 u32 htotal = mode->htotal; 355 u32 ilace = (mode->flags & DRM_MODE_FLAG_INTERLACE) ? 2 : 1;
356 u32 vtotal = mode->vtotal; 356 u32 vscan = (mode->flags & DRM_MODE_FLAG_DBLSCAN) ? 2 : 1;
357 u32 hsyncw = mode->hsync_end - mode->hsync_start - 1; 357 u32 hactive, hsynce, hbackp, hfrontp, hblanke, hblanks;
358 u32 vsyncw = mode->vsync_end - mode->vsync_start - 1; 358 u32 vactive, vsynce, vbackp, vfrontp, vblanke, vblanks;
359 u32 hfrntp = mode->hsync_start - mode->hdisplay; 359 u32 vblan2e = 0, vblan2s = 1;
360 u32 vfrntp = mode->vsync_start - mode->vdisplay; 360 u32 magic = 0x31ec6000;
361 u32 hbackp = mode->htotal - mode->hsync_end;
362 u32 vbackp = mode->vtotal - mode->vsync_end;
363 u32 hss2be = hsyncw + hbackp;
364 u32 vss2be = vsyncw + vbackp;
365 u32 hss2de = htotal - hfrntp;
366 u32 vss2de = vtotal - vfrntp;
367 u32 syncs, *push; 361 u32 syncs, *push;
368 int ret; 362 int ret;
369 363
364 hactive = mode->htotal;
365 hsynce = mode->hsync_end - mode->hsync_start - 1;
366 hbackp = mode->htotal - mode->hsync_end;
367 hblanke = hsynce + hbackp;
368 hfrontp = mode->hsync_start - mode->hdisplay;
369 hblanks = mode->htotal - hfrontp - 1;
370
371 vactive = mode->vtotal * vscan / ilace;
372 vsynce = ((mode->vsync_end - mode->vsync_start) * vscan / ilace) - 1;
373 vbackp = (mode->vtotal - mode->vsync_end) * vscan / ilace;
374 vblanke = vsynce + vbackp;
375 vfrontp = (mode->vsync_start - mode->vdisplay) * vscan / ilace;
376 vblanks = vactive - vfrontp - 1;
377 if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
378 vblan2e = vactive + vsynce + vbackp;
379 vblan2s = vblan2e + (mode->vdisplay * vscan / ilace);
380 vactive = (vactive * 2) + 1;
381 magic |= 0x00000001;
382 }
383
370 syncs = 0x00000001; 384 syncs = 0x00000001;
371 if (mode->flags & DRM_MODE_FLAG_NHSYNC) 385 if (mode->flags & DRM_MODE_FLAG_NHSYNC)
372 syncs |= 0x00000008; 386 syncs |= 0x00000008;
@@ -379,20 +393,22 @@ nvd0_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode,
379 393
380 push = evo_wait(crtc->dev, 0, 64); 394 push = evo_wait(crtc->dev, 0, 64);
381 if (push) { 395 if (push) {
382 evo_mthd(push, 0x0410 + (nv_crtc->index * 0x300), 5); 396 evo_mthd(push, 0x0410 + (nv_crtc->index * 0x300), 6);
383 evo_data(push, 0x00000000); 397 evo_data(push, 0x00000000);
384 evo_data(push, (vtotal << 16) | htotal); 398 evo_data(push, (vactive << 16) | hactive);
385 evo_data(push, (vsyncw << 16) | hsyncw); 399 evo_data(push, ( vsynce << 16) | hsynce);
386 evo_data(push, (vss2be << 16) | hss2be); 400 evo_data(push, (vblanke << 16) | hblanke);
387 evo_data(push, (vss2de << 16) | hss2de); 401 evo_data(push, (vblanks << 16) | hblanks);
402 evo_data(push, (vblan2e << 16) | vblan2s);
388 evo_mthd(push, 0x042c + (nv_crtc->index * 0x300), 1); 403 evo_mthd(push, 0x042c + (nv_crtc->index * 0x300), 1);
389 evo_data(push, 0x00000000); /* ??? */ 404 evo_data(push, 0x00000000); /* ??? */
390 evo_mthd(push, 0x0450 + (nv_crtc->index * 0x300), 3); 405 evo_mthd(push, 0x0450 + (nv_crtc->index * 0x300), 3);
391 evo_data(push, mode->clock * 1000); 406 evo_data(push, mode->clock * 1000);
392 evo_data(push, 0x00200000); /* ??? */ 407 evo_data(push, 0x00200000); /* ??? */
393 evo_data(push, mode->clock * 1000); 408 evo_data(push, mode->clock * 1000);
394 evo_mthd(push, 0x0404 + (nv_crtc->index * 0x300), 1); 409 evo_mthd(push, 0x0404 + (nv_crtc->index * 0x300), 2);
395 evo_data(push, syncs); 410 evo_data(push, syncs);
411 evo_data(push, magic);
396 evo_kick(push, crtc->dev, 0); 412 evo_kick(push, crtc->dev, 0);
397 } 413 }
398 414