From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C860C43215 for ; Fri, 15 Nov 2019 21:07:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3259020692 for ; Fri, 15 Nov 2019 21:07:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Kn/sU9wg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727021AbfKOVHy (ORCPT ); Fri, 15 Nov 2019 16:07:54 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:24056 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726985AbfKOVHx (ORCPT ); Fri, 15 Nov 2019 16:07:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573852072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=99C9DdpWoNeWvAM/k6T9CAEG7JR/+DsOeDA4+LGqn/w=; b=Kn/sU9wgk7IZcn/+qNKFYG/B+PuQl1IcHS8V2dfm21d07tOuE/RJl9AccrokJ66w6GQzbe 1P5piIXH3fyD2Tk4SH5+JhWQLU605J10MUXK5d6lXMTEjUfOjKQ+rFl2D+WfI5dVAQsD10 MIlXCRIvW+gQq08pcIh5MLq4gTwhVUY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-MredWJhJMy6M4kxd31DseA-1; Fri, 15 Nov 2019 16:07:50 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E790800686; Fri, 15 Nov 2019 21:07:46 +0000 (UTC) Received: from malachite.bss.redhat.com (dhcp-10-20-1-11.bss.redhat.com [10.20.1.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id A534169191; Fri, 15 Nov 2019 21:07:43 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org Cc: Ben Skeggs , Daniel Vetter , David Airlie , Jerry Zuo , Harry Wentland , Juston Li , Sean Paul , Laurent Pinchart , stable@vger.kernel.org, David Airlie , Daniel Vetter , Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] drm/nouveau/kms/nv50-: Call outp_atomic_check_view() before handling PBN Date: Fri, 15 Nov 2019 16:07:18 -0500 Message-Id: <20191115210728.3467-2-lyude@redhat.com> In-Reply-To: <20191115210728.3467-1-lyude@redhat.com> References: <20191115210728.3467-1-lyude@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: MredWJhJMy6M4kxd31DseA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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+ --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 44 ++++++++++++++----------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouv= eau/dispnv50/disp.c index 549486f1d937..6327aaf37c08 100644 --- 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_encoder *encoder, =09struct nv50_mstm *mstm =3D mstc->mstm; =09struct nv50_head_atom *asyh =3D nv50_head_atom(crtc_state); =09int slots; +=09int ret; =20 -=09if (crtc_state->mode_changed || crtc_state->connectors_changed) { -=09=09/* -=09=09 * When restoring duplicated states, we need to make sure that -=09=09 * the bw remains the same and avoid recalculating it, as the -=09=09 * connector's bpc may have changed after the state was -=09=09 * duplicated -=09=09 */ -=09=09if (!state->duplicated) { -=09=09=09const int bpp =3D connector->display_info.bpc * 3; -=09=09=09const int clock =3D crtc_state->adjusted_mode.clock; +=09ret =3D nv50_outp_atomic_check_view(encoder, crtc_state, conn_state, +=09=09=09=09=09 mstc->native); +=09if (ret) +=09=09return ret; =20 -=09=09=09asyh->dp.pbn =3D drm_dp_calc_pbn_mode(clock, bpp); -=09=09} +=09if (!crtc_state->mode_changed && !crtc_state->connectors_changed) +=09=09return 0; =20 -=09=09slots =3D drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, -=09=09=09=09=09=09 mstc->port, -=09=09=09=09=09=09 asyh->dp.pbn); -=09=09if (slots < 0) -=09=09=09return slots; +=09/* +=09 * When restoring duplicated states, we need to make sure that the bw +=09 * remains the same and avoid recalculating it, as the connector's bpc +=09 * may have changed after the state was duplicated +=09 */ +=09if (!state->duplicated) { +=09=09const int bpp =3D connector->display_info.bpc * 3; +=09=09const int clock =3D crtc_state->adjusted_mode.clock; =20 -=09=09asyh->dp.tu =3D slots; +=09=09asyh->dp.pbn =3D drm_dp_calc_pbn_mode(clock, bpp); =09} =20 -=09return nv50_outp_atomic_check_view(encoder, crtc_state, conn_state, -=09=09=09=09=09 mstc->native); +=09slots =3D drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, mstc->port, +=09=09=09=09=09 asyh->dp.pbn); +=09if (slots < 0) +=09=09return slots; + +=09asyh->dp.tu =3D slots; + +=09return 0; } =20 static void --=20 2.21.0