aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/compute_memory_pool.c
diff options
context:
space:
mode:
authorBruno JimĂ©nez <[email protected]>2014-06-18 17:01:56 +0200
committerTom Stellard <[email protected]>2014-06-20 13:44:00 -0400
commit0b8c29915ba9451e57b256a3c7e0abb986739937 (patch)
tree52ddebf08848226241dfddea12b99448e47e6c67 /src/gallium/drivers/r600/compute_memory_pool.c
parent3da1b17555be3ed33489992baf3d14b2d0743524 (diff)
r600g/compute: Avoid problems when promoting items mapped for reading
Acording to the OpenCL spec, it is possible to have a buffer mapped for reading and at read from it using commands or buffers. With this we can keep the mapping (that exists against the temporary item) and read with a kernel (from the item we have just added to the pool) without problems. Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/compute_memory_pool.c')
-rw-r--r--src/gallium/drivers/r600/compute_memory_pool.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
index 5b1ee148b59..f232f9fbc4f 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -375,10 +375,14 @@ int compute_memory_promote_item(struct compute_memory_pool *pool,
dst, 0, item->start_in_dw * 4, 0 ,0,
src, 0, &box);
- pool->screen->b.b.resource_destroy(
- screen, src);
-
- item->real_buffer = NULL;
+ /* We check if the item is mapped for reading.
+ * In this case, we need to keep the temporary buffer 'alive'
+ * because it is possible to keep a map active for reading
+ * while a kernel (that reads from it) executes */
+ if (!(item->status & ITEM_MAPPED_FOR_READING)) {
+ pool->screen->b.b.resource_destroy(screen, src);
+ item->real_buffer = NULL;
+ }
return 0;
}