From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Cc: Ramalingam C <ramalingampc2008@gmail.com>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
Thomas Hellstrom <thomas.hellstrom@intel.com>,
Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [RFC PATCH v3 10/17] drm/i915/vm_bind: Implement I915_GEM_EXECBUFFER3 ioctl
Date: Thu, 1 Sep 2022 08:58:57 +0100 [thread overview]
Message-ID: <f0ee82ec-03bd-1e02-affe-98f127b2d72a@linux.intel.com> (raw)
In-Reply-To: <20220901050910.GG10283@nvishwa1-DESK>
On 01/09/2022 06:09, Niranjana Vishwanathapura wrote:
> On Wed, Aug 31, 2022 at 08:38:48AM +0100, Tvrtko Ursulin wrote:
>>
>> On 27/08/2022 20:43, Andi Shyti wrote:
>>> From: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
>>>
>>> Implement new execbuf3 ioctl (I915_GEM_EXECBUFFER3) which only
>>> works in vm_bind mode. The vm_bind mode only works with
>>> this new execbuf3 ioctl.
>>>
>>> The new execbuf3 ioctl will not have any list of objects to validate
>>> bind as all required objects binding would have been requested by the
>>> userspace before submitting the execbuf3.
>>>
>>> And the legacy support like relocations etc are removed.
>>>
>>> Signed-off-by: Niranjana Vishwanathapura
>>> <niranjana.vishwanathapura@intel.com>
>>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>>> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
>>> ---
[snip]
>>> +static void signal_fence_array(const struct i915_execbuffer *eb,
>>> + struct dma_fence * const fence)
>>> +{
>>> + unsigned int n;
>>> +
>>> + for (n = 0; n < eb->num_fences; n++) {
>>> + struct drm_syncobj *syncobj;
>>> + unsigned int flags;
>>> +
>>> + syncobj = ptr_unpack_bits(eb->fences[n].syncobj, &flags, 2);
>>> + if (!(flags & I915_TIMELINE_FENCE_SIGNAL))
>>> + continue;
>>> +
>>> + if (eb->fences[n].chain_fence) {
>>> + drm_syncobj_add_point(syncobj,
>>> + eb->fences[n].chain_fence,
>>> + fence,
>>> + eb->fences[n].value);
>>> + /*
>>> + * The chain's ownership is transferred to the
>>> + * timeline.
>>> + */
>>> + eb->fences[n].chain_fence = NULL;
>>> + } else {
>>> + drm_syncobj_replace_fence(syncobj, fence);
>>> + }
>>> + }
>>> +}
>> Semi-random place to ask - how many of the code here is direct copy of
>> existing functions from i915_gem_execbuffer.c? There seems to be some
>> 100% copies at least. And then some more with small tweaks. Spend some
>> time and try to figure out some code sharing?
>>
>
> During VM_BIND design review, maintainers expressed thought on keeping
> execbuf3 completely separate and not touch the legacy execbuf path.
Got a link so this maintainer can see what exactly was said? Just to
make sure there isn't any misunderstanding on what "completely separate"
means to different people.
> I also think, execbuf3 should be fully separate. We can do some code
> sharing where is a close 100% copy (there is a TODO in cover letter).
> There are some changes like the timeline fence array handling here
> which looks similar, but the uapi is not exactly the same. Probably,
> we should keep them separate and not try to force code sharing at
> least at this point.
Okay did not spot that TODO in the cover. But fair since it is RFC to be
unfinished.
I do however think it should be improved before considering the merge.
Because looking at the patch, 100% copies are:
for_each_batch_create_order
for_each_batch_add_order
eb_throttle
eb_pin_timeline
eb_pin_engine
eb_put_engine
__free_fence_array
put_fence_array
await_fence_array
signal_fence_array
retire_requests
eb_request_add
eb_requests_get
eb_requests_put
eb_find_context
Quite a lot.
Then there is a bunch of almost same functions which could be shared if
there weren't two incompatible local struct i915_execbuffer's.
Especially given when the out fence TODO item gets handled a chunk more
will also become a 100% copy.
This could be done by having a common struct i915_execbuffer and then
eb2 and eb3 specific parts which inherit from it. After that is done it
should be easier to see if it makes sense to do something more and how.
Regards,
Tvrtko
next prev parent reply other threads:[~2022-09-01 7:59 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 19:43 [Intel-gfx] [RFC PATCH v3 00/17] drm/i915/vm_bind: Add VM_BIND functionality Andi Shyti
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 01/17] drm/i915: Expose vm_lookup in i915_gem_context.h Andi Shyti
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 02/17] drm/i915: Mark vm for vm_bind usage at creation Andi Shyti
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 03/17] drm/i915/gem: expose i915_gem_object_max_page_size() in i915_gem_object.h Andi Shyti
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 04/17] drm/i915: Implement bind and unbind of object Andi Shyti
2022-08-30 17:37 ` Matthew Auld
2022-08-31 6:10 ` Niranjana Vishwanathapura
2022-08-30 18:19 ` Matthew Auld
2022-08-31 7:28 ` Tvrtko Ursulin
2022-09-01 5:18 ` Niranjana Vishwanathapura
2022-09-01 5:31 ` Dave Airlie
2022-09-01 20:05 ` Niranjana Vishwanathapura
2022-09-12 13:11 ` Jani Nikula
2022-09-21 7:19 ` Niranjana Vishwanathapura
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 05/17] drm/i915: Support for VM private BOs Andi Shyti
2022-08-31 6:13 ` Niranjana Vishwanathapura
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 06/17] drm/i915/dmabuf: Deny the dmabuf export " Andi Shyti
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 07/17] drm/i915/vm_bind: Handle persistent vmas Andi Shyti
2022-08-31 6:16 ` Niranjana Vishwanathapura
2022-09-12 13:16 ` Jani Nikula
2022-09-21 7:21 ` Niranjana Vishwanathapura
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 08/17] drm/i915/vm_bind: Add out fence support Andi Shyti
2022-08-31 6:22 ` Niranjana Vishwanathapura
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 09/17] drm/i915: Do not support vm_bind mode in execbuf2 Andi Shyti
2022-08-31 5:45 ` Niranjana Vishwanathapura
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 10/17] drm/i915/vm_bind: Implement I915_GEM_EXECBUFFER3 ioctl Andi Shyti
2022-08-31 7:38 ` Tvrtko Ursulin
2022-09-01 5:09 ` Niranjana Vishwanathapura
2022-09-01 7:58 ` Tvrtko Ursulin [this message]
2022-09-02 5:41 ` Niranjana Vishwanathapura
2022-09-05 15:08 ` Tvrtko Ursulin
2022-09-21 7:18 ` Niranjana Vishwanathapura
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 11/17] drm/i915: Add i915_vma_is_bind_complete() Andi Shyti
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 12/17] drm/i915/vm_bind: Handle persistent vmas in execbuf3 Andi Shyti
2022-08-27 19:43 ` [Intel-gfx] [RFC PATCH v3 13/17] drm/i915/vm_bind: userptr dma-resv changes Andi Shyti
2022-08-31 6:45 ` Niranjana Vishwanathapura
2022-08-27 19:44 ` [Intel-gfx] [RFC PATCH v3 14/17] drm/i915/vm_bind: Skip vma_lookup for persistent vmas Andi Shyti
2022-08-27 19:44 ` [Intel-gfx] [RFC PATCH v3 15/17] drm/i915: Extend getparm for VM_BIND capability Andi Shyti
2022-08-27 19:44 ` [Intel-gfx] [RFC PATCH v3 16/17] drm/i915/ioctl: Enable the vm_bind/unbind ioctls Andi Shyti
2022-08-27 19:44 ` [Intel-gfx] [RFC PATCH v3 17/17] drm/i915: Enable execbuf3 ioctl for vm_bind Andi Shyti
2022-08-27 20:23 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/vm_bind: Add VM_BIND functionality (rev2) Patchwork
2022-08-27 20:24 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-08-27 20:24 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-08-27 20:39 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-08-31 7:33 ` [Intel-gfx] [RFC PATCH v3 00/17] drm/i915/vm_bind: Add VM_BIND functionality Tvrtko Ursulin
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=f0ee82ec-03bd-1e02-affe-98f127b2d72a@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=niranjana.vishwanathapura@intel.com \
--cc=ramalingampc2008@gmail.com \
--cc=thomas.hellstrom@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox