0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef __LINUX_DMA_FENCE_ARRAY_H
0013 #define __LINUX_DMA_FENCE_ARRAY_H
0014
0015 #include <linux/dma-fence.h>
0016 #include <linux/irq_work.h>
0017
0018
0019
0020
0021
0022
0023 struct dma_fence_array_cb {
0024 struct dma_fence_cb cb;
0025 struct dma_fence_array *array;
0026 };
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 struct dma_fence_array {
0038 struct dma_fence base;
0039
0040 spinlock_t lock;
0041 unsigned num_fences;
0042 atomic_t num_pending;
0043 struct dma_fence **fences;
0044
0045 struct irq_work work;
0046 };
0047
0048
0049
0050
0051
0052
0053
0054
0055 static inline struct dma_fence_array *
0056 to_dma_fence_array(struct dma_fence *fence)
0057 {
0058 if (!fence || !dma_fence_is_array(fence))
0059 return NULL;
0060
0061 return container_of(fence, struct dma_fence_array, base);
0062 }
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 #define dma_fence_array_for_each(fence, index, head) \
0076 for (index = 0, fence = dma_fence_array_first(head); fence; \
0077 ++(index), fence = dma_fence_array_next(head, index))
0078
0079 struct dma_fence_array *dma_fence_array_create(int num_fences,
0080 struct dma_fence **fences,
0081 u64 context, unsigned seqno,
0082 bool signal_on_any);
0083
0084 bool dma_fence_match_context(struct dma_fence *fence, u64 context);
0085
0086 struct dma_fence *dma_fence_array_first(struct dma_fence *head);
0087 struct dma_fence *dma_fence_array_next(struct dma_fence *head,
0088 unsigned int index);
0089
0090 #endif