From 31f8b3babb5a2d685d6e8b8ed0a2120c7966e9b1 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Wed, 15 Mar 2017 22:29:12 +0100 Subject: [PATCH] st/nine: Fix user vertex data uploader with csmt Fix regression caused by abb1c645c476b5dd289ce3efae0594f8796f9cf8 The patch made csmt use context.pipe instead of secondary_pipe, leading to thread safety issues. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/device9.c | 15 +++++++-------- src/gallium/state_trackers/nine/device9.h | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 843716207d6..4943658934a 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -476,6 +476,7 @@ NineDevice9_ctor( struct NineDevice9 *This, This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS); 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); + This->vertex_uploader = This->csmt_active ? This->pipe_secondary->stream_uploader : This->context.pipe->stream_uploader; if (!This->driver_caps.user_cbufs) This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT); This->driver_caps.window_space_position_support = GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION); @@ -2817,17 +2818,15 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This, vtxbuf.buffer = NULL; vtxbuf.user_buffer = pVertexStreamZeroData; - /* csmt is unactive when user vertex or index buffers are used, thus no - * need to call NineDevice9_GetPipe. */ if (!This->driver_caps.user_vbufs) { - u_upload_data(This->context.pipe->stream_uploader, + u_upload_data(This->vertex_uploader, 0, (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * VertexStreamZeroStride, /* XXX */ 4, vtxbuf.user_buffer, &vtxbuf.buffer_offset, &vtxbuf.buffer); - u_upload_unmap(This->context.pipe->stream_uploader); + u_upload_unmap(This->vertex_uploader); vtxbuf.user_buffer = NULL; } @@ -2883,27 +2882,27 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This, if (!This->driver_caps.user_vbufs) { const unsigned base = MinVertexIndex * VertexStreamZeroStride; - u_upload_data(This->context.pipe->stream_uploader, + u_upload_data(This->vertex_uploader, base, NumVertices * VertexStreamZeroStride, /* XXX */ 4, (const uint8_t *)vbuf.user_buffer + base, &vbuf.buffer_offset, &vbuf.buffer); - u_upload_unmap(This->context.pipe->stream_uploader); + u_upload_unmap(This->vertex_uploader); /* Won't be used: */ vbuf.buffer_offset -= base; vbuf.user_buffer = NULL; } if (This->csmt_active) { - u_upload_data(This->context.pipe->stream_uploader, + u_upload_data(This->pipe_secondary->stream_uploader, 0, (prim_count_to_vertex_count(PrimitiveType, PrimitiveCount)) * ibuf.index_size, 4, ibuf.user_buffer, &ibuf.offset, &ibuf.buffer); - u_upload_unmap(This->context.pipe->stream_uploader); + u_upload_unmap(This->pipe_secondary->stream_uploader); ibuf.user_buffer = NULL; } diff --git a/src/gallium/state_trackers/nine/device9.h b/src/gallium/state_trackers/nine/device9.h index 4b1630c40f9..c5fd8f76c63 100644 --- a/src/gallium/state_trackers/nine/device9.h +++ b/src/gallium/state_trackers/nine/device9.h @@ -140,6 +140,7 @@ struct NineDevice9 boolean buggy_barycentrics; } driver_bugs; + struct u_upload_mgr *vertex_uploader; unsigned constbuf_alignment; struct nine_range_pool range_pool; -- 2.30.2