Thread (15 messages) 15 messages, 4 authors, 2021-06-24

Re: [igt-dev] [PATCH i-g-t] i915: Handle the case where legacy mmap is not available

From: Dixit, Ashutosh <hidden>
Date: 2021-06-24 18:33:22

On Thu, 24 Jun 2021 02:02:04 -0700, Maarten Lankhorst wrote:
Op 24-06-2021 om 03:30 schreef Dixit, Ashutosh:
quoted
On Tue, 11 May 2021 02:00:00 -0700, Maarten Lankhorst wrote:
quoted
@@ -84,10 +93,14 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
 {
struct drm_i915_gem_mmap_gtt mmap_arg;
void *ptr;
+	int ret;

memset(&mmap_arg, 0, sizeof(mmap_arg));
mmap_arg.handle = handle;
-	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
+	ret = igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
+	if (ret == -1 && errno == EOPNOTSUPP)
What is the handler for DRM_IOCTL_I915_GEM_MMAP_GTT ioctl in i915 (in the
kernel)? I am unable to find it so for now I am just assuming that it will
just get routed to the handler for DRM_IOCTL_I915_GEM_MMAP and return
EOPNOTSUPP for Gen12+ which is what the code above seems to be assuming.
tools/include/uapi/drm/i915_drm.h:#define DRM_IOCTL_I915_GEM_MMAP               DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
tools/include/uapi/drm/i915_drm.h:#define DRM_IOCTL_I915_GEM_MMAP_GTT   DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
tools/include/uapi/drm/i915_drm.h:#define DRM_IOCTL_I915_GEM_MMAP_OFFSET        DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset)

I wasn't aware of that, even..

MMAP_GTT is MMAP_OFFSET with flags and extensions set to 0. Which means
flags = I915_MMAP_OFFSET_GTT.
Ah, got it! Thanks!
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help