[Mesa-dev] [PATCH 4/7] nouveau: access client and pushbuf from context directly
Karol Herbst
kherbst at redhat.com
Wed Dec 5 21:04:54 UTC 2018
prepareation for fixing our multi context issues.
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
src/gallium/drivers/nouveau/nv30/nv30_context.c | 4 ++--
src/gallium/drivers/nouveau/nv30/nv30_draw.c | 4 ++--
src/gallium/drivers/nouveau/nv50/nv50_compute.c | 4 ++--
src/gallium/drivers/nouveau/nv50/nv50_context.c | 8 ++++----
src/gallium/drivers/nouveau/nv50/nv50_query_hw.c | 4 ++--
src/gallium/drivers/nouveau/nv50/nv50_transfer.c | 2 +-
src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 10 +++++-----
src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c | 10 +++++-----
src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c | 4 ++--
9 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.c b/src/gallium/drivers/nouveau/nv30/nv30_context.c
index e137525c2b8..18eb2c41618 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_context.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_context.c
@@ -168,8 +168,8 @@ nv30_context_destroy(struct pipe_context *pipe)
if (nv30->blit_fp)
pipe_resource_reference(&nv30->blit_fp, NULL);
- if (nv30->screen->base.pushbuf->user_priv == &nv30->bufctx)
- nv30->screen->base.pushbuf->user_priv = NULL;
+ if (nv30->base.pushbuf->user_priv == &nv30->bufctx)
+ nv30->base.pushbuf->user_priv = NULL;
nouveau_bufctx_del(&nv30->bufctx);
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
index 798ec1423d2..60f6d38a516 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
@@ -124,7 +124,7 @@ nv30_render_draw_elements(struct vbuf_render *render,
{
struct nv30_render *r = nv30_render(render);
struct nv30_context *nv30 = r->nv30;
- struct nouveau_pushbuf *push = nv30->screen->base.pushbuf;
+ struct nouveau_pushbuf *push = nv30->base.pushbuf;
unsigned i;
BEGIN_NV04(push, NV30_3D(VTXBUF(0)), r->vertex_info.num_attribs);
@@ -280,7 +280,7 @@ nv30_render_validate(struct nv30_context *nv30)
struct nv30_render *r = nv30_render(nv30->draw->render);
struct nv30_rasterizer_stateobj *rast = nv30->rast;
struct pipe_screen *pscreen = &nv30->screen->base.base;
- struct nouveau_pushbuf *push = nv30->screen->base.pushbuf;
+ struct nouveau_pushbuf *push = nv30->base.pushbuf;
struct nouveau_object *eng3d = nv30->screen->eng3d;
struct nv30_vertprog *vp = nv30->vertprog.program;
struct vertex_info *vinfo = &r->vertex_info;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_compute.c b/src/gallium/drivers/nouveau/nv50/nv50_compute.c
index d781f6fd7d4..aac60bba54d 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_compute.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_compute.c
@@ -195,7 +195,7 @@ static void
nv50_compute_upload_input(struct nv50_context *nv50, const uint32_t *input)
{
struct nv50_screen *screen = nv50->screen;
- struct nouveau_pushbuf *push = screen->base.pushbuf;
+ struct nouveau_pushbuf *push = nv50->base.pushbuf;
unsigned size = align(nv50->compprog->parm_size, 0x4);
BEGIN_NV04(push, NV50_CP(USER_PARAM_COUNT), 1);
@@ -209,7 +209,7 @@ nv50_compute_upload_input(struct nv50_context *nv50, const uint32_t *input)
mm = nouveau_mm_allocate(screen->base.mm_GART, size, &bo, &offset);
assert(mm);
- nouveau_bo_map(bo, 0, screen->base.client);
+ nouveau_bo_map(bo, 0, nv50->base.client);
memcpy(bo->map + offset, input, size);
nouveau_bufctx_refn(nv50->bufctx, 0, bo, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index f08e8c4b6b3..398560c0fca 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -288,12 +288,12 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
nv50->base.pushbuf = screen->base.pushbuf;
nv50->base.client = screen->base.client;
- ret = nouveau_bufctx_new(screen->base.client, 2, &nv50->bufctx);
+ ret = nouveau_bufctx_new(nv50->base.client, 2, &nv50->bufctx);
if (!ret)
- ret = nouveau_bufctx_new(screen->base.client, NV50_BIND_3D_COUNT,
+ ret = nouveau_bufctx_new(nv50->base.client, NV50_BIND_3D_COUNT,
&nv50->bufctx_3d);
if (!ret)
- ret = nouveau_bufctx_new(screen->base.client, NV50_BIND_CP_COUNT,
+ ret = nouveau_bufctx_new(nv50->base.client, NV50_BIND_CP_COUNT,
&nv50->bufctx_cp);
if (ret)
goto out_err;
@@ -329,7 +329,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
*/
nv50->state = screen->save_state;
screen->cur_ctx = nv50;
- nouveau_pushbuf_bufctx(screen->base.pushbuf, nv50->bufctx);
+ nouveau_pushbuf_bufctx(nv50->base.pushbuf, nv50->bufctx);
}
nv50->base.pushbuf->kick_notify = nv50_default_kick_notify;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c
index ac3e409b2d5..5be7a4eea1c 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query_hw.c
@@ -68,7 +68,7 @@ nv50_hw_query_allocate(struct nv50_context *nv50, struct nv50_query *q,
return false;
hq->offset = hq->base_offset;
- ret = nouveau_bo_map(hq->bo, 0, screen->base.client);
+ ret = nouveau_bo_map(hq->bo, 0, nv50->base.client);
if (ret) {
nv50_hw_query_allocate(nv50, q, 0);
return false;
@@ -296,7 +296,7 @@ nv50_hw_get_query_result(struct nv50_context *nv50, struct nv50_query *q,
}
return false;
}
- if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nv50->screen->base.client))
+ if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nv50->base.client))
return false;
}
hq->state = NV50_HW_QUERY_STATE_READY;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c
index 8209f1f1e82..d08095a0f6f 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_transfer.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_transfer.c
@@ -328,7 +328,7 @@ nv50_miptree_transfer_map(struct pipe_context *pctx,
if (usage & PIPE_TRANSFER_WRITE)
flags |= NOUVEAU_BO_WR;
- ret = nouveau_bo_map(tx->rect[1].bo, flags, screen->base.client);
+ ret = nouveau_bo_map(tx->rect[1].bo, flags, nv50->base.client);
if (ret) {
nouveau_bo_ref(NULL, &tx->rect[1].bo);
FREE(tx);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
index 2e4490b8d97..962e9ddef04 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
@@ -372,12 +372,12 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
nvc0->base.pushbuf = screen->base.pushbuf;
nvc0->base.client = screen->base.client;
- ret = nouveau_bufctx_new(screen->base.client, 2, &nvc0->bufctx);
+ ret = nouveau_bufctx_new(nvc0->base.client, 2, &nvc0->bufctx);
if (!ret)
- ret = nouveau_bufctx_new(screen->base.client, NVC0_BIND_3D_COUNT,
+ ret = nouveau_bufctx_new(nvc0->base.client, NVC0_BIND_3D_COUNT,
&nvc0->bufctx_3d);
if (!ret)
- ret = nouveau_bufctx_new(screen->base.client, NVC0_BIND_CP_COUNT,
+ ret = nouveau_bufctx_new(nvc0->base.client, NVC0_BIND_CP_COUNT,
&nvc0->bufctx_cp);
if (ret)
goto out_err;
@@ -441,9 +441,9 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
if (!screen->cur_ctx) {
nvc0->state = screen->save_state;
screen->cur_ctx = nvc0;
- nouveau_pushbuf_bufctx(screen->base.pushbuf, nvc0->bufctx);
+ nouveau_pushbuf_bufctx(nvc0->base.pushbuf, nvc0->bufctx);
}
- screen->base.pushbuf->kick_notify = nvc0_default_kick_notify;
+ nvc0->base.pushbuf->kick_notify = nvc0_default_kick_notify;
/* add permanently resident buffers to bufctxts */
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
index a420ed4ac0d..00d12d19c35 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
@@ -60,7 +60,7 @@ nvc0_hw_query_allocate(struct nvc0_context *nvc0, struct nvc0_query *q,
return false;
hq->offset = hq->base_offset;
- ret = nouveau_bo_map(hq->bo, 0, screen->base.client);
+ ret = nouveau_bo_map(hq->bo, 0, nvc0->base.client);
if (ret) {
nvc0_hw_query_allocate(nvc0, q, 0);
return false;
@@ -302,7 +302,7 @@ nvc0_hw_get_query_result(struct nvc0_context *nvc0, struct nvc0_query *q,
return hq->funcs->get_query_result(nvc0, hq, wait, result);
if (hq->state != NVC0_HW_QUERY_STATE_READY)
- nvc0_hw_query_update(nvc0->screen->base.client, q);
+ nvc0_hw_query_update(nvc0->base.client, q);
if (hq->state != NVC0_HW_QUERY_STATE_READY) {
if (!wait) {
@@ -313,7 +313,7 @@ nvc0_hw_get_query_result(struct nvc0_context *nvc0, struct nvc0_query *q,
}
return false;
}
- if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nvc0->screen->base.client))
+ if (nouveau_bo_wait(hq->bo, NOUVEAU_BO_RD, nvc0->base.client))
return false;
NOUVEAU_DRV_STAT(&nvc0->screen->base, query_sync_count, 1);
}
@@ -387,7 +387,7 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0,
if (index == -1) {
/* TODO: Use a macro to write the availability of the query */
if (hq->state != NVC0_HW_QUERY_STATE_READY)
- nvc0_hw_query_update(nvc0->screen->base.client, q);
+ nvc0_hw_query_update(nvc0->base.client, q);
uint32_t ready[2] = {hq->state == NVC0_HW_QUERY_STATE_READY};
nvc0->base.push_cb(&nvc0->base, buf, offset,
result_type >= PIPE_QUERY_TYPE_I64 ? 2 : 1,
@@ -414,7 +414,7 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0,
* outputs the difference (no need to worry about 64-bit clamping).
*/
if (hq->state != NVC0_HW_QUERY_STATE_READY)
- nvc0_hw_query_update(nvc0->screen->base.client, q);
+ nvc0_hw_query_update(nvc0->base.client, q);
if (wait && hq->state != NVC0_HW_QUERY_STATE_READY)
nvc0_hw_query_fifo_wait(nvc0, q);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c
index 225b8947171..853ce12b13c 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c
@@ -477,7 +477,7 @@ nvc0_miptree_transfer_map(struct pipe_context *pctx,
if (usage & PIPE_TRANSFER_WRITE)
flags |= NOUVEAU_BO_WR;
- ret = nouveau_bo_map(tx->rect[1].bo, flags, nvc0->screen->base.client);
+ ret = nouveau_bo_map(tx->rect[1].bo, flags, nvc0->base.client);
if (ret) {
pipe_resource_reference(&tx->base.resource, NULL);
nouveau_bo_ref(NULL, &tx->rect[1].bo);
@@ -518,7 +518,7 @@ nvc0_miptree_transfer_unmap(struct pipe_context *pctx,
NOUVEAU_DRV_STAT(&nvc0->screen->base, tex_transfers_wr, 1);
/* Allow the copies above to finish executing before freeing the source */
- nouveau_fence_work(nvc0->screen->base.fence.current,
+ nouveau_fence_work(nvc0->base.fence.current,
nouveau_fence_unref_bo, tx->rect[1].bo);
} else {
nouveau_bo_ref(NULL, &tx->rect[1].bo);
--
2.19.2
More information about the mesa-dev
mailing list