Mesa (master): nvc0: always keep TSC slot 0 bound to fix TXF

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Dec 15 01:04:08 UTC 2018


Module: Mesa
Branch: master
Commit: 153d3fc5f9348d361b85ec0fcfe4c1a8d14fa385
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=153d3fc5f9348d361b85ec0fcfe4c1a8d14fa385

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sun Dec  2 13:19:01 2018 -0500

nvc0: always keep TSC slot 0 bound to fix TXF

Same as on nv50, the TXF op always uses the TSC bound to slot 0,
returning blank values if nothing is bound.

An earlier change arranges for the TSC entries list to always have valid
data at entry 0, so here we just make use of it.

Fixes arb_texture_buffer_object-subdata-sync among others.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/gallium/drivers/nouveau/nvc0/nvc0_context.c |  8 ++++++++
 src/gallium/drivers/nouveau/nvc0/nvc0_tex.c     | 13 +++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
index 2d46a90ddb..08ca0a204d 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
@@ -488,6 +488,14 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
    if (!screen->tsc.entries[0])
       nvc0_upload_tsc0(nvc0);
 
+   // On Fermi, mark samplers dirty so that the proper binding can happen
+   if (screen->base.class_3d < NVE4_3D_CLASS) {
+      for (int s = 0; s < 6; s++)
+         nvc0->samplers_dirty[s] = 1;
+      nvc0->dirty_3d |= NVC0_NEW_3D_SAMPLERS;
+      nvc0->dirty_cp |= NVC0_NEW_CP_SAMPLERS;
+   }
+
    return pipe;
 
 out_err:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
index 1ec55f5b8a..04f0a0d55d 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
@@ -657,6 +657,19 @@ nvc0_validate_tsc(struct nvc0_context *nvc0, int s)
 
    nvc0->state.num_samplers[s] = nvc0->num_samplers[s];
 
+   // TXF, in unlinked tsc mode, will always use sampler 0. So we have to
+   // ensure that it remains bound. Its contents don't matter, all samplers we
+   // ever create have the SRGB_CONVERSION bit set, so as long as the first
+   // entry is initialized, we're good to go. This is the only bit that has
+   // any effect on what TXF does.
+   if ((nvc0->samplers_dirty[s] & 1) && !nvc0->samplers[s][0]) {
+      if (n == 0)
+         n = 1;
+      // We're guaranteed that the first command refers to the first slot, so
+      // we're not overwriting a valid entry.
+      commands[0] = (0 << 12) | (0 << 4) | 1;
+   }
+
    if (n) {
       if (unlikely(s == 5))
          BEGIN_NIC0(push, NVC0_CP(BIND_TSC), n);




More information about the mesa-commit mailing list