Module: Mesa
Branch: staging/23.0
Commit: f6a518de2d69aa9c0df0a0b0a0fae4a97f7e5757
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6a518de2d69aa9c0df0a0b0a0fae4a97f7e5757

Author: Gert Wollny <[email protected]>
Date:   Tue Apr  4 15:58:27 2023 +0200

r600/sfn: fix container allocators

This fixes leaks in TexInstr and in Shader.

Thanks to Patrick Lerda for pointing out the bug.

Fixes: 79ca456b4837b3bc21cf9ef3c03c505c4b4909f6
    r600/sfn: rewrite NIR backend

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22300>
(cherry picked from commit 0cb6437f4f56bb995321aa91b7fe197dd5bce746)

---

 .pick_status.json                            | 2 +-
 src/gallium/drivers/r600/sfn/sfn_instr_tex.h | 2 +-
 src/gallium/drivers/r600/sfn/sfn_shader.h    | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 361adce07e8..63bddecb14f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -211,7 +211,7 @@
         "description": "r600/sfn: fix container allocators",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "79ca456b4837b3bc21cf9ef3c03c505c4b4909f6"
     },
diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_tex.h 
b/src/gallium/drivers/r600/sfn/sfn_instr_tex.h
index 06e027591d8..da1b3f26764 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instr_tex.h
+++ b/src/gallium/drivers/r600/sfn/sfn_instr_tex.h
@@ -196,7 +196,7 @@ private:
    unsigned m_resource_id;
 
    static const std::map<Opcode, std::string> s_opcode_map;
-   std::list<TexInstr *> m_prepare_instr;
+   std::list<TexInstr *, Allocator<TexInstr *>> m_prepare_instr;
 };
 
 bool
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader.h 
b/src/gallium/drivers/r600/sfn/sfn_shader.h
index 326315568c7..6197a4112a0 100644
--- a/src/gallium/drivers/r600/sfn/sfn_shader.h
+++ b/src/gallium/drivers/r600/sfn/sfn_shader.h
@@ -340,12 +340,14 @@ private:
    uint32_t m_indirect_files{0};
    std::bitset<sh_flags_count> m_flags;
    uint32_t nhwatomic_ranges{0};
-   std::vector<r600_shader_atomic> m_atomics;
+   std::vector<r600_shader_atomic, Allocator<r600_shader_atomic>> m_atomics;
 
    uint32_t m_nhwatomic{0};
    uint32_t m_atomic_base{0};
    uint32_t m_next_hwatomic_loc{0};
-   std::unordered_map<int, int> m_atomic_base_map;
+   std::unordered_map<int, int,
+                      std::hash<int>,  std::equal_to<int>,
+                      Allocator<std::pair<const int, int>>> m_atomic_base_map;
    uint32_t m_atomic_file_count{0};
    PRegister m_atomic_update{nullptr};
    PRegister m_rat_return_address{nullptr};

Reply via email to