All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Jason Ekstrand <jason@jlekstrand.net>,
	Matthew Auld <matthew.auld@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>,
	Intel GFX <intel-gfx@lists.freedesktop.org>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
	Kenneth Graunke <kenneth@whitecape.org>,
	ML mesa-dev <mesa-dev@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH v3 4/4] drm/doc/rfc: i915 DG1 uAPI
Date: Tue, 20 Apr 2021 17:34:17 +0100	[thread overview]
Message-ID: <5a412489-75ed-e971-0e0b-388f0f964fac@linux.intel.com> (raw)
In-Reply-To: <CAOFGe95gMUuqXX=Yn_xMRVxQmcwiqNEN0m3PgyNACcm0iNTyKg@mail.gmail.com>


On 19/04/2021 16:19, Jason Ekstrand wrote:
> On Mon, Apr 19, 2021 at 7:02 AM Matthew Auld <matthew.auld@intel.com> wrote:
>>
>> On 16/04/2021 17:38, Jason Ekstrand wrote:
>>> On Thu, Apr 15, 2021 at 11:04 AM Matthew Auld <matthew.auld@intel.com> wrote:
>>>>
>>>> Add an entry for the new uAPI needed for DG1.
>>>>
>>>> v2(Daniel):
>>>>     - include the overall upstreaming plan
>>>>     - add a note for mmap, there are differences here for TTM vs i915
>>>>     - bunch of other suggestions from Daniel
>>>> v3:
>>>>    (Daniel)
>>>>     - add a note for set/get caching stuff
>>>>     - add some more docs for existing query and extensions stuff
>>>>     - add an actual code example for regions query
>>>>     - bunch of other stuff
>>>>    (Jason)
>>>>     - uAPI change(!):
>>>>           - try a simpler design with the placements extension
>>>>           - rather than have a generic setparam which can cover multiple
>>>>             use cases, have each extension be responsible for one thing
>>>>             only
>>>>
>>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>>> Cc: Daniel Vetter <daniel.vetter@intel.com>
>>>> Cc: Kenneth Graunke <kenneth@whitecape.org>
>>>> Cc: Jason Ekstrand <jason@jlekstrand.net>
>>>> Cc: Dave Airlie <airlied@gmail.com>
>>>> Cc: dri-devel@lists.freedesktop.org
>>>> Cc: mesa-dev@lists.freedesktop.org
>>>> ---
>>>>    Documentation/gpu/rfc/i915_gem_lmem.h   | 255 ++++++++++++++++++++++++
>>>>    Documentation/gpu/rfc/i915_gem_lmem.rst | 139 +++++++++++++
>>>>    Documentation/gpu/rfc/index.rst         |   4 +
>>>>    3 files changed, 398 insertions(+)
>>>>    create mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
>>>>    create mode 100644 Documentation/gpu/rfc/i915_gem_lmem.rst
>>>>
>>>> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
>>>> new file mode 100644
>>>> index 000000000000..2a82a452e9f2
>>>> --- /dev/null
>>>> +++ b/Documentation/gpu/rfc/i915_gem_lmem.h
>>>> @@ -0,0 +1,255 @@
>>>> +/*
>>>> + * Note that drm_i915_query_item and drm_i915_query are existing bits of uAPI.
>>>> + * For the regions query we are just adding a new query id, so no actual new
>>>> + * ioctl or anything, but including it here for reference.
>>>> + */
>>>> +struct drm_i915_query_item {
>>>> +#define DRM_I915_QUERY_MEMORY_REGIONS   0xdeadbeaf
>>>> +       ....
>>>> +        __u64 query_id;
>>>> +
>>>> +        /*
>>>> +         * When set to zero by userspace, this is filled with the size of the
>>>> +         * data to be written at the data_ptr pointer. The kernel sets this
>>>> +         * value to a negative value to signal an error on a particular query
>>>> +         * item.
>>>> +         */
>>>> +        __s32 length;
>>>> +
>>>> +        __u32 flags;
>>>> +        /*
>>>> +         * Data will be written at the location pointed by data_ptr when the
>>>> +         * value of length matches the length of the data to be written by the
>>>> +         * kernel.
>>>> +         */
>>>> +        __u64 data_ptr;
>>>> +};
>>>> +
>>>> +struct drm_i915_query {
>>>> +        __u32 num_items;
>>>> +        /*
>>>> +         * Unused for now. Must be cleared to zero.
>>>> +         */
>>>> +        __u32 flags;
>>>> +        /*
>>>> +         * This points to an array of num_items drm_i915_query_item structures.
>>>> +         */
>>>> +        __u64 items_ptr;
>>>> +};
>>>> +
>>>> +#define DRM_IOCTL_I915_QUERY   DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
>>>> +
>>>> +/**
>>>> + * enum drm_i915_gem_memory_class
>>>> + */
>>>> +enum drm_i915_gem_memory_class {
>>>> +       /** @I915_MEMORY_CLASS_SYSTEM: system memory */
>>>> +       I915_MEMORY_CLASS_SYSTEM = 0,
>>>> +       /** @I915_MEMORY_CLASS_DEVICE: device local-memory */
>>>> +       I915_MEMORY_CLASS_DEVICE,
>>>> +};
>>>> +
>>>> +/**
>>>> + * struct drm_i915_gem_memory_class_instance
>>>> + */
>>>> +struct drm_i915_gem_memory_class_instance {
>>>> +       /** @memory_class: see enum drm_i915_gem_memory_class */
>>>> +       __u16 memory_class;
>>>> +
>>>> +       /** @memory_instance: which instance */
>>>> +       __u16 memory_instance;
>>>> +};
>>>> +
>>>> +/**
>>>> + * struct drm_i915_memory_region_info
>>>> + *
>>>> + * Describes one region as known to the driver.
>>>> + *
>>>> + * Note that we reserve quite a lot of stuff here for potential future work. As
>>>> + * an example we might want expose the capabilities(see caps) for a given
>>>> + * region, which could include things like if the region is CPU
>>>> + * mappable/accessible etc.
>>>
>>> I get caps but I'm seriously at a loss as to what the rest of this
>>> would be used for.  Why are caps and flags both there and separate?
>>> Flags are typically something you set, not query.  Also, what's with
>>> rsvd1 at the end?  This smells of substantial over-building to me.
>>>
>>> I thought to myself, "maybe I'm missing a future use-case" so I looked
>>> at the internal tree and none of this is being used there either.
>>> This indicates to me that either I'm missing something and there's
>>> code somewhere I don't know about or, with three years of building on
>>> internal branches, we still haven't proven that any of this is needed.
>>> If it's the latter, which I strongly suspect, maybe we should drop the
>>> unnecessary bits and only add them back in if and when we have proof
>>> that they're useful.
>>
>> Do you mean just drop caps/flags here, but keep/inflate rsvd0/rsvd1,
>> which is less opinionated about future unknowns? If so, makes sense to me.
> 
> I meant drop flags and rsvd1.  We need rsvd0 for padding and  I can
> see some value to caps.  We may want to advertise, for instance, what
> mapping coherency types are available per-heap.  But I don't see any
> use for any of the other fields.

I'd suggest making sure at least enough rsvd fields remain so that flags 
could be added later if needed. Experience from engine info shows that 
both were required in order to extend the query via re-purposing the 
rsvds and adding flag bits to indicate when a certain rsvd contains a 
new piece of information. I probably cannot go into too much detail 
here, but anyway the point is just to make sure too much is not stripped 
out so that instead of simply adding fields/flags we have to add a new 
query in the future. IMO some rsvd fields are not really harmful and if 
they can make things easier in the future why not.

Regards,

Tvrtko
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Jason Ekstrand <jason@jlekstrand.net>,
	Matthew Auld <matthew.auld@intel.com>
Cc: Intel GFX <intel-gfx@lists.freedesktop.org>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
	Kenneth Graunke <kenneth@whitecape.org>,
	ML mesa-dev <mesa-dev@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [Intel-gfx] [PATCH v3 4/4] drm/doc/rfc: i915 DG1 uAPI
Date: Tue, 20 Apr 2021 17:34:17 +0100	[thread overview]
Message-ID: <5a412489-75ed-e971-0e0b-388f0f964fac@linux.intel.com> (raw)
In-Reply-To: <CAOFGe95gMUuqXX=Yn_xMRVxQmcwiqNEN0m3PgyNACcm0iNTyKg@mail.gmail.com>


On 19/04/2021 16:19, Jason Ekstrand wrote:
> On Mon, Apr 19, 2021 at 7:02 AM Matthew Auld <matthew.auld@intel.com> wrote:
>>
>> On 16/04/2021 17:38, Jason Ekstrand wrote:
>>> On Thu, Apr 15, 2021 at 11:04 AM Matthew Auld <matthew.auld@intel.com> wrote:
>>>>
>>>> Add an entry for the new uAPI needed for DG1.
>>>>
>>>> v2(Daniel):
>>>>     - include the overall upstreaming plan
>>>>     - add a note for mmap, there are differences here for TTM vs i915
>>>>     - bunch of other suggestions from Daniel
>>>> v3:
>>>>    (Daniel)
>>>>     - add a note for set/get caching stuff
>>>>     - add some more docs for existing query and extensions stuff
>>>>     - add an actual code example for regions query
>>>>     - bunch of other stuff
>>>>    (Jason)
>>>>     - uAPI change(!):
>>>>           - try a simpler design with the placements extension
>>>>           - rather than have a generic setparam which can cover multiple
>>>>             use cases, have each extension be responsible for one thing
>>>>             only
>>>>
>>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>>> Cc: Daniel Vetter <daniel.vetter@intel.com>
>>>> Cc: Kenneth Graunke <kenneth@whitecape.org>
>>>> Cc: Jason Ekstrand <jason@jlekstrand.net>
>>>> Cc: Dave Airlie <airlied@gmail.com>
>>>> Cc: dri-devel@lists.freedesktop.org
>>>> Cc: mesa-dev@lists.freedesktop.org
>>>> ---
>>>>    Documentation/gpu/rfc/i915_gem_lmem.h   | 255 ++++++++++++++++++++++++
>>>>    Documentation/gpu/rfc/i915_gem_lmem.rst | 139 +++++++++++++
>>>>    Documentation/gpu/rfc/index.rst         |   4 +
>>>>    3 files changed, 398 insertions(+)
>>>>    create mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
>>>>    create mode 100644 Documentation/gpu/rfc/i915_gem_lmem.rst
>>>>
>>>> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
>>>> new file mode 100644
>>>> index 000000000000..2a82a452e9f2
>>>> --- /dev/null
>>>> +++ b/Documentation/gpu/rfc/i915_gem_lmem.h
>>>> @@ -0,0 +1,255 @@
>>>> +/*
>>>> + * Note that drm_i915_query_item and drm_i915_query are existing bits of uAPI.
>>>> + * For the regions query we are just adding a new query id, so no actual new
>>>> + * ioctl or anything, but including it here for reference.
>>>> + */
>>>> +struct drm_i915_query_item {
>>>> +#define DRM_I915_QUERY_MEMORY_REGIONS   0xdeadbeaf
>>>> +       ....
>>>> +        __u64 query_id;
>>>> +
>>>> +        /*
>>>> +         * When set to zero by userspace, this is filled with the size of the
>>>> +         * data to be written at the data_ptr pointer. The kernel sets this
>>>> +         * value to a negative value to signal an error on a particular query
>>>> +         * item.
>>>> +         */
>>>> +        __s32 length;
>>>> +
>>>> +        __u32 flags;
>>>> +        /*
>>>> +         * Data will be written at the location pointed by data_ptr when the
>>>> +         * value of length matches the length of the data to be written by the
>>>> +         * kernel.
>>>> +         */
>>>> +        __u64 data_ptr;
>>>> +};
>>>> +
>>>> +struct drm_i915_query {
>>>> +        __u32 num_items;
>>>> +        /*
>>>> +         * Unused for now. Must be cleared to zero.
>>>> +         */
>>>> +        __u32 flags;
>>>> +        /*
>>>> +         * This points to an array of num_items drm_i915_query_item structures.
>>>> +         */
>>>> +        __u64 items_ptr;
>>>> +};
>>>> +
>>>> +#define DRM_IOCTL_I915_QUERY   DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
>>>> +
>>>> +/**
>>>> + * enum drm_i915_gem_memory_class
>>>> + */
>>>> +enum drm_i915_gem_memory_class {
>>>> +       /** @I915_MEMORY_CLASS_SYSTEM: system memory */
>>>> +       I915_MEMORY_CLASS_SYSTEM = 0,
>>>> +       /** @I915_MEMORY_CLASS_DEVICE: device local-memory */
>>>> +       I915_MEMORY_CLASS_DEVICE,
>>>> +};
>>>> +
>>>> +/**
>>>> + * struct drm_i915_gem_memory_class_instance
>>>> + */
>>>> +struct drm_i915_gem_memory_class_instance {
>>>> +       /** @memory_class: see enum drm_i915_gem_memory_class */
>>>> +       __u16 memory_class;
>>>> +
>>>> +       /** @memory_instance: which instance */
>>>> +       __u16 memory_instance;
>>>> +};
>>>> +
>>>> +/**
>>>> + * struct drm_i915_memory_region_info
>>>> + *
>>>> + * Describes one region as known to the driver.
>>>> + *
>>>> + * Note that we reserve quite a lot of stuff here for potential future work. As
>>>> + * an example we might want expose the capabilities(see caps) for a given
>>>> + * region, which could include things like if the region is CPU
>>>> + * mappable/accessible etc.
>>>
>>> I get caps but I'm seriously at a loss as to what the rest of this
>>> would be used for.  Why are caps and flags both there and separate?
>>> Flags are typically something you set, not query.  Also, what's with
>>> rsvd1 at the end?  This smells of substantial over-building to me.
>>>
>>> I thought to myself, "maybe I'm missing a future use-case" so I looked
>>> at the internal tree and none of this is being used there either.
>>> This indicates to me that either I'm missing something and there's
>>> code somewhere I don't know about or, with three years of building on
>>> internal branches, we still haven't proven that any of this is needed.
>>> If it's the latter, which I strongly suspect, maybe we should drop the
>>> unnecessary bits and only add them back in if and when we have proof
>>> that they're useful.
>>
>> Do you mean just drop caps/flags here, but keep/inflate rsvd0/rsvd1,
>> which is less opinionated about future unknowns? If so, makes sense to me.
> 
> I meant drop flags and rsvd1.  We need rsvd0 for padding and  I can
> see some value to caps.  We may want to advertise, for instance, what
> mapping coherency types are available per-heap.  But I don't see any
> use for any of the other fields.

I'd suggest making sure at least enough rsvd fields remain so that flags 
could be added later if needed. Experience from engine info shows that 
both were required in order to extend the query via re-purposing the 
rsvds and adding flag bits to indicate when a certain rsvd contains a 
new piece of information. I probably cannot go into too much detail 
here, but anyway the point is just to make sure too much is not stripped 
out so that instead of simply adding fields/flags we have to add a new 
query in the future. IMO some rsvd fields are not really harmful and if 
they can make things easier in the future why not.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-04-20 16:34 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 15:59 [PATCH v3 1/4] drm/i915/uapi: hide kernel doc warnings Matthew Auld
2021-04-15 15:59 ` [Intel-gfx] " Matthew Auld
2021-04-15 15:59 ` [PATCH v3 2/4] drm/i915/uapi: convert i915_user_extension to kernel doc Matthew Auld
2021-04-15 15:59   ` [Intel-gfx] " Matthew Auld
2021-04-16  8:46   ` Daniel Vetter
2021-04-16  8:46     ` [Intel-gfx] " Daniel Vetter
2021-04-15 15:59 ` [PATCH v3 3/4] drm/i915/uapi: convert i915_query and friend " Matthew Auld
2021-04-15 15:59   ` [Intel-gfx] " Matthew Auld
2021-04-15 22:25   ` [Mesa-dev] " Ian Romanick
2021-04-15 22:25     ` [Intel-gfx] " Ian Romanick
2021-04-16  8:59     ` Daniel Vetter
2021-04-16  8:59       ` [Intel-gfx] " Daniel Vetter
2021-04-16  8:59       ` Daniel Vetter
2021-04-16 19:04       ` Jonathan Corbet
2021-04-16 19:04         ` [Intel-gfx] " Jonathan Corbet
2021-04-16 19:04         ` Jonathan Corbet
2021-04-16  7:57   ` [Intel-gfx] " Tvrtko Ursulin
2021-04-16  7:57     ` Tvrtko Ursulin
2021-04-16  8:49   ` Daniel Vetter
2021-04-16  8:49     ` [Intel-gfx] " Daniel Vetter
2021-04-15 15:59 ` [PATCH v3 4/4] drm/doc/rfc: i915 DG1 uAPI Matthew Auld
2021-04-15 15:59   ` [Intel-gfx] " Matthew Auld
2021-04-16  9:15   ` Daniel Vetter
2021-04-16  9:15     ` [Intel-gfx] " Daniel Vetter
2021-04-16 16:38   ` Jason Ekstrand
2021-04-16 16:38     ` [Intel-gfx] " Jason Ekstrand
2021-04-16 17:02     ` Daniel Vetter
2021-04-16 17:02       ` [Intel-gfx] " Daniel Vetter
2021-04-16 17:33       ` Daniele Ceraolo Spurio
2021-04-16 17:33         ` [Intel-gfx] " Daniele Ceraolo Spurio
2021-04-19 12:02     ` Matthew Auld
2021-04-19 12:02       ` [Intel-gfx] " Matthew Auld
2021-04-19 15:19       ` Jason Ekstrand
2021-04-19 15:19         ` [Intel-gfx] " Jason Ekstrand
2021-04-20 16:34         ` Tvrtko Ursulin [this message]
2021-04-20 16:34           ` Tvrtko Ursulin
2021-04-20 17:00           ` Jason Ekstrand
2021-04-20 17:00             ` [Intel-gfx] " Jason Ekstrand
2021-04-21  8:22             ` Tvrtko Ursulin
2021-04-21  8:22               ` [Intel-gfx] " Tvrtko Ursulin
2021-04-21 13:54               ` Jason Ekstrand
2021-04-21 13:54                 ` [Intel-gfx] " Jason Ekstrand
2021-04-21 14:25                 ` Tvrtko Ursulin
2021-04-21 14:25                   ` [Intel-gfx] " Tvrtko Ursulin
2021-04-21 17:17                   ` Jason Ekstrand
2021-04-21 17:17                     ` [Intel-gfx] " Jason Ekstrand
2021-04-21 18:28                     ` Tvrtko Ursulin
2021-04-21 18:28                       ` [Intel-gfx] " Tvrtko Ursulin
2021-04-21 19:23                       ` [Mesa-dev] " Daniel Vetter
2021-04-21 19:23                         ` [Intel-gfx] " Daniel Vetter
2021-04-26 15:22                         ` Jason Ekstrand
2021-04-26 15:22                           ` [Intel-gfx] " Jason Ekstrand
2021-04-15 16:32 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/4] drm/i915/uapi: hide kernel doc warnings Patchwork
2021-04-15 16:34 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-04-15 16:37 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2021-04-15 16:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-04-15 18:17 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-04-16  8:44 ` [PATCH v3 1/4] " Daniel Vetter
2021-04-16  8:44   ` [Intel-gfx] " Daniel Vetter
2021-04-16  8:54   ` Daniel Vetter
2021-04-16  8:54     ` [Intel-gfx] " 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=5a412489-75ed-e971-0e0b-388f0f964fac@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jason@jlekstrand.net \
    --cc=jordan.l.justen@intel.com \
    --cc=kenneth@whitecape.org \
    --cc=matthew.auld@intel.com \
    --cc=mesa-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.