summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-05-03 10:40:38 -0700
committerChia-I Wu <[email protected]>2019-05-06 10:31:56 -0700
commitc7078397caed46317ba49065c7e966f880607f3d (patch)
treec0da9b2444d862f0a89e830c5bdd44ae96150cec /src
parent898be8036d05eedc11903f5c7d08d330284c7cb9 (diff)
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 <[email protected]> Reviewed-By: Gert Wollny <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.c11
1 files changed, 7 insertions, 4 deletions
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)