Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2282676ybl; Thu, 19 Dec 2019 10:59:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxrcfuxq/NIvqnY5PwPoioFa3LlmyTFta6PNY+vGMeK1Wq3umnvkbqKEka/QBntTVxm20VB X-Received: by 2002:a9d:3a65:: with SMTP id j92mr9967024otc.37.1576781942697; Thu, 19 Dec 2019 10:59:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576781942; cv=none; d=google.com; s=arc-20160816; b=IvRoHdDwkq6aCJDxCDQ4a1jsWDaqW45EgHx04ab8jhGPN9uL5U3ZTr5D0qAQIVUT9C XO3+CDWzM6kDCHvnEk4N1rxRI50boFXWS8tmzYQ3Je3t8H5b+AQ+k64ZnXDGmwTrzSPP +Gd5qs3giGvpNCMRu4WaebH1ktai56cX3UqiyzDovyLat5DaLYhN425myrMAuUeKr4F1 dqlV8WGAjUiji9QUvxk325YzqQ/3w41FraZamePLJcVNXVbvCsV9496j34fP61vDpaHY Czd8Eb1IV/cwM4X3BpkVxI+KHDCkGSCPcqnFU1Qa2/T3ZwR413CIEX9plUbv+NTp2OKD MxBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zhCpRY1ubuPvJfA0oDcw1v+SemFna8x3s5kwqLBvLrk=; b=fE0yAjT9J6DbjKvyqp81dkms0FG1RHyKlZ4TofabPOU+Fwv3AycAdMYN/ISvxck5lw GZ//R6OzATRXfiGO/lLz8SDZGWMuHTf1BVZuqBc48kfZfWjdPSkf49piuV4aeRegCE7d PoGhgwC6poR6vLOeo0JvaOFgMFoA4FWRueao6r/hf+84kfLSLNpv38DAvlEx2f4kQ4oi 2Wa8ildokEJkkg1RSa6fBcR3QPKAZWm2aLJcyHE69Q3XHzFx99KfyzPJaOiwnPFw/0If bKfe1DQbCIw1NWfazFn+9U8LTYD5n781ACGAHo8Ffc6ZpQ9jUYtC+xBNxzKfjYS9OvZL /E4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nYOeoM1+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o2si3597394oig.41.2019.12.19.10.58.51; Thu, 19 Dec 2019 10:59:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nYOeoM1+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730627AbfLSS5g (ORCPT + 99 others); Thu, 19 Dec 2019 13:57:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:52166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730744AbfLSSzz (ORCPT ); Thu, 19 Dec 2019 13:55:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 880EC2468C; Thu, 19 Dec 2019 18:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781755; bh=DgQmfFODGhLO7JQvXewluc2BUtibznHL8k9J2ESLWmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nYOeoM1+F8Bi0gJ6fhDlWi/6b2hjXuqhEQkYlo9CG7Bujdwjq4V4bCv3eEOvE3opG Ck0zSzn5o9/1Kyykg/Z6lx3fnbeUN1tTE9KQGAlrIpttg1IZ29BwppzAss4XwfBaQN fGt3aAyK1C/7dbLboe9MOW450RHwOj20cWXq5cXc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Ben Skeggs , Daniel Vetter , David Airlie , Jerry Zuo , Harry Wentland , Juston Li , Sean Paul , Laurent Pinchart Subject: [PATCH 5.4 66/80] drm/nouveau/kms/nv50-: Call outp_atomic_check_view() before handling PBN Date: Thu, 19 Dec 2019 19:34:58 +0100 Message-Id: <20191219183137.703692301@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183031.278083125@linuxfoundation.org> References: <20191219183031.278083125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lyude Paul commit 310d35771ee9040f5744109fc277206ad96ba253 upstream. Since nv50_outp_atomic_check_view() can set crtc_state->mode_changed, we probably should be calling it before handling any PBN changes. Just a precaution. Signed-off-by: Lyude Paul Fixes: 232c9eec417a ("drm/nouveau: Use atomic VCPI helpers for MST") Cc: Ben Skeggs Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li Cc: Sean Paul Cc: Laurent Pinchart Cc: # v5.1+ Signed-off-by: Ben Skeggs Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 48 +++++++++++++++++--------------- 1 file changed, 26 insertions(+), 22 deletions(-) --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -770,32 +770,36 @@ nv50_msto_atomic_check(struct drm_encode struct nv50_mstm *mstm = mstc->mstm; struct nv50_head_atom *asyh = nv50_head_atom(crtc_state); int slots; + int ret; - if (crtc_state->mode_changed || crtc_state->connectors_changed) { - /* - * When restoring duplicated states, we need to make sure that - * the bw remains the same and avoid recalculating it, as the - * connector's bpc may have changed after the state was - * duplicated - */ - if (!state->duplicated) { - const int bpp = connector->display_info.bpc * 3; - const int clock = crtc_state->adjusted_mode.clock; - - asyh->dp.pbn = drm_dp_calc_pbn_mode(clock, bpp); - } - - slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, - mstc->port, - asyh->dp.pbn); - if (slots < 0) - return slots; + ret = nv50_outp_atomic_check_view(encoder, crtc_state, conn_state, + mstc->native); + if (ret) + return ret; + + if (!crtc_state->mode_changed && !crtc_state->connectors_changed) + return 0; + + /* + * When restoring duplicated states, we need to make sure that the bw + * remains the same and avoid recalculating it, as the connector's bpc + * may have changed after the state was duplicated + */ + if (!state->duplicated) { + const int bpp = connector->display_info.bpc * 3; + const int clock = crtc_state->adjusted_mode.clock; - asyh->dp.tu = slots; + asyh->dp.pbn = drm_dp_calc_pbn_mode(clock, bpp); } - return nv50_outp_atomic_check_view(encoder, crtc_state, conn_state, - mstc->native); + slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, mstc->port, + asyh->dp.pbn); + if (slots < 0) + return slots; + + asyh->dp.tu = slots; + + return 0; } static void