void
nv50_default_flush_notify(struct nouveau_channel *chan)
{
- struct nv50_context *nv50 = chan->user_private;
+ struct nv50_screen *screen = chan->user_private;
- if (!nv50)
+ if (!screen)
return;
- nouveau_fence_update(&nv50->screen->base, TRUE);
- nouveau_fence_next(&nv50->screen->base);
+ nouveau_fence_update(&screen->base, TRUE);
+ nouveau_fence_next(&screen->base);
}
static void
draw_destroy(nv50->draw);
- if (nv50->screen->cur_ctx == nv50) {
- nv50->screen->base.channel->user_private = NULL;
+ if (nv50->screen->cur_ctx == nv50)
nv50->screen->cur_ctx = NULL;
- }
FREE(nv50);
}
if (!screen->cur_ctx)
screen->cur_ctx = nv50;
- screen->base.channel->user_private = nv50;
screen->base.channel->flush_notify = nv50_default_flush_notify;
nv50_init_query_functions(nv50);
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->code);
nouveau_bo_ref(NULL, &screen->tls_bo);
FAIL_SCREEN_INIT("nouveau_screen_init failed: %d\n", ret);
chan = screen->base.channel;
+ chan->user_private = screen;
pscreen->winsys = ws;
pscreen->destroy = nv50_screen_destroy;
if (!ctx_to->zsa)
ctx_to->dirty &= ~NV50_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 {
static void
nv50_draw_vbo_flush_notify(struct nouveau_channel *chan)
{
- struct nv50_context *nv50 = chan->user_private;
+ struct nv50_screen *screen = chan->user_private;
- nouveau_fence_update(&nv50->screen->base, TRUE);
+ nouveau_fence_update(&screen->base, TRUE);
- nv50_bufctx_emit_relocs(nv50);
+ nv50_bufctx_emit_relocs(screen->cur_ctx);
}
static void
nv50_state_validate(nv50);
chan->flush_notify = nv50_draw_vbo_flush_notify;
- chan->user_private = nv50;
if (nv50->vbo_fifo) {
nv50_push_vbo(nv50, info);
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);
}
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 *
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);
{
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);
return NULL;
}
chan = screen->base.channel;
+ chan->user_private = screen;
pscreen->winsys = ws;
pscreen->destroy = nvc0_screen_destroy;
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 {
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
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);