From patchwork Fri May 11 14:59:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 10394565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CAE9460236 for ; Fri, 11 May 2018 15:00:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9FFE28EAB for ; Fri, 11 May 2018 15:00:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC24B28EB2; Fri, 11 May 2018 15:00:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0D15828EAB for ; Fri, 11 May 2018 15:00:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E13D96F1B4; Fri, 11 May 2018 14:59:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 587C06F0DF; Fri, 11 May 2018 14:59:25 +0000 (UTC) Received: by mail.bootlin.com (Postfix, from userid 110) id 93D2B20896; Fri, 11 May 2018 16:59:23 +0200 (CEST) Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 35CB2203B0; Fri, 11 May 2018 16:59:23 +0200 (CEST) From: Boris Brezillon To: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v2 4/4] drm/nouveau: Switch to the generic underscan props Date: Fri, 11 May 2018 16:59:19 +0200 Message-Id: <20180511145919.22447-5-boris.brezillon@bootlin.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180511145919.22447-1-boris.brezillon@bootlin.com> References: <20180511145919.22447-1-boris.brezillon@bootlin.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Ben Skeggs , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)