aboutsummaryrefslogtreecommitdiff
path: root/nouveau/nouveau_pushbuf.h
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-01-29 09:53:24 +0100
committerBen Skeggs <bskeggs@redhat.com>2010-02-16 10:16:37 +1000
commitb496c63143e9a4ca02011582329bce2df99d9b7c (patch)
tree4721c7af5a12c86646c272524a48ea2d39eebf9d /nouveau/nouveau_pushbuf.h
parent4a17be4a86cde1065908576e44f3710f6d9d68af (diff)
nouveau: interface changes for 0.0.16 DRM
This commit encompasses the changes necessary to run on top of the 0.0.16 nouveau interface, additional APIs to support the new features of the interface, as well as code from Luca Barbieri to improve the pushbuf interface, which just happens to break nouveau's libdrm ABI so was delayed until now. API changes as a result of 0.0.16 DRM interface: 1. No more bo_pin()/bo_unpin(), these were only there for UMS and we no longer support it. 2. Any random nouveau_bo can be submitted to the GPU as a push buffer. 3. Relocations can be applied on any nouveau_bo This patch changes the pushbuffer ABI to: 1. No longer use/expose nouveau_pushbuffer. Everything is directly in nouveau_channel. This saves the extra "pushbuf" pointer dereference. 2. Use cur/end pointers instead of tracking the remaining size. Pushing data now only needs to alter cur and not both cur and remaining. The goal is to make the *_RING macros faster and make the interface simpler and cleaner in the process. The *_RING APIs are unchanged, but those are inlined and the ABI is changed. Also, anything accessing pushbuf->remaining instead of using AVAIL_RING will need to be fixed.
Diffstat (limited to 'nouveau/nouveau_pushbuf.h')
-rw-r--r--nouveau/nouveau_pushbuf.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/nouveau/nouveau_pushbuf.h b/nouveau/nouveau_pushbuf.h
index 46982afa..52d13a0a 100644
--- a/nouveau/nouveau_pushbuf.h
+++ b/nouveau/nouveau_pushbuf.h
@@ -29,13 +29,6 @@
#include "nouveau_bo.h"
#include "nouveau_grobj.h"
-struct nouveau_pushbuf {
- struct nouveau_channel *channel;
-
- unsigned remaining;
- uint32_t *cur;
-};
-
int
nouveau_pushbuf_flush(struct nouveau_channel *, unsigned min);
@@ -51,6 +44,10 @@ nouveau_pushbuf_emit_reloc(struct nouveau_channel *, void *ptr,
struct nouveau_bo *, uint32_t data, uint32_t data2,
uint32_t flags, uint32_t vor, uint32_t tor);
+int
+nouveau_pushbuf_submit(struct nouveau_channel *chan, struct nouveau_bo *bo,
+ unsigned offset, unsigned length);
+
/* Push buffer access macros */
static __inline__ int
MARK_RING(struct nouveau_channel *chan, unsigned dwords, unsigned relocs)
@@ -67,14 +64,14 @@ MARK_UNDO(struct nouveau_channel *chan)
static __inline__ void
OUT_RING(struct nouveau_channel *chan, unsigned data)
{
- *(chan->pushbuf->cur++) = (data);
+ *(chan->cur++) = (data);
}
static __inline__ void
OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned size)
{
- memcpy(chan->pushbuf->cur, data, size * 4);
- chan->pushbuf->cur += size;
+ memcpy(chan->cur, data, size * 4);
+ chan->cur += size;
}
static __inline__ void
@@ -88,13 +85,13 @@ OUT_RINGf(struct nouveau_channel *chan, float f)
static __inline__ unsigned
AVAIL_RING(struct nouveau_channel *chan)
{
- return chan->pushbuf->remaining;
+ return chan->end - chan->cur;
}
static __inline__ void
WAIT_RING(struct nouveau_channel *chan, unsigned size)
{
- if (chan->pushbuf->remaining < size)
+ if (chan->cur + size > chan->end)
nouveau_pushbuf_flush(chan, size);
}
@@ -108,7 +105,6 @@ BEGIN_RING(struct nouveau_channel *chan, struct nouveau_grobj *gr,
WAIT_RING(chan, size + 1);
OUT_RING(chan, (gr->subc << 13) | (size << 18) | mthd);
- chan->pushbuf->remaining -= (size + 1);
}
/* non-incrementing BEGIN_RING */
@@ -147,7 +143,7 @@ static __inline__ int
OUT_RELOC(struct nouveau_channel *chan, struct nouveau_bo *bo,
unsigned data, unsigned flags, unsigned vor, unsigned tor)
{
- return nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, bo,
+ return nouveau_pushbuf_emit_reloc(chan, chan->cur++, bo,
data, 0, flags, vor, tor);
}
@@ -156,7 +152,7 @@ OUT_RELOC2(struct nouveau_channel *chan, struct nouveau_bo *bo,
unsigned data, unsigned data2, unsigned flags,
unsigned vor, unsigned tor)
{
- return nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, bo,
+ return nouveau_pushbuf_emit_reloc(chan, chan->cur++, bo,
data, data2, flags, vor, tor);
}