summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>2021-05-27 23:11:18 -0400
committerMarge Bot <eric+marge@anholt.net>2021-05-30 23:32:01 +0000
commitacfeba4010f830399d0413fedf52dcaa04d60fbb (patch)
tree585094c5d241e3fad9bd5e770d5200d470851e25
parent6d9242e109ea1edb534643528db287167c829480 (diff)
agx: Add scissor upload BO
Not sure what the proper data structure for this is yet, but this will hold over until we start optimizing for memory usage. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11084>
-rw-r--r--src/gallium/drivers/asahi/agx_pipe.c4
-rw-r--r--src/gallium/drivers/asahi/agx_state.h8
-rw-r--r--src/gallium/drivers/asahi/magic.c3
-rw-r--r--src/gallium/drivers/asahi/magic.h1
4 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c
index cae9cbdc787..e6c82733d71 100644
--- a/src/gallium/drivers/asahi/agx_pipe.c
+++ b/src/gallium/drivers/asahi/agx_pipe.c
@@ -396,6 +396,7 @@ agx_flush(struct pipe_context *pctx,
struct agx_batch *batch = ctx->batch;
agx_batch_add_bo(batch, batch->encoder);
+ agx_batch_add_bo(batch, batch->scissor.bo);
agx_batch_add_bo(batch, dev->internal.bo);
for (unsigned i = 0; i < batch->nr_cbufs; ++i) {
@@ -439,6 +440,7 @@ agx_flush(struct pipe_context *pctx,
dev->cmdbuf.size,
&ctx->batch->pool,
ctx->batch->encoder->ptr.gpu,
+ ctx->batch->scissor.bo->ptr.gpu,
ctx->batch->width,
ctx->batch->height,
pipeline_null.gpu,
@@ -463,6 +465,7 @@ agx_flush(struct pipe_context *pctx,
ctx->batch->clear = 0;
ctx->batch->draw = 0;
ctx->batch->encoder_current = ctx->batch->encoder->ptr.cpu;
+ ctx->batch->scissor.count = 0;
ctx->dirty = ~0;
}
@@ -501,6 +504,7 @@ agx_create_context(struct pipe_screen *screen,
agx_device(screen), AGX_MEMORY_TYPE_SHADER, true);
ctx->batch->encoder = agx_bo_create(agx_device(screen), 0x80000, AGX_MEMORY_TYPE_FRAMEBUFFER);
ctx->batch->encoder_current = ctx->batch->encoder->ptr.cpu;
+ ctx->batch->scissor.bo = agx_bo_create(agx_device(screen), 0x80000, AGX_MEMORY_TYPE_FRAMEBUFFER);
/* Upload fixed shaders (TODO: compile them?) */
diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h
index 2a6735c059f..420eeec496f 100644
--- a/src/gallium/drivers/asahi/agx_state.h
+++ b/src/gallium/drivers/asahi/agx_state.h
@@ -74,6 +74,12 @@ struct agx_stage {
unsigned texture_count;
};
+/* Uploaded scissor descriptors */
+struct agx_scissors {
+ struct agx_bo *bo;
+ unsigned count;
+};
+
struct agx_batch {
unsigned width, height, nr_cbufs;
struct pipe_surface *cbufs[8];
@@ -91,6 +97,8 @@ struct agx_batch {
struct agx_pool pool, pipeline_pool;
struct agx_bo *encoder;
uint8_t *encoder_current;
+
+ struct agx_scissors scissor;
};
struct agx_zsa {
diff --git a/src/gallium/drivers/asahi/magic.c b/src/gallium/drivers/asahi/magic.c
index 490f62d3557..66057ffd446 100644
--- a/src/gallium/drivers/asahi/magic.c
+++ b/src/gallium/drivers/asahi/magic.c
@@ -55,6 +55,7 @@ void
demo_cmdbuf(uint64_t *buf, size_t size,
struct agx_pool *pool,
uint64_t encoder_ptr,
+ uint64_t scissor_ptr,
unsigned width, unsigned height,
uint32_t pipeline_null,
uint32_t pipeline_clear,
@@ -135,7 +136,7 @@ demo_cmdbuf(uint64_t *buf, size_t size,
EMIT32(cmdbuf, 0);
EMIT32(cmdbuf, 0x12);
EMIT64(cmdbuf, pipeline_store | 0x4);
- EMIT64(cmdbuf, demo_zero(pool, 0x1000)); // Pointer to scissor descriptor
+ EMIT64(cmdbuf, scissor_ptr);
EMIT64(cmdbuf, demo_zero(pool, 0x1000));
EMIT64(cmdbuf, 0);
diff --git a/src/gallium/drivers/asahi/magic.h b/src/gallium/drivers/asahi/magic.h
index 25b79b004b2..61c4795b48b 100644
--- a/src/gallium/drivers/asahi/magic.h
+++ b/src/gallium/drivers/asahi/magic.h
@@ -2,6 +2,7 @@ void
demo_cmdbuf(uint64_t *buf, size_t size,
struct agx_pool *pool,
uint64_t encoder_ptr,
+ uint64_t scissor_ptr,
unsigned width, unsigned height,
uint32_t pipeline_null,
uint32_t pipeline_clear,