iris: fix major refcounting bug with resources

DONTBLOCK -> NULL was happening after taking a reference, causing those
to live forever

This resolves the OOM problems
This commit is contained in:
Kenneth Graunke 2018-06-19 19:22:47 -07:00
parent 49f9c88801
commit a6aeca9727
1 changed files with 8 additions and 8 deletions

View File

@ -503,6 +503,14 @@ iris_transfer_map(struct pipe_context *ctx,
(usage & PIPE_TRANSFER_MAP_DIRECTLY))
return NULL;
if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&
iris_batch_references(&ice->render_batch, res->bo)) {
iris_batch_flush(&ice->render_batch);
}
if ((usage & PIPE_TRANSFER_DONTBLOCK) && iris_bo_busy(res->bo))
return NULL;
struct iris_transfer *map = calloc(1, sizeof(struct iris_transfer));
struct pipe_transfer *xfer = &map->base;
@ -522,14 +530,6 @@ iris_transfer_map(struct pipe_context *ctx,
xfer->layer_stride = isl_surf_get_array_pitch(surf);
*ptransfer = xfer;
if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&
iris_batch_references(&ice->render_batch, res->bo)) {
iris_batch_flush(&ice->render_batch);
}
if ((usage & PIPE_TRANSFER_DONTBLOCK) && iris_bo_busy(res->bo))
return NULL;
xfer->usage &= (PIPE_TRANSFER_READ |
PIPE_TRANSFER_WRITE |
PIPE_TRANSFER_UNSYNCHRONIZED |