[radeonsi] Commit b1b491cd leads to memory leak
Have you ever noticed that before restarting or shutting down the computer, when all applications are already closed and unloaded from memory, memory is occupied by something?
I noticed this often and decided to investigate what actions lead to this. I noticed when I look at pictures in full screen mode in Telegram, the memory ends abruptly and the computer starts to slow down. If after that closes all applications and re-login the system, then the memory is not released.
In the end, to reproduce the bug, such a case was invented, see the video at the link https://youtu.be/JiyDjZTBvC0
If you press quickly to switch between windowed and full screen mode, then memory leaks. Moreover, the more windows are opened, the lower the switching speed will be sufficient to repeat this bug.
Of course, in real life, it is unlikely that anyone will do this.
But I have the same effect when many browser windows are open, no matter Chrome or Firefox, and some application shows something on the full screen, for example, I launch a game or a picture viewer in Telegram https://youtu.be/J2fqQ0AFnC4
Of course I found commit which aggravates the problem.
$ git bisect log
git bisect start
# good: [29093bc42d20e95288cd306757e7efc928fdb366] freedreno: Fix gmem invalidating the depth or stencil of packed d/s.
git bisect good 29093bc42d20e95288cd306757e7efc928fdb366
# bad: [1e869e3fb4255351de5e908c5a53851bb58c3f2b] freedreno/a5xx+: Fix missing LA formats.
git bisect bad 1e869e3fb4255351de5e908c5a53851bb58c3f2b
# good: [af8fa2644e1ed225d1ebf6ee532062f7c36e6c7d] radv: Split off cmd_buffer variant of descriptor set template updates
git bisect good af8fa2644e1ed225d1ebf6ee532062f7c36e6c7d
# good: [7ce3f8e639506975c512c4b0814a091a00d0f2fd] gallium/util: fix util_can_blit_via_copy_region with unbound render condition
git bisect good 7ce3f8e639506975c512c4b0814a091a00d0f2fd
# good: [4885e63a6d20c57f98b7b641ea3c39a8ff3ae2dd] vulkan/wsi: implement missing wsi_register_device_event
git bisect good 4885e63a6d20c57f98b7b641ea3c39a8ff3ae2dd
# bad: [74adf22a0aeeaf5f63748394d2da0337b04b1526] radeonsi: fix a typo preventing a fast depth-stencil clear
git bisect bad 74adf22a0aeeaf5f63748394d2da0337b04b1526
# bad: [b1b491cdbbac1ccb785f5eb1802006f76ec253f5] radeonsi: add a faster clear path for glClearTexImage
git bisect bad b1b491cdbbac1ccb785f5eb1802006f76ec253f5
# good: [5d3aea49b806322393c3275d550f4e4eaef3cca3] radeonsi: fix 2 issues with depth_cleared_level_mask
git bisect good 5d3aea49b806322393c3275d550f4e4eaef3cca3
# first bad commit: [b1b491cdbbac1ccb785f5eb1802006f76ec253f5] radeonsi: add a faster clear path for glClearTexImage
b1b491cdbbac1ccb785f5eb1802006f76ec253f5 is the first bad commit
commit b1b491cdbbac1ccb785f5eb1802006f76ec253f5
Author: Marek Olšák <marek.olsak@amd.com>
Date: Fri Oct 29 14:02:53 2021 -0400
radeonsi: add a faster clear path for glClearTexImage
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13603>
src/gallium/drivers/radeonsi/si_clear.c | 49 +++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
Without a commit (b1b491cd), the described leak is very difficult to repeat.