diff options
author | Qiang Yu <[email protected]> | 2020-02-09 09:37:53 +0800 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-17 02:54:15 +0000 |
commit | e90d8b6e4d135d58e9346220a652b4835c843d07 (patch) | |
tree | 057b011464ac711c206cb0773a11f0e23082e9eb /src | |
parent | 5c78ba60140ec48996dc4ebcfff0674229a4afd4 (diff) |
lima: add lima_submit_create_stream_bo
For creating stream buffer which is used in single submit
and freed after the submit is passed to kernel driver.
Reviewed-by: Vasily Khoruzhick <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/lima/lima_submit.c | 35 | ||||
-rw-r--r-- | src/gallium/drivers/lima/lima_submit.h | 2 |
2 files changed, 26 insertions, 11 deletions
diff --git a/src/gallium/drivers/lima/lima_submit.c b/src/gallium/drivers/lima/lima_submit.c index 43dac226d98..af51ab70b17 100644 --- a/src/gallium/drivers/lima/lima_submit.c +++ b/src/gallium/drivers/lima/lima_submit.c @@ -170,6 +170,27 @@ bool lima_submit_has_bo(struct lima_submit *submit, struct lima_bo *bo, bool all return false; } +void * +lima_submit_create_stream_bo(struct lima_submit *submit, int pipe, + unsigned size, uint32_t *va) +{ + struct lima_context *ctx = submit->ctx; + + void *cpu; + unsigned offset; + struct pipe_resource *pres = NULL; + u_upload_alloc(ctx->uploader, 0, size, 0x40, &offset, &pres, &cpu); + + struct lima_resource *res = lima_resource(pres); + *va = res->bo->va + offset; + + lima_submit_add_bo(submit, pipe, res->bo, LIMA_SUBMIT_BO_READ); + + pipe_resource_reference(&pres, NULL); + + return cpu; +} + static inline bool lima_submit_dirty(struct lima_submit *submit) { @@ -228,14 +249,9 @@ lima_pack_reload_plbu_cmd(struct lima_submit *submit) struct lima_context *ctx = submit->ctx; - void *cpu; - unsigned offset; - struct pipe_resource *pres = NULL; - u_upload_alloc(ctx->uploader, 0, lima_reload_buffer_size, - 0x40, &offset, &pres, &cpu); - - struct lima_resource *res = lima_resource(pres); - uint32_t va = res->bo->va + offset; + uint32_t va; + void *cpu = lima_submit_create_stream_bo( + submit, LIMA_PIPE_PP, lima_reload_buffer_size, &va); struct lima_screen *screen = lima_screen(ctx->base.screen); @@ -289,9 +305,6 @@ lima_pack_reload_plbu_cmd(struct lima_submit *submit) memcpy(cpu + lima_reload_varying_offset, reload_varying, sizeof(reload_varying)); - lima_submit_add_bo(submit, LIMA_PIPE_PP, res->bo, LIMA_SUBMIT_BO_READ); - pipe_resource_reference(&pres, NULL); - PLBU_CMD_BEGIN(&ctx->plbu_cmd_head, 20); PLBU_CMD_VIEWPORT_LEFT(0); diff --git a/src/gallium/drivers/lima/lima_submit.h b/src/gallium/drivers/lima/lima_submit.h index 25cd5e31eb8..47203107120 100644 --- a/src/gallium/drivers/lima/lima_submit.h +++ b/src/gallium/drivers/lima/lima_submit.h @@ -34,6 +34,8 @@ struct lima_bo; bool lima_submit_add_bo(struct lima_submit *submit, int pipe, struct lima_bo *bo, uint32_t flags); bool lima_submit_has_bo(struct lima_submit *submit, struct lima_bo *bo, bool all); +void *lima_submit_create_stream_bo(struct lima_submit *submit, int pipe, + unsigned size, uint32_t *va); bool lima_submit_init(struct lima_context *ctx); void lima_submit_fini(struct lima_context *ctx); |