[Mesa-dev] [PATCH v2] anv: add support for allocating more than 1 block of memory

Juan A. Suarez Romero jasuarez at igalia.com
Wed Mar 15 12:05:26 UTC 2017


The current ANV allocator is restricted to allocate just 1 block of memory,
which causes crashes in some Vulkan CTS tests. This patch allows to allocate
more than 1 block.

This is a re-work for the first version, which had issues due the nature of the
lock-free free-list.

In this version, instead of one list of free-blocks, we use an array: N-th list
keeps a list of free blocks that are N+1 consecutives. This array is 256
elements, meaning that we can request up to 256 blocks. If this is too much (or
too low), we can tune it.

Thus, if a program requests, let's say, 16 blocks of memory, we pull it from
free_list[15]. If this list is empty, we search in the list of bigger blocks,
pull one, split it, and returning back to the free_list the blocks we are not
using. Finally, if none is available, then we pull a fresh blocks.

Other than that, it works like the previous patch: when pulling fresh blocks, we
grow up the pool if no space is available.


Juan A. Suarez Romero (1):
  anv: add support for allocating more than 1 block of memory

 src/intel/vulkan/anv_allocator.c   | 81 +++++++++++++++++++++++++++-----------
 src/intel/vulkan/anv_batch_chain.c |  4 +-
 src/intel/vulkan/anv_private.h     |  7 +++-
 3 files changed, 66 insertions(+), 26 deletions(-)

-- 
2.9.3



More information about the mesa-dev mailing list