From c75a1254a4c1b6d7ef9a93e4fcd235e9690dd778 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 20 Apr 2018 17:42:07 -0700 Subject: [PATCH] iris: Move get_command_space to iris_batch.c for reuse in blorp. it's a better interface anyway. --- src/gallium/drivers/iris/iris_batch.c | 14 +++++++++++--- src/gallium/drivers/iris/iris_batch.h | 1 + src/gallium/drivers/iris/iris_state.c | 13 ++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index 0c62f1a8abb..7d2279981bb 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -419,12 +419,20 @@ iris_require_command_space(struct iris_batch *batch, unsigned size) require_buffer_space(batch, &batch->cmdbuf, size, BATCH_SZ, MAX_BATCH_SIZE); } +void * +iris_get_command_space(struct iris_batch *batch, unsigned bytes) +{ + iris_require_command_space(batch, bytes); + void *map = batch->cmdbuf.map_next; + batch->cmdbuf.map_next += bytes; + return map; +} + void iris_batch_emit(struct iris_batch *batch, const void *data, unsigned size) { - iris_require_command_space(batch, size); - memcpy(batch->cmdbuf.map_next, data, size); - batch->cmdbuf.map_next += size; + void *map = iris_get_command_space(batch, size); + memcpy(map, data, size); } /** diff --git a/src/gallium/drivers/iris/iris_batch.h b/src/gallium/drivers/iris/iris_batch.h index 9d8f8c57467..8af1415b649 100644 --- a/src/gallium/drivers/iris/iris_batch.h +++ b/src/gallium/drivers/iris/iris_batch.h @@ -86,6 +86,7 @@ void iris_init_batch(struct iris_batch *batch, uint8_t ring); void iris_batch_free(struct iris_batch *batch); void iris_require_command_space(struct iris_batch *batch, unsigned size); +void *iris_get_command_space(struct iris_batch *batch, unsigned bytes); void iris_batch_emit(struct iris_batch *batch, const void *data, unsigned size); int _iris_batch_flush_fence(struct iris_batch *batch, diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index f217c745b82..f1ea9a49b13 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -74,15 +74,6 @@ __gen_combine_address(struct iris_batch *batch, void *location, #define __genxml_cmd_header(cmd) cmd ## _header #define __genxml_cmd_pack(cmd) cmd ## _pack -static void * -get_command_space(struct iris_batch *batch, unsigned bytes) -{ - iris_require_command_space(batch, bytes); - void *map = batch->cmdbuf.map_next; - batch->cmdbuf.map_next += bytes; - return map; -} - #define _iris_pack_command(batch, cmd, dst, name) \ for (struct cmd name = { __genxml_cmd_header(cmd) }, \ *_dst = (void *)(dst); __builtin_expect(_dst != NULL, 1); \ @@ -100,11 +91,11 @@ get_command_space(struct iris_batch *batch, unsigned bytes) _dst = NULL) #define iris_emit_cmd(batch, cmd, name) \ - _iris_pack_command(batch, cmd, get_command_space(batch, 4 * __genxml_cmd_length(cmd)), name) + _iris_pack_command(batch, cmd, iris_get_command_space(batch, 4 * __genxml_cmd_length(cmd)), name) #define iris_emit_merge(batch, dwords0, dwords1, num_dwords) \ do { \ - uint32_t *dw = get_command_space(batch, 4 * num_dwords); \ + uint32_t *dw = iris_get_command_space(batch, 4 * num_dwords); \ for (uint32_t i = 0; i < num_dwords; i++) \ dw[i] = (dwords0)[i] | (dwords1)[i]; \ VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, num_dwords)); \ -- 2.30.2