aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c17
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_crtc.h4
-rw-r--r--drivers/gpu/drm/nouveau/nv50_crtc.c16
-rw-r--r--drivers/gpu/drm/nouveau/nvd0_display.c17
4 files changed, 26 insertions, 28 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index fc42ea8503cb..372955ddc591 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -471,7 +471,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
471 if (!ret) 471 if (!ret)
472 return -EINVAL; 472 return -EINVAL;
473 } else { 473 } else {
474 ret = nv_crtc->set_scale(nv_crtc, value, true); 474 ret = nv_crtc->set_scale(nv_crtc, true);
475 if (ret) 475 if (ret)
476 return ret; 476 return ret;
477 } 477 }
@@ -486,9 +486,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
486 if (!nv_crtc || !nv_crtc->set_scale) 486 if (!nv_crtc || !nv_crtc->set_scale)
487 return 0; 487 return 0;
488 488
489 return nv_crtc->set_scale(nv_crtc, 489 return nv_crtc->set_scale(nv_crtc, true);
490 nv_connector->scaling_mode,
491 true);
492 } 490 }
493 491
494 return 0; 492 return 0;
@@ -500,9 +498,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
500 if (!nv_crtc || !nv_crtc->set_scale) 498 if (!nv_crtc || !nv_crtc->set_scale)
501 return 0; 499 return 0;
502 500
503 return nv_crtc->set_scale(nv_crtc, 501 return nv_crtc->set_scale(nv_crtc, true);
504 nv_connector->scaling_mode,
505 true);
506 } 502 }
507 503
508 return 0; 504 return 0;
@@ -514,9 +510,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
514 if (!nv_crtc || !nv_crtc->set_scale) 510 if (!nv_crtc || !nv_crtc->set_scale)
515 return 0; 511 return 0;
516 512
517 return nv_crtc->set_scale(nv_crtc, 513 return nv_crtc->set_scale(nv_crtc, true);
518 nv_connector->scaling_mode,
519 true);
520 } 514 }
521 515
522 return 0; 516 return 0;
@@ -532,8 +526,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
532 if (!nv_crtc || !nv_crtc->set_dither) 526 if (!nv_crtc || !nv_crtc->set_dither)
533 return 0; 527 return 0;
534 528
535 return nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering, 529 return nv_crtc->set_dither(nv_crtc, true);
536 true);
537 } 530 }
538 531
539 if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV) 532 if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV)
diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h
index bf8e1289953d..b9b1980b5d8c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_crtc.h
+++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h
@@ -67,8 +67,8 @@ struct nouveau_crtc {
67 int depth; 67 int depth;
68 } lut; 68 } lut;
69 69
70 int (*set_dither)(struct nouveau_crtc *crtc, bool on, bool update); 70 int (*set_dither)(struct nouveau_crtc *crtc, bool update);
71 int (*set_scale)(struct nouveau_crtc *crtc, int mode, bool update); 71 int (*set_scale)(struct nouveau_crtc *crtc, bool update);
72}; 72};
73 73
74static inline struct nouveau_crtc *nouveau_crtc(struct drm_crtc *crtc) 74static inline struct nouveau_crtc *nouveau_crtc(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c
index c1c57cb37208..70d7fbb43cf6 100644
--- a/drivers/gpu/drm/nouveau/nv50_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv50_crtc.c
@@ -132,10 +132,12 @@ nv50_crtc_blank(struct nouveau_crtc *nv_crtc, bool blanked)
132} 132}
133 133
134static int 134static int
135nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update) 135nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool update)
136{ 136{
137 struct drm_device *dev = nv_crtc->base.dev; 137 struct drm_device *dev = nv_crtc->base.dev;
138 struct nouveau_channel *evo = nv50_display(dev)->master; 138 struct nouveau_channel *evo = nv50_display(dev)->master;
139 struct nouveau_connector *nv_connector =
140 nouveau_crtc_connector_get(nv_crtc);
139 int ret; 141 int ret;
140 142
141 NV_DEBUG_KMS(dev, "\n"); 143 NV_DEBUG_KMS(dev, "\n");
@@ -147,7 +149,7 @@ nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update)
147 } 149 }
148 150
149 BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, DITHER_CTRL), 1); 151 BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, DITHER_CTRL), 1);
150 if (on) 152 if (nv_connector->use_dithering)
151 OUT_RING(evo, NV50_EVO_CRTC_DITHER_CTRL_ON); 153 OUT_RING(evo, NV50_EVO_CRTC_DITHER_CTRL_ON);
152 else 154 else
153 OUT_RING(evo, NV50_EVO_CRTC_DITHER_CTRL_OFF); 155 OUT_RING(evo, NV50_EVO_CRTC_DITHER_CTRL_OFF);
@@ -180,15 +182,15 @@ nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc)
180} 182}
181 183
182static int 184static int
183nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, int scaling_mode, bool update) 185nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update)
184{ 186{
185 struct nouveau_connector *nv_connector; 187 struct nouveau_connector *nv_connector;
186 struct drm_crtc *crtc = &nv_crtc->base; 188 struct drm_crtc *crtc = &nv_crtc->base;
187 struct drm_device *dev = crtc->dev; 189 struct drm_device *dev = crtc->dev;
188 struct nouveau_channel *evo = nv50_display(dev)->master; 190 struct nouveau_channel *evo = nv50_display(dev)->master;
189 struct drm_display_mode *mode = &crtc->mode; 191 struct drm_display_mode *mode = &crtc->mode;
192 int scaling_mode, ret;
190 u32 ctrl = 0, oX, oY; 193 u32 ctrl = 0, oX, oY;
191 int ret;
192 194
193 NV_DEBUG_KMS(dev, "\n"); 195 NV_DEBUG_KMS(dev, "\n");
194 196
@@ -196,6 +198,8 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, int scaling_mode, bool update)
196 if (!nv_connector || !nv_connector->native_mode) { 198 if (!nv_connector || !nv_connector->native_mode) {
197 NV_ERROR(dev, "no native mode, forcing panel scaling\n"); 199 NV_ERROR(dev, "no native mode, forcing panel scaling\n");
198 scaling_mode = DRM_MODE_SCALE_NONE; 200 scaling_mode = DRM_MODE_SCALE_NONE;
201 } else {
202 scaling_mode = nv_connector->scaling_mode;
199 } 203 }
200 204
201 /* start off at the resolution we programmed the crtc for, this 205 /* start off at the resolution we programmed the crtc for, this
@@ -663,8 +667,8 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
663 BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, SCALE_CENTER_OFFSET), 1); 667 BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, SCALE_CENTER_OFFSET), 1);
664 OUT_RING(evo, NV50_EVO_CRTC_SCALE_CENTER_OFFSET_VAL(0, 0)); 668 OUT_RING(evo, NV50_EVO_CRTC_SCALE_CENTER_OFFSET_VAL(0, 0));
665 669
666 nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering, false); 670 nv_crtc->set_dither(nv_crtc, false);
667 nv_crtc->set_scale(nv_crtc, nv_connector->scaling_mode, false); 671 nv_crtc->set_scale(nv_crtc, false);
668 672
669 return nv50_crtc_do_mode_set_base(crtc, old_fb, x, y, false); 673 return nv50_crtc_do_mode_set_base(crtc, old_fb, x, y, false);
670} 674}
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c
index cb006a718e70..9e96eb12133a 100644
--- a/drivers/gpu/drm/nouveau/nvd0_display.c
+++ b/drivers/gpu/drm/nouveau/nvd0_display.c
@@ -107,13 +107,14 @@ nvd0_display_crtc_get(struct drm_encoder *encoder)
107 * CRTC 107 * CRTC
108 *****************************************************************************/ 108 *****************************************************************************/
109static int 109static int
110nvd0_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update) 110nvd0_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool update)
111{ 111{
112 struct nouveau_connector *nv_connector;
112 struct drm_device *dev = nv_crtc->base.dev; 113 struct drm_device *dev = nv_crtc->base.dev;
113 u32 *push, mode; 114 u32 *push, mode = 0;
114 115
115 mode = 0x00000000; 116 nv_connector = nouveau_crtc_connector_get(nv_crtc);
116 if (on) { 117 if (nv_connector->use_dithering) {
117 /* 0x11: 6bpc dynamic 2x2 118 /* 0x11: 6bpc dynamic 2x2
118 * 0x13: 8bpc dynamic 2x2 119 * 0x13: 8bpc dynamic 2x2
119 * 0x19: 6bpc static 2x2 120 * 0x19: 6bpc static 2x2
@@ -139,7 +140,7 @@ nvd0_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update)
139} 140}
140 141
141static int 142static int
142nvd0_crtc_set_scale(struct nouveau_crtc *nv_crtc, int type, bool update) 143nvd0_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update)
143{ 144{
144 struct drm_display_mode *mode = &nv_crtc->base.mode; 145 struct drm_display_mode *mode = &nv_crtc->base.mode;
145 struct drm_device *dev = nv_crtc->base.dev; 146 struct drm_device *dev = nv_crtc->base.dev;
@@ -155,7 +156,7 @@ nvd0_crtc_set_scale(struct nouveau_crtc *nv_crtc, int type, bool update)
155 u32 xratio = (native->hdisplay << 19) / mode->hdisplay; 156 u32 xratio = (native->hdisplay << 19) / mode->hdisplay;
156 u32 yratio = (native->vdisplay << 19) / mode->vdisplay; 157 u32 yratio = (native->vdisplay << 19) / mode->vdisplay;
157 158
158 switch (type) { 159 switch (nv_connector->scaling_mode) {
159 case DRM_MODE_SCALE_ASPECT: 160 case DRM_MODE_SCALE_ASPECT:
160 if (xratio > yratio) { 161 if (xratio > yratio) {
161 outX = (mode->hdisplay * yratio) >> 19; 162 outX = (mode->hdisplay * yratio) >> 19;
@@ -378,8 +379,8 @@ nvd0_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode,
378 } 379 }
379 380
380 nv_connector = nouveau_crtc_connector_get(nv_crtc); 381 nv_connector = nouveau_crtc_connector_get(nv_crtc);
381 nvd0_crtc_set_dither(nv_crtc, nv_connector->use_dithering, false); 382 nvd0_crtc_set_dither(nv_crtc, false);
382 nvd0_crtc_set_scale(nv_crtc, nv_connector->scaling_mode, false); 383 nvd0_crtc_set_scale(nv_crtc, false);
383 nvd0_crtc_set_image(nv_crtc, crtc->fb, x, y, false); 384 nvd0_crtc_set_image(nv_crtc, crtc->fb, x, y, false);
384 return 0; 385 return 0;
385} 386}