aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_buffer.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-05-09 13:27:34 -0700
committerChia-I Wu <[email protected]>2019-05-22 09:28:19 -0700
commit96c2851586e8d76397823624321d5d24b3d22b36 (patch)
treeb1b08df7750f827390394435799f18e99749c997 /src/gallium/drivers/virgl/virgl_buffer.c
parent440982cdd6e50797853eb78b6edf9401ba5a93b8 (diff)
virgl: track valid buffer range for transfer sync
virgl_transfer_queue_is_queued was used to avoid flushing. That fails when the resource is being accessed by previous cmdbufs but not the current one. The new approach of tracking the valid buffer range does not apply to textures however. But hopefully it is fine because the goal is to avoid waiting for this scenario glBufferSubData(..., offset, size, data1); glDrawArrays(...); // append new vertex data glBufferSubData(..., offset+size, size, data2); glDrawArrays(...); If glTex(Sub)Image* turns out to be an issue, we will need to track valid level/layer ranges as well. v2: update virgl_buffer_transfer_extend as well v3: do not remove virgl_transfer_queue_is_queued Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Alexandros Frantzis <[email protected]> (v1) Reviewed-by: Gurchetan Singh <[email protected]> (v2)
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_buffer.c')
-rw-r--r--src/gallium/drivers/virgl/virgl_buffer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c
index fce1ac496e7..284eeca4d8f 100644
--- a/src/gallium/drivers/virgl/virgl_buffer.c
+++ b/src/gallium/drivers/virgl/virgl_buffer.c
@@ -59,6 +59,9 @@ static void *virgl_buffer_transfer_map(struct pipe_context *ctx,
return NULL;
}
+ if (usage & PIPE_TRANSFER_WRITE)
+ util_range_add(&vbuf->valid_buffer_range, box->x, box->x + box->width);
+
*transfer = &trans->base;
return trans->hw_res_map + trans->offset;
}