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)
{
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 */
/* 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.
*/
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);
}
#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
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;
BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
PUSH_DATA (push, (15 << 4) | 1);
}
+
+ nvc0->dirty_cp |= NVC0_NEW_CP_DRIVERCONST;
}
void