From: Keith Packard <keithp@keithp.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: mesa-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] intel: Track known prime buffers for re-use
Date: Mon, 25 Nov 2013 13:21:42 -0800 [thread overview]
Message-ID: <86eh645g9l.fsf@miki.keithp.com> (raw)
In-Reply-To: <20131125153946.GC27344@phenom.ffwll.local>
[-- Attachment #1.1: Type: text/plain, Size: 2399 bytes --]
Daniel Vetter <daniel@ffwll.ch> writes:
> Yeah, it unfortunately took a few rounds of kernel fixes and other
> haggling to get the semantics right on this one. The kernel atm promises
> to userspace (minus one big in a racy corner case no one should care
> about, still need to fix that one) that it'll return the same gem handle
> if userspace already has one for the underlying object.
That's definitely something we want it to do -- returning different
handles to the same object would result in madness. We just need to deal with the
userspace consequences.
> We need that to make sure userspace doesn't submit the same bo in execbuf
> multiple times and then upsets the kernel - we'll reject such batches as
> userspace bugs.
Oh, I'm well aware of that; you can imagine the adventures I had trying
to debug this...
>> - DRMINITLISTHEAD(&bo_gem->name_list);
>> DRMINITLISTHEAD(&bo_gem->vma_list);
>> + DRMLISTADDTAIL(&bo_gem->name_list, &bufmgr_gem->prime);
>
> Won't this result in us having fun when a buffer is both imported from a
> prime buffer and then also used with legacy flink? Or is this something
> the X server won't support?
Well, the whole point of prime-based FD buffer passing is to *not* use
flink, of course. However, you could use both DRI2 and DRI3 on
the same pixmap (presumably through different APIs).
Ok, I just tried to create a completely separate prime list for this,
and I think that's wrong. If the question is whether the kernel might
return the same object from two calls, then we'd best actually keep a
single list and look things up for both APIs there. *and*, I think we
need to do the flink->gem handle conversion and then look in the list
again to see if that gem handle was already returned from another flink
or prime fd.
> The second one is about exporting: With flink names we also add the name
> to the lookup list in drm_intel_gem_bo_flink. I think we should do the
> same for exported prime buffers just as a precaution - the kernel will
> return the (existing) gem name also for a prime buffer that has been
> exported by yourself. I guess that would imply insane userspace, but
> better safe than sorry.
yeah, that would seem like crazy user-space behaviour, but user space
often seems insane.
Thanks for your review; replacement patch to follow shortly.
--
keith.packard@intel.com
[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2013-11-25 21:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-22 13:35 [PATCH] intel: Track known prime buffers for re-use Keith Packard
2013-11-25 15:39 ` [Mesa-dev] " Daniel Vetter
2013-11-25 21:21 ` Keith Packard [this message]
2013-11-25 21:22 ` Keith Packard
2013-11-26 9:42 ` Daniel Vetter
2013-11-26 11:40 ` Keith Packard
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=86eh645g9l.fsf@miki.keithp.com \
--to=keithp@keithp.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox