diff options
author | Marek Olšák <[email protected]> | 2017-12-01 03:05:18 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-12-05 13:30:35 +0100 |
commit | dbad0acfaf2930648d85b49f9795c36e077888f8 (patch) | |
tree | 6a373b731c3db7a85102bce1338186144e575a3c | |
parent | c7f84f6513f9cc9502b9cf3bdca9b95a6b87c98b (diff) |
gallium/u_upload_mgr: allow drivers to specify pipe_resource::flags
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/util/u_upload_mgr.c | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_upload_mgr.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a5xx/fd5_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe_common.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_context.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_resource_texture.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/virgl/virgl_context.c | 2 |
11 files changed, 22 insertions, 19 deletions
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index 4bb14d6218b..f703852be81 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -44,6 +44,7 @@ struct u_upload_mgr { unsigned default_size; /* Minimum size of the upload buffer, in bytes. */ unsigned bind; /* Bitmask of PIPE_BIND_* flags. */ enum pipe_resource_usage usage; + unsigned flags; unsigned map_flags; /* Bitmask of PIPE_TRANSFER_* flags. */ boolean map_persistent; /* If persistent mappings are supported. */ @@ -57,7 +58,7 @@ struct u_upload_mgr { struct u_upload_mgr * u_upload_create(struct pipe_context *pipe, unsigned default_size, - unsigned bind, enum pipe_resource_usage usage) + unsigned bind, enum pipe_resource_usage usage, unsigned flags) { struct u_upload_mgr *upload = CALLOC_STRUCT(u_upload_mgr); if (!upload) @@ -67,6 +68,7 @@ u_upload_create(struct pipe_context *pipe, unsigned default_size, upload->default_size = default_size; upload->bind = bind; upload->usage = usage; + upload->flags = flags; upload->map_persistent = pipe->screen->get_param(pipe->screen, @@ -94,14 +96,14 @@ u_upload_create_default(struct pipe_context *pipe) PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER | PIPE_BIND_CONSTANT_BUFFER, - PIPE_USAGE_STREAM); + PIPE_USAGE_STREAM, 0); } struct u_upload_mgr * u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload) { return u_upload_create(pipe, upload->default_size, upload->bind, - upload->usage); + upload->usage, upload->flags); } static void @@ -169,14 +171,15 @@ u_upload_alloc_buffer(struct u_upload_mgr *upload, unsigned min_size) buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */ buffer.bind = upload->bind; buffer.usage = upload->usage; + buffer.flags = upload->flags; buffer.width0 = size; buffer.height0 = 1; buffer.depth0 = 1; buffer.array_size = 1; if (upload->map_persistent) { - buffer.flags = PIPE_RESOURCE_FLAG_MAP_PERSISTENT | - PIPE_RESOURCE_FLAG_MAP_COHERENT; + buffer.flags |= PIPE_RESOURCE_FLAG_MAP_PERSISTENT | + PIPE_RESOURCE_FLAG_MAP_COHERENT; } upload->buffer = screen->resource_create(screen, &buffer); diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h index 536467eb35c..875fd9a7bb6 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.h +++ b/src/gallium/auxiliary/util/u_upload_mgr.h @@ -52,7 +52,7 @@ extern "C" { */ struct u_upload_mgr * u_upload_create(struct pipe_context *pipe, unsigned default_size, - unsigned bind, enum pipe_resource_usage usage); + unsigned bind, enum pipe_resource_usage usage, unsigned flags); /** * Create the default uploader for pipe_context. Only pipe_context::screen diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_context.c b/src/gallium/drivers/freedreno/a3xx/fd3_context.c index 476d06d43ff..3623b9cf773 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_context.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_context.c @@ -114,7 +114,7 @@ fd3_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) fd3_query_context_init(pctx); fd3_ctx->border_color_uploader = u_upload_create(pctx, 4096, 0, - PIPE_USAGE_STREAM); + PIPE_USAGE_STREAM, 0); return pctx; } diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_context.c b/src/gallium/drivers/freedreno/a4xx/fd4_context.c index 82ba94a0895..1f5546d2368 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_context.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_context.c @@ -114,7 +114,7 @@ fd4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) fd4_query_context_init(pctx); fd4_ctx->border_color_uploader = u_upload_create(pctx, 4096, 0, - PIPE_USAGE_STREAM); + PIPE_USAGE_STREAM, 0); return pctx; } diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_context.c b/src/gallium/drivers/freedreno/a5xx/fd5_context.c index 1d086338e9f..4ebbb971ad8 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_context.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_context.c @@ -114,7 +114,7 @@ fd5_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) fd5_query_context_init(pctx); fd5_ctx->border_color_uploader = u_upload_create(pctx, 4096, 0, - PIPE_USAGE_STREAM); + PIPE_USAGE_STREAM, 0); return pctx; } diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index b55fb63f000..627ba0c5702 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -425,7 +425,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.create_video_buffer = vl_video_buffer_create; r300->uploader = u_upload_create(&r300->context, 1024 * 1024, - PIPE_BIND_CUSTOM, PIPE_USAGE_STREAM); + PIPE_BIND_CUSTOM, PIPE_USAGE_STREAM, 0); r300->context.stream_uploader = r300->uploader; r300->context.const_uploader = r300->uploader; diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index d44860a2d71..d20d2f4bb04 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -696,12 +696,12 @@ bool r600_common_context_init(struct r600_common_context *rctx, return false; rctx->b.stream_uploader = u_upload_create(&rctx->b, 1024 * 1024, - 0, PIPE_USAGE_STREAM); + 0, PIPE_USAGE_STREAM, 0); if (!rctx->b.stream_uploader) return false; rctx->b.const_uploader = u_upload_create(&rctx->b, 128 * 1024, - 0, PIPE_USAGE_DEFAULT); + 0, PIPE_USAGE_DEFAULT, 0); if (!rctx->b.const_uploader) return false; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 7e7e42f3d6c..d85f9f03110 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -445,12 +445,12 @@ bool si_common_context_init(struct r600_common_context *rctx, return false; rctx->b.stream_uploader = u_upload_create(&rctx->b, 1024 * 1024, - 0, PIPE_USAGE_STREAM); + 0, PIPE_USAGE_STREAM, 0); if (!rctx->b.stream_uploader) return false; rctx->b.const_uploader = u_upload_create(&rctx->b, 128 * 1024, - 0, PIPE_USAGE_DEFAULT); + 0, PIPE_USAGE_DEFAULT, 0); if (!rctx->b.const_uploader) return false; diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index 8640da95e82..546b9f48b13 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -144,13 +144,13 @@ svga_context_create(struct pipe_screen *screen, void *priv, unsigned flags) svga->pipe.stream_uploader = u_upload_create(&svga->pipe, 1024 * 1024, PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER, - PIPE_USAGE_STREAM); + PIPE_USAGE_STREAM, 0); if (!svga->pipe.stream_uploader) goto cleanup; svga->pipe.const_uploader = u_upload_create(&svga->pipe, 128 * 1024, PIPE_BIND_CONSTANT_BUFFER, - PIPE_USAGE_STREAM); + PIPE_USAGE_STREAM, 0); if (!svga->pipe.const_uploader) goto cleanup; @@ -231,7 +231,7 @@ svga_context_create(struct pipe_screen *screen, void *priv, unsigned flags) svga->const0_upload = u_upload_create(&svga->pipe, CONST0_UPLOAD_DEFAULT_SIZE, PIPE_BIND_CONSTANT_BUFFER, - PIPE_USAGE_STREAM); + PIPE_USAGE_STREAM, 0); if (!svga->const0_upload) goto cleanup; diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 9e4d6c9fb18..71b8ebe7d42 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -1332,7 +1332,7 @@ boolean svga_texture_transfer_map_upload_create(struct svga_context *svga) { svga->tex_upload = u_upload_create(&svga->pipe, TEX_UPLOAD_DEFAULT_SIZE, - 0, PIPE_USAGE_STAGING); + 0, PIPE_USAGE_STAGING, 0); return svga->tex_upload != NULL; } diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 232d2951c0b..f1b6ef45018 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -938,7 +938,7 @@ struct pipe_context *virgl_context_create(struct pipe_screen *pscreen, vctx->primconvert = util_primconvert_create(&vctx->base, rs->caps.caps.v1.prim_mask); vctx->uploader = u_upload_create(&vctx->base, 1024 * 1024, - PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STREAM); + PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STREAM, 0); if (!vctx->uploader) goto fail; vctx->base.stream_uploader = vctx->uploader; |