OSDN Git Service

freedreno: add simpler ring-reloc
authorRob Clark <robclark@freedesktop.org>
Fri, 20 May 2016 21:19:04 +0000 (17:19 -0400)
committerRob Clark <robclark@freedesktop.org>
Wed, 20 Jul 2016 23:42:21 +0000 (19:42 -0400)
Provide a way to insert a reference (ie. OUT_IB()) to a target ring,
executing all the cmds in the target ring from the start.

Sometimes the ringmarker stuff is just overkill.  And it will won't
really work properly once we support multiple physical cmdstream buffers
per fd_ringbuffer.  So in the future the old ringmarker related APIs
will be deprecated in a few releases.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
freedreno/freedreno_drmif.h
freedreno/freedreno_ringbuffer.c
freedreno/freedreno_ringbuffer.h

index 02dcfd2..15ae075 100644 (file)
 #include <xf86drm.h>
 #include <stdint.h>
 
+#if defined(__GNUC__)
+#  define deprecated __attribute__((__deprecated__))
+#else
+#  define deprecated
+#endif
+
+/* an empty marker for things that will be deprecated in the future: */
+#define will_be_deprecated
+
 struct fd_bo;
 struct fd_pipe;
 struct fd_device;
index 9d987aa..be80296 100644 (file)
@@ -112,6 +112,16 @@ fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
        ring->funcs->emit_reloc_ring(ring, target->ring, submit_offset, size);
 }
 
+uint32_t
+fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring,
+               struct fd_ringbuffer *target, uint32_t cmd_idx)
+{
+       uint32_t size = offset_bytes(target->cur, target->start);
+       assert(cmd_idx == 0);
+       ring->funcs->emit_reloc_ring(ring, target, 0, size);
+       return size;
+}
+
 struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring)
 {
        struct fd_ringmarker *marker = NULL;
@@ -124,7 +134,7 @@ struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring)
 
        marker->ring = ring;
 
-       fd_ringmarker_mark(marker);
+       marker->cur = marker->ring->cur;
 
        return marker;
 }
index 578cdb2..643f50b 100644 (file)
@@ -75,14 +75,16 @@ struct fd_reloc {
 };
 
 void fd_ringbuffer_reloc(struct fd_ringbuffer *ring, const struct fd_reloc *reloc);
-void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
+will_be_deprecated void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
                struct fd_ringmarker *target, struct fd_ringmarker *end);
+uint32_t fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring,
+               struct fd_ringbuffer *target, uint32_t cmd_idx);
 
-struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring);
-void fd_ringmarker_del(struct fd_ringmarker *marker);
-void fd_ringmarker_mark(struct fd_ringmarker *marker);
-uint32_t fd_ringmarker_dwords(struct fd_ringmarker *start,
+will_be_deprecated struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring);
+will_be_deprecated void fd_ringmarker_del(struct fd_ringmarker *marker);
+will_be_deprecated void fd_ringmarker_mark(struct fd_ringmarker *marker);
+will_be_deprecated uint32_t fd_ringmarker_dwords(struct fd_ringmarker *start,
                struct fd_ringmarker *end);
-int fd_ringmarker_flush(struct fd_ringmarker *marker);
+will_be_deprecated int fd_ringmarker_flush(struct fd_ringmarker *marker);
 
 #endif /* FREEDRENO_RINGBUFFER_H_ */