virgl, vtest: Correct the transfer size calculation
authorGert Wollny <gert.wollny@collabora.com>
Thu, 4 Oct 2018 14:40:07 +0000 (16:40 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Sat, 6 Oct 2018 11:12:44 +0000 (13:12 +0200)
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@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c

index 4d20a63ad64e58c1156989302d5b043468e97e8e..ce565ee76cf2bdb95378b6ae678bbb39b39346db 100644 (file)
@@ -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;