diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-07-07 02:01:57 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-09-20 02:07:15 -0400 |
commit | f3fdc52dd73a083dcb80f95e5c6ce8a33277b102 (patch) | |
tree | c87d36f47716a113bb351f541e0916a8da253a3e /drivers | |
parent | a46232ee09064351246c6f7134c81790ef737874 (diff) |
drm/nvd0/disp: scaling
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvd0_display.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c index 4fadea47b3b4..d85b25939653 100644 --- a/drivers/gpu/drm/nouveau/nvd0_display.c +++ b/drivers/gpu/drm/nouveau/nvd0_display.c | |||
@@ -150,16 +150,43 @@ nvd0_crtc_set_scale(struct nouveau_crtc *nv_crtc, int type, bool update) | |||
150 | { | 150 | { |
151 | struct drm_display_mode *mode = &nv_crtc->base.mode; | 151 | struct drm_display_mode *mode = &nv_crtc->base.mode; |
152 | struct drm_device *dev = nv_crtc->base.dev; | 152 | struct drm_device *dev = nv_crtc->base.dev; |
153 | u32 *push; | 153 | struct nouveau_connector *nv_connector; |
154 | u32 *push, outX, outY; | ||
154 | 155 | ||
155 | /*XXX: actually handle scaling */ | 156 | outX = mode->hdisplay; |
157 | outY = mode->vdisplay; | ||
158 | |||
159 | nv_connector = nouveau_crtc_connector_get(nv_crtc); | ||
160 | if (nv_connector && nv_connector->native_mode) { | ||
161 | struct drm_display_mode *native = nv_connector->native_mode; | ||
162 | u32 xratio = (native->hdisplay << 19) / mode->hdisplay; | ||
163 | u32 yratio = (native->vdisplay << 19) / mode->vdisplay; | ||
164 | |||
165 | switch (type) { | ||
166 | case DRM_MODE_SCALE_ASPECT: | ||
167 | if (xratio > yratio) { | ||
168 | outX = (mode->hdisplay * yratio) >> 19; | ||
169 | outY = (mode->vdisplay * yratio) >> 19; | ||
170 | } else { | ||
171 | outX = (mode->hdisplay * xratio) >> 19; | ||
172 | outY = (mode->vdisplay * xratio) >> 19; | ||
173 | } | ||
174 | break; | ||
175 | case DRM_MODE_SCALE_FULLSCREEN: | ||
176 | outX = native->hdisplay; | ||
177 | outY = native->vdisplay; | ||
178 | break; | ||
179 | default: | ||
180 | break; | ||
181 | } | ||
182 | } | ||
156 | 183 | ||
157 | push = evo_wait(dev, 0, 16); | 184 | push = evo_wait(dev, 0, 16); |
158 | if (push) { | 185 | if (push) { |
159 | evo_mthd(push, 0x04c0 + (nv_crtc->index * 0x300), 3); | 186 | evo_mthd(push, 0x04c0 + (nv_crtc->index * 0x300), 3); |
160 | evo_data(push, (mode->vdisplay << 16) | mode->hdisplay); | 187 | evo_data(push, (outY << 16) | outX); |
161 | evo_data(push, (mode->vdisplay << 16) | mode->hdisplay); | 188 | evo_data(push, (outY << 16) | outX); |
162 | evo_data(push, (mode->vdisplay << 16) | mode->hdisplay); | 189 | evo_data(push, (outY << 16) | outX); |
163 | evo_mthd(push, 0x0494 + (nv_crtc->index * 0x300), 1); | 190 | evo_mthd(push, 0x0494 + (nv_crtc->index * 0x300), 1); |
164 | evo_data(push, 0x00000000); | 191 | evo_data(push, 0x00000000); |
165 | evo_mthd(push, 0x04b0 + (nv_crtc->index * 0x300), 1); | 192 | evo_mthd(push, 0x04b0 + (nv_crtc->index * 0x300), 1); |