All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Ekstrand <jason@jlekstrand.net>
To: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
Cc: IGT GPU Tools <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 15:06:36 -0600	[thread overview]
Message-ID: <CAOFGe95n2A93bhk2EGMqb42-8BHwr1W91Hbg57TdY6ztwsuq3w@mail.gmail.com> (raw)
In-Reply-To: <87ft11tndw.wl-ashutosh.dixit@intel.com>

On Thu, Mar 11, 2021 at 3:02 PM Dixit, Ashutosh
<ashutosh.dixit@intel.com> wrote:
>
> 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.

Fine with me.  I'm mostly asking questions here, not really having opinions. :-)

--Jason
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2021-03-11 21:06 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
2021-03-11 21:06   ` Jason Ekstrand [this message]
  -- 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=CAOFGe95n2A93bhk2EGMqb42-8BHwr1W91Hbg57TdY6ztwsuq3w@mail.gmail.com \
    --to=jason@jlekstrand.net \
    --cc=ashutosh.dixit@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 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.