From 8838861ea39e14038624e26a933178b4cd3ee01e Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Mon, 17 Aug 2020 14:37:03 -0700 Subject: [PATCH] iris: Upload constant resources for efficient GPU access Re-using the stream_uploader for constant data hurts performance on DG1. Constant data like uniform buffers should reside in local memory for faster GPU access. Reviewed-by: Kenneth Graunke Reviewed-by: Jordan Justen Part-of: --- src/gallium/drivers/iris/iris_context.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c index a26b59a3a49..2388f8bea52 100644 --- a/src/gallium/drivers/iris/iris_context.c +++ b/src/gallium/drivers/iris/iris_context.c @@ -217,6 +217,8 @@ iris_destroy_context(struct pipe_context *ctx) if (ctx->stream_uploader) u_upload_destroy(ctx->stream_uploader); + if (ctx->const_uploader) + u_upload_destroy(ctx->const_uploader); clear_dirty_dmabuf_set(ice); @@ -286,7 +288,14 @@ iris_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags) free(ctx); return NULL; } - ctx->const_uploader = ctx->stream_uploader; + ctx->const_uploader = u_upload_create(ctx, 1024 * 1024, + PIPE_BIND_CONSTANT_BUFFER, + PIPE_USAGE_IMMUTABLE, 0); + if (!ctx->const_uploader) { + u_upload_destroy(ctx->stream_uploader); + free(ctx); + return NULL; + } if (!create_dirty_dmabuf_set(ice)) { ralloc_free(ice);