On Fri, Jun 13, 2014 at 10:35:31PM +0200, Bruno Jiménez wrote: > These statuses will help track whether the items are mapped > or if they should be promoted to or demoted from the pool > --- > src/gallium/drivers/r600/compute_memory_pool.h | 7 ++++++- > src/gallium/drivers/r600/evergreen_compute.c | 12 ++++++++++++ > 2 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/src/gallium/drivers/r600/compute_memory_pool.h > b/src/gallium/drivers/r600/compute_memory_pool.h > index e94159c..166093d 100644 > --- a/src/gallium/drivers/r600/compute_memory_pool.h > +++ b/src/gallium/drivers/r600/compute_memory_pool.h > @@ -27,13 +27,18 @@ > > #include <stdlib.h> > > +#define ITEM_MAPPED_FOR_READING (1<<0) > +#define ITEM_MAPPED_FOR_WRITING (1<<1) > +#define ITEM_FOR_PROMOTING (1<<2) > +#define ITEM_FOR_DEMOTING (1<<3) > + > struct compute_memory_pool; > > struct compute_memory_item > { > int64_t id; ///ID of the memory chunk > > - int untouched; ///True if the memory contains only junk, no need to > save it for defrag > + uint32_t status; ///Will track the status of the item > > int64_t start_in_dw; ///Start pointer in dwords relative in the pool bo > int64_t size_in_dw; ///Size of the chunk in dwords
This whole structure should use c style comments /* */, but that should be fixed in a follow up patch. > diff --git a/src/gallium/drivers/r600/evergreen_compute.c > b/src/gallium/drivers/r600/evergreen_compute.c > index c152e54..9123a40 100644 > --- a/src/gallium/drivers/r600/evergreen_compute.c > +++ b/src/gallium/drivers/r600/evergreen_compute.c > @@ -659,6 +659,15 @@ static void evergreen_set_global_binding( > return; > } > > + /* We mark these items for promotion to the pool if they > + * aren't already there */ > + for (int i = 0; i < n; i++) { > + struct compute_memory_item *item = buffers[i]->chunk; > + > + if (item->start_in_dw == -1) I would prefer to encapsulate this in an is_item_in_pool() helper function. > + buffers[i]->chunk->status |= ITEM_FOR_PROMOTING; > + } > + > compute_memory_finalize_pending(pool, ctx_); > > for (int i = 0; i < n; i++) > @@ -969,6 +978,9 @@ void *r600_compute_global_transfer_map( > offset += (buffer->chunk->start_in_dw * 4); > } > > + if (usage & PIPE_TRANSFER_READ) > + buffer->chunk->status |= ITEM_MAPPED_FOR_READING; > + > COMPUTE_DBG(rctx->screen, "* r600_compute_global_transfer_map()\n" > "level = %u, usage = %u, box(x = %u, y = %u, z = %u " > "width = %u, height = %u, depth = %u)\n", level, usage, > -- > 2.0.0 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev