2011-04-12 04:17:47

by Ole Henrik Jahren

[permalink] [raw]
Subject: [PATCH] Fix typo in include/drm/i915_drm.h

Signed-off-by: Ole Henrik Jahren <[email protected]>
Cc: Chris Wilson <[email protected]>
---

While adding DRM ioctl decoding support to strace, I noticed something
that looks very much like a typo. If it is intended this way, sorry
about the noise.

include/drm/i915_drm.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 0039f1f..ca7b8af 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -237,7 +237,7 @@ typedef struct _drm_i915_sarea {
#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
-#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_IOCTL_I915_OVERLAY_ATTRS, struct drm_intel_overlay_put_image)
+#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)

/* Allow drivers to submit batchbuffers directly to hardware, relying
--
1.7.5.rc1


2011-04-12 13:16:09

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH] Fix typo in include/drm/i915_drm.h

Indeed, good catch. Luckily never ever used (libdrm takes care of it
internally) in the drmCommand(Write|Read) functions.

Acked-by: Daniel Vetter <[email protected]>

On Tue, Apr 12, 2011 at 6:10 AM, Ole Henrik Jahren
<[email protected]> wrote:
> Signed-off-by: Ole Henrik Jahren <[email protected]>
> Cc: Chris Wilson <[email protected]>
> ---
>
> While adding DRM ioctl decoding support to strace, I noticed something
> that looks very much like a typo. If it is intended this way, sorry
> about the noise.
>
> ?include/drm/i915_drm.h | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
> index 0039f1f..ca7b8af 100644
> --- a/include/drm/i915_drm.h
> +++ b/include/drm/i915_drm.h
> @@ -237,7 +237,7 @@ typedef struct _drm_i915_sarea {
> ?#define DRM_IOCTL_I915_GEM_GET_APERTURE ? ? ? ?DRM_IOR ?(DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
> ?#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
> ?#define DRM_IOCTL_I915_GEM_MADVISE ? ? DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
> -#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE ? ? ? DRM_IOW(DRM_COMMAND_BASE + DRM_IOCTL_I915_OVERLAY_ATTRS, struct drm_intel_overlay_put_image)
> +#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE ? ? ? DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
> ?#define DRM_IOCTL_I915_OVERLAY_ATTRS ? DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
>
> ?/* Allow drivers to submit batchbuffers directly to hardware, relying
> --
> 1.7.5.rc1
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



--
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch

2011-04-22 01:34:46

by Ole Henrik Jahren

[permalink] [raw]
Subject: [PATCH] drm/i915: Fix typo in DRM_I915_OVERLAY_PUT_IMAGE ioctl define

Calling ioctl with DRM_IOCTL_I915_OVERLAY_PUT_IMAGE is broken if the
macro is used directly, because the define contains a typo. When using
libdrm you do not hit the bug, since libdrm handles the ioctl encoding
internally.

The typo also leads to the .cmd and .cmd_drv fields of the drm_ioctl
structure for DRM_I915_OVERLAY_PUT_IMAGE having inconsistent content.

Signed-off-by: Ole Henrik Jahren <[email protected]>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---

Included a bit more explanation about the problem. The impact of the
inconsistency between .cmd and .cmd_drv does not seem to have any impact,
since the only thing .cmd_drv seems to be used for is calculating the
size of the copy_from_user() buffer. It incidentally result in the same
size both with and without this patch (at least on 64bit).

include/drm/i915_drm.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 0039f1f..ca7b8af 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -237,7 +237,7 @@ typedef struct _drm_i915_sarea {
#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
-#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_IOCTL_I915_OVERLAY_ATTRS, struct drm_intel_overlay_put_image)
+#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)

/* Allow drivers to submit batchbuffers directly to hardware, relying
--
1.7.5.rc1