From: Gurchetan Singh Date: Mon, 26 Nov 2018 17:54:04 +0000 (-0800) Subject: virgl: avoid large inline transfers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d18492c64f0abb4eb638d2b213b4b1ff3d775965;p=mesa.git virgl: avoid large inline transfers We flush everytime the command buffer (16 kB) is full, which is quite costly. This improves dEQP-GLES3.performance.buffer.data_upload.function_call.buffer_data.new_buffer.usage_stream_draw from 111.16 MB/s to 1930.36 MB/s. In addition, I made the benchmark produce buffers from 0 --> VIRGL_MAX_CMDBUF_DWORDS * 4, and tried ((VIRGL_MAX_CMDBUF_DWORDS * 4) / 2), ((VIRGL_MAX_CMDBUF_DWORDS * 4) / 4), etc. I didn't notice any clear differences, so let's just go with the most obvious heuristic. Tested-By: Gert Wollny Reviewed-by: Erik Faye-Lund --- diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c index db5e7dd61af..9174ec5cbbd 100644 --- a/src/gallium/drivers/virgl/virgl_resource.c +++ b/src/gallium/drivers/virgl/virgl_resource.c @@ -95,7 +95,11 @@ static void virgl_buffer_subdata(struct pipe_context *pipe, usage |= PIPE_TRANSFER_DISCARD_RANGE; u_box_1d(offset, size, &box); - virgl_transfer_inline_write(pipe, resource, 0, usage, &box, data, 0, 0); + + if (size >= (VIRGL_MAX_CMDBUF_DWORDS * 4)) + u_default_buffer_subdata(pipe, resource, usage, offset, size, data); + else + virgl_transfer_inline_write(pipe, resource, 0, usage, &box, data, 0, 0); } void virgl_init_context_resource_functions(struct pipe_context *ctx)