iris: Fix FLUSH_EXPLICIT handling with staging buffers.
I neglected to blit the staging buffer back to the real one at transfer_flush_region (FlushMappedBufferRange) time.
This commit is contained in:
parent
62b2ce0592
commit
0f3dc832bc
|
@ -878,24 +878,37 @@ iris_resource_get_handle(struct pipe_screen *pscreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
iris_unmap_copy_region(struct iris_transfer *map)
|
iris_flush_staging_region(struct pipe_transfer *xfer,
|
||||||
|
const struct pipe_box *flush_box)
|
||||||
{
|
{
|
||||||
struct pipe_transfer *xfer = &map->base;
|
if (!(xfer->usage & PIPE_TRANSFER_WRITE))
|
||||||
struct pipe_box *dst_box = &xfer->box;
|
return;
|
||||||
struct pipe_box src_box = (struct pipe_box) {
|
|
||||||
.x = xfer->resource->target == PIPE_BUFFER ?
|
struct iris_transfer *map = (void *) xfer;
|
||||||
xfer->box.x % IRIS_MAP_BUFFER_ALIGNMENT : 0,
|
|
||||||
.width = dst_box->width,
|
struct pipe_box src_box = *flush_box;
|
||||||
.height = dst_box->height,
|
|
||||||
.depth = dst_box->depth,
|
/* Account for extra alignment padding in staging buffer */
|
||||||
|
if (xfer->resource->target == PIPE_BUFFER)
|
||||||
|
src_box.x += xfer->box.x % IRIS_MAP_BUFFER_ALIGNMENT;
|
||||||
|
|
||||||
|
struct pipe_box dst_box = (struct pipe_box) {
|
||||||
|
.x = xfer->box.x + flush_box->x,
|
||||||
|
.y = xfer->box.y + flush_box->y,
|
||||||
|
.z = xfer->box.z + flush_box->z,
|
||||||
|
.width = flush_box->width,
|
||||||
|
.height = flush_box->height,
|
||||||
|
.depth = flush_box->depth,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (xfer->usage & PIPE_TRANSFER_WRITE) {
|
iris_copy_region(map->blorp, map->batch, xfer->resource, xfer->level,
|
||||||
iris_copy_region(map->blorp, map->batch, xfer->resource, xfer->level,
|
dst_box.x, dst_box.y, dst_box.z, map->staging, 0,
|
||||||
dst_box->x, dst_box->y, dst_box->z, map->staging, 0,
|
&src_box);
|
||||||
&src_box);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
iris_unmap_copy_region(struct iris_transfer *map)
|
||||||
|
{
|
||||||
iris_resource_destroy(map->staging->screen, map->staging);
|
iris_resource_destroy(map->staging->screen, map->staging);
|
||||||
|
|
||||||
map->ptr = NULL;
|
map->ptr = NULL;
|
||||||
|
@ -1372,6 +1385,10 @@ iris_transfer_flush_region(struct pipe_context *ctx,
|
||||||
{
|
{
|
||||||
struct iris_context *ice = (struct iris_context *)ctx;
|
struct iris_context *ice = (struct iris_context *)ctx;
|
||||||
struct iris_resource *res = (struct iris_resource *) xfer->resource;
|
struct iris_resource *res = (struct iris_resource *) xfer->resource;
|
||||||
|
struct iris_transfer *map = (void *) xfer;
|
||||||
|
|
||||||
|
if (map->staging)
|
||||||
|
iris_flush_staging_region(xfer, box);
|
||||||
|
|
||||||
for (int i = 0; i < IRIS_BATCH_COUNT; i++) {
|
for (int i = 0; i < IRIS_BATCH_COUNT; i++) {
|
||||||
if (ice->batches[i].contains_draw ||
|
if (ice->batches[i].contains_draw ||
|
||||||
|
@ -1387,19 +1404,20 @@ iris_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer *xfer)
|
||||||
{
|
{
|
||||||
struct iris_context *ice = (struct iris_context *)ctx;
|
struct iris_context *ice = (struct iris_context *)ctx;
|
||||||
struct iris_transfer *map = (void *) xfer;
|
struct iris_transfer *map = (void *) xfer;
|
||||||
struct iris_resource *res = (struct iris_resource *) xfer->resource;
|
|
||||||
|
if (!(xfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT)) {
|
||||||
|
struct pipe_box flush_box = {
|
||||||
|
.x = 0, .y = 0, .z = 0,
|
||||||
|
.width = xfer->box.width,
|
||||||
|
.height = xfer->box.height,
|
||||||
|
.depth = xfer->box.depth,
|
||||||
|
};
|
||||||
|
iris_transfer_flush_region(ctx, xfer, &flush_box);
|
||||||
|
}
|
||||||
|
|
||||||
if (map->unmap)
|
if (map->unmap)
|
||||||
map->unmap(map);
|
map->unmap(map);
|
||||||
|
|
||||||
for (int i = 0; i < IRIS_BATCH_COUNT; i++) {
|
|
||||||
if (ice->batches[i].contains_draw ||
|
|
||||||
ice->batches[i].cache.render->entries) {
|
|
||||||
iris_batch_maybe_flush(&ice->batches[i], 24);
|
|
||||||
iris_flush_and_dirty_for_history(ice, &ice->batches[i], res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pipe_resource_reference(&xfer->resource, NULL);
|
pipe_resource_reference(&xfer->resource, NULL);
|
||||||
slab_free(&ice->transfer_pool, map);
|
slab_free(&ice->transfer_pool, map);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue