drm/nouveau: no need to pass parameters into set_scale/dither
authorBen Skeggs <bskeggs@redhat.com>
Mon, 17 Oct 2011 00:38:10 +0000 (10:38 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 21 Dec 2011 09:01:20 +0000 (19:01 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_connector.c
drivers/gpu/drm/nouveau/nouveau_crtc.h
drivers/gpu/drm/nouveau/nv50_crtc.c
drivers/gpu/drm/nouveau/nvd0_display.c

index fc42ea8503cb2b6e9b2828231b49adb63da3e9f1..372955ddc5914b26f23c0804d2c1262eb95220aa 100644 (file)
@@ -471,7 +471,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
                        if (!ret)
                                return -EINVAL;
                } else {
-                       ret = nv_crtc->set_scale(nv_crtc, value, true);
+                       ret = nv_crtc->set_scale(nv_crtc, true);
                        if (ret)
                                return ret;
                }
@@ -486,9 +486,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
                        if (!nv_crtc || !nv_crtc->set_scale)
                                return 0;
 
-                       return nv_crtc->set_scale(nv_crtc,
-                                                 nv_connector->scaling_mode,
-                                                 true);
+                       return nv_crtc->set_scale(nv_crtc, true);
                }
 
                return 0;
@@ -500,9 +498,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
                        if (!nv_crtc || !nv_crtc->set_scale)
                                return 0;
 
-                       return nv_crtc->set_scale(nv_crtc,
-                                                 nv_connector->scaling_mode,
-                                                 true);
+                       return nv_crtc->set_scale(nv_crtc, true);
                }
 
                return 0;
@@ -514,9 +510,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
                        if (!nv_crtc || !nv_crtc->set_scale)
                                return 0;
 
-                       return nv_crtc->set_scale(nv_crtc,
-                                                 nv_connector->scaling_mode,
-                                                 true);
+                       return nv_crtc->set_scale(nv_crtc, true);
                }
 
                return 0;
@@ -532,8 +526,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
                if (!nv_crtc || !nv_crtc->set_dither)
                        return 0;
 
-               return nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering,
-                                          true);
+               return nv_crtc->set_dither(nv_crtc, true);
        }
 
        if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV)
index bf8e1289953de6550293252087d7de52018b6a10..b9b1980b5d8c8436a29cf73cbcc5afb7341c21d3 100644 (file)
@@ -67,8 +67,8 @@ struct nouveau_crtc {
                int depth;
        } lut;
 
-       int (*set_dither)(struct nouveau_crtc *crtc, bool on, bool update);
-       int (*set_scale)(struct nouveau_crtc *crtc, int mode, bool update);
+       int (*set_dither)(struct nouveau_crtc *crtc, bool update);
+       int (*set_scale)(struct nouveau_crtc *crtc, bool update);
 };
 
 static inline struct nouveau_crtc *nouveau_crtc(struct drm_crtc *crtc)
index c1c57cb3720854bc95cac5e30871ba20d3febf85..70d7fbb43cf68033b38b9be3431d711ae637fb9b 100644 (file)
@@ -132,10 +132,12 @@ nv50_crtc_blank(struct nouveau_crtc *nv_crtc, bool blanked)
 }
 
 static int
-nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update)
+nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool update)
 {
        struct drm_device *dev = nv_crtc->base.dev;
        struct nouveau_channel *evo = nv50_display(dev)->master;
+       struct nouveau_connector *nv_connector =
+               nouveau_crtc_connector_get(nv_crtc);
        int ret;
 
        NV_DEBUG_KMS(dev, "\n");
@@ -147,7 +149,7 @@ nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update)
        }
 
        BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, DITHER_CTRL), 1);
-       if (on)
+       if (nv_connector->use_dithering)
                OUT_RING(evo, NV50_EVO_CRTC_DITHER_CTRL_ON);
        else
                OUT_RING(evo, NV50_EVO_CRTC_DITHER_CTRL_OFF);
@@ -180,15 +182,15 @@ nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc)
 }
 
 static int
-nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, int scaling_mode, bool update)
+nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update)
 {
        struct nouveau_connector *nv_connector;
        struct drm_crtc *crtc = &nv_crtc->base;
        struct drm_device *dev = crtc->dev;
        struct nouveau_channel *evo = nv50_display(dev)->master;
        struct drm_display_mode *mode = &crtc->mode;
+       int scaling_mode, ret;
        u32 ctrl = 0, oX, oY;
-       int ret;
 
        NV_DEBUG_KMS(dev, "\n");
 
@@ -196,6 +198,8 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, int scaling_mode, bool update)
        if (!nv_connector || !nv_connector->native_mode) {
                NV_ERROR(dev, "no native mode, forcing panel scaling\n");
                scaling_mode = DRM_MODE_SCALE_NONE;
+       } else {
+               scaling_mode = nv_connector->scaling_mode;
        }
 
        /* 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,
        BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, SCALE_CENTER_OFFSET), 1);
        OUT_RING(evo, NV50_EVO_CRTC_SCALE_CENTER_OFFSET_VAL(0, 0));
 
-       nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering, false);
-       nv_crtc->set_scale(nv_crtc, nv_connector->scaling_mode, false);
+       nv_crtc->set_dither(nv_crtc, false);
+       nv_crtc->set_scale(nv_crtc, false);
 
        return nv50_crtc_do_mode_set_base(crtc, old_fb, x, y, false);
 }
index cb006a718e700f2c72cf06dfdac0c7f22e8cbdac..9e96eb12133a40c4ae70e8414474f5e6b496c564 100644 (file)
@@ -107,13 +107,14 @@ nvd0_display_crtc_get(struct drm_encoder *encoder)
  * CRTC
  *****************************************************************************/
 static int
-nvd0_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update)
+nvd0_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool update)
 {
+       struct nouveau_connector *nv_connector;
        struct drm_device *dev = nv_crtc->base.dev;
-       u32 *push, mode;
+       u32 *push, mode = 0;
 
-       mode = 0x00000000;
-       if (on) {
+       nv_connector = nouveau_crtc_connector_get(nv_crtc);
+       if (nv_connector->use_dithering) {
                /* 0x11: 6bpc dynamic 2x2
                 * 0x13: 8bpc dynamic 2x2
                 * 0x19: 6bpc static 2x2
@@ -139,7 +140,7 @@ nvd0_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update)
 }
 
 static int
-nvd0_crtc_set_scale(struct nouveau_crtc *nv_crtc, int type, bool update)
+nvd0_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update)
 {
        struct drm_display_mode *mode = &nv_crtc->base.mode;
        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)
                u32 xratio = (native->hdisplay << 19) / mode->hdisplay;
                u32 yratio = (native->vdisplay << 19) / mode->vdisplay;
 
-               switch (type) {
+               switch (nv_connector->scaling_mode) {
                case DRM_MODE_SCALE_ASPECT:
                        if (xratio > yratio) {
                                outX = (mode->hdisplay * yratio) >> 19;
@@ -378,8 +379,8 @@ nvd0_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode,
        }
 
        nv_connector = nouveau_crtc_connector_get(nv_crtc);
-       nvd0_crtc_set_dither(nv_crtc, nv_connector->use_dithering, false);
-       nvd0_crtc_set_scale(nv_crtc, nv_connector->scaling_mode, false);
+       nvd0_crtc_set_dither(nv_crtc, false);
+       nvd0_crtc_set_scale(nv_crtc, false);
        nvd0_crtc_set_image(nv_crtc, crtc->fb, x, y, false);
        return 0;
 }