virgl: Increase the shader transfer buffer by doubling the size
authorGert Wollny <gert.wollny@collabora.com>
Mon, 16 Dec 2019 20:48:09 +0000 (21:48 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 17 Dec 2019 08:07:51 +0000 (08:07 +0000)
With only linearly increasing the size of the shader transfer buffer
the transfer of very large shaders may fail, so with each attempt double
the size of the buffer.

CTS:
  dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.48
  for VTK-GL-CTS b5dcfb9c5 and newer

virglrenderer bug:
  https://gitlab.freedesktop.org/virgl/virglrenderer/issues/150

Fixes: a8987b88ff1db4ac00720a9b56c4bc3aeb666537
    virgl: add driver for virtio-gpu 3D (v2)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3121>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3121>

src/gallium/drivers/virgl/virgl_encode.c

index 9f90345722e90173b62f55f77481903c4e59195e..fa4e4c0d50ebb6dbe6b6d783ffa5b22ba4d9476f 100644 (file)
@@ -492,12 +492,13 @@ int virgl_encode_shader_state(struct virgl_context *ctx,
          if (virgl_debug & VIRGL_DEBUG_VERBOSE)
             debug_printf("Failed to translate shader in available space - trying again\n");
          old_size = str_total_size;
-         str_total_size = 65536 * ++retry_size;
+         str_total_size = 65536 * retry_size;
+         retry_size *= 2;
          str = REALLOC(str, old_size, str_total_size);
          if (!str)
             return -1;
       }
-   } while (bret == false && retry_size < 10);
+   } while (bret == false && retry_size < 1024);
 
    if (bret == false)
       return -1;