From patchwork Mon Aug 29 15:14:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12958021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7E4BDECAAD2 for ; Mon, 29 Aug 2022 15:15:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B0F1210F39E; Mon, 29 Aug 2022 15:15:13 +0000 (UTC) Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0567510F391 for ; Mon, 29 Aug 2022 15:15:10 +0000 (UTC) Date: Mon, 29 Aug 2022 15:14:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail3; t=1661786107; x=1662045307; bh=e4jUqxUScMtErGJkmkHwID2vhEFdoPxDRA7/lrlBH0U=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:Feedback-ID:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID; b=b5qbTANwPOrd2LL82qV0uM7cRymk942lKa8iXdavt8M/Jf0lDhZ9+3664CmJwbYzV Zc9Mewb0KwFxAweV0nrGZByEF+tOwe55R+QBFO/QqQjy+m7f0vAOE8i2IWhCCJbtm5 73SL4YMXiApAzKHh5ogSPTEZSm7bK3K79YwfZTOMRvKti+JxhvX9vVKSMdjGgNN7om fdXqNAWi+7Wa+Nljw4uE6n0FPEYP1/M7j+bjIjn/g2zMZH0IyvIhRtLUs6dFpSq30L j6ZTSZcB1mLCbKq6yzkF1Wy5xD/XXPzEM+RekUqQyftBLhbQ6kSg2KQPGePdXY6RTu Y9bOJq76OYKsA== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v2 1/3] drm/atomic-helper: print message on driver connector check failure Message-ID: <20220829151451.152114-1-contact@emersion.fr> Feedback-ID: 1358184:user:proton MIME-Version: 1.0 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: Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Sometimes drivers are missing logs when they return EINVAL. Printing the failure here in common code can help understand where EINVAL is coming from. All other atomic_check() calls in this file already have similar logging. v2: add missing newlines Signed-off-by: Simon Ser Cc: Daniel Vetter Cc: Lyude Paul Reviewed-by: Lyude Paul --- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index c6abfd3d4b62..4aa05b626b57 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -702,8 +702,12 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, if (funcs->atomic_check) ret = funcs->atomic_check(connector, state); - if (ret) + if (ret) { + drm_dbg_atomic(dev, + "[CONNECTOR:%d:%s] driver check failed\n", + connector->base.id, connector->name); return ret; + } connectors_mask |= BIT(i); } @@ -745,8 +749,12 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, if (funcs->atomic_check) ret = funcs->atomic_check(connector, state); - if (ret) + if (ret) { + drm_dbg_atomic(dev, + "[CONNECTOR:%d:%s] driver check failed\n", + connector->base.id, connector->name); return ret; + } } /* From patchwork Mon Aug 29 15:15:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12958023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2CAB2ECAAD2 for ; Mon, 29 Aug 2022 15:15:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1808510F3B7; Mon, 29 Aug 2022 15:15:27 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1183410F391 for ; Mon, 29 Aug 2022 15:15:11 +0000 (UTC) Date: Mon, 29 Aug 2022 15:15:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail3; t=1661786108; x=1662045308; bh=8M/nzKdEyABlpDRuxr/NSz0hrQDY0sdw/OAw7Rma17M=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=N4/8WbZYJa+sIHY19Am5RdnLF2sHb+mVR0IKoVNJggYfwjjfTyA7CyIm5CDqkTk7U fBji0aIBNQ9RFOctPXaAxoL+2m4TW4TqWWK6b6VZJ23VaS4rOG7LPJ9Cn+FOj6pe2/ HznArkmMn1HiabNOBKkN6pDhTdR4s56p6BrUEI29AJBKqSheYwyeIOuGrf44xFVFwb zwSIBitSTR1BoB/ZNVIwJ3RY5Mu8leIbWcDWV1l0QS2MSMzwnX+ger0h0P/aPaRKk4 ysJlKLolvft4RAKvx9L6Asql12SzRbIlVaO2hS2W1bFr7pZ6C7hLlnO/e6PlOBn95R HCTRsqmfMOrWQ== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v2 2/3] drm/atomic-helper: log EINVAL cause in drm_atomic_helper_async_check() Message-ID: <20220829151451.152114-2-contact@emersion.fr> In-Reply-To: <20220829151451.152114-1-contact@emersion.fr> References: <20220829151451.152114-1-contact@emersion.fr> Feedback-ID: 1358184:user:proton MIME-Version: 1.0 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: Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This can help figure out why the kernel returns EINVAL from user-space. v2: add missing newlines Signed-off-by: Simon Ser Cc: Daniel Vetter Cc: Lyude Paul --- drivers/gpu/drm/drm_atomic_helper.c | 32 +++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 4aa05b626b57..d36720f419f7 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1796,7 +1796,7 @@ int drm_atomic_helper_async_check(struct drm_device *dev, struct drm_plane_state *old_plane_state = NULL; struct drm_plane_state *new_plane_state = NULL; const struct drm_plane_helper_funcs *funcs; - int i, n_planes = 0; + int i, ret, n_planes = 0; for_each_new_crtc_in_state(state, crtc, crtc_state, i) { if (drm_atomic_crtc_needs_modeset(crtc_state)) @@ -1807,19 +1807,34 @@ int drm_atomic_helper_async_check(struct drm_device *dev, n_planes++; /* FIXME: we support only single plane updates for now */ - if (n_planes != 1) + if (n_planes != 1) { + drm_dbg_atomic(dev, + "only single plane async updates are supported\n"); return -EINVAL; + } if (!new_plane_state->crtc || - old_plane_state->crtc != new_plane_state->crtc) + old_plane_state->crtc != new_plane_state->crtc) { + drm_dbg_atomic(dev, + "[PLANE:%d:%s] async update cannot change CRTC\n", + plane->base.id, plane->name); return -EINVAL; + } funcs = plane->helper_private; - if (!funcs->atomic_async_update) + if (!funcs->atomic_async_update) { + drm_dbg_atomic(dev, + "[PLANE:%d:%s] driver does not support async updates\n", + plane->base.id, plane->name); return -EINVAL; + } - if (new_plane_state->fence) + if (new_plane_state->fence) { + drm_dbg_atomic(dev, + "[PLANE:%d:%s] missing fence for async update\n", + plane->base.id, plane->name); return -EINVAL; + } /* * Don't do an async update if there is an outstanding commit modifying @@ -1834,7 +1849,12 @@ int drm_atomic_helper_async_check(struct drm_device *dev, return -EBUSY; } - return funcs->atomic_async_check(plane, state); + ret = funcs->atomic_async_check(plane, state); + if (ret != 0) + drm_dbg_atomic(dev, + "[PLANE:%d:%s] driver async check failed\n", + plane->base.id, plane->name); + return ret; } EXPORT_SYMBOL(drm_atomic_helper_async_check); From patchwork Mon Aug 29 15:15:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12958022 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BA6BBECAAD5 for ; Mon, 29 Aug 2022 15:15:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D694710F392; Mon, 29 Aug 2022 15:15:26 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB7D210F391 for ; Mon, 29 Aug 2022 15:15:13 +0000 (UTC) Date: Mon, 29 Aug 2022 15:15:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail3; t=1661786112; x=1662045312; bh=EEkAXvkmbHxeai88mh9TxAx4tKP8/BdSF8aQZBkGoLg=; h=Date:To:From:Reply-To:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=LhLEH+X7btfZOwGdoaB0VhYsaVuMkYxGrPvKeegTyB+bTGGnFqGgTLPq24YhCNBZw 67fuKeQjGGHC85rgoVH/RdFsG/uPSAPX9LEqIIZXa5AWtE2YcwOMaGCXJZsmrdPTnI hGFSLK/xYFwcWmJ4M4D2Awl9nS1co704wFQfHac5XY2yXsNb9zxf1ABJ5qcmwBo+DO svhBsoOGX/wf9+XmvqAgzwEAltqS5bF/FwHXIxk1qC4xAtKsxKk0dhADB9PWch9veR F8T1juDC8enyXWNtQw6SFtPSdd+QtAhndAU6ClFXEoLVAeaaUDi97Zb9kUXjszZ4Eb FyoL0s+YW4Jyg== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v2 3/3] drm/bridge: log message on atomic_check() and mode_fixup() failure Message-ID: <20220829151451.152114-3-contact@emersion.fr> In-Reply-To: <20220829151451.152114-1-contact@emersion.fr> References: <20220829151451.152114-1-contact@emersion.fr> Feedback-ID: 1358184:user:proton MIME-Version: 1.0 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 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This helps user-space understand why an atomic commit fails. v2: new patch Signed-off-by: Simon Ser --- drivers/gpu/drm/drm_bridge.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 1545c50fd1c8..c41c728b0c28 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -830,12 +830,26 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, ret = bridge->funcs->atomic_check(bridge, bridge_state, crtc_state, conn_state); - if (ret) + if (ret) { + drm_dbg_atomic(bridge->dev, + "bridge driver check failed for [CRTC:%d:%s] and [CONNECTOR:%d:%s]\n", + crtc_state->crtc->base.id, + crtc_state->crtc->name, + conn_state->connector->base.id, + conn_state->connector->name); return ret; + } } else if (bridge->funcs->mode_fixup) { if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, - &crtc_state->adjusted_mode)) + &crtc_state->adjusted_mode)) { + drm_dbg_atomic(bridge->dev, + "bridge mode fixup failed for [CRTC:%d:%s] and [CONNECTOR:%d:%s]\n", + crtc_state->crtc->base.id, + crtc_state->crtc->name, + conn_state->connector->base.id, + conn_state->connector->name); return -EINVAL; + } } return 0;