summaryrefslogtreecommitdiff
path: root/src/xg47_cmdlist.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-07-21 22:10:46 -0700
committerIan Romanick <idr@us.ibm.com>2007-07-21 22:10:46 -0700
commita0f3b097e29d7bfc90072011fdc7a53179a6e700 (patch)
treea19a788c3402b671a9df7b97823a905a080a12a8 /src/xg47_cmdlist.c
parente5049b8277d075b7febe42bb2e2192b9b8306972 (diff)
Clean up dumpCommandBuffer
Conditionally compile the function (and its callers). Also, make it only dump the part of the command buffer that we're likely to care about...the part that's about to be sumitted to the kernel.
Diffstat (limited to 'src/xg47_cmdlist.c')
-rw-r--r--src/xg47_cmdlist.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/xg47_cmdlist.c b/src/xg47_cmdlist.c
index c7e1587..3f8ebe6 100644
--- a/src/xg47_cmdlist.c
+++ b/src/xg47_cmdlist.c
@@ -179,7 +179,9 @@ static CARD32 getCurBatchBeginPort(struct xg47_CmdList * pCmdList);
static inline void triggerHWCommandList(struct xg47_CmdList * pCmdList, CARD32 triggerCounter);
static inline void waitForPCIIdleOnly(struct xg47_CmdList *);
static inline uint32_t getGEWorkedCmdHWAddr(const struct xg47_CmdList *);
+#ifdef DUMP_COMMAND_BUFFER
static void dumpCommandBuffer(struct xg47_CmdList * pCmdList);
+#endif
CARD32 s_emptyBegin[AGPCMDLIST_BEGIN_SIZE] =
{
@@ -523,9 +525,6 @@ static void addScratchBatch(struct xg47_CmdList * pCmdList)
pCmdList->current.end += AGPCMDLIST_2D_SCRATCH_CMD_SIZE;
pCmdList->current.data_count += AGPCMDLIST_2D_SCRATCH_CMD_SIZE;
-
- /* Jong 06/29/2006; demark */
- dumpCommandBuffer(pCmdList);
}
static void linkToLastBatch(struct xg47_CmdList * pCmdList)
@@ -653,32 +652,27 @@ static void waitForPCIIdleOnly(struct xg47_CmdList *s_pCmdList)
}
}
+#ifdef DUMP_COMMAND_BUFFER
void dumpCommandBuffer(struct xg47_CmdList * pCmdList)
{
- unsigned i;
+ const unsigned int count = pCmdList->current.end
+ - pCmdList->current.begin;
+ unsigned int i;
XGIDebug(DBG_FUNCTION,"Entering dumpCommandBuffer\n");
- for (i = 0;
- & pCmdList->command.ptr[i] < pCmdList->current.end;
- i++) {
- if (i % 4 == 0) {
- XGIDebug(DBG_CMD_BUFFER, "\n%08p ",
- pCmdList->command.ptr + i);
- }
-
- XGIDebug(DBG_CMD_BUFFER, "%08x ",
- *(pCmdList->command.ptr + i));
-
- if ((i+1) % 4 == 0)
- {
- XGIDebug(DBG_CMD_BUFFER, "\n");
- }
-
+ for (i = 0; i < count; i += 4) {
+ XGIDebug(DBG_CMD_BUFFER, "%08p: %08x %08x %08x %08x\n",
+ (pCmdList->current.begin + i),
+ pCmdList->current.begin[i + 0],
+ pCmdList->current.begin[i + 1],
+ pCmdList->current.begin[i + 2],
+ pCmdList->current.begin[i + 3]);
}
XGIDebug(DBG_FUNCTION,"Leaving dumpCommandBuffer\n");
}
+#endif /* DUMP_COMMAND_BUFFER */
/*
@@ -738,6 +732,10 @@ static int submit2DBatch(struct xg47_CmdList * pCmdList)
XGIDebug(DBG_FUNCTION, "%s: calling ioctl XGI_IOCTL_SUBMIT_CMDLIST\n",
__func__);
+#ifdef DUMP_COMMAND_BUFFER
+ dumpCommandBuffer(pCmdList);
+#endif
+
err = drmCommandWrite(pCmdList->_fd, DRM_XGI_SUBMIT_CMDLIST,
&submitInfo, sizeof(submitInfo));