From: Gert Wollny Date: Sun, 24 Jul 2022 11:37:31 +0000 (+0200) Subject: r600/sfn: make sure the memory pool is released after shader translation X-Git-Tag: upstream/22.3.5~5669 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99e4a2329000714ea5dce1931549a2b1ef185944;p=platform%2Fupstream%2Fmesa.git r600/sfn: make sure the memory pool is released after shader translation Signed-off-by: Gert Wollny Part-of: --- diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp index 8c87884..1dfb532 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp @@ -628,10 +628,20 @@ bool r600_lower_to_scalar_instr_filter(const nir_instr *instr, const void *) } } + +class MallocPoolRelease { +public: + ~MallocPoolRelease() { + r600::release_pool(); + } +}; + int r600_shader_from_nir(struct r600_context *rctx, struct r600_pipe_shader *pipeshader, r600_shader_key *key) { + MallocPoolRelease pool_release; + struct r600_pipe_shader_selector *sel = pipeshader->selector; bool lower_64bit = (rctx->b.gfx_level < CAYMAN && diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_vs.h b/src/gallium/drivers/r600/sfn/sfn_shader_vs.h index 41751b8..571f32a 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_vs.h +++ b/src/gallium/drivers/r600/sfn/sfn_shader_vs.h @@ -120,7 +120,11 @@ private: const pipe_stream_output_info *m_so_info {nullptr}; - std::unordered_map m_output_registers; + template + using unordered_map_alloc = std::unordered_map, std::equal_to, + Allocator>>; + + unordered_map_alloc m_output_registers; }; diff --git a/src/gallium/drivers/r600/sfn/sfn_valuefactory.h b/src/gallium/drivers/r600/sfn/sfn_valuefactory.h index 89a9bcf..74ee1a5 100644 --- a/src/gallium/drivers/r600/sfn/sfn_valuefactory.h +++ b/src/gallium/drivers/r600/sfn/sfn_valuefactory.h @@ -37,6 +37,7 @@ #include #include #include +#include struct r600_shader; @@ -282,7 +283,7 @@ private: using ROValueMap = unordered_reg_map_alloc; RegisterMap m_registers; - std::vector m_pinned_registers; + std::list> m_pinned_registers; ROValueMap m_values; unordered_map_alloc m_literal_values; unordered_map_alloc m_inline_constants;