[Mesa-dev] [PATCH v3 03/14] nvc0: add a new validation state for 3D driver constbuf

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Feb 17 21:27:41 UTC 2016


This will be used to invalidate 3D driver constbuf when using COMPUTE
and vice-versa. This is needed because this CB contains a bunch of
useful information like the addrs of shader buffers.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/nouveau/nvc0/nvc0_context.h        |  1 +
 src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index 191aa3c..d8dc48b 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -57,6 +57,7 @@
 #define NVC0_NEW_MIN_SAMPLES  (1 << 24)
 #define NVC0_NEW_TESSFACTOR   (1 << 25)
 #define NVC0_NEW_BUFFERS      (1 << 26)
+#define NVC0_NEW_DRIVERCONST  (1 << 27)
 
 #define NVC0_NEW_CP_PROGRAM   (1 << 0)
 #define NVC0_NEW_CP_SURFACES  (1 << 1)
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 2a210e9..86557d7 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -540,6 +540,23 @@ nvc0_validate_min_samples(struct nvc0_context *nvc0)
    IMMED_NVC0(push, NVC0_3D(SAMPLE_SHADING), samples);
 }
 
+static void
+nvc0_validate_driverconst(struct nvc0_context *nvc0)
+{
+   struct nouveau_pushbuf *push = nvc0->base.pushbuf;
+   struct nvc0_screen *screen = nvc0->screen;
+   int i;
+
+   for (i = 0; i < 5; ++i) {
+      BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
+      PUSH_DATA (push, 1024);
+      PUSH_DATAh(push, screen->uniform_bo->offset + (6 << 16) + (i << 10));
+      PUSH_DATA (push, screen->uniform_bo->offset + (6 << 16) + (i << 10));
+      BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
+      PUSH_DATA (push, (15 << 4) | 1);
+   }
+}
+
 void
 nvc0_validate_global_residents(struct nvc0_context *nvc0,
                                struct nouveau_bufctx *bctx, int bin)
@@ -705,6 +722,7 @@ static struct state_validate {
     { nvc0_idxbuf_validate,        NVC0_NEW_IDXBUF },
     { nvc0_tfb_validate,           NVC0_NEW_TFB_TARGETS | NVC0_NEW_GMTYPROG },
     { nvc0_validate_min_samples,   NVC0_NEW_MIN_SAMPLES },
+    { nvc0_validate_driverconst,   NVC0_NEW_DRIVERCONST },
 };
 
 bool
-- 
2.6.4



More information about the mesa-dev mailing list