nvc0: bind driver constbuf for compute on Fermi

Changes from v3:
 - add new validation state for COMPUTE driver constbuf

Changes from v2:
 - always bind the driver consts even if user params come in via clover

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-01-11 22:11:19 +01:00
parent 527652629d
commit a9b70a86db
5 changed files with 29 additions and 0 deletions

View file

@ -196,6 +196,22 @@ nvc0_compute_validate_constbufs(struct nvc0_context *nvc0)
PUSH_DATA (push, NVC0_COMPUTE_FLUSH_CB);
}
static void
nvc0_compute_validate_driverconst(struct nvc0_context *nvc0)
{
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
struct nvc0_screen *screen = nvc0->screen;
BEGIN_NVC0(push, NVC0_COMPUTE(CB_SIZE), 3);
PUSH_DATA (push, 1024);
PUSH_DATAh(push, screen->uniform_bo->offset + (6 << 16) + (5 << 10));
PUSH_DATA (push, screen->uniform_bo->offset + (6 << 16) + (5 << 10));
BEGIN_NVC0(push, NVC0_COMPUTE(CB_BIND), 1);
PUSH_DATA (push, (15 << 8) | 1);
nvc0->dirty |= NVC0_NEW_DRIVERCONST;
}
static bool
nvc0_compute_state_validate(struct nvc0_context *nvc0)
{
@ -203,6 +219,8 @@ nvc0_compute_state_validate(struct nvc0_context *nvc0)
return false;
if (nvc0->dirty_cp & NVC0_NEW_CP_CONSTBUF)
nvc0_compute_validate_constbufs(nvc0);
if (nvc0->dirty_cp & NVC0_NEW_CP_DRIVERCONST)
nvc0_compute_validate_driverconst(nvc0);
/* TODO: textures, samplers, surfaces, global memory buffers */

View file

@ -349,6 +349,11 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
/* set the empty tctl prog on next draw in case one is never set */
nvc0->dirty |= NVC0_NEW_TCTLPROG;
/* Do not bind the COMPUTE driver constbuf at screen initialization because
* CBs are aliased between 3D and COMPUTE, but make sure it will be bound if
* a grid is launched later. */
nvc0->dirty_cp |= NVC0_NEW_CP_DRIVERCONST;
/* now that there are no more opportunities for errors, set the current
* context if there isn't already one.
*/
@ -368,6 +373,7 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
BCTX_REFN_bo(nvc0->bufctx_3d, SCREEN, flags, screen->txc);
if (screen->compute) {
BCTX_REFN_bo(nvc0->bufctx_cp, CP_SCREEN, flags, screen->text);
BCTX_REFN_bo(nvc0->bufctx_cp, CP_SCREEN, flags, screen->uniform_bo);
BCTX_REFN_bo(nvc0->bufctx_cp, CP_SCREEN, flags, screen->txc);
BCTX_REFN_bo(nvc0->bufctx_cp, CP_SCREEN, flags, screen->parm);
}

View file

@ -65,6 +65,7 @@
#define NVC0_NEW_CP_SAMPLERS (1 << 3)
#define NVC0_NEW_CP_CONSTBUF (1 << 4)
#define NVC0_NEW_CP_GLOBALS (1 << 5)
#define NVC0_NEW_CP_DRIVERCONST (1 << 6)
/* 3d bufctx (during draw_vbo, blit_3d) */
#define NVC0_BIND_FB 0

View file

@ -544,6 +544,8 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
info->io.texBindBase = NVE4_CP_INPUT_TEX(0);
info->io.suInfoBase = NVE4_CP_INPUT_SUF(0);
info->prop.cp.gridInfoBase = NVE4_CP_INPUT_GRID_INFO(0);
} else {
info->io.resInfoCBSlot = 15;
}
info->io.msInfoCBSlot = 0;
info->io.msInfoBase = NVE4_CP_INPUT_MS_OFFSETS;

View file

@ -555,6 +555,8 @@ nvc0_validate_driverconst(struct nvc0_context *nvc0)
BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
PUSH_DATA (push, (15 << 4) | 1);
}
nvc0->dirty_cp |= NVC0_NEW_CP_DRIVERCONST;
}
void