Skip to content

lima: fix max sampler views

Erico Nunes requested to merge enunes/mesa:lima-max-sampler-views into master

Testing glmark2 with valgrind showed this memory leak (and others related):

448 (32 direct, 416 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 19
   at 0x48695A0: calloc (vg_replace_malloc.c:760)
   by 0x5B027A7: lima_create_sampler_view (lima_state.c:346)
   by 0x5578A9F: st_create_texture_sampler_view_from_stobj (st_sampler_view.c:565)
   by 0x5578A9F: st_get_texture_sampler_view_from_stobj (st_sampler_view.c:612)
   by 0x557AD8B: st_update_single_texture (st_atom_texture.c:93)
   by 0x557AF03: update_textures (st_atom_texture.c:157)
   by 0x5598B7B: st_validate_state (st_atom.c:262)
   by 0x5587C0B: prepare_draw (st_draw.c:104)
   by 0x5588377: st_draw_gallium (st_draw.c:281)
   by 0x564C12F: _mesa_draw_arrays (draw.c:1345)
   by 0x150BC3: ??? (in /usr/bin/glmark2-es2-drm)
   by 0x150FEB: ??? (in /usr/bin/glmark2-es2-drm)
   by 0x11DE03: ??? (in /usr/bin/glmark2-es2-drm)

This was actually quite bad as running this could reach OOM within a few minutes:

glmark2-es2-drm -b texture:duration=0.1 --run-forever

Some debugging showed me that lima was skipping this: https://gitlab.freedesktop.org/mesa/mesa/-/blob/3250e04d25ec0bc41d7c7e4263104d1910429b7e/src/gallium/auxiliary/cso_cache/cso_context.c#L323 since PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS was not set.

Setting the cap fixes that behaviour. With this there are now no leaks reported in lima functions in full glmark2 runs.

No changes in deqp and piglit.

Merge request reports

Loading