summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2015-12-19 17:54:31 +0100
committerMarek Olšák <marek.olsak@amd.com>2016-01-02 15:15:45 +0100
commitecb2da1559bcb9a9eec7ac224c8ff47b026c95ff (patch)
tree33acc93ea88f258e8941cb9270f1dfaa5195cf14 /src
parent37d0aea772a39f9ae7fe3d791e23c1be03ccf9de (diff)
u_upload_mgr: allow specifying PIPE_USAGE_* for the upload buffer
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c2
-rw-r--r--src/gallium/auxiliary/indices/u_primconvert.c3
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c3
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c10
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.h7
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c3
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c3
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_context.c3
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_context.c3
-rw-r--r--src/gallium/drivers/ilo/ilo_context.c3
-rw-r--r--src/gallium/drivers/r300/r300_context.c2
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c2
-rw-r--r--src/gallium/drivers/svga/svga_context.c3
-rw-r--r--src/gallium/drivers/vc4/vc4_context.c3
-rw-r--r--src/gallium/drivers/virgl/virgl_context.c2
-rw-r--r--src/gallium/state_trackers/nine/device9.c8
-rw-r--r--src/mesa/state_tracker/st_context.c9
17 files changed, 43 insertions, 26 deletions
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index de019ebcb02..75afebe4919 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -1177,7 +1177,7 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso)
hud->pipe = pipe;
hud->cso = cso;
hud->uploader = u_upload_create(pipe, 256 * 1024,
- PIPE_BIND_VERTEX_BUFFER);
+ PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM);
/* font */
if (!util_font_create(pipe, UTIL_FONT_FIXED_8X13, &hud->font)) {
diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c
index e21174a608f..5effd883f67 100644
--- a/src/gallium/auxiliary/indices/u_primconvert.c
+++ b/src/gallium/auxiliary/indices/u_primconvert.c
@@ -153,7 +153,8 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
}
if (!pc->upload) {
- pc->upload = u_upload_create(pc->pipe, 4096, PIPE_BIND_INDEX_BUFFER);
+ pc->upload = u_upload_create(pc->pipe, 4096, PIPE_BIND_INDEX_BUFFER,
+ PIPE_USAGE_STREAM);
}
u_upload_alloc(pc->upload, 0, new_ib.index_size * new_info.count, 4,
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 833a79cf5de..43fbd8e6452 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -320,7 +320,8 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
for (i = 0; i < 4; i++)
ctx->vertices[i][0][3] = 1; /*v.w*/
- ctx->upload = u_upload_create(pipe, 65536, PIPE_BIND_VERTEX_BUFFER);
+ ctx->upload = u_upload_create(pipe, 65536, PIPE_BIND_VERTEX_BUFFER,
+ PIPE_USAGE_STREAM);
return &ctx->base;
}
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 842a7f68e27..aa31ef2a4bd 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -43,6 +43,7 @@ struct u_upload_mgr {
unsigned default_size; /* Minimum size of the upload buffer, in bytes. */
unsigned bind; /* Bitmask of PIPE_BIND_* flags. */
+ unsigned usage; /* PIPE_USAGE_* */
unsigned map_flags; /* Bitmask of PIPE_TRANSFER_* flags. */
boolean map_persistent; /* If persistent mappings are supported. */
@@ -54,9 +55,9 @@ struct u_upload_mgr {
};
-struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
- unsigned default_size,
- unsigned bind )
+struct u_upload_mgr *
+u_upload_create(struct pipe_context *pipe, unsigned default_size,
+ unsigned bind, unsigned usage)
{
struct u_upload_mgr *upload = CALLOC_STRUCT( u_upload_mgr );
if (!upload)
@@ -65,6 +66,7 @@ struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
upload->pipe = pipe;
upload->default_size = default_size;
upload->bind = bind;
+ upload->usage = usage;
upload->map_persistent =
pipe->screen->get_param(pipe->screen,
@@ -146,7 +148,7 @@ u_upload_alloc_buffer(struct u_upload_mgr *upload,
buffer.target = PIPE_BUFFER;
buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
buffer.bind = upload->bind;
- buffer.usage = PIPE_USAGE_STREAM;
+ buffer.usage = upload->usage;
buffer.width0 = size;
buffer.height0 = 1;
buffer.depth0 = 1;
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h
index 54e839bbdff..1d933d754ae 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -44,10 +44,11 @@ struct pipe_resource;
* \param pipe Pipe driver.
* \param default_size Minimum size of the upload buffer, in bytes.
* \param bind Bitmask of PIPE_BIND_* flags.
+ * \param usage PIPE_USAGE_*
*/
-struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
- unsigned default_size,
- unsigned bind );
+struct u_upload_mgr *
+u_upload_create(struct pipe_context *pipe, unsigned default_size,
+ unsigned bind, unsigned usage);
/**
* Destroy the upload manager.
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 060f3d14eb9..e16ee3651e6 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -315,7 +315,8 @@ u_vbuf_create(struct pipe_context *pipe,
memset(mgr->fallback_vbs, ~0, sizeof(mgr->fallback_vbs));
mgr->uploader = u_upload_create(pipe, 1024 * 1024,
- PIPE_BIND_VERTEX_BUFFER);
+ PIPE_BIND_VERTEX_BUFFER,
+ PIPE_USAGE_STREAM);
return mgr;
}
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index 10ac1712f19..77688f0f99f 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -1091,7 +1091,8 @@ vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
c->pipe = pipe;
- c->upload = u_upload_create(pipe, 128 * 1024, PIPE_BIND_VERTEX_BUFFER);
+ c->upload = u_upload_create(pipe, 128 * 1024, PIPE_BIND_VERTEX_BUFFER,
+ PIPE_USAGE_STREAM);
if (!c->upload)
return false;
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_context.c b/src/gallium/drivers/freedreno/a3xx/fd3_context.c
index edc716e25c8..e47bbff5643 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_context.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_context.c
@@ -171,7 +171,8 @@ 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);
+ fd3_ctx->border_color_uploader = u_upload_create(pctx, 4096, 0,
+ PIPE_USAGE_STREAM);
return pctx;
}
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_context.c b/src/gallium/drivers/freedreno/a4xx/fd4_context.c
index f074a01b886..7d6365bbb6d 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_context.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_context.c
@@ -171,7 +171,8 @@ 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);
+ fd4_ctx->border_color_uploader = u_upload_create(pctx, 4096, 0,
+ PIPE_USAGE_STREAM);
return pctx;
}
diff --git a/src/gallium/drivers/ilo/ilo_context.c b/src/gallium/drivers/ilo/ilo_context.c
index 6c885b1bf83..6bcd0bcb8f5 100644
--- a/src/gallium/drivers/ilo/ilo_context.c
+++ b/src/gallium/drivers/ilo/ilo_context.c
@@ -190,7 +190,8 @@ ilo_context_create(struct pipe_screen *screen, void *priv, unsigned flags)
* context.
*/
ilo->uploader = u_upload_create(&ilo->base, 1024 * 1024,
- PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_INDEX_BUFFER);
+ PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_INDEX_BUFFER,
+ PIPE_USAGE_STREAM);
if (!ilo->uploader) {
ilo_context_destroy(&ilo->base);
return NULL;
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index ea47c3fff5b..82ba0435118 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -422,7 +422,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, 256 * 1024,
- PIPE_BIND_CUSTOM);
+ PIPE_BIND_CUSTOM, PIPE_USAGE_STREAM);
r300->blitter = util_blitter_create(&r300->context);
if (r300->blitter == NULL)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 7d971209305..0ab4a60a919 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -274,7 +274,7 @@ bool r600_common_context_init(struct r600_common_context *rctx,
rctx->uploader = u_upload_create(&rctx->b, 1024 * 1024,
PIPE_BIND_INDEX_BUFFER |
- PIPE_BIND_CONSTANT_BUFFER);
+ PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STREAM);
if (!rctx->uploader)
return false;
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index 460804ccd9d..b10eb45e548 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -219,7 +219,8 @@ struct pipe_context *svga_context_create(struct pipe_screen *screen,
svga->const0_upload = u_upload_create(&svga->pipe,
CONST0_UPLOAD_DEFAULT_SIZE,
- PIPE_BIND_CONSTANT_BUFFER);
+ PIPE_BIND_CONSTANT_BUFFER,
+ PIPE_USAGE_STREAM);
if (!svga->const0_upload)
goto cleanup;
diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index 59c01d86658..a0888f23265 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -255,7 +255,8 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
goto fail;
vc4->uploader = u_upload_create(pctx, 16 * 1024,
- PIPE_BIND_INDEX_BUFFER);
+ PIPE_BIND_INDEX_BUFFER,
+ PIPE_USAGE_STREAM);
vc4_debug |= saved_shaderdb_flag;
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index 6e74e9a07bc..c322503d816 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -949,7 +949,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_BIND_INDEX_BUFFER, PIPE_USAGE_STREAM);
if (!vctx->uploader)
goto fail;
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 3d3f505a827..0be83658928 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -393,13 +393,15 @@ NineDevice9_ctor( struct NineDevice9 *This,
This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS);
if (!This->driver_caps.user_vbufs)
- This->vertex_uploader = u_upload_create(This->pipe, 65536, PIPE_BIND_VERTEX_BUFFER);
+ This->vertex_uploader = u_upload_create(This->pipe, 65536,
+ PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM);
if (!This->driver_caps.user_ibufs)
- This->index_uploader = u_upload_create(This->pipe, 128 * 1024, PIPE_BIND_INDEX_BUFFER);
+ This->index_uploader = u_upload_create(This->pipe, 128 * 1024,
+ PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STREAM);
if (!This->driver_caps.user_cbufs) {
This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
This->constbuf_uploader = u_upload_create(This->pipe, This->vs_const_size,
- PIPE_BIND_CONSTANT_BUFFER);
+ PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STREAM);
}
This->driver_caps.window_space_position_support = GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 4f6d379723f..2fb792d628f 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -172,16 +172,19 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
/* Create upload manager for vertex data for glBitmap, glDrawPixels,
* glClear, etc.
*/
- st->uploader = u_upload_create(st->pipe, 65536, PIPE_BIND_VERTEX_BUFFER);
+ st->uploader = u_upload_create(st->pipe, 65536, PIPE_BIND_VERTEX_BUFFER,
+ PIPE_USAGE_STREAM);
if (!screen->get_param(screen, PIPE_CAP_USER_INDEX_BUFFERS)) {
st->indexbuf_uploader = u_upload_create(st->pipe, 128 * 1024,
- PIPE_BIND_INDEX_BUFFER);
+ PIPE_BIND_INDEX_BUFFER,
+ PIPE_USAGE_STREAM);
}
if (!screen->get_param(screen, PIPE_CAP_USER_CONSTANT_BUFFERS))
st->constbuf_uploader = u_upload_create(pipe, 128 * 1024,
- PIPE_BIND_CONSTANT_BUFFER);
+ PIPE_BIND_CONSTANT_BUFFER,
+ PIPE_USAGE_STREAM);
st->cso_context = cso_create_context(pipe);