[PATCH v2 4/4] drm/nouveau: Switch to the generic underscan props

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that underscan props can be parsed by the core and assigned to
conn_state->underscan.xxx, we can rely on this implementation and get
rid of the nouveau-specific underscan props.

Signed-off-by: Boris Brezillon <boris.brezillon at bootlin.com>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 39 +++++------------------------
 drivers/gpu/drm/nouveau/nouveau_connector.h |  9 -------
 drivers/gpu/drm/nouveau/nouveau_display.c   | 14 -----------
 drivers/gpu/drm/nouveau/nouveau_display.h   |  3 ---
 drivers/gpu/drm/nouveau/nv50_display.c      | 17 +++++++++----
 5 files changed, 18 insertions(+), 64 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 6ed9cb053dfa..0ce055d3b89e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -105,12 +105,6 @@ nouveau_conn_atomic_get_property(struct drm_connector *connector,
 
 	if (property == dev->mode_config.scaling_mode_property)
 		*val = asyc->scaler.mode;
-	else if (property == disp->underscan_property)
-		*val = asyc->scaler.underscan.mode;
-	else if (property == disp->underscan_hborder_property)
-		*val = asyc->scaler.underscan.hborder;
-	else if (property == disp->underscan_vborder_property)
-		*val = asyc->scaler.underscan.vborder;
 	else if (property == disp->dithering_mode)
 		*val = asyc->dither.mode;
 	else if (property == disp->dithering_depth)
@@ -170,24 +164,6 @@ nouveau_conn_atomic_set_property(struct drm_connector *connector,
 			asyc->set.scaler = true;
 		}
 	} else
-	if (property == disp->underscan_property) {
-		if (asyc->scaler.underscan.mode != val) {
-			asyc->scaler.underscan.mode = val;
-			asyc->set.scaler = true;
-		}
-	} else
-	if (property == disp->underscan_hborder_property) {
-		if (asyc->scaler.underscan.hborder != val) {
-			asyc->scaler.underscan.hborder = val;
-			asyc->set.scaler = true;
-		}
-	} else
-	if (property == disp->underscan_vborder_property) {
-		if (asyc->scaler.underscan.vborder != val) {
-			asyc->scaler.underscan.vborder = val;
-			asyc->set.scaler = true;
-		}
-	} else
 	if (property == disp->dithering_mode) {
 		if (asyc->dither.mode != val) {
 			asyc->dither.mode = val;
@@ -256,7 +232,6 @@ nouveau_conn_reset(struct drm_connector *connector)
 	asyc->dither.mode = DITHERING_MODE_AUTO;
 	asyc->dither.depth = DITHERING_DEPTH_AUTO;
 	asyc->scaler.mode = DRM_MODE_SCALE_NONE;
-	asyc->scaler.underscan.mode = UNDERSCAN_OFF;
 	asyc->procamp.color_vibrance = 150;
 	asyc->procamp.vibrant_hue = 90;
 
@@ -285,18 +260,16 @@ nouveau_conn_attach_properties(struct drm_connector *connector)
 					   dvi_i_subconnector_property, 0);
 
 	/* Add overscan compensation options to digital outputs. */
-	if (disp->underscan_property &&
+	if (disp->disp.oclass >= NV50_DISP &&
 	    (connector->connector_type == DRM_MODE_CONNECTOR_DVID ||
 	     connector->connector_type == DRM_MODE_CONNECTOR_DVII ||
 	     connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
 	     connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)) {
-		drm_object_attach_property(&connector->base,
-					   disp->underscan_property,
-					   UNDERSCAN_OFF);
-		drm_object_attach_property(&connector->base,
-					   disp->underscan_hborder_property, 0);
-		drm_object_attach_property(&connector->base,
-					   disp->underscan_vborder_property, 0);
+		WARN_ON(drm_connector_attach_underscan_properties(connector,
+						BIT(DRM_UNDERSCAN_OFF) |
+						BIT(DRM_UNDERSCAN_ON) |
+						BIT(DRM_UNDERSCAN_AUTO),
+						128, 128));
 	}
 
 	/* Add hue and saturation options. */
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h
index a4d1a059bd3d..1d3ec65288e1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.h
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.h
@@ -111,15 +111,6 @@ struct nouveau_conn_atom {
 
 	struct {
 		int mode;	/* DRM_MODE_SCALE_* */
-		struct {
-			enum {
-				UNDERSCAN_OFF,
-				UNDERSCAN_ON,
-				UNDERSCAN_AUTO,
-			} mode;
-			u32 hborder;
-			u32 vborder;
-		} underscan;
 		bool full;
 	} scaler;
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 7d0bec8dd03d..002c2b13571b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -303,13 +303,6 @@ struct nouveau_drm_prop_enum_list {
 	char *name;
 };
 
-static struct nouveau_drm_prop_enum_list underscan[] = {
-	{ 6, UNDERSCAN_AUTO, "auto" },
-	{ 6, UNDERSCAN_OFF, "off" },
-	{ 6, UNDERSCAN_ON, "on" },
-	{}
-};
-
 static struct nouveau_drm_prop_enum_list dither_mode[] = {
 	{ 7, DITHERING_MODE_AUTO, "auto" },
 	{ 7, DITHERING_MODE_OFF, "off" },
@@ -464,13 +457,6 @@ nouveau_display_create_properties(struct drm_device *dev)
 
 	PROP_ENUM(disp->dithering_mode, gen, "dithering mode", dither_mode);
 	PROP_ENUM(disp->dithering_depth, gen, "dithering depth", dither_depth);
-	PROP_ENUM(disp->underscan_property, gen, "underscan", underscan);
-
-	disp->underscan_hborder_property =
-		drm_property_create_range(dev, 0, "underscan hborder", 0, 128);
-
-	disp->underscan_vborder_property =
-		drm_property_create_range(dev, 0, "underscan vborder", 0, 128);
 
 	if (gen < 1)
 		return;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 270ba56f2756..df2f57d72fa9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -42,9 +42,6 @@ struct nouveau_display {
 
 	struct drm_property *dithering_mode;
 	struct drm_property *dithering_depth;
-	struct drm_property *underscan_property;
-	struct drm_property *underscan_hborder_property;
-	struct drm_property *underscan_vborder_property;
 	/* not really hue and saturation: */
 	struct drm_property *vibrant_hue_property;
 	struct drm_property *color_vibrance_property;
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 8bd739cfd00d..7c7dbf3bd3a0 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -2057,11 +2057,11 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh,
 	 * ratio the same as the backend mode unless overridden by the
 	 * user setting both hborder and vborder properties.
 	 */
-	if ((asyc->scaler.underscan.mode == UNDERSCAN_ON ||
-	    (asyc->scaler.underscan.mode == UNDERSCAN_AUTO &&
+	if ((asyc->state.underscan.mode == DRM_UNDERSCAN_ON ||
+	    (asyc->state.underscan.mode == DRM_UNDERSCAN_AUTO &&
 	     drm_detect_hdmi_monitor(edid)))) {
-		u32 bX = asyc->scaler.underscan.hborder;
-		u32 bY = asyc->scaler.underscan.vborder;
+		u32 bX = asyc->state.underscan.hborder;
+		u32 bY = asyc->state.underscan.vborder;
 		u32 r = (asyh->view.oH << 19) / asyh->view.oW;
 
 		if (bX) {
@@ -2185,8 +2185,8 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
 	struct nv50_head *head = nv50_head(crtc);
 	struct nv50_head_atom *armh = nv50_head_atom(crtc->state);
 	struct nv50_head_atom *asyh = nv50_head_atom(state);
+	struct drm_connector_state *conns, *oldconns;
 	struct nouveau_conn_atom *asyc = NULL;
-	struct drm_connector_state *conns;
 	struct drm_connector *conn;
 	int i;
 
@@ -2199,6 +2199,13 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
 			}
 		}
 
+		for_each_oldnew_connector_in_state(asyh->state.state, conn,
+						   oldconns, conns, i) {
+			if (memcmp(&oldconns->underscan, &conns->underscan,
+				   sizeof(conns->underscan)))
+				asyc->set.scaler = true;
+		}
+
 		if (armh->state.active) {
 			if (asyc) {
 				if (asyh->state.mode_changed)
-- 
2.14.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux