summaryrefslogtreecommitdiff
path: root/src/smi_exa.c
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-12-19 21:15:01 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-12-19 21:15:01 -0200
commit7f252345c0c6b260c5b37aff98a22679eb5c6c82 (patch)
tree7267c7e5a1c35cb4791334554fe657a552724eb3 /src/smi_exa.c
parent6a91bcc111902c45cc75c865893848b7c6c0a0b1 (diff)
Enable the SMI 501/502 command list interpreter in a "debug" build.
To enable it, set SMI501_CLI_DEBUG to 1 in smi.h, and use Option "AcellMethod "EXA" in the Device section of /etc/X11/xorg.conf This code is enabled mainly for debug purposes. To make if have an actual performance gain (like when using a sm50x with a "low profile" "main" processor") it should be required to actually do busy loops in kernel mode (and hope the costs of context switch will pay it). In kernel mode it is possible to wait for an interrupt being triggered when the command list is processed, or when the 2d engine is idle. This commit should be functional, but, mainly due to debug messages, should be significantly slower then a build with MI501_CLI_DEBUG defined to 0.
Diffstat (limited to 'src/smi_exa.c')
-rw-r--r--src/smi_exa.c70
1 files changed, 66 insertions, 4 deletions
diff --git a/src/smi_exa.c b/src/smi_exa.c
index aeed606..1b6d42f 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -27,6 +27,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "smi.h"
+#if SMI501_CLI_DEBUG
+# include "smi_501.h"
+# undef WRITE_DPR
+# define WRITE_DPR(pSmi, dpr, data) \
+ do { \
+ if (pSmi->batch_active) \
+ BATCH_LOAD_REG((pSmi->DPRBase - pSmi->MapBase) + \
+ dpr, data); \
+ else \
+ MMIO_OUT32(pSmi->DPRBase, dpr, data); \
+ DEBUG("DPR%02X = %08X\n", dpr, data); \
+ } while (0)
+#endif
static void
SMI_EXASync(ScreenPtr pScreen, int marker);
@@ -241,13 +254,16 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
pSmi->AccelCmd |= SMI_RIGHT_TO_LEFT;
}
- WaitQueue();
-
if (pDstPixmap->drawable.bitsPerPixel == 24) {
src_pitch *= 3;
dst_pitch *= 3;
}
+#if SMI501_CLI_DEBUG
+ BATCH_BEGIN(7);
+#else
+ WaitQueue();
+#endif
/* Destination and Source Window Widths */
WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (src_pitch & 0xFFFF));
/* Destination and Source Row Pitch */
@@ -266,6 +282,9 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
WRITE_DPR(pSmi, 0x44, dst_offset);
WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+#if SMI501_CLI_DEBUG
+ BATCH_END();
+#endif
LEAVE(TRUE);
}
@@ -304,10 +323,17 @@ SMI_Copy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX,
}
}
+#if SMI501_CLI_DEBUG
+ BATCH_BEGIN(3);
+#else
WaitQueue();
+#endif
WRITE_DPR(pSmi, 0x00, (srcX << 16) + (srcY & 0xFFFF));
WRITE_DPR(pSmi, 0x04, (dstX << 16) + (dstY & 0xFFFF));
WRITE_DPR(pSmi, 0x08, (width << 16) + (height & 0xFFFF));
+#if SMI501_CLI_DEBUG
+ BATCH_END();
+#endif
LEAVE();
}
@@ -371,12 +397,16 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
| SMI_BITBLT
| SMI_QUICK_START;
- WaitQueue();
-
if (pPixmap->drawable.bitsPerPixel == 24) {
dst_pitch *= 3;
}
+#if SMI501_CLI_DEBUG
+ BATCH_BEGIN(10);
+#else
+ WaitQueue();
+#endif
+
/* Destination Window Width */
WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (dst_pitch & 0xFFFF));
/* Destination Row Pitch */
@@ -401,6 +431,9 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
WRITE_DPR(pSmi, 0x38, 0xFFFFFFFF);
WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+#if SMI501_CLI_DEBUG
+ BATCH_END();
+#endif
LEAVE(TRUE);
}
@@ -427,9 +460,16 @@ SMI_Solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
}
}
+#if SMI501_CLI_DEBUG
+ BATCH_BEGIN(2);
+#else
WaitQueue();
+#endif
WRITE_DPR(pSmi, 0x04, (x1 << 16) | (y1 & 0xFFFF));
WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
+#if SMI501_CLI_DEBUG
+ BATCH_END();
+#endif
LEAVE();
}
@@ -503,7 +543,11 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
/* set clipping */
SMI_SetClippingRectangle(pScrn, x, y, x+w, y+h);
+#if SMI501_CLI_DEBUG
+ BATCH_BEGIN(9);
+#else
WaitQueue();
+#endif
/* Destination and Source Window Widths */
WRITE_DPR(pSmi, 0x3C, (dst_pixelpitch << 16) | (src_pixelpitch & 0xFFFF));
@@ -528,6 +572,9 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
WRITE_DPR(pSmi, 0x00, 0);
WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF));
WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
+#if SMI501_CLI_DEBUG
+ BATCH_END();
+#endif
while (h--) {
memcpy(pSmi->DataPortBase, src, aligned_pitch);
@@ -585,7 +632,11 @@ SMI_PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, Pi
ENTER();
+#if SMI501_CLI_DEBUG
+ BATCH_BEGIN(7);
+#else
WaitQueue();
+#endif
/* Destination and Source Window Widths */
WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (src_pitch & 0xFFFF));
@@ -611,6 +662,10 @@ SMI_PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, Pi
WRITE_DPR(pSmi, 0x0C, 0xCC /*GXCopy*/ | SMI_ROTATE_BLT |
SMI_ROTATE_CCW | SMI_QUICK_START);
+#if SMI501_CLI_DEBUG
+ BATCH_END();
+#endif
+
pSmi->renderTransform = pSrcPicture->transform;
LEAVE(TRUE);
@@ -640,11 +695,18 @@ SMI_Composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
v.vector[2] = xFixed1;
PictureTransformPoint(t, &v);
+#if SMI501_CLI_DEBUG
+ BATCH_BEGIN(3);
+#else
WaitQueue();
+#endif
WRITE_DPR(pSmi, 0x00, (xFixedToInt(v.vector[0]) << 16) + (xFixedToInt(v.vector[1]) & 0xFFFF));
WRITE_DPR(pSmi, 0x04, (dstX << 16) + (dstY & 0xFFFF));
WRITE_DPR(pSmi, 0x08, (height << 16) + (width & 0xFFFF));
+#if SMI501_CLI_DEBUG
+ BATCH_END();
+#endif
LEAVE();
}