Skip to content

lima: adjust pp and gp max const buffer size

Erico Nunes requested to merge enunes/mesa:lima-max-const-buffer-size into master

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.

Based on the following outputs from the mali driver:

0:1: L0005: Out of space for uniforms, globals and temporary variables. Mali-400 GP provides space for 304 vec4s, this shader uses 100003 vec4s.
L0001 Fragment shader corrupt. Uniform table is sized 399996, must be no larger than 32768.

piglit test glsl-uniform-interstage-limits probes for the maximum limit and tries to use arrays in glsl that go up to the limit supported by the driver. With the limits going beyond what the driver really support, it caused errors such as:

[14449.656409] [drm:lima_sched_timedout_job [lima]] *ERROR* lima job timeout
[14449.669412] lima d00c0000.gpu: pp task error 0 int_state=0 status=5
[14449.675195] lima d00c0000.gpu: pp task error 1 int_state=0 status=5
[14449.681391] lima d00c0000.gpu: pp task error 2 int_state=0 status=5

Even in the mali driver, such an access causes:

Mali: Mali PP: Job 31 timed out on core Mali_PP0
Mali: Mali PP: Job 31 timed out on core Mali_PP1

Note that it would be possible to have pp uniforms whose summed size is still up to 32768 as long as none of them results in an array indirect access >2048, but I'm not sure if that's possible to detect for now in mesa.

With this patch I get no deqp or piglit regressions and fix one of the potential causes of "lima job timeout" which was being hit in piglit glsl-uniform-interstage-limits. I know it doesn't solve all problems (for example some gp constants also become uniforms and are not counted here and more difficult to predict), but this at least prevents the problem in one level.

Merge request reports