summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/dri/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-03-17 14:22:36 +1100
committerBen Skeggs <skeggsb@gmail.com>2008-03-17 14:45:19 +1100
commitf93386de0fb281e79633c3bf57060f660abdfade (patch)
tree13b33883fdb61c6b56c257c1a69894fe03729b12 /src/gallium/winsys/dri/nouveau
parent767cd2ed6e97ae09526b15728495f361d5e22cb2 (diff)
nouveau: create fence object when allocating pushbuf, instead of submit
Diffstat (limited to 'src/gallium/winsys/dri/nouveau')
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_bo.c3
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_drmif.h4
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c14
3 files changed, 11 insertions, 10 deletions
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_bo.c b/src/gallium/winsys/dri/nouveau/nouveau_bo.c
index ad587bafdf..40d4667c47 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_bo.c
+++ b/src/gallium/winsys/dri/nouveau/nouveau_bo.c
@@ -376,9 +376,10 @@ nouveau_bo_validate_bo(struct nouveau_channel *chan, struct nouveau_bo *bo,
int
nouveau_bo_validate(struct nouveau_channel *chan, struct nouveau_bo *bo,
- struct nouveau_fence *fence, uint32_t flags)
+ uint32_t flags)
{
struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
+ struct nouveau_fence *fence = nouveau_pushbuf(chan->pushbuf)->fence;
int ret;
assert(bo->map == NULL);
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_drmif.h b/src/gallium/winsys/dri/nouveau/nouveau_drmif.h
index 37e404fc6c..1c9b5799f9 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_drmif.h
+++ b/src/gallium/winsys/dri/nouveau/nouveau_drmif.h
@@ -127,6 +127,8 @@ struct nouveau_pushbuf_bo {
struct nouveau_pushbuf_priv {
struct nouveau_pushbuf base;
+ struct nouveau_fence *fence;
+
unsigned nop_jump;
unsigned start;
unsigned size;
@@ -288,7 +290,7 @@ nouveau_bo_unmap(struct nouveau_bo *);
extern int
nouveau_bo_validate(struct nouveau_channel *, struct nouveau_bo *,
- struct nouveau_fence *fence, uint32_t flags);
+ uint32_t flags);
extern int
nouveau_resource_init(struct nouveau_resource **heap, unsigned start,
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c b/src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c
index fd9a5c5a96..a2b9321b15 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c
+++ b/src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c
@@ -56,6 +56,10 @@ nouveau_pushbuf_space(struct nouveau_channel *chan, unsigned min)
nvpb->base.remaining = nvpb->size;
nvpb->base.cur = &nvchan->pushbuf[nvpb->start];
+ /* Create a new fence object for this "frame" */
+ nouveau_fence_ref(NULL, &nvpb->fence);
+ nouveau_fence_new(chan, &nvpb->fence);
+
return 0;
}
@@ -128,7 +132,6 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min)
struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
struct nouveau_pushbuf_priv *nvpb = &nvchan->pb;
struct nouveau_pushbuf_bo *pbbo;
- struct nouveau_fence *fence = NULL;
int ret;
if (nvpb->base.remaining == nvpb->size)
@@ -139,10 +142,6 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min)
nvchan->dma->free -= nvpb->size;
assert(nvchan->dma->cur <= nvchan->dma->max);
- ret = nouveau_fence_new(chan, &fence);
- if (ret)
- return ret;
-
nvchan->dma = &nvchan->dma_bufmgr;
nvchan->pushbuf[nvpb->nop_jump] = 0x20000000 |
(nvchan->dma->base + (nvchan->dma->cur << 2));
@@ -153,7 +152,7 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min)
struct nouveau_pushbuf_reloc *r;
struct nouveau_bo *bo = &ptr_to_bo(pbbo->handle)->base;
- ret = nouveau_bo_validate(chan, bo, fence, pbbo->flags);
+ ret = nouveau_bo_validate(chan, bo, pbbo->flags);
assert (ret == 0);
if (bo->offset == nouveau_bo(bo)->offset &&
@@ -188,9 +187,8 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min)
nvchan->dma = &nvchan->dma_master;
/* Fence + kickoff */
- nouveau_fence_emit(fence);
+ nouveau_fence_emit(nvpb->fence);
FIRE_RING_CH(chan);
- nouveau_fence_ref(NULL, &fence);
/* Allocate space for next push buffer */
ret = nouveau_pushbuf_space(chan, min);