virgl: only blit if resource is read
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 5 Apr 2019 06:27:14 +0000 (08:27 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 17 Apr 2019 07:27:08 +0000 (07:27 +0000)
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
src/gallium/drivers/virgl/virgl_texture.c

index 5cb01cb18a04697574137723fc6431db74e01242..471fe6c7b9a27176fb08fc13859e21847f41588a 100644 (file)
@@ -178,8 +178,11 @@ static void *texture_transfer_map_resolve(struct pipe_context *ctx,
    struct pipe_box dst_box = *box;
    dst_box.x = dst_box.y = dst_box.z = 0;
 
-   virgl_copy_region_with_blit(ctx, resolve_tmp, 0, &dst_box, resource, level, box);
-   ctx->flush(ctx, NULL, 0);
+   if (usage & PIPE_TRANSFER_READ) {
+      virgl_copy_region_with_blit(ctx, resolve_tmp, 0, &dst_box, resource,
+                                  level, box);
+      ctx->flush(ctx, NULL, 0);
+   }
 
    void *ptr = texture_transfer_map_plain(ctx, resolve_tmp, 0, usage, &dst_box,
                                           &trans->resolve_transfer);