[Mesa-dev] [PATCH] virgl: fix virgl_bo_transfer_{put, get} box struct copy

Marek Olšák maraeo at gmail.com
Sat May 13 19:31:41 UTC 2017


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Sat, May 13, 2017 at 12:05 AM, Rob Herring <robh at kernel.org> wrote:

> Commit 3dfe61ed6ec6 ("gallium: decrease the size of pipe_box - 24 -> 16
> bytes") changed the size of pipe_box, but the virgl code was relying on
> pipe_box and drm_virtgpu_3d_box structs having the same size/layout doing
> a struct copy. Copy the fields one by one instead.
>
> Cc: Marek Olšák <marek.olsak at amd.com>
> Cc: Dave Airlie <airlied at redhat.com>
> Signed-off-by: Rob Herring <robh at kernel.org>
> ---
>  src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
> b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
> index 4708126aed9d..0edae4767e6b 100644
> --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
> +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
> @@ -264,7 +264,12 @@ virgl_bo_transfer_put(struct virgl_winsys *vws,
>
>     memset(&tohostcmd, 0, sizeof(tohostcmd));
>     tohostcmd.bo_handle = res->bo_handle;
> -   tohostcmd.box = *(struct drm_virtgpu_3d_box *)box;
> +   tohostcmd.box.x = box->x;
> +   tohostcmd.box.y = box->y;
> +   tohostcmd.box.z = box->z;
> +   tohostcmd.box.w = box->width;
> +   tohostcmd.box.h = box->height;
> +   tohostcmd.box.d = box->depth;
>     tohostcmd.offset = buf_offset;
>     tohostcmd.level = level;
>    // tohostcmd.stride = stride;
> @@ -288,7 +293,12 @@ virgl_bo_transfer_get(struct virgl_winsys *vws,
>     fromhostcmd.offset = buf_offset;
>    // fromhostcmd.stride = stride;
>    // fromhostcmd.layer_stride = layer_stride;
> -   fromhostcmd.box = *(struct drm_virtgpu_3d_box *)box;
> +   fromhostcmd.box.x = box->x;
> +   fromhostcmd.box.y = box->y;
> +   fromhostcmd.box.z = box->z;
> +   fromhostcmd.box.w = box->width;
> +   fromhostcmd.box.h = box->height;
> +   fromhostcmd.box.d = box->depth;
>     return drmIoctl(vdws->fd, DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST,
> &fromhostcmd);
>  }
>
> --
> 2.11.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170513/77312878/attachment.html>


More information about the mesa-dev mailing list