From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C02B9381EB0 for ; Tue, 18 Aug 2026 23:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787097435; cv=none; b=MI/Nvl6o898NNzdOWGG78KY2Iorbdgf7pisYe0ufIpJRQS6jqQGeRiJDxfSZ3KaedhXnwr8W3+VAoGd7lceLVoj8OnCpoLeOKnf93esZTfqkC+z2TuoMHMn0UxIziWtv3SU/5p9IhgUtbLSGH0Pj85m+s51/080RycEGnhgv94o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787097435; c=relaxed/simple; bh=CCLYtguIp7aFmld18f3Sh0cOqkHOeVpid7iacpuj2RE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N9SRXBaipTPcogWRvjlAnikjIwRHVgOwjvjw+phj7ClnuctKN1dbEJ+wm/6/n1ZYuE7M+ilnaN0LYoqoAjxYsae6rcSGBnN4Nno5GJgCfZNdYHdB7TQTM2pPfElyvxcRkws62/z/AGBPGa5UQGEgwPVthVOkTUJfxzu0StBZw4U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PcbR1N3c; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PcbR1N3c" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787097432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pz0aXgFMqOpBVjMIOtdMICeTUjk8ldXgSQBenL20dmc=; b=PcbR1N3chSZMoqPJ39liELPBQRSrhGDdtZ+PV/XwX6JJpa7fScher951izZbPiEWc17HA0 N8vtQCMv7tTHE1rhT1g+QAdaE9gKvgYDTQ3NSZAenOpPo6V7BqkOIBCIRQCZPR2mNZgXmM 2XC+ZX4PRoT9i0h1xKBynUalyCdNzkc= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-1-H0UBxphkPlK_ZrnM_2TM5w-1; Tue, 18 Aug 2026 19:57:06 -0400 X-MC-Unique: H0UBxphkPlK_ZrnM_2TM5w-1 X-Mimecast-MFC-AGG-ID: H0UBxphkPlK_ZrnM_2TM5w_1787097424 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6D881180049D; Tue, 18 Aug 2026 23:57:03 +0000 (UTC) Received: from GoldenWind.lan (unknown [10.22.80.100]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7B68D1800347; Tue, 18 Aug 2026 23:57:00 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, Marek Czernohous Cc: Marek Czernohous , stable@vger.kernel.org, "Faith Ekstrand" , "Dave Airlie" , "Maarten Lankhorst" , "Luca Ceresoli" , "Kees Cook" , "Marco Crivellari" , "Simona Vetter" , "Ben Skeggs" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "James Jones" , "Lyude Paul" Subject: [PATCH 3/6] drm/nouveau/kms/nv50-: Stop using nv_encoder->crtc in nv50_sor_atomic_disable() Date: Tue, 18 Aug 2026 19:48:45 -0400 Message-ID: <20260818235637.1738055-4-lyude@redhat.com> In-Reply-To: <20260818235637.1738055-1-lyude@redhat.com> References: <20260818235637.1738055-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 This is a leftover CRTC bookkeeping variable from the pre-atomic days. While it works in most situations, it's prone to breaking - as pointed out by Marek Czernohous. Signed-off-by: Lyude Paul Reported-by: Marek Czernohous Fixes: f575f2bdb6c3 ("drm/nouveau/kms/nv50-: Remove (nv_encoder->crtc) checks in ->disable callbacks") Cc: # v5.12+ --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index 152361f7feb42..f19820dc055ae 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -459,7 +459,7 @@ nv50_outp_get_old_connector(struct drm_atomic_commit *state, struct nouveau_enco return NULL; } -static struct nouveau_crtc * __maybe_unused +static struct nouveau_crtc * nv50_outp_get_old_crtc(const struct drm_atomic_commit *state, const struct nouveau_encoder *outp) { struct drm_crtc *crtc; @@ -1606,12 +1606,18 @@ static void nv50_sor_atomic_disable(struct drm_encoder *encoder, struct drm_atomic_commit *state) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); - struct nv50_head *head = nv50_head(nv_encoder->crtc); + struct nouveau_crtc *nv_crtc; + struct nv50_head *head; #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT nv50_sor_atomic_disable_backlight(nouveau_drm(state->dev), nv_encoder, state); #endif + nv_crtc = nv50_outp_get_old_crtc(state, nv_encoder); + if (drm_WARN_ON(state->dev, !nv_crtc)) + return; + head = nv50_head(&nv_crtc->base); + if (nv_encoder->dcb->type == DCB_OUTPUT_TMDS && nv_encoder->hdmi.enabled) { nvif_outp_hdmi(&nv_encoder->outp, head->base.index, false, 0, 0, 0, false, false, false); -- 2.55.0