mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
nouveau: move nouveau_context initialization to common code
Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
This commit is contained in:
parent
54f285901d
commit
4154d53a85
5 changed files with 11 additions and 22 deletions
|
|
@ -66,7 +66,7 @@ void
|
|||
nouveau_context_init_vdec(struct nouveau_context *);
|
||||
|
||||
void
|
||||
nouveau_context_init(struct nouveau_context *);
|
||||
nouveau_context_init(struct nouveau_context *, struct nouveau_screen *);
|
||||
|
||||
void
|
||||
nouveau_scratch_runout_release(struct nouveau_context *);
|
||||
|
|
|
|||
|
|
@ -409,7 +409,11 @@ nouveau_set_debug_callback(struct pipe_context *pipe,
|
|||
}
|
||||
|
||||
void
|
||||
nouveau_context_init(struct nouveau_context *context)
|
||||
nouveau_context_init(struct nouveau_context *context, struct nouveau_screen *screen)
|
||||
{
|
||||
context->pipe.set_debug_callback = nouveau_set_debug_callback;
|
||||
|
||||
context->screen = screen;
|
||||
context->client = screen->client;
|
||||
context->pushbuf = screen->pushbuf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,6 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
{
|
||||
struct nv30_screen *screen = nv30_screen(pscreen);
|
||||
struct nv30_context *nv30 = CALLOC_STRUCT(nv30_context);
|
||||
struct nouveau_pushbuf *push;
|
||||
struct pipe_context *pipe;
|
||||
int ret;
|
||||
|
||||
|
|
@ -199,7 +198,6 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
return NULL;
|
||||
|
||||
nv30->screen = screen;
|
||||
nv30->base.screen = &screen->base;
|
||||
nv30->base.copy_data = nv30_transfer_copy_data;
|
||||
|
||||
pipe = &nv30->base.pipe;
|
||||
|
|
@ -208,6 +206,9 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
pipe->destroy = nv30_context_destroy;
|
||||
pipe->flush = nv30_context_flush;
|
||||
|
||||
nouveau_context_init(&nv30->base, &screen->base);
|
||||
nv30->base.pushbuf->kick_notify = nv30_context_kick_notify;
|
||||
|
||||
nv30->base.pipe.stream_uploader = u_upload_create_default(&nv30->base.pipe);
|
||||
if (!nv30->base.pipe.stream_uploader) {
|
||||
nv30_context_destroy(pipe);
|
||||
|
|
@ -215,14 +216,6 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
}
|
||||
nv30->base.pipe.const_uploader = nv30->base.pipe.stream_uploader;
|
||||
|
||||
/*XXX: *cough* per-context client */
|
||||
nv30->base.client = screen->base.client;
|
||||
|
||||
/*XXX: *cough* per-context pushbufs */
|
||||
push = screen->base.pushbuf;
|
||||
nv30->base.pushbuf = push;
|
||||
push->kick_notify = nv30_context_kick_notify;
|
||||
|
||||
nv30->base.invalidate_resource_storage = nv30_invalidate_resource_storage;
|
||||
|
||||
ret = nouveau_bufctx_new(nv30->base.client, 64, &nv30->bufctx);
|
||||
|
|
@ -244,7 +237,6 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
if (debug_get_bool_option("NV30_SWTNL", false))
|
||||
nv30->draw_flags |= NV30_NEW_SWTNL;
|
||||
|
||||
nouveau_context_init(&nv30->base);
|
||||
nv30->sample_mask = 0xffff;
|
||||
nv30_vbo_init(pipe);
|
||||
nv30_query_init(pipe);
|
||||
|
|
|
|||
|
|
@ -313,8 +313,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
if (!nv50_blitctx_create(nv50))
|
||||
goto out_err;
|
||||
|
||||
nv50->base.pushbuf = screen->base.pushbuf;
|
||||
nv50->base.client = screen->base.client;
|
||||
nouveau_context_init(&nv50->base, &screen->base);
|
||||
|
||||
ret = nouveau_bufctx_new(nv50->base.client, 2, &nv50->bufctx);
|
||||
if (!ret)
|
||||
|
|
@ -326,7 +325,6 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
if (ret)
|
||||
goto out_err;
|
||||
|
||||
nv50->base.screen = &screen->base;
|
||||
nv50->base.copy_data = nv50_m2mf_copy_linear;
|
||||
nv50->base.push_data = nv50_sifc_linear_u8;
|
||||
nv50->base.push_cb = nv50_cb_push;
|
||||
|
|
@ -361,7 +359,6 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
}
|
||||
nv50->base.pushbuf->kick_notify = nv50_default_kick_notify;
|
||||
|
||||
nouveau_context_init(&nv50->base);
|
||||
nv50_init_query_functions(nv50);
|
||||
nv50_init_surface_functions(nv50);
|
||||
nv50_init_state_functions(nv50);
|
||||
|
|
|
|||
|
|
@ -425,8 +425,7 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
if (!nvc0_blitctx_create(nvc0))
|
||||
goto out_err;
|
||||
|
||||
nvc0->base.pushbuf = screen->base.pushbuf;
|
||||
nvc0->base.client = screen->base.client;
|
||||
nouveau_context_init(&nvc0->base, &screen->base);
|
||||
|
||||
ret = nouveau_bufctx_new(nvc0->base.client, 2, &nvc0->bufctx);
|
||||
if (!ret)
|
||||
|
|
@ -439,8 +438,6 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
goto out_err;
|
||||
|
||||
nvc0->screen = screen;
|
||||
nvc0->base.screen = &screen->base;
|
||||
|
||||
pipe->screen = pscreen;
|
||||
pipe->priv = priv;
|
||||
pipe->stream_uploader = u_upload_create_default(pipe);
|
||||
|
|
@ -464,7 +461,6 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
|
|||
pipe->emit_string_marker = nvc0_emit_string_marker;
|
||||
pipe->get_device_reset_status = nvc0_get_device_reset_status;
|
||||
|
||||
nouveau_context_init(&nvc0->base);
|
||||
nvc0_init_query_functions(nvc0);
|
||||
nvc0_init_surface_functions(nvc0);
|
||||
nvc0_init_state_functions(nvc0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue