From patchwork Wed Nov 11 09:07:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 11896989 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=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 24B46C388F9 for ; Wed, 11 Nov 2020 09:07:55 +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 F182C206F1 for ; Wed, 11 Nov 2020 09:07:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F182C206F1 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 5ABFB89FD3; Wed, 11 Nov 2020 09:07:53 +0000 (UTC) Received: from mail-40136.protonmail.ch (mail-40136.protonmail.ch [185.70.40.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 506BA89FD3 for ; Wed, 11 Nov 2020 09:07:51 +0000 (UTC) Date: Wed, 11 Nov 2020 09:07:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail2; t=1605085669; bh=3CnySMZH2apTpCFBS19YF02YJsKtkXuILcez4Wq+5eE=; h=Date:To:From:Cc:Reply-To:Subject:From; b=BrrD60X4BmMzqNzf4CrP53DNIlA4/murOETsxV8G2nuVOOI1EBTxQsfbEQwDUZYT0 /FsuhybuhSB8fvIc0BiEreWmfVv9QM8UZt1Wiq5f9NjhZWl+D9eKqSmoQQKq3Ed/r0 BYvuIx4XGJ49sp4X0RFxQSeV7PvXIbah5+akE7P0K42z5onQOdLKANiP3g3UsTgL1n XA43PEbzmaT2TKGULdioLokIxMkTqvG0xxTzgoUnVybIAHBP1Kbl0wOMAD+UfI403l ilfkAaoe1Ono3BNn5Xs2pmap1ygjmrotYbSZZGwvXsZW9eaeoK3+5C9FPB+SoG8ZC0 hIEvHTnHCzuhA== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v2 2/2] drm: add debug logs for drm_mode_atomic_ioctl errors Message-ID: 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: Thomas Zimmermann , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Be nice to user-space and log what happened when returning EINVAL in drm_mode_atomic_ioctl. v2: - Migrate to drm_dbg_atomic (Sam) - Add debug log for arg->reserved (Ville) - Drop redundant "atomic" word in log messages (Ville) Signed-off-by: Simon Ser Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: Sam Ravnborg Cc: Ville Syrjala Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/drm_atomic_uapi.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index efab3d518891..9df7f2a170e3 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -1330,22 +1330,35 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, * though this may be a bit overkill, since legacy userspace * wouldn't know how to call this ioctl) */ - if (!file_priv->atomic) + if (!file_priv->atomic) { + drm_dbg_atomic(dev, + "commit failed: atomic cap not enabled\n"); return -EINVAL; + } - if (arg->flags & ~DRM_MODE_ATOMIC_FLAGS) + if (arg->flags & ~DRM_MODE_ATOMIC_FLAGS) { + drm_dbg_atomic(dev, "commit failed: invalid flag\n"); return -EINVAL; + } - if (arg->reserved) + if (arg->reserved) { + drm_dbg_atomic(dev, "commit failed: reserved field set\n"); return -EINVAL; + } - if (arg->flags & DRM_MODE_PAGE_FLIP_ASYNC) + if (arg->flags & DRM_MODE_PAGE_FLIP_ASYNC) { + drm_dbg_atomic(dev, + "commit failed: invalid flag DRM_MODE_PAGE_FLIP_ASYNC\n"); return -EINVAL; + } /* can't test and expect an event at the same time. */ if ((arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) && - (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) + (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) { + drm_dbg_atomic(dev, + "commit failed: page-flip event requested with test-only commit\n"); return -EINVAL; + } state = drm_atomic_state_alloc(dev); if (!state)