aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cx88/cx88-core.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 2c3d9f1999be..e1092d5d4628 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -146,9 +146,11 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
146 fields++; 146 fields++;
147 147
148 /* estimate risc mem: worst case is one write per page border + 148 /* estimate risc mem: worst case is one write per page border +
149 one write per scan line + syncs + jump (all 2 dwords) */ 149 one write per scan line + syncs + jump (all 2 dwords). Padding
150 instructions = (bpl * lines * fields) / PAGE_SIZE + lines * fields; 150 can cause next bpl to start close to a page border. First DMA
151 instructions += 3 + 4; 151 region may be smaller than PAGE_SIZE */
152 instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines);
153 instructions += 2;
152 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) 154 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0)
153 return rc; 155 return rc;
154 156
@@ -176,9 +178,11 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
176 int rc; 178 int rc;
177 179
178 /* estimate risc mem: worst case is one write per page border + 180 /* estimate risc mem: worst case is one write per page border +
179 one write per scan line + syncs + jump (all 2 dwords) */ 181 one write per scan line + syncs + jump (all 2 dwords). Here
180 instructions = (bpl * lines) / PAGE_SIZE + lines; 182 there is no padding and no sync. First DMA region may be smaller
181 instructions += 3 + 4; 183 than PAGE_SIZE */
184 instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
185 instructions += 1;
182 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) 186 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0)
183 return rc; 187 return rc;
184 188