From patchwork Mon Aug 29 15:01:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12958001 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 D4F8BECAAD5 for ; Mon, 29 Aug 2022 15:01:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 67E9910E478; Mon, 29 Aug 2022 15:01:31 +0000 (UTC) Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 73FAE10E478 for ; Mon, 29 Aug 2022 15:01:27 +0000 (UTC) Date: Mon, 29 Aug 2022 15:01:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail3; t=1661785285; x=1662044485; bh=qTFKahN7lW/aaijvy88ROdjHIXQQ6fz2C8TM0d8qzdU=; 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=RRkPuaDVsHt3ERelhvAkeNdeDt4t949z4PW0zOWB3gIsaJ2rvVkZDsVDWrD092Xre F/THcDV+xzMqhFxbakM28enOhx7mViRAmCgrFWk3AdTMX7DmJZjE7TB10MPPpsd4gR qudpcDrNCjzgFMP1QVtYSRz0WOTM+dNbMUaZHEogDFIh7NfOTJVBI7uMwg/Z0PoIc+ r08D8f/s33K67CO4dusNCuAp89Awhm501xSiR0FPayFdXvXsUwTdP9CFOIFKstzK1Y p3oNWvNqVXK2UI2KK9ATn9bmghGM9VWeixrwyvQtfL0pIWtHXk+IToiiKUfXNyNK0n FYGX3m3BDorhQ== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH 2/2] drm/atomic-helper: log EINVAL cause in drm_atomic_helper_async_check() Message-ID: <20220829150040.125800-2-contact@emersion.fr> In-Reply-To: <20220829150040.125800-1-contact@emersion.fr> References: <20220829150040.125800-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. 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 fbdcca3047f2..63a0e1553408 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", + plane->base.id, plane->name); + return ret; } EXPORT_SYMBOL(drm_atomic_helper_async_check);