zink: null out bo usage when allocating from slab
avoids weird cases with stale usage cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27827>
This commit is contained in:
committed by
Marge Bot
parent
689a80704a
commit
91f99f82ab
@@ -637,6 +637,8 @@ zink_bo_create(struct zink_screen *screen, uint64_t size, unsigned alignment, en
|
||||
assert(bo->base.base.placement == mem_type_idx);
|
||||
pipe_reference_init(&bo->base.base.reference, 1);
|
||||
bo->base.base.size = size;
|
||||
memset(&bo->reads, 0, sizeof(bo->reads));
|
||||
memset(&bo->writes, 0, sizeof(bo->writes));
|
||||
bo->unique_id = p_atomic_inc_return(&screen->pb.next_bo_unique_id);
|
||||
assert(alignment <= 1 << bo->base.base.alignment_log2);
|
||||
|
||||
@@ -666,8 +668,11 @@ no_slab:
|
||||
bo = (struct zink_bo*)
|
||||
pb_cache_reclaim_buffer(&screen->pb.bo_cache, size, alignment, 0, mem_type_idx);
|
||||
assert(!bo || bo->base.base.placement == mem_type_idx);
|
||||
if (bo)
|
||||
if (bo) {
|
||||
memset(&bo->reads, 0, sizeof(bo->reads));
|
||||
memset(&bo->writes, 0, sizeof(bo->writes));
|
||||
return &bo->base;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a new one. */
|
||||
|
||||
Reference in New Issue
Block a user