aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_resource.c
diff options
context:
space:
mode:
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;
+ }
}