All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Surendrakumar Upadhyay, TejaskumarX" <tejaskumarx.surendrakumar.upadhyay@intel.com>
To: "Latvala, Petri" <petri.latvala@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [i-g-t] lib/i915: Use FIXED mapping only for discrete memory
Date: Mon, 30 Aug 2021 09:31:05 +0000	[thread overview]
Message-ID: <SN6PR11MB3421C69BE2E8340BAD42029FDFCB9@SN6PR11MB3421.namprd11.prod.outlook.com> (raw)
In-Reply-To: <YSyi05MMPGmGWE8S@platvala-desk.ger.corp.intel.com>



> -----Original Message-----
> From: Latvala, Petri <petri.latvala@intel.com>
> Sent: 30 August 2021 14:50
> To: Surendrakumar Upadhyay, TejaskumarX
> <tejaskumarx.surendrakumar.upadhyay@intel.com>
> Cc: igt-dev@lists.freedesktop.org
> Subject: Re: [igt-dev] [i-g-t] lib/i915: Use FIXED mapping only for discrete
> memory
> 
> On Mon, Aug 30, 2021 at 12:12:25PM +0300, Surendrakumar Upadhyay,
> TejaskumarX wrote:
> >
> >
> > > -----Original Message-----
> > > From: Latvala, Petri <petri.latvala@intel.com>
> > > Sent: 30 August 2021 14:07
> > > To: Surendrakumar Upadhyay, TejaskumarX
> > > <tejaskumarx.surendrakumar.upadhyay@intel.com>
> > > Cc: igt-dev@lists.freedesktop.org
> > > Subject: Re: [igt-dev] [i-g-t] lib/i915: Use FIXED mapping only for
> > > discrete memory
> > >
> > > On Fri, Aug 27, 2021 at 06:30:02PM +0530, Tejas Upadhyay wrote:
> > > > The FIXED mapping is only used for discrete, and mapping type is
> > > > pre-defined. This disables the other type of mmap offsets when
> > > > discrete memory is used.
> > > >
> > > > Taken from kernel commit:
> > > > commit 7961c5b60f23 ("drm/i915: Add TTM offset argument to
> mmap.")
> > > >
> > > > Signed-off-by: Tejas Upadhyay
> > > > <tejaskumarx.surendrakumar.upadhyay@intel.com>
> > > > ---
> > > >  include/drm-uapi/i915_drm.h | 1 +
> > > >  lib/i915/gem_mman.c         | 8 +++++++-
> > > >  2 files changed, 8 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/include/drm-uapi/i915_drm.h
> > > > b/include/drm-uapi/i915_drm.h index a1c0030c..b46367f2 100644
> > > > --- a/include/drm-uapi/i915_drm.h
> > > > +++ b/include/drm-uapi/i915_drm.h
> > > > @@ -871,6 +871,7 @@ struct drm_i915_gem_mmap_offset {  #define
> > > > I915_MMAP_OFFSET_WC  1  #define I915_MMAP_OFFSET_WB  2
> #define
> > > > I915_MMAP_OFFSET_UC  3
> > > > +#define I915_MMAP_OFFSET_FIXED 4
> > > >
> > > >     /*
> > > >      * Zero-terminated chain of extensions.
> > > > diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index
> > > > 0406a0b9..1917c24d 100644
> > > > --- a/lib/i915/gem_mman.c
> > > > +++ b/lib/i915/gem_mman.c
> > > > @@ -75,7 +75,13 @@ bool gem_has_legacy_mmap(int fd)
> > > >
> > > >  bool gem_has_mmap_offset_type(int fd, const struct mmap_offset *t)
> {
> > > > -   return gem_has_mmap_offset(fd) || t->type ==
> > > I915_MMAP_OFFSET_GTT;
> > > > +   if (gem_has_mmap_offset(fd))
> > > > +           if (!gem_has_lmem(fd))
> > > > +                   return !(t->type == I915_MMAP_OFFSET_FIXED);
> > > > +           else
> > > > +                   return !(t->type != I915_MMAP_OFFSET_FIXED);
> > >
> > > Why the !(a == b) stuff?
> > >        ^^^
> >
> > If its discrete memory and offset type is fixed then only its valid
> combination.  Reverse if not discrete then any offset type except fixed is valid
> combination.
> 
> 
> I understand the goal, but this is imho more readable:
> 
> if (gem_has_lmem(fd))
>   return t->type == I915_MMAP_OFFSET_FIXED; else
>   return t->type != I915_MMAP_OFFSET_FIXED;
> 

I agree. Changed accordingly.

Thanks,
Tejas
> 
> 
> --
> Petri Latvala

  reply	other threads:[~2021-08-30  9:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27 13:00 [igt-dev] [i-g-t] lib/i915: Use FIXED mapping only for discrete memory Tejas Upadhyay
2021-08-27 13:57 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-08-27 16:42 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-08-30  5:10 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/i915: Use FIXED mapping only for discrete memory (rev2) Patchwork
2021-08-30  6:19 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-08-30  8:36 ` [igt-dev] [i-g-t] lib/i915: Use FIXED mapping only for discrete memory Petri Latvala
2021-08-30  9:12   ` Surendrakumar Upadhyay, TejaskumarX
2021-08-30  9:20     ` Petri Latvala
2021-08-30  9:31       ` Surendrakumar Upadhyay, TejaskumarX [this message]
2021-08-30 15:59 ` Daniel Vetter

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=SN6PR11MB3421C69BE2E8340BAD42029FDFCB9@SN6PR11MB3421.namprd11.prod.outlook.com \
    --to=tejaskumarx.surendrakumar.upadhyay@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    /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.