lima: adjust pp and gp max const buffer size
authorErico Nunes <nunes.erico@gmail.com>
Fri, 11 Dec 2020 18:58:07 +0000 (19:58 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 16 Dec 2020 01:04:41 +0000 (01:04 +0000)
According to the mali driver output, the Mali-400 GP provides space for
304 vec4 uniforms, globals and temporary variables.

The Mali-PP supports a uniform table up to size 32768 total.
However, indirect access to an uniform only supports indices up to 8192
(a 2048 vec4 array). Trying to access beyond that currently causes a pp
job timeout with both lima and the mali driver. To prevent indices
bigger than that in application uniforms, limit to 8192 for now.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8079>

src/gallium/drivers/lima/lima_screen.c

index 0d65aa4..28a40e3 100644 (file)
@@ -197,8 +197,10 @@ get_vertex_shader_param(struct lima_screen *screen,
    case PIPE_SHADER_CAP_MAX_OUTPUTS:
       return LIMA_MAX_VARYING_NUM; /* varying */
 
+   /* Mali-400 GP provides space for 304 vec4 uniforms, globals and
+    * temporary variables. */
    case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
-      return 16 * 1024 * sizeof(float);
+      return 304 * 4 * sizeof(float);
 
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       return 1;
@@ -234,8 +236,12 @@ get_fragment_shader_param(struct lima_screen *screen,
    case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
       return 1024;
 
+   /* The Mali-PP supports a uniform table up to size 32768 total.
+    * However, indirect access to an uniform only supports indices up
+    * to 8192 (a 2048 vec4 array). To prevent indices bigger than that,
+    * limit max const buffer size to 8192 for now. */
    case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
-      return 16 * 1024 * sizeof(float);
+      return 2048 * 4 * sizeof(float);
 
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       return 1;