summaryrefslogtreecommitdiff
path: root/linux-core/xgi_cmdlist.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-07-20 11:29:16 -0700
committerIan Romanick <idr@us.ibm.com>2007-07-20 11:29:16 -0700
commit659209cb2d59c7b25df58d130d0649f8f899b693 (patch)
tree6770e224249daf9f4c7b06e8a92f32b15fcac803 /linux-core/xgi_cmdlist.c
parent6bd848307485f678915913f282e2ea59ae3ca1a8 (diff)
Clean up generation of begin commands in xgi_submit_cmdlist
Generate the begin command once in a temporary buffer. Then, depending on whether the command is to be written directly to the hardware or to a secondary buffer, copy to command to the correct place.
Diffstat (limited to 'linux-core/xgi_cmdlist.c')
-rw-r--r--linux-core/xgi_cmdlist.c49
1 files changed, 18 insertions, 31 deletions
diff --git a/linux-core/xgi_cmdlist.c b/linux-core/xgi_cmdlist.c
index 6cc4c142..682c4ac1 100644
--- a/linux-core/xgi_cmdlist.c
+++ b/linux-core/xgi_cmdlist.c
@@ -84,8 +84,15 @@ static void xgi_submit_cmdlist(struct xgi_info * info,
const struct xgi_cmd_info * pCmdInfo)
{
const unsigned int cmd = get_batch_command(pCmdInfo->_firstBeginType);
+ u32 begin[4];
+ begin[0] = (cmd << 24) | (BEGIN_VALID_MASK) |
+ (BEGIN_BEGIN_IDENTIFICATION_MASK & pCmdInfo->_curDebugID);
+ begin[1] = BEGIN_LINK_ENABLE_MASK | pCmdInfo->_firstSize;
+ begin[2] = pCmdInfo->_firstBeginAddr >> 4;
+ begin[3] = 0;
+
if (s_cmdring._lastBatchStartAddr == 0) {
const unsigned int portOffset = BASE_3D_ENG + (cmd << 2);
@@ -111,17 +118,10 @@ static void xgi_submit_cmdlist(struct xgi_info * info,
DRM_INFO("portOffset=%d, beginPort=%d\n",
portOffset, cmd << 2);
- dwWriteReg(info->mmio_map, portOffset,
- (cmd << 24) + (BEGIN_VALID_MASK) +
- pCmdInfo->_curDebugID);
-
- dwWriteReg(info->mmio_map, portOffset + 4,
- BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize);
-
- dwWriteReg(info->mmio_map, portOffset + 8,
- (pCmdInfo->_firstBeginAddr >> 4));
-
- dwWriteReg(info->mmio_map, portOffset + 12, 0);
+ dwWriteReg(info->mmio_map, portOffset, begin[0]);
+ dwWriteReg(info->mmio_map, portOffset + 4, begin[1]);
+ dwWriteReg(info->mmio_map, portOffset + 8, begin[2]);
+ dwWriteReg(info->mmio_map, portOffset + 12, begin[3]);
} else {
u32 *lastBatchVirtAddr;
@@ -135,26 +135,13 @@ static void xgi_submit_cmdlist(struct xgi_info * info,
xgi_find_pcie_virt(info,
s_cmdring._lastBatchStartAddr);
- /* lastBatchVirtAddr should *never* be NULL. However, there
- * are currently some bugs that cause this to happen. The
- * if-statement here prevents some fatal (i.e., hard lock
- * requiring the reset button) oopses.
- */
- if (lastBatchVirtAddr) {
- lastBatchVirtAddr[1] =
- BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize;
- lastBatchVirtAddr[2] = pCmdInfo->_firstBeginAddr >> 4;
- lastBatchVirtAddr[3] = 0;
- //barrier();
- lastBatchVirtAddr[0] =
- (cmd << 24) + (BEGIN_VALID_MASK) +
- (0xffff & pCmdInfo->_curDebugID);
-
- /* Jong 06/12/2006; system hang; marked for test */
- triggerHWCommandList(info, pCmdInfo->_beginCount);
- } else {
- DRM_ERROR("lastBatchVirtAddr is NULL\n");
- }
+ lastBatchVirtAddr[1] = begin[1];
+ lastBatchVirtAddr[2] = begin[2];
+ lastBatchVirtAddr[3] = begin[3];
+ wmb();
+ lastBatchVirtAddr[0] = begin[0];
+
+ triggerHWCommandList(info, pCmdInfo->_beginCount);
}
s_cmdring._lastBatchStartAddr = pCmdInfo->_lastBeginAddr;