Hi,
This is my first attempt to review patch for Mesa, so please take it with a
grain of salt.
On úterý 14. srpna 2018 20:21:40 CEST Chris Wilson wrote:
> @@ -504,6 +506,24 @@ bo_alloc_internal(struct brw_bufmgr *bufmgr,
> bool busy = false;
> bool zeroed = false;
>
> + /* Reuse the same bo for all zero-sized requests */
> + if (size == 0) {
> + if (bufmgr->bo_zero == NULL) {
> + bo = bo_alloc_internal(bufmgr, "zero", 4096,
> + BRW_MEMZONE_OTHER, BO_ALLOC_BUSY, 0, 0);
> + if (!bo)
> + return NULL;
> +
> + bo->size = 0;
Doesn't this break something once the bo_zero is freed? Either after two
threads raced and one has to cleanup or when the whole bufmgr is destroyed.
The bucket_for_size will choose different bucket for sizes 4096 and 0:
size 4096 -> bucket index 0 -> some bucket (I assume)
size 0 -> bucket index 119 -> null bucket (always too big)
So the get_bucket_allocator function will return some bucket when allocating
and null bucket when freeing, so allocation goes thru bucket_vma_alloc and
freeing thru util_vma_heap_free. I did not examine those functions closer, but
it does sound like it would break something.
> +
> + if (p_atomic_cmpxchg(&bufmgr->bo_zero, NULL, bo))
> + brw_bo_unreference(bo);
> + }
Michal
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev