freedreno: add simpler ring-reloc

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>
main
Rob Clark 2016-05-20 17:19:04 -04:00
parent 73db0a0421
commit 2ca73c666a
3 changed files with 28 additions and 7 deletions

View File

@ -32,6 +32,15 @@
#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;

View 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;
}

View 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_ */