Am 08.04.2017 um 18:26 schrieb Chris Wilson:
Reserve 0 for general use a token meaning that the fence doesn't belong
to an ordered timeline (fence context).

NAK, we kept context allocation cheap to avoid exactly that.

Please elaborate further why it should be necessary now.

Regards,
Christian.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: Gustavo Padovan <gust...@padovan.org>
Cc: Joonas Lahtinen <joonas.lahti...@linux.intel.com>
Cc: "Christian König" <christian.koe...@amd.com
Cc: Daniel Vetter <daniel.vet...@ffwll.ch>
Cc: Alex Deucher <alexander.deuc...@amd.com>
---
  drivers/dma-buf/dma-fence.c | 4 +++-
  include/linux/dma-fence.h   | 2 ++
  2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 0918d3f003d6..0646357ea350 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -36,8 +36,10 @@ EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal);
   * fence context, this allows checking if fences belong to the same
   * context or not. One device can have multiple separate contexts,
   * and they're used if some engine can run independently of another.
+ *
+ * 0 is excluded and treated as a special DMA_FENCE_NO_CONTEXT.
   */
-static atomic64_t dma_fence_context_counter = ATOMIC64_INIT(0);
+static atomic64_t dma_fence_context_counter = ATOMIC64_INIT(1);
/**
   * dma_fence_context_alloc - allocate an array of fence contexts
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 6048fa404e57..adfdc7fdd9c3 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -455,6 +455,8 @@ static inline signed long dma_fence_wait(struct dma_fence 
*fence, bool intr)
        return ret < 0 ? ret : 0;
  }
+#define DMA_FENCE_NO_CONTEXT ((u64)0)
+
  u64 dma_fence_context_alloc(unsigned num);
#define DMA_FENCE_TRACE(f, fmt, args...) \


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to