diff options
author | Axel Davy <[email protected]> | 2016-12-18 19:21:08 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-12-20 23:47:08 +0100 |
commit | 123e947228241e743a4d0fdb8a911f57a3dd4ef9 (patch) | |
tree | 18162a7872e44fd4462fba8a5f8e53e0b94b294c /src/gallium/state_trackers/nine | |
parent | 0ec4e5f630ed68ece3f176b174cfd66eff023904 (diff) |
st/nine: Upload on secondary context for Draw*Up
Avoid synchronization by using the secondary context
for uploading the vertex data for Draw*Up.
v2: Rely on u_upload_mgr to use persistent coherent
buffers. Do not flush.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine')
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 9f2575309a5..f095ff3c862 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -274,6 +274,12 @@ NineDevice9_ctor( struct NineDevice9 *This, /* r600 and radeonsi are thread safe. */ This->csmt_active = strstr(pScreen->get_name(pScreen), "AMD") != NULL; + /* We rely on u_upload_mgr using persistent coherent buffers (which don't + * require flush to work in multi-pipe_context scenario) for vertex and + * index buffers */ + if (!GET_PCAP(BUFFER_MAP_PERSISTENT_COHERENT)) + This->csmt_active = false; + if (This->csmt_active) { This->csmt_ctx = nine_csmt_create(This); if (!This->csmt_ctx) @@ -472,13 +478,20 @@ NineDevice9_ctor( struct NineDevice9 *This, This->driver_caps.user_sw_vbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS); This->driver_caps.user_sw_cbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_CONSTANT_BUFFERS); + /* Implicit use of context pipe for vertex and index uploaded when + * csmt is not active. Does not need to sync since csmt is unactive, + * thus no need to call NineDevice9_GetPipe at each upload. */ if (!This->driver_caps.user_vbufs) - This->vertex_uploader = u_upload_create(This->context.pipe, 65536, + This->vertex_uploader = u_upload_create(This->csmt_active ? + This->pipe_secondary : This->context.pipe, + 65536, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM); This->vertex_sw_uploader = u_upload_create(This->pipe_sw, 65536, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM); if (!This->driver_caps.user_ibufs) - This->index_uploader = u_upload_create(This->context.pipe, 128 * 1024, + This->index_uploader = u_upload_create(This->csmt_active ? + This->pipe_secondary : This->context.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); @@ -2835,8 +2848,6 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This, vtxbuf.user_buffer = pVertexStreamZeroData; if (!This->driver_caps.user_vbufs) { - /* Implicit use of context pipe */ - (void)NineDevice9_GetPipe(This); u_upload_data(This->vertex_uploader, 0, (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * VertexStreamZeroStride, /* XXX */ @@ -2900,8 +2911,6 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This, if (!This->driver_caps.user_vbufs) { const unsigned base = MinVertexIndex * VertexStreamZeroStride; - /* Implicit use of context pipe */ - (void)NineDevice9_GetPipe(This); u_upload_data(This->vertex_uploader, base, NumVertices * VertexStreamZeroStride, /* XXX */ @@ -2915,8 +2924,6 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This, vbuf.user_buffer = NULL; } if (!This->driver_caps.user_ibufs) { - /* Implicit use of context pipe */ - (void)NineDevice9_GetPipe(This); u_upload_data(This->index_uploader, 0, (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * ibuf.index_size, |