panfrost: Fix uniform_count on Midgard
The compiler ABI specifies push uniforms at a 4-byte granularity (like Bifrost), but Midgard require a 16-byte granularity. As such if the number of pushed words is not a multiple of 4, there is a buffer overrun at shader load time. Ordinarily this is inaccessible so the garbage is ignored. However, there was a great deal of confusion around the `uniform_cutoff` variable. In some cases (such a full glmark2 run on a 64-bit processor), the push uniforms would be at the end of a BO and the overrun would cause a page fault. Remove uniform_cutoff entirely and work with count directly to avoid faulting, and round the count up to be defensive. Closes: #4289 Fixes: ed810eb0 ("panfrost: Don't truncate uniform_count") Signed-off-by:Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Tested-by:
Robin Murphy <robin.murphy@arm.com> Part-of: <!9109>
- src/panfrost/lib/pan_shader.h 3 additions, 1 deletionsrc/panfrost/lib/pan_shader.h
- src/panfrost/midgard/compiler.h 0 additions, 3 deletionssrc/panfrost/midgard/compiler.h
- src/panfrost/midgard/midgard_compile.c 0 additions, 5 deletionssrc/panfrost/midgard/midgard_compile.c
- src/panfrost/midgard/midgard_ra.c 12 additions, 13 deletionssrc/panfrost/midgard/midgard_ra.c
- src/panfrost/midgard/mir_promote_uniforms.c 2 additions, 3 deletionssrc/panfrost/midgard/mir_promote_uniforms.c
- src/panfrost/util/pan_ir.h 0 additions, 1 deletionsrc/panfrost/util/pan_ir.h