#include "nouveau_msg.h"
#include "nouveau_fifo.h"
#include "nouveau_lock.h"
+#include "nouveau_object.h"
+#include "nouveau_sync.h"
#define RING_SKIPS 8
}
/*
- * Wait for the card to be idle
+ * Wait for the channel to be idle
*/
void nouveauWaitForIdleLocked(nouveauContextPtr nmesa)
{
- int i,status;
-
+ /* Wait for FIFO idle */
FIRE_RING();
while(RING_AHEAD()>0);
- /* We can't wait on PGRAPH going idle..
- * 1) We don't have the regs mapped
- * 2) PGRAPH may not go idle with multiple channels active
- * Look into replacing this with a NOTIFY/NOP + wait notifier sequence.
+ /* Wait on notifier to indicate all commands in the channel have
+ * been completed.
*/
-#if 0
- for(i=0;i<1000000;i++) /* 1 second */
- {
- switch(nmesa->screen->card->type)
- {
- case NV_03:
- status=NV_READ(NV03_STATUS);
- break;
- case NV_04:
- case NV_05:
- case NV_10:
- case NV_20:
- case NV_30:
- case NV_40:
- case NV_44:
- case NV_50:
- default:
- status=NV_READ(NV04_STATUS);
- break;
- }
- if (status)
- return;
- DO_USLEEP(1);
- }
-#endif
+ nouveau_notifier_wait_nop(nmesa->glCtx, nmesa->syncNotifier, NvSub3D);
}
void nouveauWaitForIdle(nouveauContextPtr nmesa)
if (ret) MESSAGE("wait on notifier failed\n");
}
-void nouveauSyncInitFuncs(GLcontext *ctx)
+GLboolean nouveauSyncInitFuncs(GLcontext *ctx)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
nmesa->syncNotifier = nouveau_notifier_new(ctx, NvSyncNotify);
+ if (!nmesa->syncNotifier) {
+ MESSAGE("Failed to create channel sync notifier\n");
+ return GL_FALSE;
+ }
+
+ /* 0x180 is SET_DMA_NOTIFY, should be correct for all supported 3D
+ * object classes
+ */
+ BEGIN_RING_CACHE(NvSub3D, 0x180, 1);
+ OUT_RING_CACHE (NvSyncNotify);
+
+ return GL_TRUE;
}
extern void nouveau_notifier_wait_nop(GLcontext *ctx,
nouveau_notifier *, GLuint subc);
-extern void nouveauSyncInitFuncs(GLcontext *ctx);
+extern GLboolean nouveauSyncInitFuncs(GLcontext *ctx);
#endif