summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvc0
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2011-07-07 14:58:29 +0200
committerChristoph Bumiller <[email protected]>2011-07-07 15:00:12 +0200
commit3069a7eaa5d83e7f41616347ba244c0dc0d944ae (patch)
tree3de61a1dcd02840d5eefe03009592474c445f9ab /src/gallium/drivers/nvc0
parente54354e8853c3521e71e5b94984722f18b7638e4 (diff)
nv50,nvc0: use screen instead of context for flush notifier
Context may become NULL and we still have to be able to flush pending fences.
Diffstat (limited to 'src/gallium/drivers/nvc0')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_context.c13
-rw-r--r--src/gallium/drivers/nvc0/nvc0_screen.c8
-rw-r--r--src/gallium/drivers/nvc0/nvc0_state_validate.c3
-rw-r--r--src/gallium/drivers/nvc0/nvc0_vbo.c7
4 files changed, 15 insertions, 16 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c
index 2679b7f86aa..983db23eedb 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nvc0/nvc0_context.c
@@ -89,10 +89,8 @@ nvc0_destroy(struct pipe_context *pipe)
draw_destroy(nvc0->draw);
- if (nvc0->screen->cur_ctx == nvc0) {
- nvc0->screen->base.channel->user_private = NULL;
+ if (nvc0->screen->cur_ctx == nvc0)
nvc0->screen->cur_ctx = NULL;
- }
FREE(nvc0);
}
@@ -100,13 +98,13 @@ nvc0_destroy(struct pipe_context *pipe)
void
nvc0_default_flush_notify(struct nouveau_channel *chan)
{
- struct nvc0_context *nvc0 = chan->user_private;
+ struct nvc0_screen *screen = chan->user_private;
- if (!nvc0)
+ if (!screen)
return;
- nouveau_fence_update(&nvc0->screen->base, TRUE);
- nouveau_fence_next(&nvc0->screen->base);
+ nouveau_fence_update(&screen->base, TRUE);
+ nouveau_fence_next(&screen->base);
}
struct pipe_context *
@@ -141,7 +139,6 @@ nvc0_create(struct pipe_screen *pscreen, void *priv)
if (!screen->cur_ctx)
screen->cur_ctx = nvc0;
- screen->base.channel->user_private = nvc0;
screen->base.channel->flush_notify = nvc0_default_flush_notify;
nvc0_init_query_functions(nvc0);
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c
index 34bf0f0a2ad..1bd7fa9f0ea 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -198,8 +198,11 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)
{
struct nvc0_screen *screen = nvc0_screen(pscreen);
- nouveau_fence_wait(screen->base.fence.current);
- nouveau_fence_ref(NULL, &screen->base.fence.current);
+ if (screen->base.fence.current) {
+ nouveau_fence_wait(screen->base.fence.current);
+ nouveau_fence_ref(NULL, &screen->base.fence.current);
+ }
+ screen->base.channel->user_private = NULL;
nouveau_bo_ref(NULL, &screen->text);
nouveau_bo_ref(NULL, &screen->tls);
@@ -358,6 +361,7 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
return NULL;
}
chan = screen->base.channel;
+ chan->user_private = screen;
pscreen->winsys = ws;
pscreen->destroy = nvc0_screen_destroy;
diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c
index 9b2a28150b1..f300f37fb7b 100644
--- a/src/gallium/drivers/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c
@@ -428,8 +428,7 @@ nvc0_switch_pipe_context(struct nvc0_context *ctx_to)
if (!ctx_to->zsa)
ctx_to->dirty &= ~NVC0_NEW_ZSA;
- ctx_to->screen->base.channel->user_private = ctx_to->screen->cur_ctx =
- ctx_to;
+ ctx_to->screen->cur_ctx = ctx_to;
}
static struct state_validate {
diff --git a/src/gallium/drivers/nvc0/nvc0_vbo.c b/src/gallium/drivers/nvc0/nvc0_vbo.c
index 41079104b39..8a5bf8dc582 100644
--- a/src/gallium/drivers/nvc0/nvc0_vbo.c
+++ b/src/gallium/drivers/nvc0/nvc0_vbo.c
@@ -367,11 +367,11 @@ nvc0_prim_gl(unsigned prim)
static void
nvc0_draw_vbo_flush_notify(struct nouveau_channel *chan)
{
- struct nvc0_context *nvc0 = chan->user_private;
+ struct nvc0_screen *screen = chan->user_private;
- nouveau_fence_update(&nvc0->screen->base, TRUE);
+ nouveau_fence_update(&screen->base, TRUE);
- nvc0_bufctx_emit_relocs(nvc0);
+ nvc0_bufctx_emit_relocs(screen->cur_ctx);
}
static void
@@ -587,7 +587,6 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
nvc0_state_validate(nvc0);
chan->flush_notify = nvc0_draw_vbo_flush_notify;
- chan->user_private = nvc0;
if (nvc0->vbo_fifo) {
nvc0_push_vbo(nvc0, info);