Ilia Mirkin
2015-Sep-15 05:40 UTC
[Nouveau] [PATCH] nv50, nvc0: unlock tic and update address when invalidating resource
When updating texture buffers, we might end up replacing the whole buffer. When the resource is invalidated, we never actually recreate the sampler view, so we have to make sure that it gets reuploaded, and that it gets the proper new address. This fixes arb_direct_state_access-texture-buffer. Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> Cc: "11.0" <mesa-stable at lists.freedesktop.org> --- src/gallium/drivers/nouveau/nv50/nv50_context.c | 6 ++++++ src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c index 4108f48..fadb812 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_context.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c @@ -212,8 +212,14 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx, for (i = 0; i < nv50->num_textures[s]; ++i) { if (nv50->textures[s][i] && nv50->textures[s][i]->texture == res) { + struct nv50_tic_entry *tic = nv50_tic_entry(nv50->textures[s][i]); nv50->dirty |= NV50_NEW_TEXTURES; nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_TEXTURES); + nv50_screen_tic_unlock(nv50->screen, tic); + tic->id = -1; + tic->tic[1] = nv04_resource(res)->address; + tic->tic[2] &= 0xffffff00; + tic->tic[2] |= nv04_resource(res)->address >> 32; if (!--ref) return ref; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c index f7604f1..e6d2700 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c @@ -229,9 +229,15 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx, for (i = 0; i < nvc0->num_textures[s]; ++i) { if (nvc0->textures[s][i] && nvc0->textures[s][i]->texture == res) { + struct nv50_tic_entry *tic = nv50_tic_entry(nvc0->textures[s][i]); nvc0->textures_dirty[s] |= 1 << i; nvc0->dirty |= NVC0_NEW_TEXTURES; nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(s, i)); + nvc0_screen_tic_unlock(nvc0->screen, tic); + tic->id = -1; + tic->tic[1] = nv04_resource(res)->address; + tic->tic[2] &= 0xffffff00; + tic->tic[2] |= nv04_resource(res)->address >> 32; if (!--ref) return ref; } -- 2.4.6