Lines Matching +full:ri +full:- +full:override
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 bttv-risc.c -- interfaces to other kernel modules
7 - memory management
8 - generation
10 (c) 2000-2003 Gerd Knorr <kraxel@bytesex.org>
25 #include <media/v4l2-ioctl.h>
31 /* ---------------------------------------------------------- */
54 if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions)) < 0) in bttv_risc_packed()
58 rp = risc->cpu; in bttv_risc_packed()
62 while (skip_lines-- > 0) { in bttv_risc_packed()
70 if ((btv->opt_vcr_hack) && in bttv_risc_packed()
71 (line >= (store_lines - VCR_HACK_LINES))) in bttv_risc_packed()
74 offset -= sg_dma_len(sg); in bttv_risc_packed()
77 if (bpl <= sg_dma_len(sg)-offset) { in bttv_risc_packed()
87 (sg_dma_len(sg)-offset)); in bttv_risc_packed()
89 todo -= (sg_dma_len(sg)-offset); in bttv_risc_packed()
96 todo -= sg_dma_len(sg); in bttv_risc_packed()
108 risc->jmp = rp; in bttv_risc_packed()
109 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); in bttv_risc_packed()
124 u32 ri; in bttv_risc_planar() local
137 if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*4*5)) < 0) in bttv_risc_planar()
141 rp = risc->cpu; in bttv_risc_planar()
150 if ((btv->opt_vcr_hack) && in bttv_risc_planar()
151 (line >= (ylines - VCR_HACK_LINES))) in bttv_risc_planar()
174 for (todo = ybpl; todo > 0; todo -= ylen) { in bttv_risc_planar()
177 yoffset -= sg_dma_len(ysg); in bttv_risc_planar()
184 ylen = sg_dma_len(ysg) - yoffset; in bttv_risc_planar()
187 uoffset -= sg_dma_len(usg); in bttv_risc_planar()
191 voffset -= sg_dma_len(vsg); in bttv_risc_planar()
196 ylen = (sg_dma_len(usg) - uoffset) << hshift; in bttv_risc_planar()
198 ylen = (sg_dma_len(vsg) - voffset) << hshift; in bttv_risc_planar()
199 ri = BT848_RISC_WRITE123; in bttv_risc_planar()
201 ri = BT848_RISC_WRITE1S23; in bttv_risc_planar()
204 ri |= BT848_RISC_SOL; in bttv_risc_planar()
206 ri |= BT848_RISC_EOL; in bttv_risc_planar()
209 *(rp++)=cpu_to_le32(ri | ylen); in bttv_risc_planar()
229 risc->jmp = rp; in bttv_risc_planar()
230 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); in bttv_risc_planar()
243 u32 ri,ra; in bttv_risc_overlay() local
247 skips = kmalloc_array(ov->nclips, sizeof(*skips),GFP_KERNEL); in bttv_risc_overlay()
249 return -ENOMEM; in bttv_risc_overlay()
253 dwords = (3 * ov->nclips + 2) * in bttv_risc_overlay()
254 ((skip_even || skip_odd) ? (ov->w.height+1)>>1 : ov->w.height); in bttv_risc_overlay()
256 if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,dwords*4)) < 0) { in bttv_risc_overlay()
262 rp = risc->cpu; in bttv_risc_overlay()
266 addr = (unsigned long)btv->fbuf.base; in bttv_risc_overlay()
267 addr += btv->fbuf.fmt.bytesperline * ov->w.top; in bttv_risc_overlay()
268 addr += (fmt->depth >> 3) * ov->w.left; in bttv_risc_overlay()
271 for (maxy = -1, line = 0; line < ov->w.height; in bttv_risc_overlay()
272 line++, addr += btv->fbuf.fmt.bytesperline) { in bttv_risc_overlay()
273 if ((btv->opt_vcr_hack) && in bttv_risc_overlay()
274 (line >= (ov->w.height - VCR_HACK_LINES))) in bttv_risc_overlay()
283 btcx_calc_skips(line, ov->w.width, &maxy, in bttv_risc_overlay()
284 skips, &nskips, ov->clips, ov->nclips); in bttv_risc_overlay()
287 for (start = 0, skip = 0; start < ov->w.width; start = end) { in bttv_risc_overlay()
289 ri = BT848_RISC_WRITE; in bttv_risc_overlay()
290 end = ov->w.width; in bttv_risc_overlay()
292 ri = BT848_RISC_WRITE; in bttv_risc_overlay()
295 ri = BT848_RISC_SKIP; in bttv_risc_overlay()
299 if (BT848_RISC_WRITE == ri) in bttv_risc_overlay()
300 ra = addr + (fmt->depth>>3)*start; in bttv_risc_overlay()
305 ri |= BT848_RISC_SOL; in bttv_risc_overlay()
306 if (ov->w.width == end) in bttv_risc_overlay()
307 ri |= BT848_RISC_EOL; in bttv_risc_overlay()
308 ri |= (fmt->depth>>3) * (end-start); in bttv_risc_overlay()
310 *(rp++)=cpu_to_le32(ri); in bttv_risc_overlay()
317 risc->jmp = rp; in bttv_risc_overlay()
318 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); in bttv_risc_overlay()
323 /* ---------------------------------------------------------- */
333 int swidth = tvnorm->swidth; in bttv_calc_geo_old()
334 int totalwidth = tvnorm->totalwidth; in bttv_calc_geo_old()
335 int scaledtwidth = tvnorm->scaledtwidth; in bttv_calc_geo_old()
337 if (btv->input == btv->dig) { in bttv_calc_geo_old()
343 vdelay = tvnorm->vdelay; in bttv_calc_geo_old()
346 geo->hscale = ((totalwidth*4096UL)/xsf-4096); in bttv_calc_geo_old()
347 geo->hdelay = tvnorm->hdelayx1; in bttv_calc_geo_old()
348 geo->hdelay = (geo->hdelay*width)/swidth; in bttv_calc_geo_old()
349 geo->hdelay &= 0x3fe; in bttv_calc_geo_old()
350 sr = ((tvnorm->sheight >> (interleaved?0:1))*512)/height - 512; in bttv_calc_geo_old()
351 geo->vscale = (0x10000UL-sr) & 0x1fff; in bttv_calc_geo_old()
352 geo->crop = ((width>>8)&0x03) | ((geo->hdelay>>6)&0x0c) | in bttv_calc_geo_old()
353 ((tvnorm->sheight>>4)&0x30) | ((vdelay>>2)&0xc0); in bttv_calc_geo_old()
354 geo->vscale |= interleaved ? (BT848_VSCALE_INT<<8) : 0; in bttv_calc_geo_old()
355 geo->vdelay = vdelay; in bttv_calc_geo_old()
356 geo->width = width; in bttv_calc_geo_old()
357 geo->sheight = tvnorm->sheight; in bttv_calc_geo_old()
358 geo->vtotal = tvnorm->vtotal; in bttv_calc_geo_old()
360 if (btv->opt_combfilter) { in bttv_calc_geo_old()
361 geo->vtc = (width < 193) ? 2 : ((width < 385) ? 1 : 0); in bttv_calc_geo_old()
362 geo->comb = (width < 769) ? 1 : 0; in bttv_calc_geo_old()
364 geo->vtc = 0; in bttv_calc_geo_old()
365 geo->comb = 0; in bttv_calc_geo_old()
382 if ((crop->left == tvnorm->cropcap.defrect.left in bttv_calc_geo()
383 && crop->top == tvnorm->cropcap.defrect.top in bttv_calc_geo()
384 && crop->width == tvnorm->cropcap.defrect.width in bttv_calc_geo()
385 && crop->height == tvnorm->cropcap.defrect.height in bttv_calc_geo()
386 && width <= tvnorm->swidth /* see PAL-Nc et al */) in bttv_calc_geo()
387 || btv->input == btv->dig) { in bttv_calc_geo()
395 c_width = min((unsigned int) crop->width, width * 16); in bttv_calc_geo()
396 c_height = min((unsigned int) crop->height, height * 16); in bttv_calc_geo()
398 geo->width = width; in bttv_calc_geo()
399 geo->hscale = (c_width * 4096U + (width >> 1)) / width - 4096; in bttv_calc_geo()
401 geo->hdelay = ((crop->left * width + c_width) / c_width) & ~1; in bttv_calc_geo()
403 geo->sheight = c_height; in bttv_calc_geo()
404 geo->vdelay = crop->top - tvnorm->cropcap.bounds.top + MIN_VDELAY; in bttv_calc_geo()
406 sr = (sr * 512U + (height >> 1)) / height - 512; in bttv_calc_geo()
407 geo->vscale = (0x10000UL - sr) & 0x1fff; in bttv_calc_geo()
408 geo->vscale |= both_fields ? (BT848_VSCALE_INT << 8) : 0; in bttv_calc_geo()
409 geo->vtotal = tvnorm->vtotal; in bttv_calc_geo()
411 geo->crop = (((geo->width >> 8) & 0x03) | in bttv_calc_geo()
412 ((geo->hdelay >> 6) & 0x0c) | in bttv_calc_geo()
413 ((geo->sheight >> 4) & 0x30) | in bttv_calc_geo()
414 ((geo->vdelay >> 2) & 0xc0)); in bttv_calc_geo()
416 if (btv->opt_combfilter) { in bttv_calc_geo()
417 geo->vtc = (width < 193) ? 2 : ((width < 385) ? 1 : 0); in bttv_calc_geo()
418 geo->comb = (width < 769) ? 1 : 0; in bttv_calc_geo()
420 geo->vtc = 0; in bttv_calc_geo()
421 geo->comb = 0; in bttv_calc_geo()
430 if (geo->comb) in bttv_apply_geo()
435 btwrite(geo->vtc, BT848_E_VTC+off); in bttv_apply_geo()
436 btwrite(geo->hscale >> 8, BT848_E_HSCALE_HI+off); in bttv_apply_geo()
437 btwrite(geo->hscale & 0xff, BT848_E_HSCALE_LO+off); in bttv_apply_geo()
438 btaor((geo->vscale>>8), 0xe0, BT848_E_VSCALE_HI+off); in bttv_apply_geo()
439 btwrite(geo->vscale & 0xff, BT848_E_VSCALE_LO+off); in bttv_apply_geo()
440 btwrite(geo->width & 0xff, BT848_E_HACTIVE_LO+off); in bttv_apply_geo()
441 btwrite(geo->hdelay & 0xff, BT848_E_HDELAY_LO+off); in bttv_apply_geo()
442 btwrite(geo->sheight & 0xff, BT848_E_VACTIVE_LO+off); in bttv_apply_geo()
443 btwrite(geo->vdelay & 0xff, BT848_E_VDELAY_LO+off); in bttv_apply_geo()
444 btwrite(geo->crop, BT848_E_CROP+off); in bttv_apply_geo()
445 btwrite(geo->vtotal>>8, BT848_VTOTAL_HI); in bttv_apply_geo()
446 btwrite(geo->vtotal & 0xff, BT848_VTOTAL_LO); in bttv_apply_geo()
449 /* ---------------------------------------------------------- */
453 bttv_set_dma(struct bttv *btv, int override) in bttv_set_dma() argument
458 btv->cap_ctl = 0; in bttv_set_dma()
459 if (NULL != btv->curr.top) btv->cap_ctl |= 0x02; in bttv_set_dma()
460 if (NULL != btv->curr.bottom) btv->cap_ctl |= 0x01; in bttv_set_dma()
461 if (NULL != btv->cvbi) btv->cap_ctl |= 0x0c; in bttv_set_dma()
464 capctl |= (btv->cap_ctl & 0x03) ? 0x03 : 0x00; /* capture */ in bttv_set_dma()
465 capctl |= (btv->cap_ctl & 0x0c) ? 0x0c : 0x00; /* vbi data */ in bttv_set_dma()
466 capctl |= override; in bttv_set_dma()
469 btv->c.nr,capctl,btv->loop_irq, in bttv_set_dma()
470 btv->cvbi ? (unsigned long long)btv->cvbi->top.dma : 0, in bttv_set_dma()
471 btv->curr.top ? (unsigned long long)btv->curr.top->top.dma : 0, in bttv_set_dma()
472 btv->cvbi ? (unsigned long long)btv->cvbi->bottom.dma : 0, in bttv_set_dma()
473 btv->curr.bottom ? (unsigned long long)btv->curr.bottom->bottom.dma : 0); in bttv_set_dma()
476 if (btv->loop_irq) { in bttv_set_dma()
478 cmd |= (btv->loop_irq & 0x0f) << 16; in bttv_set_dma()
479 cmd |= (~btv->loop_irq & 0x0f) << 20; in bttv_set_dma()
481 if (btv->curr.frame_irq || btv->loop_irq || btv->cvbi) { in bttv_set_dma()
482 mod_timer(&btv->timeout, jiffies+BTTV_TIMEOUT); in bttv_set_dma()
484 del_timer(&btv->timeout); in bttv_set_dma()
486 btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd); in bttv_set_dma()
490 if (btv->dma_on) in bttv_set_dma()
492 btwrite(btv->main.dma, BT848_RISC_STRT_ADD); in bttv_set_dma()
494 btv->dma_on = 1; in bttv_set_dma()
496 if (!btv->dma_on) in bttv_set_dma()
499 btv->dma_on = 0; in bttv_set_dma()
509 if ((rc = btcx_riscmem_alloc(btv->c.pci,&btv->main,PAGE_SIZE)) < 0) in bttv_risc_init_main()
512 btv->c.nr, (unsigned long long)btv->main.dma); in bttv_risc_init_main()
514 btv->main.cpu[0] = cpu_to_le32(BT848_RISC_SYNC | BT848_RISC_RESYNC | in bttv_risc_init_main()
516 btv->main.cpu[1] = cpu_to_le32(0); in bttv_risc_init_main()
517 btv->main.cpu[2] = cpu_to_le32(BT848_RISC_JUMP); in bttv_risc_init_main()
518 btv->main.cpu[3] = cpu_to_le32(btv->main.dma + (4<<2)); in bttv_risc_init_main()
521 btv->main.cpu[4] = cpu_to_le32(BT848_RISC_JUMP); in bttv_risc_init_main()
522 btv->main.cpu[5] = cpu_to_le32(btv->main.dma + (6<<2)); in bttv_risc_init_main()
523 btv->main.cpu[6] = cpu_to_le32(BT848_RISC_JUMP); in bttv_risc_init_main()
524 btv->main.cpu[7] = cpu_to_le32(btv->main.dma + (8<<2)); in bttv_risc_init_main()
526 btv->main.cpu[8] = cpu_to_le32(BT848_RISC_SYNC | BT848_RISC_RESYNC | in bttv_risc_init_main()
528 btv->main.cpu[9] = cpu_to_le32(0); in bttv_risc_init_main()
531 btv->main.cpu[10] = cpu_to_le32(BT848_RISC_JUMP); in bttv_risc_init_main()
532 btv->main.cpu[11] = cpu_to_le32(btv->main.dma + (12<<2)); in bttv_risc_init_main()
533 btv->main.cpu[12] = cpu_to_le32(BT848_RISC_JUMP); in bttv_risc_init_main()
534 btv->main.cpu[13] = cpu_to_le32(btv->main.dma + (14<<2)); in bttv_risc_init_main()
537 btv->main.cpu[14] = cpu_to_le32(BT848_RISC_JUMP); in bttv_risc_init_main()
538 btv->main.cpu[15] = cpu_to_le32(btv->main.dma + (0<<2)); in bttv_risc_init_main()
548 unsigned long next = btv->main.dma + ((slot+2) << 2); in bttv_risc_hook()
551 d2printk("%d: risc=%p slot[%d]=NULL\n", btv->c.nr, risc, slot); in bttv_risc_hook()
552 btv->main.cpu[slot+1] = cpu_to_le32(next); in bttv_risc_hook()
555 btv->c.nr, risc, slot, in bttv_risc_hook()
556 (unsigned long long)risc->dma, irqflags); in bttv_risc_hook()
563 risc->jmp[0] = cpu_to_le32(cmd); in bttv_risc_hook()
564 risc->jmp[1] = cpu_to_le32(next); in bttv_risc_hook()
565 btv->main.cpu[slot+1] = cpu_to_le32(risc->dma); in bttv_risc_hook()
573 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); in bttv_dma_free()
575 videobuf_waiton(q, &buf->vb, 0, 0); in bttv_dma_free()
576 videobuf_dma_unmap(q->dev, dma); in bttv_dma_free()
578 btcx_riscmem_free(btv->c.pci,&buf->bottom); in bttv_dma_free()
579 btcx_riscmem_free(btv->c.pci,&buf->top); in bttv_dma_free()
580 buf->vb.state = VIDEOBUF_NEEDS_INIT; in bttv_dma_free()
600 vbi->vb.state = VIDEOBUF_ACTIVE; in bttv_buffer_activate_vbi()
601 list_del(&vbi->vb.queue); in bttv_buffer_activate_vbi()
607 if (vbi->geo.vdelay > vdelay) { in bttv_buffer_activate_vbi()
608 vdelay = vbi->geo.vdelay & 0xfe; in bttv_buffer_activate_vbi()
609 crop = (crop & 0x3f) | ((vbi->geo.vdelay >> 2) & 0xc0); in bttv_buffer_activate_vbi()
617 if (vbi->vbi_count[0] > 0) { in bttv_buffer_activate_vbi()
618 top = &vbi->top; in bttv_buffer_activate_vbi()
622 if (vbi->vbi_count[1] > 0) { in bttv_buffer_activate_vbi()
624 bottom = &vbi->bottom; in bttv_buffer_activate_vbi()
640 if (NULL != set->top && NULL != set->bottom) { in bttv_buffer_activate_video()
641 if (set->top == set->bottom) { in bttv_buffer_activate_video()
642 set->top->vb.state = VIDEOBUF_ACTIVE; in bttv_buffer_activate_video()
643 if (set->top->vb.queue.next) in bttv_buffer_activate_video()
644 list_del(&set->top->vb.queue); in bttv_buffer_activate_video()
646 set->top->vb.state = VIDEOBUF_ACTIVE; in bttv_buffer_activate_video()
647 set->bottom->vb.state = VIDEOBUF_ACTIVE; in bttv_buffer_activate_video()
648 if (set->top->vb.queue.next) in bttv_buffer_activate_video()
649 list_del(&set->top->vb.queue); in bttv_buffer_activate_video()
650 if (set->bottom->vb.queue.next) in bttv_buffer_activate_video()
651 list_del(&set->bottom->vb.queue); in bttv_buffer_activate_video()
653 bttv_apply_geo(btv, &set->top->geo, 1); in bttv_buffer_activate_video()
654 bttv_apply_geo(btv, &set->bottom->geo,0); in bttv_buffer_activate_video()
655 bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top, in bttv_buffer_activate_video()
656 set->top_irq); in bttv_buffer_activate_video()
657 bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom, in bttv_buffer_activate_video()
658 set->frame_irq); in bttv_buffer_activate_video()
659 btaor((set->top->btformat & 0xf0) | (set->bottom->btformat & 0x0f), in bttv_buffer_activate_video()
661 btaor((set->top->btswap & 0x0a) | (set->bottom->btswap & 0x05), in bttv_buffer_activate_video()
663 } else if (NULL != set->top) { in bttv_buffer_activate_video()
664 set->top->vb.state = VIDEOBUF_ACTIVE; in bttv_buffer_activate_video()
665 if (set->top->vb.queue.next) in bttv_buffer_activate_video()
666 list_del(&set->top->vb.queue); in bttv_buffer_activate_video()
667 bttv_apply_geo(btv, &set->top->geo,1); in bttv_buffer_activate_video()
668 bttv_apply_geo(btv, &set->top->geo,0); in bttv_buffer_activate_video()
669 bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top, in bttv_buffer_activate_video()
670 set->frame_irq); in bttv_buffer_activate_video()
672 btaor(set->top->btformat & 0xff, ~0xff, BT848_COLOR_FMT); in bttv_buffer_activate_video()
673 btaor(set->top->btswap & 0x0f, ~0x0f, BT848_COLOR_CTL); in bttv_buffer_activate_video()
674 } else if (NULL != set->bottom) { in bttv_buffer_activate_video()
675 set->bottom->vb.state = VIDEOBUF_ACTIVE; in bttv_buffer_activate_video()
676 if (set->bottom->vb.queue.next) in bttv_buffer_activate_video()
677 list_del(&set->bottom->vb.queue); in bttv_buffer_activate_video()
678 bttv_apply_geo(btv, &set->bottom->geo,1); in bttv_buffer_activate_video()
679 bttv_apply_geo(btv, &set->bottom->geo,0); in bttv_buffer_activate_video()
681 bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom, in bttv_buffer_activate_video()
682 set->frame_irq); in bttv_buffer_activate_video()
683 btaor(set->bottom->btformat & 0xff, ~0xff, BT848_COLOR_FMT); in bttv_buffer_activate_video()
684 btaor(set->bottom->btswap & 0x0f, ~0x0f, BT848_COLOR_CTL); in bttv_buffer_activate_video()
692 /* ---------------------------------------------------------- */
698 const struct bttv_tvnorm *tvnorm = bttv_tvnorms + buf->tvnorm; in bttv_buffer_risc()
699 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); in bttv_buffer_risc()
702 btv->c.nr, v4l2_field_names[buf->vb.field], in bttv_buffer_risc()
703 buf->fmt->fourcc, buf->vb.width, buf->vb.height); in bttv_buffer_risc()
706 if (buf->fmt->flags & FORMAT_FLAGS_PACKED) { in bttv_buffer_risc()
707 int bpl = (buf->fmt->depth >> 3) * buf->vb.width; in bttv_buffer_risc()
708 int bpf = bpl * (buf->vb.height >> 1); in bttv_buffer_risc()
710 bttv_calc_geo(btv,&buf->geo,buf->vb.width,buf->vb.height, in bttv_buffer_risc()
711 V4L2_FIELD_HAS_BOTH(buf->vb.field), in bttv_buffer_risc()
712 tvnorm,&buf->crop); in bttv_buffer_risc()
714 switch (buf->vb.field) { in bttv_buffer_risc()
716 bttv_risc_packed(btv,&buf->top,dma->sglist, in bttv_buffer_risc()
719 buf->vb.height); in bttv_buffer_risc()
722 bttv_risc_packed(btv,&buf->bottom,dma->sglist, in bttv_buffer_risc()
723 0,bpl,0,0,buf->vb.height); in bttv_buffer_risc()
726 bttv_risc_packed(btv,&buf->top,dma->sglist, in bttv_buffer_risc()
727 0,bpl,bpl,0,buf->vb.height >> 1); in bttv_buffer_risc()
728 bttv_risc_packed(btv,&buf->bottom,dma->sglist, in bttv_buffer_risc()
729 bpl,bpl,bpl,0,buf->vb.height >> 1); in bttv_buffer_risc()
732 bttv_risc_packed(btv,&buf->top,dma->sglist, in bttv_buffer_risc()
733 0,bpl,0,0,buf->vb.height >> 1); in bttv_buffer_risc()
734 bttv_risc_packed(btv,&buf->bottom,dma->sglist, in bttv_buffer_risc()
735 bpf,bpl,0,0,buf->vb.height >> 1); in bttv_buffer_risc()
743 if (buf->fmt->flags & FORMAT_FLAGS_PLANAR) { in bttv_buffer_risc()
748 uoffset = buf->vb.width * buf->vb.height; in bttv_buffer_risc()
749 voffset = buf->vb.width * buf->vb.height; in bttv_buffer_risc()
750 if (buf->fmt->flags & FORMAT_FLAGS_CrCb) { in bttv_buffer_risc()
751 /* Y-Cr-Cb plane order */ in bttv_buffer_risc()
752 uoffset >>= buf->fmt->hshift; in bttv_buffer_risc()
753 uoffset >>= buf->fmt->vshift; in bttv_buffer_risc()
756 /* Y-Cb-Cr plane order */ in bttv_buffer_risc()
757 voffset >>= buf->fmt->hshift; in bttv_buffer_risc()
758 voffset >>= buf->fmt->vshift; in bttv_buffer_risc()
762 switch (buf->vb.field) { in bttv_buffer_risc()
764 bttv_calc_geo(btv,&buf->geo,buf->vb.width, in bttv_buffer_risc()
765 buf->vb.height,/* both_fields */ 0, in bttv_buffer_risc()
766 tvnorm,&buf->crop); in bttv_buffer_risc()
767 bttv_risc_planar(btv, &buf->top, dma->sglist, in bttv_buffer_risc()
768 0,buf->vb.width,0,buf->vb.height, in bttv_buffer_risc()
769 uoffset,voffset,buf->fmt->hshift, in bttv_buffer_risc()
770 buf->fmt->vshift,0); in bttv_buffer_risc()
773 bttv_calc_geo(btv,&buf->geo,buf->vb.width, in bttv_buffer_risc()
774 buf->vb.height,0, in bttv_buffer_risc()
775 tvnorm,&buf->crop); in bttv_buffer_risc()
776 bttv_risc_planar(btv, &buf->bottom, dma->sglist, in bttv_buffer_risc()
777 0,buf->vb.width,0,buf->vb.height, in bttv_buffer_risc()
778 uoffset,voffset,buf->fmt->hshift, in bttv_buffer_risc()
779 buf->fmt->vshift,0); in bttv_buffer_risc()
782 bttv_calc_geo(btv,&buf->geo,buf->vb.width, in bttv_buffer_risc()
783 buf->vb.height,1, in bttv_buffer_risc()
784 tvnorm,&buf->crop); in bttv_buffer_risc()
785 lines = buf->vb.height >> 1; in bttv_buffer_risc()
786 ypadding = buf->vb.width; in bttv_buffer_risc()
787 cpadding = buf->vb.width >> buf->fmt->hshift; in bttv_buffer_risc()
788 bttv_risc_planar(btv,&buf->top, in bttv_buffer_risc()
789 dma->sglist, in bttv_buffer_risc()
790 0,buf->vb.width,ypadding,lines, in bttv_buffer_risc()
792 buf->fmt->hshift, in bttv_buffer_risc()
793 buf->fmt->vshift, in bttv_buffer_risc()
795 bttv_risc_planar(btv,&buf->bottom, in bttv_buffer_risc()
796 dma->sglist, in bttv_buffer_risc()
797 ypadding,buf->vb.width,ypadding,lines, in bttv_buffer_risc()
800 buf->fmt->hshift, in bttv_buffer_risc()
801 buf->fmt->vshift, in bttv_buffer_risc()
805 bttv_calc_geo(btv,&buf->geo,buf->vb.width, in bttv_buffer_risc()
806 buf->vb.height,1, in bttv_buffer_risc()
807 tvnorm,&buf->crop); in bttv_buffer_risc()
808 lines = buf->vb.height >> 1; in bttv_buffer_risc()
809 ypadding = buf->vb.width; in bttv_buffer_risc()
810 cpadding = buf->vb.width >> buf->fmt->hshift; in bttv_buffer_risc()
811 bttv_risc_planar(btv,&buf->top, in bttv_buffer_risc()
812 dma->sglist, in bttv_buffer_risc()
813 0,buf->vb.width,0,lines, in bttv_buffer_risc()
816 buf->fmt->hshift, in bttv_buffer_risc()
817 buf->fmt->vshift, in bttv_buffer_risc()
819 bttv_risc_planar(btv,&buf->bottom, in bttv_buffer_risc()
820 dma->sglist, in bttv_buffer_risc()
821 lines * ypadding,buf->vb.width,0,lines, in bttv_buffer_risc()
824 buf->fmt->hshift, in bttv_buffer_risc()
825 buf->fmt->vshift, in bttv_buffer_risc()
834 if (buf->fmt->flags & FORMAT_FLAGS_RAW) { in bttv_buffer_risc()
836 buf->vb.field = V4L2_FIELD_SEQ_TB; in bttv_buffer_risc()
837 bttv_calc_geo(btv,&buf->geo,tvnorm->swidth,tvnorm->sheight, in bttv_buffer_risc()
838 1,tvnorm,&buf->crop); in bttv_buffer_risc()
839 bttv_risc_packed(btv, &buf->top, dma->sglist, in bttv_buffer_risc()
842 bttv_risc_packed(btv, &buf->bottom, dma->sglist, in bttv_buffer_risc()
843 buf->vb.size/2 , RAW_BPL, 0, 0, RAW_LINES); in bttv_buffer_risc()
847 buf->btformat = buf->fmt->btformat; in bttv_buffer_risc()
848 buf->btswap = buf->fmt->btswap; in bttv_buffer_risc()
852 /* ---------------------------------------------------------- */
863 btv->c.nr, v4l2_field_names[buf->vb.field], in bttv_overlay_risc()
864 fmt->fourcc, ov->w.width, ov->w.height); in bttv_overlay_risc()
867 bttv_calc_geo(btv,&buf->geo,ov->w.width,ov->w.height, in bttv_overlay_risc()
868 V4L2_FIELD_HAS_BOTH(ov->field), in bttv_overlay_risc()
869 &bttv_tvnorms[ov->tvnorm],&buf->crop); in bttv_overlay_risc()
872 switch (ov->field) { in bttv_overlay_risc()
874 bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 0); in bttv_overlay_risc()
877 bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0); in bttv_overlay_risc()
880 bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 1); in bttv_overlay_risc()
881 bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0); in bttv_overlay_risc()
888 buf->btformat = fmt->btformat; in bttv_overlay_risc()
889 buf->btswap = fmt->btswap; in bttv_overlay_risc()
890 buf->vb.field = ov->field; in bttv_overlay_risc()