int rc;
/* estimate risc mem: worst case is one write per page border +
- one write per scan line + sync + jump (all 2 dwords). padding
- can cause next bpl to start close to a page border. First DMA
- region may be smaller than PAGE_SIZE */
- instructions = 1 + ((bpl + padding) * lines) / PAGE_SIZE + lines;
+ one write per scan line + sync + jump (all 2 dwords) */
+ instructions = (bpl * lines) / PAGE_SIZE + lines;
instructions += 2;
if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0)
return rc;
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
return 0;
}
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
return 0;
}
const struct bttv_format *fmt, struct bttv_overlay *ov,
int skip_even, int skip_odd)
{
- int dwords,rc,line,maxy,start,end,skip,nskips;
+ int instructions,rc,line,maxy,start,end,skip,nskips;
struct btcx_skiplist *skips;
u32 *rp,ri,ra;
u32 addr;
if (NULL == (skips = kmalloc(sizeof(*skips) * ov->nclips,GFP_KERNEL)))
return -ENOMEM;
- /* estimate risc mem: worst case is (1.5*clip+1) * lines instructions
+ /* estimate risc mem: worst case is (clip+1) * lines instructions
+ sync + jump (all 2 dwords) */
- dwords = (3 * ov->nclips + 2) *
- ((skip_even || skip_odd) ? (ov->w.height+1)>>1 : ov->w.height);
- dwords += 4;
- if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,dwords*4)) < 0) {
+ instructions = (ov->nclips + 1) *
+ ((skip_even || skip_odd) ? ov->w.height>>1 : ov->w.height);
+ instructions += 2;
+ if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0) {
kfree(skips);
return rc;
}
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
kfree(skips);
return 0;
}
}
void
-bttv_dma_free(struct videobuf_queue *q,struct bttv *btv, struct bttv_buffer *buf)
+bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf)
{
- BUG_ON(in_interrupt());
+ if (in_interrupt())
+ BUG();
videobuf_waiton(&buf->vb,0,0);
- videobuf_dma_unmap(q, &buf->vb.dma);
+ videobuf_dma_pci_unmap(btv->c.pci, &buf->vb.dma);
videobuf_dma_free(&buf->vb.dma);
btcx_riscmem_free(btv->c.pci,&buf->bottom);
btcx_riscmem_free(btv->c.pci,&buf->top);