[Mesa-dev] [PATCH 0/9] [RFC] Solve the mapping bug

Bruno Jiménez brunojimen at gmail.com
Fri Jun 13 13:35:29 PDT 2014


Hi,

This is my latest attempt to fix the mapping bug and, so far,
it seems that it is resolved.

This series changes completely how OpenCL buffers are handled
by the r600g driver. Before this, we would add them directly to
a pool, and this pool would grow whenever we needed more space.
But this process implied destroying the pool and creating a new
one. There could be cases where a buffer would be mapped and
the pool would grow, leaving one side of the mapping pointed
to where the item was. This is the 'mapping bug'

Now, Items will have an intermediate resource, where all mappings
can be done, and when a buffer is going to be used with a kernel
it is promoted to the pool. In the case where a promoted item
is going to be mapped, it is previously demoted, so even if
the pool changes its location due to growing, the map remains
valid. In the case of a buffer mapped for reading, and used
by a kernel to read from it, we will duplicate this buffer,
having the intermediate buffer, where the user has its map, and
an item in the pool, which is the one that the kernel is going
to use.

As a summary:
Patches 1-7: These are the main part of the series, and solve
    the mapping bug.
Patch 8: Introduces some utils for managing the pool's lists

Patch 9: This is just a proof of concept for avoiding transfers
    GPU <-> GPU when using all CL Read/Write functions.
    In fact, it CAN'T land as it is because PIPE_TRANSFER_MAP_DIRECTLY
    collides with CL_MAP_WRITE_INVALIDATE_REGION

Please review and Thanks :)

Bruno Jiménez (9):
  r600g/compute: Add an intermediate resource for OpenCL buffers
  r600g/compute: Add statuses to the compute_memory_items
  r600g/compute: divide the item list in two
  r600g/compute: only move to the pool the buffers marked for promoting
  r600g/compute: avoid problems when promoting items mapped for reading
  r600g/compute: implement compute_memory_demote_item
  r600g/compute: map only against intermediate buffers
  r600g/compute: add util functions to add and remove items from lists
  r600g/compute: avoid demoting items when reading/writing

 src/gallium/drivers/r600/compute_memory_pool.c     | 313 +++++++++++++--------
 src/gallium/drivers/r600/compute_memory_pool.h     |  18 +-
 src/gallium/drivers/r600/evergreen_compute.c       |  38 ++-
 src/gallium/state_trackers/clover/api/transfer.cpp |   4 +-
 .../state_trackers/clover/core/resource.cpp        |   2 +
 5 files changed, 255 insertions(+), 120 deletions(-)

-- 
2.0.0



More information about the mesa-dev mailing list