iris: Move get_command_space to iris_batch.c
for reuse in blorp. it's a better interface anyway.
This commit is contained in:
@@ -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);
|
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
|
void
|
||||||
iris_batch_emit(struct iris_batch *batch, const void *data, unsigned size)
|
iris_batch_emit(struct iris_batch *batch, const void *data, unsigned size)
|
||||||
{
|
{
|
||||||
iris_require_command_space(batch, size);
|
void *map = iris_get_command_space(batch, size);
|
||||||
memcpy(batch->cmdbuf.map_next, data, size);
|
memcpy(map, data, size);
|
||||||
batch->cmdbuf.map_next += size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -86,6 +86,7 @@ void iris_init_batch(struct iris_batch *batch,
|
|||||||
uint8_t ring);
|
uint8_t ring);
|
||||||
void iris_batch_free(struct iris_batch *batch);
|
void iris_batch_free(struct iris_batch *batch);
|
||||||
void iris_require_command_space(struct iris_batch *batch, unsigned size);
|
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);
|
void iris_batch_emit(struct iris_batch *batch, const void *data, unsigned size);
|
||||||
|
|
||||||
int _iris_batch_flush_fence(struct iris_batch *batch,
|
int _iris_batch_flush_fence(struct iris_batch *batch,
|
||||||
|
@@ -74,15 +74,6 @@ __gen_combine_address(struct iris_batch *batch, void *location,
|
|||||||
#define __genxml_cmd_header(cmd) cmd ## _header
|
#define __genxml_cmd_header(cmd) cmd ## _header
|
||||||
#define __genxml_cmd_pack(cmd) cmd ## _pack
|
#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) \
|
#define _iris_pack_command(batch, cmd, dst, name) \
|
||||||
for (struct cmd name = { __genxml_cmd_header(cmd) }, \
|
for (struct cmd name = { __genxml_cmd_header(cmd) }, \
|
||||||
*_dst = (void *)(dst); __builtin_expect(_dst != NULL, 1); \
|
*_dst = (void *)(dst); __builtin_expect(_dst != NULL, 1); \
|
||||||
@@ -100,11 +91,11 @@ get_command_space(struct iris_batch *batch, unsigned bytes)
|
|||||||
_dst = NULL)
|
_dst = NULL)
|
||||||
|
|
||||||
#define iris_emit_cmd(batch, cmd, name) \
|
#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) \
|
#define iris_emit_merge(batch, dwords0, dwords1, num_dwords) \
|
||||||
do { \
|
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++) \
|
for (uint32_t i = 0; i < num_dwords; i++) \
|
||||||
dw[i] = (dwords0)[i] | (dwords1)[i]; \
|
dw[i] = (dwords0)[i] | (dwords1)[i]; \
|
||||||
VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, num_dwords)); \
|
VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, num_dwords)); \
|
||||||
|
Reference in New Issue
Block a user