From 527652629dc6e7dc593e16505e4b6b648b1f09cc Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 17 Feb 2016 21:43:40 +0100 Subject: nvc0: add a new validation state for 3D driver constbuf 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 Reviewed-by: Ilia Mirkin --- 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 191aa3cfde0..d8dc48b1f0d 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 2a210e99022..86557d73cb2 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 -- cgit v1.2.3