From a6aeca972719ac85f6d333b4178375a626983e43 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 19 Jun 2018 19:22:47 -0700 Subject: [PATCH] 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 --- src/gallium/drivers/iris/iris_resource.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index f4e9318d297..df910a5b213 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -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 | -- 2.30.2