st/va: use pipe transfer_map to map upload buffer
authorLeo Liu <leo.liu@amd.com>
Tue, 26 Sep 2017 13:11:52 +0000 (09:11 -0400)
committerLeo Liu <leo.liu@amd.com>
Thu, 28 Sep 2017 13:22:55 +0000 (09:22 -0400)
The function pipe_buffer_map() is only for linear pipe buffer,
with height as 0, and it's not for any 2D textures.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/state_trackers/va/buffer.c

index fb5b20e44bb5891e63bbbddce995b4f74e1fe3b6..deaeb1939febe84ab4accc45cbd0ad8d0085742f 100644 (file)
@@ -125,9 +125,15 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
    }
 
    if (buf->derived_surface.resource) {
-      *pbuff = pipe_buffer_map(drv->pipe, buf->derived_surface.resource,
-                               PIPE_TRANSFER_WRITE,
-                               &buf->derived_surface.transfer);
+      struct pipe_resource *resource;
+      struct pipe_box box = {};
+
+      resource = buf->derived_surface.resource;
+      box.width = resource->width0;
+      box.height = resource->height0;
+      box.depth = resource->depth0;
+      *pbuff = drv->pipe->transfer_map(drv->pipe, resource, 0, PIPE_TRANSFER_WRITE,
+                                       &box, &buf->derived_surface.transfer);
       mtx_unlock(&drv->mutex);
 
       if (!buf->derived_surface.transfer || !*pbuff)