diff options
author | Axel Davy <[email protected]> | 2016-11-12 23:36:35 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-12-20 23:44:23 +0100 |
commit | 31262bbce085c69ef7a654528f509cb37415b41f (patch) | |
tree | 4aa276717d27ef00f20ef3ced214c4a79ef63f8f /src | |
parent | 22f6d6fbd270333979c282627349eb74c06acd6b (diff) |
st/nine: use get_pipe_acquire/release when possible
Use the acquire/release semantic when we don't need
to wait for any pending command.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/nine/basetexture9.c | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/buffer9.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 16 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/pixelshader9.c | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/surface9.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/swapchain9.c | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/vertexshader9.c | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/volume9.c | 3 |
8 files changed, 34 insertions, 16 deletions
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c index f37dbb1d121..ce08c25c114 100644 --- a/src/gallium/state_trackers/nine/basetexture9.c +++ b/src/gallium/state_trackers/nine/basetexture9.c @@ -455,7 +455,6 @@ NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This, if (!res) return D3DERR_OUTOFVIDEOMEMORY; This->base.resource = res; - pipe = NineDevice9_GetPipe(This->base.base.device); if (old && CopyData) { /* Don't return without releasing old ! */ struct pipe_box box; @@ -470,6 +469,8 @@ NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This, box.height = u_minify(templ.height0, l); box.depth = u_minify(templ.depth0, l); + pipe = nine_context_get_pipe_acquire(This->base.base.device); + for (; l <= templ.last_level; ++l, ++m) { pipe->resource_copy_region(pipe, res, l, 0, 0, 0, @@ -478,6 +479,8 @@ NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This, box.height = u_minify(box.height, 1); box.depth = u_minify(box.depth, 1); } + + nine_context_get_pipe_release(This->base.base.device); } pipe_resource_reference(&old, NULL); @@ -574,8 +577,9 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, templ.swizzle_a = swizzle[3]; templ.target = resource->target; - pipe = NineDevice9_GetPipe(This->base.base.device); + pipe = nine_context_get_pipe_acquire(This->base.base.device); This->view[sRGB] = pipe->create_sampler_view(pipe, resource, &templ); + nine_context_get_pipe_release(This->base.base.device); DBG("sampler view = %p(resource = %p)\n", This->view[sRGB], resource); diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index bd115ff70b1..086985b0d5a 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -327,11 +327,13 @@ NineBuffer9_Unlock( struct NineBuffer9 *This ) if (This->base.pool != D3DPOOL_MANAGED) { pipe = This->maps[This->nmaps].is_pipe_secondary ? device->pipe_secondary : - NineDevice9_GetPipe(device); + nine_context_get_pipe_acquire(device); pipe->transfer_unmap(pipe, This->maps[This->nmaps].transfer); /* We need to flush in case the driver does implicit copies */ if (This->maps[This->nmaps].is_pipe_secondary) pipe->flush(pipe, NULL, 0); + else + nine_context_get_pipe_release(device); } else { BASEBUF_REGISTER_UPDATE(This); } diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index c05d9bb18bd..5b6ca12fd7e 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -2678,11 +2678,13 @@ CSMT_ITEM_NO_WAIT(nine_context_blit, struct pipe_query * nine_context_create_query(struct NineDevice9 *device, unsigned query_type) { - struct nine_context *context = &device->context; + struct pipe_context *pipe; + struct pipe_query *res; - if (device->csmt_active) - nine_csmt_process(device); - return context->pipe->create_query(context->pipe, query_type, 0); + pipe = nine_context_get_pipe_acquire(device); + res = pipe->create_query(pipe, query_type, 0); + nine_context_get_pipe_release(device); + return res; } CSMT_ITEM_DO_WAIT(nine_context_destroy_query, @@ -3146,7 +3148,7 @@ update_vertex_elements_sw(struct NineDevice9 *device) static void update_vertex_buffers_sw(struct NineDevice9 *device, int start_vertice, int num_vertices) { - struct pipe_context *pipe = NineDevice9_GetPipe(device); + struct pipe_context *pipe = nine_context_get_pipe_acquire(device); struct pipe_context *pipe_sw = device->pipe_sw; struct nine_state *state = &device->state; struct nine_state_sw_internal *sw_internal = &device->state_sw_internal; @@ -3194,6 +3196,7 @@ update_vertex_buffers_sw(struct NineDevice9 *device, int start_vertice, int num_ pipe_sw->set_vertex_buffers(pipe_sw, i, 1, NULL); } } + nine_context_get_pipe_release(device); } static void @@ -3371,7 +3374,7 @@ void nine_state_after_draw_sw(struct NineDevice9 *device) { struct nine_state_sw_internal *sw_internal = &device->state_sw_internal; - struct pipe_context *pipe = NineDevice9_GetPipe(device); + struct pipe_context *pipe = nine_context_get_pipe_acquire(device); struct pipe_context *pipe_sw = device->pipe_sw; int i; @@ -3381,6 +3384,7 @@ nine_state_after_draw_sw(struct NineDevice9 *device) pipe->transfer_unmap(pipe, sw_internal->transfers_so[i]); sw_internal->transfers_so[i] = NULL; } + nine_context_get_pipe_release(device); } void diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c index cb970eae76b..bfc395cdf55 100644 --- a/src/gallium/state_trackers/nine/pixelshader9.c +++ b/src/gallium/state_trackers/nine/pixelshader9.c @@ -51,7 +51,6 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This, return D3D_OK; } device = This->base.device; - pipe = NineDevice9_GetPipe(device); info.type = PIPE_SHADER_FRAGMENT; info.byte_code = pFunction; @@ -63,7 +62,9 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This, info.projected = 0; info.process_vertices = false; + pipe = nine_context_get_pipe_acquire(device); hr = nine_translate_shader(device, &info, pipe); + nine_context_get_pipe_release(device); if (FAILED(hr)) return hr; This->byte_code.version = info.version; diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index f348f501a77..ca9fd55828e 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -194,8 +194,9 @@ NineSurface9_ctor( struct NineSurface9 *This, /* TODO: investigate what else exactly needs to be cleared */ if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) { surf = NineSurface9_GetSurface(This, 0); - pipe = NineDevice9_GetPipe(pParams->device); + pipe = nine_context_get_pipe_acquire(pParams->device); pipe->clear_render_target(pipe, surf, &rgba, 0, 0, pDesc->Width, pDesc->Height, false); + nine_context_get_pipe_release(pParams->device); } NineSurface9_Dump(This); @@ -225,7 +226,7 @@ NineSurface9_dtor( struct NineSurface9 *This ) struct pipe_surface * NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB ) { - struct pipe_context *pipe = NineDevice9_GetPipe(This->base.base.device); + struct pipe_context *pipe; struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device); struct pipe_resource *resource = This->base.resource; struct pipe_surface templ; @@ -245,7 +246,9 @@ NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB ) templ.u.tex.first_layer = This->layer; templ.u.tex.last_layer = This->layer; + pipe = nine_context_get_pipe_acquire(This->base.base.device); This->surface[sRGB] = pipe->create_surface(pipe, resource, &templ); + nine_context_get_pipe_release(This->base.base.device); assert(This->surface[sRGB]); return This->surface[sRGB]; } @@ -509,8 +512,9 @@ NineSurface9_UnlockRect( struct NineSurface9 *This ) DBG("This=%p lock_count=%u\n", This, This->lock_count); user_assert(This->lock_count, D3DERR_INVALIDCALL); if (This->transfer) { - pipe = NineDevice9_GetPipe(This->base.base.device); + pipe = nine_context_get_pipe_acquire(This->base.base.device); pipe->transfer_unmap(pipe, This->transfer); + nine_context_get_pipe_release(This->base.base.device); This->transfer = NULL; } --This->lock_count; diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c index 9074f2b3ded..feaece2f77f 100644 --- a/src/gallium/state_trackers/nine/swapchain9.c +++ b/src/gallium/state_trackers/nine/swapchain9.c @@ -90,7 +90,7 @@ D3DWindowBuffer_create(struct NineSwapChain9 *This, int for_frontbuffer_reading) { D3DWindowBuffer *ret; - struct pipe_context *pipe = NineDevice9_GetPipe(This->base.device); + struct pipe_context *pipe = nine_context_get_pipe_acquire(This->base.device); struct winsys_handle whandle; int stride, dmaBufFd; HRESULT hr; @@ -103,6 +103,7 @@ D3DWindowBuffer_create(struct NineSwapChain9 *This, PIPE_HANDLE_USAGE_WRITE : PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ); + nine_context_get_pipe_release(This->base.device); stride = whandle.stride; dmaBufFd = whandle.handle; hr = ID3DPresent_NewD3DWindowBufferFromDmaBuf(This->present, diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c index 79a49d13b6c..a4228af157e 100644 --- a/src/gallium/state_trackers/nine/vertexshader9.c +++ b/src/gallium/state_trackers/nine/vertexshader9.c @@ -56,7 +56,6 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This, } device = This->base.device; - pipe = NineDevice9_GetPipe(device); info.type = PIPE_SHADER_VERTEX; info.byte_code = pFunction; @@ -70,6 +69,7 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This, info.swvp_on = !!(device->params.BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING); info.process_vertices = false; + pipe = nine_context_get_pipe_acquire(device); hr = nine_translate_shader(device, &info, pipe); if (hr == D3DERR_INVALIDCALL && (device->params.BehaviorFlags & D3DCREATE_MIXED_VERTEXPROCESSING)) { @@ -77,6 +77,7 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This, info.swvp_on = true; hr = nine_translate_shader(device, &info, pipe); } + nine_context_get_pipe_release(device); if (hr == D3DERR_INVALIDCALL) ERR("Encountered buggy shader\n"); if (FAILED(hr)) diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index ac935516baa..b579f9205f5 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -344,9 +344,10 @@ NineVolume9_UnlockBox( struct NineVolume9 *This ) DBG("This=%p lock_count=%u\n", This, This->lock_count); user_assert(This->lock_count, D3DERR_INVALIDCALL); if (This->transfer) { - pipe = NineDevice9_GetPipe(This->base.device); + pipe = nine_context_get_pipe_acquire(This->base.device); pipe->transfer_unmap(pipe, This->transfer); This->transfer = NULL; + nine_context_get_pipe_release(This->base.device); } --This->lock_count; |