From 4a51a7c1da54e853dbd59d1ae714d0acf14f3593 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Wed, 10 Apr 2019 22:21:48 +0200 Subject: [PATCH] st/nine: Optimize volume upload with conversion Use nine_context_box_upload instead of locking the pipe for volume upload with format conversion. nine_context_box_upload already handles format conversion. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/volume9.c | 52 +++++++++++------------ 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index d6d80611f3c..f2a2865b0a3 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -372,39 +372,37 @@ NineVolume9_UnlockBox( struct NineVolume9 *This ) --This->lock_count; if (This->data_conversion) { - struct pipe_transfer *transfer; - uint8_t *dst = This->data; struct pipe_box box; u_box_3d(0, 0, 0, This->desc.Width, This->desc.Height, This->desc.Depth, &box); - pipe = NineDevice9_GetPipe(This->base.device); - if (!dst) { - dst = pipe->transfer_map(pipe, - This->resource, - This->level, - PIPE_TRANSFER_WRITE | - PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE, - &box, &transfer); - if (!dst) - return D3D_OK; - } - - (void) util_format_translate_3d(This->info.format, - dst, This->data ? This->stride : transfer->stride, - This->data ? This->layer_stride : transfer->layer_stride, - 0, 0, 0, - This->format_conversion, - This->data_conversion, - This->stride_conversion, - This->layer_stride_conversion, - 0, 0, 0, - This->desc.Width, This->desc.Height, - This->desc.Depth); - if (!This->data) - pipe_transfer_unmap(pipe, transfer); + if (This->data) { + (void) util_format_translate_3d(This->info.format, + This->data, This->stride, + This->layer_stride, + 0, 0, 0, + This->format_conversion, + This->data_conversion, + This->stride_conversion, + This->layer_stride_conversion, + 0, 0, 0, + This->desc.Width, This->desc.Height, + This->desc.Depth); + } else { + nine_context_box_upload(This->base.device, + &This->pending_uploads_counter, + (struct NineUnknown *)This, + This->resource, + This->level, + &box, + This->format_conversion, + This->data_conversion, + This->stride_conversion, + This->layer_stride_conversion, + &box); + } } return D3D_OK; -- 2.30.2