diff options
author | Marek Olšák <[email protected]> | 2017-01-27 00:12:37 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-02-14 21:46:16 +0100 |
commit | 55ad59d2b72d6d6e38bd0a54586b713a7a93bb10 (patch) | |
tree | eb46201b7ce87773e0199399a75a469c389f3dc7 /src/gallium/drivers/nouveau | |
parent | 998396c32e4e95fef5a1efef6cb1a9efb0868aa6 (diff) |
gallium: set pipe_context uploaders in drivers (v3)
Notes:
- make sure the default size is large enough to handle all state trackers
- pipe wrappers don't receive transfer calls from stream_uploader, because
pipe_context::stream_uploader points directly to the underlying driver's
stream_uploader (to keep it simple for now)
v2: add error handling to nv50, nvc0, noop
v3: set const_uploader
Reviewed-by: Nicolai Hähnle <[email protected]>
Tested-by: Edmondo Tommasina <[email protected]> (v1)
Tested-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_context.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_context.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 10 |
3 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.c b/src/gallium/drivers/nouveau/nv30/nv30_context.c index 3ed088912e2..716d2bbe4c1 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_context.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_context.c @@ -24,6 +24,7 @@ */ #include "draw/draw_context.h" +#include "util/u_upload_mgr.h" #include "nv_object.xml.h" #include "nv30/nv30-40_3d.xml.h" @@ -165,6 +166,9 @@ nv30_context_destroy(struct pipe_context *pipe) if (nv30->draw) draw_destroy(nv30->draw); + if (nv30->base.pipe.stream_uploader) + u_upload_destroy(nv30->base.pipe.stream_uploader); + if (nv30->blit_vp) nouveau_heap_free(&nv30->blit_vp); @@ -205,6 +209,13 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) nv30->base.screen = &screen->base; nv30->base.copy_data = nv30_transfer_copy_data; + nv30->base.pipe.stream_uploader = u_upload_create_default(&nv30->base.pipe); + if (!nv30->base.pipe.stream_uploader) { + nv30_context_destroy(pipe); + return NULL; + } + nv30->base.pipe.const_uploader = nv30->base.pipe.stream_uploader; + pipe = &nv30->base.pipe; pipe->screen = pscreen; pipe->priv = priv; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c index ece7da9c5b4..bf768bc6db5 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_context.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c @@ -22,6 +22,7 @@ #include "pipe/p_defines.h" #include "util/u_framebuffer.h" +#include "util/u_upload_mgr.h" #include "nv50/nv50_context.h" #include "nv50/nv50_screen.h" @@ -176,6 +177,10 @@ nv50_destroy(struct pipe_context *pipe) /* Save off the state in case another context gets created */ nv50->screen->save_state = nv50->state; } + + if (nv50->base.pipe.stream_uploader) + u_upload_destroy(nv50->base.pipe.stream_uploader); + nouveau_pushbuf_bufctx(nv50->base.pushbuf, NULL); nouveau_pushbuf_kick(nv50->base.pushbuf, nv50->base.pushbuf->channel); @@ -315,6 +320,10 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) nv50->screen = screen; pipe->screen = pscreen; pipe->priv = priv; + pipe->stream_uploader = u_upload_create_default(pipe); + if (!pipe->stream_uploader) + goto out_err; + pipe->const_uploader = pipe->stream_uploader; pipe->destroy = nv50_destroy; @@ -387,6 +396,8 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) return pipe; out_err: + if (pipe->stream_uploader) + u_upload_destroy(pipe->stream_uploader); if (nv50->bufctx_3d) nouveau_bufctx_del(&nv50->bufctx_3d); if (nv50->bufctx_cp) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c index 8f2b974b34a..d0f4da303bb 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c @@ -22,6 +22,7 @@ #include "pipe/p_defines.h" #include "util/u_framebuffer.h" +#include "util/u_upload_mgr.h" #include "nvc0/nvc0_context.h" #include "nvc0/nvc0_screen.h" @@ -199,6 +200,9 @@ nvc0_destroy(struct pipe_context *pipe) nvc0->screen->save_state.tfb = NULL; } + if (nvc0->base.pipe.stream_uploader) + u_upload_destroy(nvc0->base.pipe.stream_uploader); + /* Unset bufctx, we don't want to revalidate any resources after the flush. * Other contexts will always set their bufctx again on action calls. */ @@ -386,6 +390,10 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) pipe->screen = pscreen; pipe->priv = priv; + pipe->stream_uploader = u_upload_create_default(pipe); + if (!pipe->stream_uploader) + goto out_err; + pipe->const_uploader = pipe->stream_uploader; pipe->destroy = nvc0_destroy; @@ -472,6 +480,8 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) out_err: if (nvc0) { + if (pipe->stream_uploader) + u_upload_destroy(pipe->stream_uploader); if (nvc0->bufctx_3d) nouveau_bufctx_del(&nvc0->bufctx_3d); if (nvc0->bufctx_cp) |