From: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 4/4] lib/ioctl_wrapper: Use __gem_mmap within __gem_mmap__cpu/wc
Date: Fri, 11 Jan 2019 16:37:45 +0100 [thread overview]
Message-ID: <20190111153745.14422-4-lukasz.kalamarz@intel.com> (raw)
In-Reply-To: <20190111153745.14422-1-lukasz.kalamarz@intel.com>
This patch remove duplicated code from __gem_mmap__cpu/wc functions
and instead use call to __gem_mmap function, which is doing exactly
the same work.
Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/ioctl_wrappers.c | 34 ++--------------------------------
1 file changed, 2 insertions(+), 32 deletions(-)
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index a856b664..08bd5d1a 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -791,25 +791,7 @@ static void
*/
void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
{
- struct drm_i915_gem_mmap arg;
-
- if (!gem_mmap__has_wc(fd)) {
- errno = ENOSYS;
- return NULL;
- }
-
- memset(&arg, 0, sizeof(arg));
- arg.handle = handle;
- arg.offset = offset;
- arg.size = size;
- arg.flags = I915_MMAP_WC;
- if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg))
- return NULL;
-
- VG(VALGRIND_MAKE_MEM_DEFINED(from_user_pointer(arg.addr_ptr), arg.size));
-
- errno = 0;
- return from_user_pointer(arg.addr_ptr);
+ return __gem_mmap(fd, handle, offset, size, prot, I915_MMAP_WC);
}
/**
@@ -846,19 +828,7 @@ void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsi
*/
void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
{
- struct drm_i915_gem_mmap mmap_arg;
-
- memset(&mmap_arg, 0, sizeof(mmap_arg));
- mmap_arg.handle = handle;
- mmap_arg.offset = offset;
- mmap_arg.size = size;
- if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg))
- return NULL;
-
- VG(VALGRIND_MAKE_MEM_DEFINED(from_user_pointer(mmap_arg.addr_ptr), mmap_arg.size));
-
- errno = 0;
- return from_user_pointer(mmap_arg.addr_ptr);
+ return __gem_mmap(fd, handle, offset, size, prot, 0);
}
/**
--
2.17.2
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-01-11 15:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 15:37 [igt-dev] [PATCH i-g-t v2 1/4] lib/ioctl_wrapper: use defines for get_param instead of param number Lukasz Kalamarz
2019-01-11 15:37 ` [igt-dev] [PATCH i-g-t v2 2/4] lib/igt_dummyload: use gem_mmap__cpu and gem_mmap__wc when applicable Lukasz Kalamarz
2019-01-11 15:37 ` [igt-dev] [PATCH i-g-t v2 3/4] lib/ioctl_wrapper: Implement __gem_mmap Lukasz Kalamarz
2019-01-11 15:37 ` Lukasz Kalamarz [this message]
2019-01-11 16:04 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/4] lib/ioctl_wrapper: use defines for get_param instead of param number Patchwork
2019-01-11 21:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190111153745.14422-4-lukasz.kalamarz@intel.com \
--to=lukasz.kalamarz@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox