From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Jason Ekstrand <jason@jlekstrand.net>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [i-g-t] lib/ioctl_wrappers: Keep IGT working without pread/pwrite ioctls
Date: Thu, 11 Mar 2021 13:02:19 -0800 [thread overview]
Message-ID: <87ft11tndw.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <CAOFGe96q2QR8zm3UgUYGRcz_1C0H=yUe2S=5FNmR4V0tqCZU0g@mail.gmail.com>
On Thu, 11 Mar 2021 12:47:41 -0800, Jason Ekstrand wrote:
> > diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> > index 45415621b7..4440004c42 100644
> > --- a/lib/ioctl_wrappers.c
> > +++ b/lib/ioctl_wrappers.c
> > @@ -56,6 +56,7 @@
> > #include "igt_debugfs.h"
> > #include "igt_sysfs.h"
> > #include "config.h"
> > +#include "i915/gem_mman.h"
> >
> > #ifdef HAVE_VALGRIND
> > #include <valgrind/valgrind.h>
> > @@ -324,6 +325,70 @@ void gem_close(int fd, uint32_t handle)
> > do_ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
> > }
> >
> > +static bool is_cache_coherent(int fd, uint32_t handle)
> > +{
> > + return gem_get_caching(fd, handle) != I915_CACHING_NONE;
> > +}
> > +
> > +static void mmap_write(int fd, uint32_t handle, uint64_t offset,
> > + const void *buf, uint64_t length)
> > +{
> > + void *map = NULL;
> > +
> > + if (!length)
> > + return;
> > +
> > + if (is_cache_coherent(fd, handle)) {
> > + /* offset arg for mmap functions must be 0 */
> > + map = __gem_mmap__cpu_coherent(fd, handle, 0, offset + length,
> > + PROT_READ | PROT_WRITE);
> > + if (map)
> > + gem_set_domain(fd, handle,
> > + I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
>
> Not sure how much it matters for IGT but the pread/pwrite ioctls
> appear to always leave the BO in the GTT domain.
It probably doesn't matter. This code here is actually copied from lib/intel_bufops.c:
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/lib/intel_bufops.c#L423
Because it has been tested and verified to work and because it is already
used elsewhere my preference would be to leave as is unless you think
otherwise? Thanks.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2021-03-11 21:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 20:47 [igt-dev] [i-g-t] lib/ioctl_wrappers: Keep IGT working without pread/pwrite ioctls Jason Ekstrand
2021-03-11 21:02 ` Dixit, Ashutosh [this message]
2021-03-11 21:06 ` Jason Ekstrand
-- strict thread matches above, loose matches on Subject: below --
2020-09-30 3:40 [igt-dev] [PATCH i-g-t] " Ashutosh Dixit
2021-01-11 20:46 ` [igt-dev] [i-g-t] " Dave Airlie
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=87ft11tndw.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jason@jlekstrand.net \
/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