On Tue, Feb 28, 2017 at 08:56:45AM -0800, Jason Ekstrand wrote: > This implementation allocates a 4k BO for each semaphore that can be > exported using OPAQUE_FD and uses the kernel's already-existing > synchronization mechanism on BOs. > --- > VkResult > anv_cmd_buffer_execbuf(struct anv_device *device, > - struct anv_cmd_buffer *cmd_buffer) > + struct anv_cmd_buffer *cmd_buffer, > + const VkSemaphore *in_semaphores, > + uint32_t num_in_semaphores, > + const VkSemaphore *out_semaphores, > + uint32_t num_out_semaphores) > { > struct anv_execbuf execbuf; > anv_execbuf_init(&execbuf); > > + for (uint32_t i = 0; i < num_in_semaphores; i++) { > + ANV_FROM_HANDLE(anv_semaphore, semaphore, in_semaphores[i]); > + assert(semaphore->temporary.type == ANV_SEMAPHORE_TYPE_NONE); > + struct anv_semaphore_impl *impl = &semaphore->permanent; > + > + switch (impl->type) { > + case ANV_SEMAPHORE_TYPE_BO: > + anv_execbuf_add_bo(&execbuf, &impl->bo, NULL, 0, &device->alloc); > + break; > + default: > + break; > + } > + }
Do the in/out semaphores[] have any constraints against repeated use? If you pass in the same handle twice into the execbuf, it will EINVAL. (Both within the in/out arrays and between them.) Or does execbuf_add_bo do a repeated use check? > + for (uint32_t i = 0; i < num_out_semaphores; i++) { > + ANV_FROM_HANDLE(anv_semaphore, semaphore, out_semaphores[i]); > + assert(semaphore->temporary.type == ANV_SEMAPHORE_TYPE_NONE); > + struct anv_semaphore_impl *impl = &semaphore->permanent; > + > + switch (impl->type) { > + case ANV_SEMAPHORE_TYPE_BO: > + anv_execbuf_add_bo(&execbuf, &impl->bo, NULL, EXEC_OBJECT_WRITE, > + &device->alloc); > + break; > + default: > + break; > + } > + } Seperate in/out arrays curtains the issues I could see with the implicit fences accidentally serialising input-only semaphores. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev