mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-23 08:20:25 +01:00
pan/decode: Free mapped memory objects on BO unreference
Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8583>
(cherry picked from commit 0d0536c1a7)
This commit is contained in:
parent
5fc12bcbc0
commit
d038bd7b3e
4 changed files with 24 additions and 1 deletions
|
|
@ -1084,7 +1084,7 @@
|
|||
"description": "pan/decode: Free mapped memory objects on BO unreference",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -117,6 +117,24 @@ pandecode_inject_mmap(uint64_t gpu_va, void *cpu, unsigned sz, const char *name)
|
|||
_mesa_hash_table_u64_insert(mmap_table, gpu_va + i, mapped_mem);
|
||||
}
|
||||
|
||||
void
|
||||
pandecode_inject_free(uint64_t gpu_va, unsigned sz)
|
||||
{
|
||||
struct pandecode_mapped_memory *mem =
|
||||
pandecode_find_mapped_gpu_mem_containing_rw(gpu_va);
|
||||
|
||||
if (!mem)
|
||||
return;
|
||||
|
||||
assert(mem->gpu_va == gpu_va);
|
||||
assert(mem->length == sz);
|
||||
|
||||
free(mem);
|
||||
|
||||
for (unsigned i = 0; i < sz; i += 4096)
|
||||
_mesa_hash_table_u64_remove(mmap_table, gpu_va + i);
|
||||
}
|
||||
|
||||
char *
|
||||
pointer_as_memory_reference(uint64_t ptr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -436,6 +436,9 @@ panfrost_bo_unreference(struct panfrost_bo *bo)
|
|||
/* When the reference count goes to zero, we need to cleanup */
|
||||
panfrost_bo_munmap(bo);
|
||||
|
||||
if (dev->debug & (PAN_DBG_TRACE | PAN_DBG_SYNC))
|
||||
pandecode_inject_free(bo->ptr.gpu, bo->size);
|
||||
|
||||
/* Rather than freeing the BO now, we'll cache the BO for later
|
||||
* allocations if we're allowed to.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ void pandecode_close(void);
|
|||
void
|
||||
pandecode_inject_mmap(uint64_t gpu_va, void *cpu, unsigned sz, const char *name);
|
||||
|
||||
void pandecode_inject_free(uint64_t gpu_va, unsigned sz);
|
||||
|
||||
void pandecode_jc(uint64_t jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal);
|
||||
|
||||
#endif /* __MMAP_TRACE_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue