[PATCH] dma-fence: allow dma fence to have their own lock
Sergey Senozhatsky
senozhatsky at chromium.org
Mon May 30 15:45:10 UTC 2022
On (22/05/30 16:55), Christian König wrote:
>
> If you just want to create a single dma_fence which is also only bound to a
> single context you can embed the lock into the fence without much problem.
>
> See how the dma_fence_array does that for example: https://elixir.bootlin.com/linux/latest/source/include/linux/dma-fence-array.h#L37
Christian, I'm not sure I'm following you on the "embed the lock into the
fence without much problem" part. If I understand it correctly this should
be something like:
fences = kmalloc_array(1, sizeof(*fences), GFP_KERNEL);
for_each_fence(...) {
// what spinlock should I use here?
dma_fence_init(&fences[i], .. &lock ..);
dma_fence_get(&fences[i]);
}
fence_array = dma_fence_array_create(1, fences, ....);
sync_file_create(&fence_array->base);
More information about the dri-devel
mailing list