summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-11-20 22:51:26 -0800
committerKenneth Graunke <[email protected]>2019-02-21 10:26:10 -0800
commitc5b22441f1c3a77027af4306f09ea6d1f20d00ab (patch)
tree3cee2258f5b847f5970030aef98f61bf4ad19137 /src/gallium
parentbeb2d5e0657ce4c4df8956be7ef46ced90fc6994 (diff)
iris: Fix buffer -> buffer copy_region
Size can be too large for a surf, blorp_buffer_copy chops things up into segments we can actually handle Fixes map_buffer_range_test and copy_buffer_coherency
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/iris/iris_blit.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c
index 96fb8fc2768..6e6f4456072 100644
--- a/src/gallium/drivers/iris/iris_blit.c
+++ b/src/gallium/drivers/iris/iris_blit.c
@@ -395,27 +395,42 @@ iris_resource_copy_region(struct pipe_context *ctx,
unsigned src_level,
const struct pipe_box *src_box)
{
+ struct blorp_batch blorp_batch;
struct iris_context *ice = (void *) ctx;
- struct blorp_surf src_surf, dst_surf;
- iris_blorp_surf_for_resource(&src_surf, src, ISL_AUX_USAGE_NONE, false);
- iris_blorp_surf_for_resource(&dst_surf, dst, ISL_AUX_USAGE_NONE, true);
-
- // XXX: ???
- unsigned dst_layer = dstz;
- unsigned src_layer = src_box->z;
-
- assert(src_box->depth == 1);
-
struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER];
iris_batch_maybe_flush(batch, 1500);
- struct blorp_batch blorp_batch;
blorp_batch_init(&ice->blorp, &blorp_batch, batch, 0);
- blorp_copy(&blorp_batch, &src_surf, src_level, src_layer,
- &dst_surf, dst_level, dst_layer,
- src_box->x, src_box->y, dstx, dsty,
- src_box->width, src_box->height);
+
+ if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
+ struct blorp_address src_addr = {
+ .buffer = iris_resource_bo(src), .offset = src_box->x,
+ };
+ struct blorp_address dst_addr = {
+ .buffer = iris_resource_bo(dst), .offset = dstx,
+ };
+
+ blorp_buffer_copy(&blorp_batch, src_addr, dst_addr, src_box->width);
+ } else {
+ // XXX: what about one surface being a buffer and not the other?
+
+ struct blorp_surf src_surf, dst_surf;
+ iris_blorp_surf_for_resource(&src_surf, src, ISL_AUX_USAGE_NONE, false);
+ iris_blorp_surf_for_resource(&dst_surf, dst, ISL_AUX_USAGE_NONE, true);
+
+ // XXX: ???
+ unsigned dst_layer = dstz;
+ unsigned src_layer = src_box->z;
+
+ assert(src_box->depth == 1);
+
+ blorp_copy(&blorp_batch, &src_surf, src_level, src_layer,
+ &dst_surf, dst_level, dst_layer,
+ src_box->x, src_box->y, dstx, dsty,
+ src_box->width, src_box->height);
+ }
+
blorp_batch_finish(&blorp_batch);
}