[Mesa-dev] [PATCH 9/9] anv: Implement support for exporting semaphores as FENCE_FD
Jason Ekstrand
jason at jlekstrand.net
Tue Feb 28 17:29:52 UTC 2017
On Tue, Feb 28, 2017 at 9:25 AM, Chris Wilson <chris at chris-wilson.co.uk>
wrote:
> On Tue, Feb 28, 2017 at 08:56:47AM -0800, Jason Ekstrand wrote:
> > ---
> > src/intel/vulkan/anv_batch_chain.c | 91 ++++++++++++++++++++++++++++++
> ++++++--
> > src/intel/vulkan/anv_device.c | 26 +++++++++++
> > src/intel/vulkan/anv_gem.c | 36 +++++++++++++++
> > src/intel/vulkan/anv_private.h | 9 +++-
> > src/intel/vulkan/anv_queue.c | 68 +++++++++++++++++++++++++---
> > 5 files changed, 220 insertions(+), 10 deletions(-)
> >
> > diff --git a/src/intel/vulkan/anv_batch_chain.c
> b/src/intel/vulkan/anv_batch_chain.c
> > index 3640588..004594a 100644
> > --- a/src/intel/vulkan/anv_batch_chain.c
> > +++ b/src/intel/vulkan/anv_batch_chain.c
> > @@ -1352,6 +1352,28 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf
> *execbuf,
> > }
> > }
> >
> > +static void
> > +setup_empty_execbuf(struct anv_execbuf *execbuf, struct anv_device
> *device)
> > +{
> > + anv_execbuf_add_bo(execbuf, &device->trivial_batch_bo, NULL, 0,
> > + &device->alloc);
> > +
> > + execbuf->execbuf = (struct drm_i915_gem_execbuffer2) {
>
> Does mesa check for gcc > 4.4?
>
We use designated initializers all over the place. This won't be the first
thing to not compile on old gcc.
>
> > + .buffers_ptr = (uintptr_t) execbuf->objects,
> > + .buffer_count = execbuf->bo_count,
> > + .batch_start_offset = 0,
> > + .batch_len = 8, /* GEN8_MI_BATCH_BUFFER_END and NOOP */
>
> > + .cliprects_ptr = 0,
> > + .num_cliprects = 0,
> > + .DR1 = 0,
> > + .DR4 = 0,
>
> Best left to the compiler to clear, and don't mention DRI1 leftovers.
>
Fair enough. I can do a pre-patch or a follow-on to get rid of those.
> > + .flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER |
> > + I915_EXEC_CONSTANTS_REL_GENERAL,
>
> Just drop EXEC_CONSTANTS; it is entirely dead and best forgotten.
>
Yeah...
> > + .rsvd1 = device->context_id,
> > + .rsvd2 = 0,
> > + };
> > +}
>
>
> > VkResult
> > anv_cmd_buffer_execbuf(struct anv_device *device,
> > struct anv_cmd_buffer *cmd_buffer,
>
> > + if (need_out_fence)
> > + execbuf.execbuf.flags |= I915_EXEC_FENCE_OUT;
> >
> > VkResult result = anv_device_execbuf(device, &execbuf.execbuf,
> execbuf.bos);
> >
> > + if (need_out_fence) {
> > + int out_fence = execbuf.execbuf.rsvd2 >> 32;
> > + for (uint32_t i = 0; i < num_out_semaphores; i++) {
> > + ANV_FROM_HANDLE(anv_semaphore, semaphore, out_semaphores[i]);
> > + /* Out fences can't have temporary state because that would
> imply
> > + * that we imported a sync file and are trying to signal it.
> > + */
> > + assert(semaphore->temporary.type == ANV_SEMAPHORE_TYPE_NONE);
> > + struct anv_semaphore_impl *impl = &semaphore->permanent;
> > +
> > + if (impl->type == ANV_SEMAPHORE_TYPE_SYNC_FILE) {
> > + assert(impl->fd == -1);
> > + impl->fd = dup(out_fence);
>
> out_fence will still be zero/stdin if anv_device_execbuf() failed.
>
Good catch! Best not to close stdin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170228/5e76ff78/attachment.html>
More information about the mesa-dev
mailing list