dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
To: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: "David (ChunMing) Zhou"
	<David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
	"Boris Brezillon"
	<boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Eric Anholt" <eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>,
	"Ben Skeggs" <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Alex Deucher" <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH v2 4/4] drm/nouveau: Switch to the generic underscan props
Date: Fri, 11 May 2018 16:59:19 +0200	[thread overview]
Message-ID: <20180511145919.22447-5-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20180511145919.22447-1-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>

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@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

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2018-05-11 14:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11 14:59 [PATCH v2 0/4] drm/connector: Provide generic support for underscan Boris Brezillon
     [not found] ` <20180511145919.22447-1-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-05-11 14:59   ` [PATCH v2 1/4] drm/connector: Add generic underscan properties Boris Brezillon
2018-05-11 14:59   ` [PATCH v2 2/4] drm/vc4: Take underscan setup into account when updating planes Boris Brezillon
     [not found]     ` <20180511145919.22447-3-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-05-11 15:34       ` Ville Syrjälä
     [not found]         ` <20180511153450.GS23723-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-05-11 15:52           ` Boris Brezillon
2018-05-11 16:54             ` Ville Syrjälä
     [not found]               ` <20180511165402.GU23723-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-05-11 17:12                 ` Boris Brezillon
2018-05-11 17:29                   ` Ville Syrjälä
     [not found]                     ` <20180511172948.GV23723-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-05-11 19:47                       ` Boris Brezillon
2018-05-11 20:46                         ` Ville Syrjälä
     [not found]                           ` <20180511204643.GW23723-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-05-14  7:05                             ` Eric Anholt
2018-05-11 20:11                       ` Eric Anholt
2018-05-11 14:59   ` Boris Brezillon [this message]
2018-05-11 14:59 ` [PATCH v2 3/4] drm/vc4: Attach underscan props to the HDMI connector Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180511145919.22447-5-boris.brezillon@bootlin.com \
    --to=boris.brezillon-ldxbnhwyfcjbdgjk7y7tuq@public.gmane.org \
    --cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=daniel-/w4YWyX8dFk@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox