From patchwork Wed Jun 3 10:45:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 11585499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2CA3D739 for ; Wed, 3 Jun 2020 10:45:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 004332074B for ; Wed, 3 Jun 2020 10:45:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=emersion.fr header.i=@emersion.fr header.b="bzGO0YzY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 004332074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57D2689CF7; Wed, 3 Jun 2020 10:45:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail2.protonmail.ch (mail2.protonmail.ch [185.70.40.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id 699F089CF7 for ; Wed, 3 Jun 2020 10:45:35 +0000 (UTC) Date: Wed, 03 Jun 2020 10:45:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1591181133; bh=dL0hNzhffG6kkgrQLYFzpVklReEnz35ljoYoEETQJE8=; h=Date:To:From:Cc:Reply-To:Subject:From; b=bzGO0YzYhDbUP02RjsbHEF6ELk/lTg8iKW8kWHVln3Fk6ebstyWo6WcENQmFLiiaM 4mYzpY+SHDBtDW6LwAWYVBiHwG/dOvnypTrAdAX6bXmF1VIRIopeg8G716kqtKlTHu 20ap7A2nXFGQu00aWklP2ArWmJbCLJZ4Abiehla0= To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH] drm/atomic: don't reset link-status to GOOD without ALLOW_MODESET Message-ID: <6Q-O7vKObfRu8cOyvcAxR_uRWgjQdlYgVursTGN2AaHtdaUZICSC6szFjkkDGXhyKF22Grj-aGCTC74OGhtuJ9JChitqvqtCVi1wr_Lnh6Y=@emersion.fr> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mail.protonmail.ch X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Cc: Manasi Navare Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In update_output_state, the link-status property was reset to GOOD to ensure legacy drmModeSetCrtc re-trains the link. However this auto-reset is also performed on an atomic commit without ALLLOW_MODESET. If a driver reads link-status to figure out whether to re-train the link, this could cause an atomic commit failure. User-space doesn't expect such a failure, because commits without ALLOW_MODESET aren't supposed to fail because of link training issues. Change update_output_state to implicitly reset link-status to GOOD only if ALLOW_MODESET is set. This is the case for legacy drmModeSetCrtc because drm_atomic_state_init sets it (and is used in drm_atomic_helper_set_config, called from drm_mode_setcrtc). Drivers don't seem to read link-status at the moment -- they seem to rely on user-space performing a modeset instead. So this shouldn't result in any change in behaviour, this should only prevent future failures if drivers start reading link-status. Signed-off-by: Simon Ser Suggested-by: Pekka Paalanen Cc: Daniel Vetter Cc: Manasi Navare --- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 965173fd0ac2..3d9d9e6f7397 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1426,7 +1426,8 @@ static int update_output_state(struct drm_atomic_state *state, return ret; /* Make sure legacy setCrtc always re-trains */ - new_conn_state->link_status = DRM_LINK_STATUS_GOOD; + if (state->allow_modeset) + new_conn_state->link_status = DRM_LINK_STATUS_GOOD; } }