[Mesa-dev] [PATCH v5 1/2] virgl, vtest: Correct the transfer size calculation
Gurchetan Singh
gurchetansingh at chromium.org
Thu Oct 4 17:10:12 UTC 2018
On Thu, Oct 4, 2018 at 7:41 AM Gert Wollny <gw.fossdev at gmail.com> wrote:
>
> From: Gert Wollny <gert.wollny at collabora.com>
>
> The transfer size used in virglrenderer refers to uint32_t, so one
> must add 3 and then divide by 4 instead of adding 3/4 which is a no-op
> with integers.
>
> Fixes: b3b82fe8ea virgl/vtest: add vtest driver
>
> Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
> ---
> src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
> index 4d20a63ad6..ce565ee76c 100644
> --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
> +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
> @@ -295,8 +295,10 @@ int virgl_vtest_send_transfer_cmd(struct virgl_vtest_winsys *vws,
> vtest_hdr[VTEST_CMD_LEN] = VCMD_TRANSFER_HDR_SIZE;
> vtest_hdr[VTEST_CMD_ID] = vcmd;
>
> + /* The host expects the size in dwords so calculate the rounded up
> + * value here. */
> if (vcmd == VCMD_TRANSFER_PUT)
> - vtest_hdr[VTEST_CMD_LEN] += data_size + 3 / 4;
> + vtest_hdr[VTEST_CMD_LEN] += (data_size + 3) / 4;
>
> cmd[0] = handle;
> cmd[1] = level;
> --
> 2.16.4
>
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>
More information about the mesa-dev
mailing list