All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/2] drm: add debug logs for drm_mode_atomic_ioctl errors
@ 2020-11-11  9:07 Simon Ser
  2020-11-11 16:48 ` Daniel Vetter
  2020-11-11 18:31 ` Sam Ravnborg
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Ser @ 2020-11-11  9:07 UTC (permalink / raw)
  To: dri-devel; +Cc: Thomas Zimmermann, Sam Ravnborg

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 <contact@emersion.fr>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
---
 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)
-- 
2.29.2


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] drm: add debug logs for drm_mode_atomic_ioctl errors
  2020-11-11  9:07 [PATCH v2 2/2] drm: add debug logs for drm_mode_atomic_ioctl errors Simon Ser
@ 2020-11-11 16:48 ` Daniel Vetter
  2020-11-11 16:51   ` Simon Ser
  2020-11-11 18:31 ` Sam Ravnborg
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2020-11-11 16:48 UTC (permalink / raw)
  To: Simon Ser; +Cc: dri-devel, Thomas Zimmermann, Sam Ravnborg

On Wed, Nov 11, 2020 at 09:07:39AM +0000, Simon Ser wrote:
> 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 <contact@emersion.fr>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>

Submission bikeshed: Patch 1&2 aren't threaded. I thought git send-email
gets that right by default nowadays ...

Anyway, on both patches: Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  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)
> -- 
> 2.29.2
> 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] drm: add debug logs for drm_mode_atomic_ioctl errors
  2020-11-11 16:48 ` Daniel Vetter
@ 2020-11-11 16:51   ` Simon Ser
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Ser @ 2020-11-11 16:51 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: dri-devel, Thomas Zimmermann, Sam Ravnborg

On Wednesday, November 11, 2020 5:48 PM, Daniel Vetter <daniel@ffwll.ch> wrote:

> Submission bikeshed: Patch 1&2 aren't threaded. I thought git send-email
> gets that right by default nowadays ...

Yeah, it's a bug in my SMTP server I haven't bothered to write a patch
for yet. Sorry about that.

> Anyway, on both patches: Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch

Thanks for the review!
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] drm: add debug logs for drm_mode_atomic_ioctl errors
  2020-11-11  9:07 [PATCH v2 2/2] drm: add debug logs for drm_mode_atomic_ioctl errors Simon Ser
  2020-11-11 16:48 ` Daniel Vetter
@ 2020-11-11 18:31 ` Sam Ravnborg
  1 sibling, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2020-11-11 18:31 UTC (permalink / raw)
  To: Simon Ser; +Cc: dri-devel, Thomas Zimmermann

On Wed, Nov 11, 2020 at 09:07:39AM +0000, Simon Ser wrote:
> 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 <contact@emersion.fr>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-11 18:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11  9:07 [PATCH v2 2/2] drm: add debug logs for drm_mode_atomic_ioctl errors Simon Ser
2020-11-11 16:48 ` Daniel Vetter
2020-11-11 16:51   ` Simon Ser
2020-11-11 18:31 ` Sam Ravnborg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.