Module: Mesa Branch: main Commit: 3b78f175323f1db5ae28da264d5761bebb4f7052 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b78f175323f1db5ae28da264d5761bebb4f7052
Author: Kenneth Graunke <[email protected]> Date: Mon Nov 15 19:14:01 2021 -0800 iris: Tidy code in iris_use_pinned_bo a bit Now that we aren't short-circuiting most of the code, we should probably reorganize it a little bit. Tagged with fixes just so we pull all the refactors together as one group. Fixes: b21e916a628 ("iris: Combine iris_use_pinned_bo and add_exec_bo") Reviewed-by: Paulo Zanoni <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13808> --- src/gallium/drivers/iris/iris_batch.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index da4a9863c99..0e78c834e0c 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -360,20 +360,17 @@ iris_use_pinned_bo(struct iris_batch *batch, int existing_index = find_exec_index(batch, bo); - if (existing_index != -1) { - /* The BO is already in the list; mark it writable */ - if (writable && !BITSET_TEST(batch->bos_written, existing_index)) { - BITSET_SET(batch->bos_written, existing_index); - flush_for_cross_batch_dependencies(batch, bo, writable); - } - - return; - } + if (existing_index == -1) { + flush_for_cross_batch_dependencies(batch, bo, writable); - flush_for_cross_batch_dependencies(batch, bo, writable); + ensure_exec_obj_space(batch, 1); + add_bo_to_batch(batch, bo, writable); + } else if (writable && !BITSET_TEST(batch->bos_written, existing_index)) { + flush_for_cross_batch_dependencies(batch, bo, writable); - ensure_exec_obj_space(batch, 1); - add_bo_to_batch(batch, bo, writable); + /* The BO is already in the list; mark it writable */ + BITSET_SET(batch->bos_written, existing_index); + } } static void
