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 <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
Samuel Pitoiset 2016-02-17 21:43:40 +01:00
parent 57d4251003
commit 527652629d
2 changed files with 19 additions and 0 deletions

View file

@ -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)

View file

@ -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