iris: Move get_command_space to iris_batch.c
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 21 Apr 2018 00:42:07 +0000 (17:42 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:06 +0000 (10:26 -0800)
for reuse in blorp.  it's a better interface anyway.

src/gallium/drivers/iris/iris_batch.c
src/gallium/drivers/iris/iris_batch.h
src/gallium/drivers/iris/iris_state.c

index 0c62f1a8abb6acc15403e7f9934a7706771fabe6..7d2279981bb3412d975120f9dfba4a304d519a6a 100644 (file)
@@ -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);
 }
 
 /**
index 9d8f8c574679d27b03b90617f15f75550ecad2bc..8af1415b6496ed7935b694464c96095f1ac0695e 100644 (file)
@@ -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,
index f217c745b82c32e69174f5d63205ab0f0c917a2d..f1ea9a49b132dd6c3a3ffe478e35f137150caf1e 100644 (file)
@@ -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));       \