int l, x;\r
\r
// account for all outstanding xfers XXX kludge, entry attr's not saved\r
- pv->fifo_cnt = vf->fifo_cnt;\r
- for (l = vf->fifo_ql, x = vf->fifo_qx + l-1; l > 1; l--, x--)\r
- pv->fifo_cnt += (vf->fifo_queue[x&7] >> 3) << (vf->fifo_queue[x&7] & FQ_BYTE);\r
+ pv->fifo_cnt = pv->fifo_bgcnt = 0;\r
+ for (l = vf->fifo_ql, x = vf->fifo_qx + l-1; l > 1; l--, x--) {\r
+ int cnt = (vf->fifo_queue[x&7] >> 3) << (vf->fifo_queue[x&7] & FQ_BYTE);\r
+ if (vf->fifo_queue[x&7] & FQ_BGDMA)\r
+ pv->fifo_bgcnt += cnt;\r
+ else\r
+ pv->fifo_cnt += cnt;\r
+ }\r
+ if (vf->fifo_ql && (vf->fifo_queue[vf->fifo_qx] & FQ_BGDMA))\r
+ pv->fifo_bgcnt += vf->fifo_cnt;\r
+ else\r
+ pv->fifo_cnt += vf->fifo_cnt;\r
}\r
\r
void PicoVideoLoad(void)\r
\r
// convert former dma_xfers (why was this in PicoMisc anyway?)\r
if (Pico.m.dma_xfers) {\r
- pv->status |= SR_DMA;\r
pv->fifo_cnt = Pico.m.dma_xfers << b;\r
Pico.m.dma_xfers = 0;\r
}\r
- // make an entry in the FIFO if there are outstanding transfers\r
+\r
+ // fake entries in the FIFO if there are outstanding transfers\r
vf->fifo_ql = vf->fifo_qx = vf->fifo_total = 0;\r
- vf->fifo_cnt = pv->fifo_cnt;\r
if (pv->fifo_cnt) {\r
int wc = (pv->fifo_cnt + b) >> b;\r
pv->status |= PVS_FIFORUN|PVS_CPUWR;\r
- if (!(pv->status & PVS_DMABG))\r
- vf->fifo_total = wc;\r
- if ((pv->status & SR_DMA) && !(pv->status & PVS_DMAFILL))\r
- b |= (pv->status & PVS_DMABG) ? FQ_BGDMA : FQ_FGDMA;\r
- vf->fifo_queue[vf->fifo_qx] = (wc << 3) | b;\r
- vf->fifo_ql = 1;\r
+ vf->fifo_total = wc;\r
+ vf->fifo_queue[vf->fifo_qx + vf->fifo_ql] = (wc << 3) | b | FQ_FGDMA;\r
+ vf->fifo_ql ++;\r
+ vf->fifo_cnt = pv->fifo_cnt;\r
+ }\r
+ if (pv->fifo_bgcnt) {\r
+ int wc = pv->fifo_bgcnt;\r
+ if (!vf->fifo_ql) {\r
+ pv->status |= PVS_DMABG;\r
+ vf->fifo_cnt = pv->fifo_bgcnt;\r
+ }\r
+ vf->fifo_queue[vf->fifo_qx + vf->fifo_ql] = (wc << 3) | FQ_BGDMA;\r
+ vf->fifo_ql ++;\r
}\r
+ if (vf->fifo_ql)\r
+ pv->status |= SR_DMA;\r
PicoVideoCacheSAT();\r
}\r
// vim:shiftwidth=2:ts=2:expandtab\r