summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-12-04 21:48:26 +0100
committerMarek Olšák <[email protected]>2013-12-12 18:48:04 +0100
commite4ef639a5700cff492fbddf7131d1cc9e52a2bb0 (patch)
tree19c5d05d7ef0169aad6499d22e3c8113ee5cbb46 /src/gallium/drivers/r600
parent7fa8fb7382285797c34ef498da7a3a4cf3a85ebe (diff)
r600g,radeonsi: fix initialized buffer range tracking for DMA, add comments
The DMA functions modify dst_offset and size and util_range_add gets wrong values. Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/evergreen_hw_context.c18
-rw-r--r--src/gallium/drivers/r600/r600_hw_context.c18
2 files changed, 24 insertions, 12 deletions
diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c
index e5d6249bcfb..85fdc4e925d 100644
--- a/src/gallium/drivers/r600/evergreen_hw_context.c
+++ b/src/gallium/drivers/r600/evergreen_hw_context.c
@@ -40,6 +40,12 @@ void evergreen_dma_copy(struct r600_context *rctx,
struct r600_resource *rdst = (struct r600_resource*)dst;
struct r600_resource *rsrc = (struct r600_resource*)src;
+ /* Mark the buffer range of destination as valid (initialized),
+ * so that transfer_map knows it should wait for the GPU when mapping
+ * that range. */
+ util_range_add(&rdst->valid_buffer_range, dst_offset,
+ dst_offset + size);
+
/* make sure that the dma ring is only one active */
rctx->b.rings.gfx.flush(rctx, RADEON_FLUSH_ASYNC);
dst_offset += r600_resource_va(&rctx->screen->b.b, dst);
@@ -71,9 +77,6 @@ void evergreen_dma_copy(struct r600_context *rctx,
src_offset += csize << shift;
size -= csize;
}
-
- util_range_add(&rdst->valid_buffer_range, dst_offset,
- dst_offset + size);
}
/* The max number of bytes to copy per packet. */
@@ -88,6 +91,12 @@ void evergreen_cp_dma_clear_buffer(struct r600_context *rctx,
assert(size);
assert(rctx->screen->b.has_cp_dma);
+ /* Mark the buffer range of destination as valid (initialized),
+ * so that transfer_map knows it should wait for the GPU when mapping
+ * that range. */
+ util_range_add(&r600_resource(dst)->valid_buffer_range, offset,
+ offset + size);
+
offset += r600_resource_va(&rctx->screen->b.b, dst);
/* Flush the cache where the resource is bound. */
@@ -141,8 +150,5 @@ void evergreen_cp_dma_clear_buffer(struct r600_context *rctx,
rctx->b.flags |= R600_CONTEXT_INV_CONST_CACHE |
R600_CONTEXT_INV_VERTEX_CACHE |
R600_CONTEXT_INV_TEX_CACHE;
-
- util_range_add(&r600_resource(dst)->valid_buffer_range, offset,
- offset + size);
}
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 11414cb6aa0..da90d631633 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -447,6 +447,12 @@ void r600_cp_dma_copy_buffer(struct r600_context *rctx,
assert(size);
assert(rctx->screen->b.has_cp_dma);
+ /* Mark the buffer range of destination as valid (initialized),
+ * so that transfer_map knows it should wait for the GPU when mapping
+ * that range. */
+ util_range_add(&r600_resource(dst)->valid_buffer_range, dst_offset,
+ dst_offset + size);
+
dst_offset += r600_resource_va(&rctx->screen->b.b, dst);
src_offset += r600_resource_va(&rctx->screen->b.b, src);
@@ -506,9 +512,6 @@ void r600_cp_dma_copy_buffer(struct r600_context *rctx,
rctx->b.flags |= R600_CONTEXT_INV_CONST_CACHE |
R600_CONTEXT_INV_VERTEX_CACHE |
R600_CONTEXT_INV_TEX_CACHE;
-
- util_range_add(&r600_resource(dst)->valid_buffer_range, dst_offset,
- dst_offset + size);
}
void r600_need_dma_space(struct r600_context *ctx, unsigned num_dw)
@@ -533,6 +536,12 @@ void r600_dma_copy(struct r600_context *rctx,
struct r600_resource *rdst = (struct r600_resource*)dst;
struct r600_resource *rsrc = (struct r600_resource*)src;
+ /* Mark the buffer range of destination as valid (initialized),
+ * so that transfer_map knows it should wait for the GPU when mapping
+ * that range. */
+ util_range_add(&rdst->valid_buffer_range, dst_offset,
+ dst_offset + size);
+
/* make sure that the dma ring is only one active */
rctx->b.rings.gfx.flush(rctx, RADEON_FLUSH_ASYNC);
@@ -555,7 +564,4 @@ void r600_dma_copy(struct r600_context *rctx,
src_offset += csize << shift;
size -= csize;
}
-
- util_range_add(&rdst->valid_buffer_range, dst_offset,
- dst_offset + size);
}