virgl: resolve to correct level during texture read
authorChia-I Wu <olvaffe@gmail.com>
Mon, 3 Jun 2019 18:39:34 +0000 (11:39 -0700)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 4 Jun 2019 21:37:03 +0000 (21:37 +0000)
When PIPE_TRANSFER_READ requires a resolve, we blit from the host
storage to a temporary storage, and do a format conversion from the
temporary storage to the guest storage.  This change makes sure we
convert to the correct level of the guest storage.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
src/gallium/drivers/virgl/virgl_texture.c

index 926f8a56f9d9ab9334f8c478317e1d27451169f1..7eca56bd9272d4f92bd190e24ac772c9fe618d50 100644 (file)
@@ -220,8 +220,8 @@ static void *texture_transfer_map_resolve(struct pipe_context *ctx,
          if (!ptr)
             goto fail;
 
-          if (!util_format_translate_3d(resource->format,
-                                       ptr,
+         if (!util_format_translate_3d(resource->format,
+                                       ptr + vtex->metadata.level_offset[level],
                                        trans->base.stride,
                                        trans->base.layer_stride,
                                        box->x, box->y, box->z,