summaryrefslogtreecommitdiff
path: root/src/regsmi.h
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-10-08 18:36:11 -0300
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-10-08 18:36:11 -0300
commit61f814d1c8ad9440bab89eda44e64b01ba0eb703 (patch)
treeb776af98375e5ff02463bb9759d76d9cded37385 /src/regsmi.h
parent1656fb6de5308ff586676e8d6a8aa8d4579ebf4c (diff)
Rewrite WaitQueue and WaitIdle accell macros
WaitQueue() did receive an unused parameter, that was removed. The parameter was unused since version 1.0 in XFree86 CVS, so probably nobody knows for what it was used. WaitIdle() now also replaces WaitIdleEmpty(), as an idle engine should also have an empty fifo. SMI_SubsequentScreenToScreenCopy() was changed to use WaitIdle() instead of WaitQueue() before submitting the commands to the engine. This fixes a nasty lockup when using XaaOffscreenPixmaps (what is desired/wanted to help improve performance), and the lockup in the MSOC was clearly due to an engine overrun, when sending commands faster then the engine could process.
Diffstat (limited to 'src/regsmi.h')
-rw-r--r--src/regsmi.h89
1 files changed, 52 insertions, 37 deletions
diff --git a/src/regsmi.h b/src/regsmi.h
index bdf4035..106b13c 100644
--- a/src/regsmi.h
+++ b/src/regsmi.h
@@ -194,51 +194,66 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
#define SMI_QUICK_START 0x10000000
#define SMI_START_ENGINE 0x80000000
-#define MAXLOOP 0x100000 /* timeout value for engine waits */
-
-#define ENGINE_IDLE() \
- (IS_MSOC(pSmi) ? \
- (READ_SCR(pSmi, 0x0000) & 0x00080000) == 0 : \
- (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) & 0x08) == 0)
-#define FIFO_EMPTY() \
- (IS_MSOC(pSmi) ? \
- READ_SCR(pSmi, 0x0000) & 0x00100000 : \
- VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) & 0x10)
-
-/* Wait until "v" queue entries are free */
-/**** FIXME
- **** This is completely ilogical. Argument "v" is ignored, and
- **** pSmi->PCIRetry defaults to false (but on smi sources this
- **** macro is a noop and will get stuck on engine reset timeouts if enabled...)
- ***/
-#define WaitQueue(v) \
+/* timeout value for engine waits */
+#define MAXLOOP 0x100000
+
+/* Wait until 2d engine queue is empty */
+#define WaitQueue() \
do { \
- if (!IS_MSOC(pSmi)) { \
- int loop = MAXLOOP; \
+ int loop = MAXLOOP; \
\
- mem_barrier(); \
- while (!FIFO_EMPTY()) \
- if (loop-- <= 0) \
- break; \
- if (loop <= 0) SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
+ mem_barrier(); \
+ if (IS_MSOC(pSmi)) { \
+ /* 20:20 2D Engine FIFO Status. This bit is read-only.
+ * 0: FIFO not emtpy.
+ * 1: FIFO empty.
+ */ \
+ while (loop-- && \
+ (READ_SCR(pSmi, 0x0000) & (1 << 20)) == 0) \
+ ; \
+ } \
+ else { \
+ while (loop-- && \
+ (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, \
+ VGA_SEQ_DATA, 0x16) & 0x10)) \
+ ; \
} \
+ if (loop <= 0) \
+ SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
} while (0)
/* Wait until GP is idle */
-#define WaitIdle() \
- do { \
- int loop = MAXLOOP; mem_barrier(); \
- while (!ENGINE_IDLE()) \
- if (loop-- == 0) break; \
- if (loop <= 0) SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
+#define WaitIdle() \
+ do { \
+ int status; \
+ int loop = MAXLOOP; \
+ \
+ mem_barrier(); \
+ if (IS_MSOC(pSmi)) { \
+ /* bit 0: 2d engine idle if *not set*
+ * bit 1: 2d fifo empty if *set*
+ * bit 2: 2d setup idle if if *not set*
+ * bit 18: color conversion idle if *not set*
+ * bit 19: command fifo empty if *set*
+ * bit 20: 2d memory fifo empty idle if *set*
+ */ \
+ for (status = READ_SCR(pSmi, 0x0024); \
+ loop && (status & 0x1C0007) != 0x180002; \
+ status = READ_SCR(pSmi, 0x0024), loop--) \
+ ; \
+ } \
+ else { \
+ for (status = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, \
+ VGA_SEQ_DATA, 0x16); \
+ loop && (status & 0x18) != 0x10; \
+ status = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, \
+ VGA_SEQ_DATA, 0x16), loop--) \
+ ; \
+ } \
+ if (loop <= 0) \
+ SMI_GEReset(pScrn, 1, __LINE__, __FILE__); \
} while (0)
-/* Wait until GP is idle and queue is empty */
-#define WaitIdleEmpty() \
- do { \
- WaitQueue(MAXFIFO); \
- WaitIdle(); \
- } while (0)
#define RGB8_PSEUDO (-1)
#define RGB16_565 0