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>
This commit is contained in:
Alyssa Rosenzweig 2021-05-27 23:11:18 -04:00 committed by Marge Bot
parent 6d9242e109
commit acfeba4010
4 changed files with 15 additions and 1 deletions

View File

@ -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?) */

View File

@ -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 {

View File

@ -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);

View File

@ -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,