aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_resource.c
diff options
context:
space:
mode:
authorGurchetan Singh <[email protected]>2019-01-11 17:38:55 -0800
committerGert Wollny <[email protected]>2019-02-15 11:19:04 +0100
commit7626e6e18956cac0de9077694c97a388c739bdd0 (patch)
tree455944983dbb9f90e0b2917eed2193887ef36dbe /src/gallium/drivers/virgl/virgl_resource.c
parentc19aedcf1a83c70a999b963dfbc0bce47a189600 (diff)
virgl: track level cleanliness rather than resource cleanliness
This allows a minor optimization for texture upload. Reviewed-by: Gert Wollny <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_resource.c')
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c
index 883dad0e386..40f70be8036 100644
--- a/src/gallium/drivers/virgl/virgl_resource.c
+++ b/src/gallium/drivers/virgl/virgl_resource.c
@@ -41,10 +41,10 @@ bool virgl_res_needs_flush_wait(struct virgl_context *vctx,
bool virgl_res_needs_readback(struct virgl_context *vctx,
struct virgl_resource *res,
- unsigned usage)
+ unsigned usage, unsigned level)
{
bool readback = true;
- if (res->clean[0])
+ if (res->clean[level])
readback = false;
else if (usage & PIPE_TRANSFER_DISCARD_RANGE)
readback = false;
@@ -281,6 +281,10 @@ boolean virgl_resource_get_handle(struct pipe_screen *screen,
void virgl_resource_dirty(struct virgl_resource *res, uint32_t level)
{
- if (res)
- res->clean[0] = FALSE;
+ if (res) {
+ if (res->u.b.target == PIPE_BUFFER)
+ res->clean[0] = FALSE;
+ else
+ res->clean[level] = FALSE;
+ }
}