[Mesa-dev] [PATCH 0/9] anv: Implement VK_KHX_external_semaphore_*

Jason Ekstrand jason at jlekstrand.net
Tue Feb 28 16:56:38 UTC 2017


This patch series implements VK_KHX_external_semaphore and supports both
the OPAQUE_FD and FENCE_FD semaphore import/export.  I would like to land
patch 1 quickly but the others may sit on the list for a while.

Working on this series made me realize a very subtle issue: GEM handle
reference counting.  If we have two Vulkan instances in the same process or
a Vulkan and a GL instance, you can export memory from one and import it
into the other.  However, if we're not careful, we can run into issues
where one of them closes the GEM handle and destroys it for the other one.
The classic solution to this problem is to use libdrm for BO management and
it has a BO pool that's shared by all contexts in the current process.
However, in order to avoid the big fat global lock in libdrm, we made the
choice early on in Vulkan driver development to not use libdrm.  Maybe we
should start using libdrm for most BO allocations?  I'm open to
suggestions.

Cc: Chad Versace <chadversary at chromium.org>
Cc: Kristian H. Kristensen <hoegsberg at gmail.com>

Jason Ekstrand (9):
  anv: Move queues, events, and semaphores to their own file
  anv: Add a real semaphore struct
  anv: Implement VK_KHX_external_semaphore_capabilities
  anv: Implement VK_KHX_external_semaphore
  anv/cmd_buffer: Use the device allocator for QueueSubmit
  anv: Pull the guts of cmd_buffer_execbuf into a helper
  anv: Implement VK_KHX_external_semaphore_fd
  anv/gem: Use EXECBUFFER2_WR when the FENCE_OUT flag is set
  anv: Implement support for exporting semaphores as FENCE_FD

 src/intel/vulkan/Makefile.sources       |   1 +
 src/intel/vulkan/anv_batch_chain.c      | 180 +++++++--
 src/intel/vulkan/anv_device.c           | 464 ++-------------------
 src/intel/vulkan/anv_entrypoints_gen.py |   3 +
 src/intel/vulkan/anv_gem.c              |  41 +-
 src/intel/vulkan/anv_private.h          |  31 +-
 src/intel/vulkan/anv_queue.c            | 690 ++++++++++++++++++++++++++++++++
 7 files changed, 948 insertions(+), 462 deletions(-)
 create mode 100644 src/intel/vulkan/anv_queue.c

-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list