Skip to contentSkip to conversation

nouveau: Support fence FDs

PATCH New Thierry Reding 1 participant 1 message Jan 11, 2018 DRM drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: Support fence FDs

From: Thierry Reding <[email protected]>

Add a new nouveau_pushbuf_kick_fence() function that takes and emits a sync fence FD. The fence FD can be waited on, or merged with other fence FDs, or passed back to the kernel as a prerequisite for a subsequent HW operation.

Based heavily on work by Lauri Peltonen <[email protected]>

---
For the kernel patches that add the new IOCTL, see the series at:

	https://patchwork.freedesktop.org/series/36361/
 include/drm/nouveau_drm.h |  23 ++++++++
 nouveau/nouveau.h         |   2 +
 nouveau/pushbuf.c         | 130 ++++++++++++++++++++++++++++++++++------------
 3 files changed, 121 insertions(+), 34 deletions(-)
include/drm/nouveau_drm.h +23 -0
index cb077821c43f..e7f1a2aefd22 100644
@@ -178,6 +178,28 @@ struct drm_nouveau_gem_pushbuf {
 	__u64 gart_available;
 };
 
+#define NOUVEAU_GEM_PUSHBUF_FENCE_WAIT (1 << 0)
+#define NOUVEAU_GEM_PUSHBUF_FENCE_EMIT (1 << 1)
+#define NOUVEAU_GEM_PUSHBUF_FLAGS (NOUVEAU_GEM_PUSHBUF_FENCE_WAIT | \
+                                   NOUVEAU_GEM_PUSHBUF_FENCE_EMIT)
+
+struct drm_nouveau_gem_pushbuf2 {
+    uint32_t channel;
+    uint32_t nr_buffers;
+    uint64_t buffers;
+    uint32_t nr_relocs;
+    uint32_t nr_push;
+    uint64_t relocs;
+    uint64_t push;
+    uint32_t suffix0;
+    uint32_t suffix1;
+    uint64_t vram_available;
+    uint64_t gart_available;
+    uint32_t flags;
+    int32_t fence;
+    uint64_t reserved;
+};
+
 #define NOUVEAU_GEM_CPU_PREP_NOWAIT                                  0x00000001
 #define NOUVEAU_GEM_CPU_PREP_NOBLOCK                                 0x00000002
 #define NOUVEAU_GEM_CPU_PREP_WRITE                                   0x00000004
@@ -212,6 +234,7 @@ struct drm_nouveau_sarea {
 #define DRM_NOUVEAU_GEM_CPU_PREP       0x42
 #define DRM_NOUVEAU_GEM_CPU_FINI       0x43
 #define DRM_NOUVEAU_GEM_INFO           0x44
+#define DRM_NOUVEAU_GEM_PUSHBUF2       0x45
 
 #if defined(__cplusplus)
 }
nouveau/nouveau.h +2 -0
index 335ce77dca77..70d680700faf 100644
@@ -226,6 +226,8 @@ void nouveau_pushbuf_reloc(struct nouveau_pushbuf *, struct nouveau_bo *,
 int nouveau_pushbuf_validate(struct nouveau_pushbuf *);
 uint32_t nouveau_pushbuf_refd(struct nouveau_pushbuf *, struct nouveau_bo *);
 int nouveau_pushbuf_kick(struct nouveau_pushbuf *, struct nouveau_object *chan);
+int nouveau_pushbuf_kick_fence(struct nouveau_pushbuf *,
+                               struct nouveau_object *chan, int *fence);
 struct nouveau_bufctx *
 nouveau_pushbuf_bufctx(struct nouveau_pushbuf *, struct nouveau_bufctx *);
 
nouveau/pushbuf.c +96 -34

216 lines not on this page · raw message

Signature · 6 lines
2.15.1

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau