summaryrefslogtreecommitdiff
path: root/src/regsmi.h
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-12-18 20:47:24 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-12-18 20:47:24 -0200
commit6a91bcc111902c45cc75c865893848b7c6c0a0b1 (patch)
treede546a3852ba6a3c40dc7c2aa317eccecc9da7b9 /src/regsmi.h
parent5a07709ae41600bc02205753c64d764f11838240 (diff)
Add definitions for the SMI 501/502 "command list interpreter".
This also changes some bit operations to use a "bitfield" equivalent one, with named fields, that should make it easier to understand what is being tested. The enum smi_cli_cmd_code in smi_501.h is code that was added to a experimental smi_drm.h, but the hardware only supports basic 2d accel, and to compensate for the extra overhead for maintaining a command list (assuming it worked correctly) it would be required to have a special handling, like calling an ioctl to do the "busy loop" in the kernel (that is, should wait for an irq or a timeout). The problem is that even if waiting for a idle engine before crafting a command, and waiting again after submitting the command, there would be corruption on screen after some time. So, the "busy loop" in the kernel would only be useful if still using direct writes to mmio registers.
Diffstat (limited to 'src/regsmi.h')
-rw-r--r--src/regsmi.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/regsmi.h b/src/regsmi.h
index 031e448..5dd0320 100644
--- a/src/regsmi.h
+++ b/src/regsmi.h
@@ -213,11 +213,12 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
/* Wait until GP is idle */
#define WaitIdle() \
do { \
- int status; \
int loop = MAXLOOP; \
\
mem_barrier(); \
if (IS_MSOC(pSmi)) { \
+ MSOCCmdStatusRec status; \
+ \
/* bit 0: 2d engine idle if *not set*
* bit 1: 2d fifo empty if *set*
* bit 2: 2d setup idle if if *not set*
@@ -225,12 +226,19 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
* 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--) \
+ for (status.value = READ_SCR(pSmi, CMD_STATUS); \
+ loop && (status.f.engine || \
+ !status.f.cmdfifo || \
+ status.f.setup || \
+ status.f.csc || \
+ !status.f.cmdhif || \
+ !status.f.memfifo); \
+ status.value = READ_SCR(pSmi, CMD_STATUS), loop--) \
; \
} \
else { \
+ int status; \
+ \
for (status = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, \
VGA_SEQ_DATA, 0x16); \
loop && (status & 0x18) != 0x10; \