From: Chia-I Wu Date: Fri, 3 May 2019 17:40:38 +0000 (-0700) Subject: virgl: do not use inline writes for subdata X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7078397caed46317ba49065c7e966f880607f3d;p=mesa.git virgl: do not use inline writes for subdata Inline writes skip transfer map/unamp at the cost of an extra copy on the data during execbuffer. That is generally a win for small transfers. But the heuristic to use inline writes based on buffer sizes rather than transfer sizes makes little sense. More importantly, inline writes miss optimizations that are done for buffer transfers. Let's just use transfers. Signed-off-by: Chia-I Wu Reviewed-By: Gert Wollny --- diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c index ef81f213f40..bd0a633e471 100644 --- a/src/gallium/drivers/virgl/virgl_resource.c +++ b/src/gallium/drivers/virgl/virgl_resource.c @@ -174,6 +174,8 @@ static void virgl_buffer_subdata(struct pipe_context *pipe, unsigned usage, unsigned offset, unsigned size, const void *data) { + struct pipe_transfer *transfer; + uint8_t *map; struct pipe_box box; assert(!(usage & PIPE_TRANSFER_READ)); @@ -192,10 +194,11 @@ static void virgl_buffer_subdata(struct pipe_context *pipe, virgl_buffer_transfer_extend(pipe, resource, usage, &box, data)) return; - if (resource->width0 >= getpagesize()) - u_default_buffer_subdata(pipe, resource, usage, offset, size, data); - else - virgl_transfer_inline_write(pipe, resource, 0, usage, &box, data, 0, 0); + map = pipe->transfer_map(pipe, resource, 0, usage, &box, &transfer); + if (map) { + memcpy(map, data, size); + pipe_transfer_unmap(pipe, transfer); + } } void virgl_init_context_resource_functions(struct pipe_context *ctx)