Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269641
b: refs/heads/master
c: f3fdc52
h: refs/heads/master
i:
  269639: 2b1b354
v: v3
  • Loading branch information
Ben Skeggs committed Sep 20, 2011
1 parent 8af84d6 commit 6fdcc7d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a46232ee09064351246c6f7134c81790ef737874
refs/heads/master: f3fdc52dd73a083dcb80f95e5c6ce8a33277b102
37 changes: 32 additions & 5 deletions trunk/drivers/gpu/drm/nouveau/nvd0_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,43 @@ nvd0_crtc_set_scale(struct nouveau_crtc *nv_crtc, int type, bool update)
{
struct drm_display_mode *mode = &nv_crtc->base.mode;
struct drm_device *dev = nv_crtc->base.dev;
u32 *push;
struct nouveau_connector *nv_connector;
u32 *push, outX, outY;

/*XXX: actually handle scaling */
outX = mode->hdisplay;
outY = mode->vdisplay;

nv_connector = nouveau_crtc_connector_get(nv_crtc);
if (nv_connector && nv_connector->native_mode) {
struct drm_display_mode *native = nv_connector->native_mode;
u32 xratio = (native->hdisplay << 19) / mode->hdisplay;
u32 yratio = (native->vdisplay << 19) / mode->vdisplay;

switch (type) {
case DRM_MODE_SCALE_ASPECT:
if (xratio > yratio) {
outX = (mode->hdisplay * yratio) >> 19;
outY = (mode->vdisplay * yratio) >> 19;
} else {
outX = (mode->hdisplay * xratio) >> 19;
outY = (mode->vdisplay * xratio) >> 19;
}
break;
case DRM_MODE_SCALE_FULLSCREEN:
outX = native->hdisplay;
outY = native->vdisplay;
break;
default:
break;
}
}

push = evo_wait(dev, 0, 16);
if (push) {
evo_mthd(push, 0x04c0 + (nv_crtc->index * 0x300), 3);
evo_data(push, (mode->vdisplay << 16) | mode->hdisplay);
evo_data(push, (mode->vdisplay << 16) | mode->hdisplay);
evo_data(push, (mode->vdisplay << 16) | mode->hdisplay);
evo_data(push, (outY << 16) | outX);
evo_data(push, (outY << 16) | outX);
evo_data(push, (outY << 16) | outX);
evo_mthd(push, 0x0494 + (nv_crtc->index * 0x300), 1);
evo_data(push, 0x00000000);
evo_mthd(push, 0x04b0 + (nv_crtc->index * 0x300), 1);
Expand Down

0 comments on commit 6fdcc7d

Please sign in to comment.