Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3201849pxb; Mon, 9 Nov 2020 05:29:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJww51JZYm4cZflkPD1xEztrfqWsuPSEgAm3iuAsCJ7mitu4/DirMslMHkO0pmzhKLatYZ59 X-Received: by 2002:a17:907:2175:: with SMTP id rl21mr14876763ejb.59.1604928556673; Mon, 09 Nov 2020 05:29:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928556; cv=none; d=google.com; s=arc-20160816; b=DpBfe5MTpbzEneZfSOaBRB/RMMbJrANxVehex1TnkP9IR3967p4rm4/1Lm/BIHNPnJ S+DRhgQ0+s9ZUNcn4AJCsPxhABlvITXfsMyQykfNFCy/y5xhp0oKRJXV0s0wQzYRGraU iQwn1KRalE6cpC0Lt1Zi6GGxIStsntWt6ZTLFrH/8QJJyxpqJaydjXhP8Yqn+HL7Se4t Ux3PvdAvsm/+wR3i6IiJaaJRfsBQfnYcxS96Hj5LTRD1cbzBTNLVVLt7E0j2wIUN8kIZ mMrXqdp41EoL421Of28I0o+N5+8TCpil2K98gUfsq6kdMHqwHvmozAj6CqP/lFJyR2TM Jksw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+Ic0apIavXIp8owYWxAfgXQl3RYVzLfA1+TyFAb9pHU=; b=DVl56Qu3UHu+4pdUe5G19K/pyGFGZDmHRELNbB5FFXzyX6OHy5jUm9pQJ64ROVgUqr TVPQvdWh+BmyTn680jtkZVdnxik4MXsRdNhMoweeWVOTcnbR2i8WwjMdomet6OQvZSY4 9w8JLbnJuxgQpi4tPh787FvvoUJbSf/ha9KazrrSIMpLNZ+CU4wUVvdIHMOWfBuv0rs4 T/zpk3SohrCBsFUL/QtYnwNkfVMpZ9SP/O8RGIfwxbpwiCBkS8iHQaaVI744eX2dL2Dy oCgORQi4BQKAXIZ4rXWwgYAKypnBwFNhRovQYasH9LLsWkUI0ZMuNKIQfkp0810YpKHK WoiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vVcebLvN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si7428478edn.236.2020.11.09.05.28.54; Mon, 09 Nov 2020 05:29:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vVcebLvN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729931AbgKINRg (ORCPT + 99 others); Mon, 9 Nov 2020 08:17:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:44702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387600AbgKINRb (ORCPT ); Mon, 9 Nov 2020 08:17:31 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 279A1206D8; Mon, 9 Nov 2020 13:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927850; bh=k+ciKGmdAaWHmNFCpirppe+yWEkX+BhcNsI0sA/QUvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vVcebLvNIntlg6M6CMnMYYZ9LyDEBRpXVmmgoGM836Ji4rvTLVCU6am8F3eF5TGnG OoV1Dp7XOcC78XQ/zuvCcfj6xcXuu0aOIHfPt+L4J1IorrrlcMWBL+xoNahMRSpAbq ZGCImh0UXM41EdNGWenjPR9v5J9gFBzqJGvrBhXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Ben Skeggs Subject: [PATCH 5.9 043/133] drm/nouveau/kms/nv50-: Get rid of bogus nouveau_conn_mode_valid() Date: Mon, 9 Nov 2020 13:55:05 +0100 Message-Id: <20201109125032.780880244@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125030.706496283@linuxfoundation.org> References: <20201109125030.706496283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lyude Paul commit 2d831155cf0607566e43d8465da33774b2dc7221 upstream. Ville also pointed out that I got a lot of the logic here wrong as well, whoops. While I don't think anyone's likely using 3D output with nouveau, the next patch will make nouveau_conn_mode_valid() make a lot less sense. So, let's just get rid of it and open-code it like before, while taking care to move the 3D frame packing calculations on the dot clock into the right place. Signed-off-by: Lyude Paul Fixes: d6a9efece724 ("drm/nouveau/kms/nv50-: Share DP SST mode_valid() handling with MST") Cc: Ville Syrjälä Cc: # v5.8+ Signed-off-by: Ben Skeggs Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_connector.c | 36 +++++++--------------------- drivers/gpu/drm/nouveau/nouveau_dp.c | 15 +++++++---- 2 files changed, 20 insertions(+), 31 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -1035,29 +1035,6 @@ get_tmds_link_bandwidth(struct drm_conne return 112000 * duallink_scale; } -enum drm_mode_status -nouveau_conn_mode_clock_valid(const struct drm_display_mode *mode, - const unsigned min_clock, - const unsigned max_clock, - unsigned int *clock_out) -{ - unsigned int clock = mode->clock; - - if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == - DRM_MODE_FLAG_3D_FRAME_PACKING) - clock *= 2; - - if (clock < min_clock) - return MODE_CLOCK_LOW; - if (clock > max_clock) - return MODE_CLOCK_HIGH; - - if (clock_out) - *clock_out = clock; - - return MODE_OK; -} - static enum drm_mode_status nouveau_connector_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) @@ -1065,7 +1042,7 @@ nouveau_connector_mode_valid(struct drm_ struct nouveau_connector *nv_connector = nouveau_connector(connector); struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; struct drm_encoder *encoder = to_drm_encoder(nv_encoder); - unsigned min_clock = 25000, max_clock = min_clock; + unsigned int min_clock = 25000, max_clock = min_clock, clock = mode->clock; switch (nv_encoder->dcb->type) { case DCB_OUTPUT_LVDS: @@ -1094,8 +1071,15 @@ nouveau_connector_mode_valid(struct drm_ return MODE_BAD; } - return nouveau_conn_mode_clock_valid(mode, min_clock, max_clock, - NULL); + if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING) + clock *= 2; + + if (clock < min_clock) + return MODE_CLOCK_LOW; + if (clock > max_clock) + return MODE_CLOCK_HIGH; + + return MODE_OK; } static struct drm_encoder * --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c @@ -114,18 +114,23 @@ nv50_dp_mode_valid(struct drm_connector unsigned *out_clock) { const unsigned min_clock = 25000; - unsigned max_clock, clock; - enum drm_mode_status ret; + unsigned max_clock, clock = mode->clock; if (mode->flags & DRM_MODE_FLAG_INTERLACE && !outp->caps.dp_interlace) return MODE_NO_INTERLACE; + if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING) + clock *= 2; + max_clock = outp->dp.link_nr * outp->dp.link_bw; clock = mode->clock * (connector->display_info.bpc * 3) / 10; + if (clock < min_clock) + return MODE_CLOCK_LOW; + if (clock > max_clock) + return MODE_CLOCK_HIGH; - ret = nouveau_conn_mode_clock_valid(mode, min_clock, max_clock, - &clock); if (out_clock) *out_clock = clock; - return ret; + + return MODE_OK; }