[Mesa-dev] [PATCH 0/6] anv: Do relocations in userspace

Jason Ekstrand jason at jlekstrand.net
Tue Nov 1 22:35:07 UTC 2016

This series is a revival of a patch of Kristian's from earlier this year to
do relocations in userspace before handing the batch off to the kernel.
The kernel refuses to write a relocation into a busy buffer (for obvious
reasons).  Because we use a single surface state buffer that is shared
across batches, it is basically always busy so the kernel always stalls
before writing relocations.  Due to the way the driver is structured,
however, we know that it's always safe to write the relocations even when
it's busy.  By doing relocations in userspace, we can take advantage of
this knowledge and avoid the kernel stalls.

I've suspected for a while that something in the kernel was causing us
performance problems but thought we had already solved this particular
problem.  It turns out we hadn't and that this was 100% of our performance
problem.  With these patches, Dota 2 runs about 30% faster my Sky Lake GT2.
It now runs faster on Vulkan than it does on GL.  Talos shows a simlar
improvement but it's hard to measure since I haven't figured out how to
automatically benchmark it.

Jason Ekstrand (5):
  anv: Don't presume to know what address is in a surface relocation
  anv: Add a new bo_pool_init helper
  anv/allocator: Simplify anv_scratch_pool
  anv: Initialize anv_bo::offset to -1
  anv/device: Add an execbuf wrapper

Kristian Høgsberg (1):
  anv: Do relocations in userspace before execbuf ioctl

 src/intel/vulkan/anv_allocator.c   | 118 +++++++++++---------------
 src/intel/vulkan/anv_batch_chain.c |  57 ++++---------
 src/intel/vulkan/anv_device.c      | 167 +++++++++++++++++++++++++++++++------
 src/intel/vulkan/anv_intel.c       |  11 ++-
 src/intel/vulkan/anv_private.h     |  24 +++++-
 5 files changed, 231 insertions(+), 146 deletions(-)


More information about the mesa-dev mailing list