summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvc0/nvc0_context.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-02-20 17:57:47 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-02-24 17:35:35 +0100
commita6ea37da4bd02241ce3bf522b93dd7ff0757f959 (patch)
treef1a13e36013b1d0e99c9b2505f59810f245adec9 /src/gallium/drivers/nvc0/nvc0_context.c
parent410a13c5ce799fe97a4e4503190d0f66fb2559a3 (diff)
nvc0: improve userspace fencing
Before, there were situations in which we never checked the fences for completion (some loading screens for example) and thus never released memory.
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_context.c')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_context.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c
index 20c1a31b5b..f02de4d044 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nvc0/nvc0_context.c
@@ -47,15 +47,12 @@ nvc0_flush(struct pipe_context *pipe, unsigned flags,
OUT_RING (chan, 0);
}
- if (fence) {
- nvc0_screen_fence_new(nvc0->screen, (struct nvc0_fence **)fence, TRUE);
- }
+ if (fence)
+ nvc0_fence_reference((struct nvc0_fence **)fence,
+ nvc0->screen->fence.current);
- if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME)) {
+ if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME))
FIRE_RING(chan);
-
- nvc0_screen_fence_next(nvc0->screen);
- }
}
static void
@@ -71,6 +68,16 @@ nvc0_destroy(struct pipe_context *pipe)
FREE(nvc0);
}
+void
+nvc0_default_flush_notify(struct nouveau_channel *chan)
+{
+ struct nvc0_context *nvc0 = chan->user_private;
+
+ nvc0_screen_fence_update(nvc0->screen, TRUE);
+
+ nvc0_screen_fence_next(nvc0->screen);
+}
+
struct pipe_context *
nvc0_create(struct pipe_screen *pscreen, void *priv)
{
@@ -95,6 +102,7 @@ nvc0_create(struct pipe_screen *pscreen, void *priv)
nvc0->pipe.flush = nvc0_flush;
screen->base.channel->user_private = nvc0;
+ screen->base.channel->flush_notify = nvc0_default_flush_notify;
nvc0_init_query_functions(nvc0);
nvc0_init_surface_functions(nvc0);