• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/drivers/media/video/bt8xx/

Lines Matching defs:fh

840 int check_alloc_btres(struct bttv *btv, struct bttv_fh *fh, int bit)
844 if (fh->resources & bit)
862 __s32 top = btv->crop[!!fh->do_crop].rect.top;
871 __s32 end = fh->vbi_fmt.end;
876 /* Claim scan lines above fh->vbi_fmt.end. */
881 fh->resources |= bit;
892 int check_btres(struct bttv_fh *fh, int bit)
894 return (fh->resources & bit);
933 void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits)
935 if ((fh->resources & bits) != bits) {
940 fh->resources &= ~bits;
969 unsigned char fl, fh, fi;
979 fh=fout/fin;
985 btwrite(fh, BT848_PLL_F_HI);
1719 bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh,
1737 bttv_dma_free(&fh->cap,btv, old);
1741 free_btres(btv,fh,RESOURCE_OVERLAY);
1755 struct bttv_fh *fh = q->priv_data;
1791 c = btv->crop[!!fh->do_crop];
1860 struct bttv_fh *fh = q->priv_data;
1862 *size = fh->fmt->depth*fh->width*fh->height >> 3;
1875 struct bttv_fh *fh = q->priv_data;
1877 return bttv_prepare_buffer(q,fh->btv, buf, fh->fmt,
1878 fh->width, fh->height, field);
1885 struct bttv_fh *fh = q->priv_data;
1886 struct bttv *btv = fh->btv;
1899 struct bttv_fh *fh = q->priv_data;
1901 bttv_dma_free(q,fh->btv,buf);
2312 limit_scaled_size (struct bttv_fh * fh,
2321 struct bttv *btv = fh->btv;
2340 c = &btv->crop[!!fh->do_crop];
2342 if (fh->do_crop
2426 verify_window (struct bttv_fh * fh,
2445 height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1;
2460 if (NULL == fh->ovfmt)
2463 switch (fh->ovfmt->depth) {
2480 rc = limit_scaled_size(fh, &win->w.width, &win->w.height,
2491 static int setup_window(struct bttv_fh *fh, struct bttv *btv,
2497 if (NULL == fh->ovfmt)
2499 if (!(fh->ovfmt->flags & FORMAT_FLAGS_PACKED))
2501 retval = verify_window(fh, win,
2527 switch (fh->ovfmt->depth) {
2542 mutex_lock(&fh->cap.lock);
2543 kfree(fh->ov.clips);
2544 fh->ov.clips = clips;
2545 fh->ov.nclips = n;
2547 fh->ov.w = win->w;
2548 fh->ov.field = win->field;
2549 fh->ov.setup_ok = 1;
2556 if (check_btres(fh, RESOURCE_OVERLAY)) {
2560 new->crop = btv->crop[!!fh->do_crop].rect;
2561 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
2562 retval = bttv_switch_overlay(btv,fh,new);
2564 mutex_unlock(&fh->cap.lock);
2570 static struct videobuf_queue* bttv_queue(struct bttv_fh *fh)
2574 switch (fh->type) {
2576 q = &fh->cap;
2579 q = &fh->vbi;
2587 static int bttv_resource(struct bttv_fh *fh)
2591 switch (fh->type) {
2604 static int bttv_switch_type(struct bttv_fh *fh, enum v4l2_buf_type type)
2606 struct videobuf_queue *q = bttv_queue(fh);
2607 int res = bttv_resource(fh);
2609 if (check_btres(fh,res))
2613 fh->type = type;
2635 static int bttv_g_fmt(struct bttv_fh *fh, struct v4l2_format *f)
2640 pix_format_set_size (&f->fmt.pix, fh->fmt,
2641 fh->width, fh->height);
2642 f->fmt.pix.field = fh->cap.field;
2643 f->fmt.pix.pixelformat = fh->fmt->fourcc;
2647 f->fmt.win.w = fh->ov.w;
2648 f->fmt.win.field = fh->ov.field;
2651 bttv_vbi_get_fmt(fh, &f->fmt.vbi);
2658 static int bttv_try_fmt(struct bttv_fh *fh, struct bttv *btv,
2677 height2 = btv->crop[!!fh->do_crop].rect.height >> 1;
2701 rc = limit_scaled_size(fh, &width, &height, field,
2716 return verify_window(fh, &f->fmt.win,
2720 return bttv_vbi_try_fmt(fh, &f->fmt.vbi);
2726 static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv,
2736 retval = bttv_switch_type(fh,f->type);
2739 retval = bttv_try_fmt(fh,btv,f, /* adjust_crop */ 1);
2745 mutex_lock(&fh->cap.lock);
2746 fh->fmt = fmt;
2747 fh->cap.field = f->fmt.pix.field;
2748 fh->cap.last = V4L2_FIELD_NONE;
2749 fh->width = f->fmt.pix.width;
2750 fh->height = f->fmt.pix.height;
2754 mutex_unlock(&fh->cap.lock);
2763 return setup_window(fh, btv, &f->fmt.win, 1);
2765 retval = bttv_switch_type(fh,f->type);
2768 return bttv_vbi_set_fmt(fh, &f->fmt.vbi);
2777 struct bttv_fh *fh = file->private_data;
2778 struct bttv *btv = fh->btv;
2797 retval = v4l2_prio_check(&btv->prio,&fh->prio);
2811 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
2842 if (fh->fmt) {
2843 pic->depth = fh->fmt->depth;
2844 pic->palette = fh->fmt->palette;
2856 mutex_lock(&fh->cap.lock);
2865 fh->width = RAW_BPL;
2866 fh->height = gbufsize / RAW_BPL;
2870 fh->ovfmt = fmt;
2871 fh->fmt = fmt;
2880 fh->ovfmt = fmt+1;
2887 mutex_unlock(&fh->cap.lock);
2896 win->x = fh->ov.w.left;
2897 win->y = fh->ov.w.top;
2898 win->width = fh->ov.w.width;
2899 win->height = fh->ov.w.height;
2919 retval = setup_window(fh, btv, &w2, 0);
2922 fh->width = fh->ov.w.width;
2923 fh->height = fh->ov.w.height;
2924 btv->init.width = fh->ov.w.width;
2925 btv->init.height = fh->ov.w.height;
2938 if (fh->ovfmt)
2939 fbuf->depth = fh->ovfmt->depth;
2961 mutex_lock(&fh->cap.lock);
2988 fh->ovfmt = fmt;
2989 fh->fmt = fmt;
2999 mutex_unlock(&fh->cap.lock);
3013 if (!fh->ov.setup_ok) {
3019 if (!check_alloc_btres(btv,fh,RESOURCE_OVERLAY))
3022 mutex_lock(&fh->cap.lock);
3024 fh->ov.tvnorm = btv->tvnorm;
3026 new->crop = btv->crop[!!fh->do_crop].rect;
3027 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
3033 retval = bttv_switch_overlay(btv,fh,new);
3034 mutex_unlock(&fh->cap.lock);
3043 mutex_lock(&fh->cap.lock);
3044 retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize,
3053 mutex_unlock(&fh->cap.lock);
3067 res = bttv_resource(fh);
3068 if (!check_alloc_btres(btv, fh, res))
3071 mutex_lock(&fh->cap.lock);
3073 buf = (struct bttv_buffer *)fh->cap.bufs[vm->frame];
3082 height2 = btv->crop[!!fh->do_crop].rect.height >> 1;
3086 retval = bttv_prepare_buffer(&fh->cap,btv,buf,
3092 buffer_queue(&fh->cap,&buf->vb);
3094 mutex_unlock(&fh->cap.lock);
3105 mutex_lock(&fh->cap.lock);
3107 buf = (struct bttv_buffer *)fh->cap.bufs[*frame];
3118 videobuf_dma_sync(&fh->cap,&buf->vb.dma);
3119 bttv_dma_free(&fh->cap,btv,buf);
3125 mutex_unlock(&fh->cap.lock);
3130 if (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE) {
3131 retval = bttv_switch_type(fh,V4L2_BUF_TYPE_VBI_CAPTURE);
3233 return bttv_try_fmt(fh,btv,f, /* adjust_crop */ 0);
3238 return bttv_g_fmt(fh,f);
3243 return bttv_s_fmt(fh,btv,f);
3252 if (fh->ovfmt)
3253 fb->fmt.pixelformat = fh->ovfmt->fourcc;
3277 retval = limit_scaled_size(fh, &width, &height,
3288 mutex_lock(&fh->cap.lock);
3298 fh->ovfmt = fmt;
3301 fh->ov.w.left = 0;
3302 fh->ov.w.top = 0;
3303 fh->ov.w.width = fb->fmt.width;
3304 fh->ov.w.height = fb->fmt.height;
3307 kfree(fh->ov.clips);
3308 fh->ov.clips = NULL;
3309 fh->ov.nclips = 0;
3311 if (check_btres(fh, RESOURCE_OVERLAY)) {
3315 new->crop = btv->crop[!!fh->do_crop].rect;
3316 bttv_overlay_risc(btv,&fh->ov,fh->ovfmt,new);
3317 retval = bttv_switch_overlay(btv,fh,new);
3320 mutex_unlock(&fh->cap.lock);
3325 return videobuf_reqbufs(bttv_queue(fh),arg);
3328 return videobuf_querybuf(bttv_queue(fh),arg);
3332 int res = bttv_resource(fh);
3334 if (!check_alloc_btres(btv, fh, res))
3336 return videobuf_qbuf(bttv_queue(fh),arg);
3340 return videobuf_dqbuf(bttv_queue(fh),arg,
3345 int res = bttv_resource(fh);
3347 if (!check_alloc_btres(btv,fh,res))
3349 return videobuf_streamon(bttv_queue(fh));
3353 int res = bttv_resource(fh);
3355 retval = videobuf_streamoff(bttv_queue(fh));
3358 free_btres(btv,fh,res);
3433 return v4l2_prio_change(&btv->prio, &fh->prio, *prio);
3460 /* No fh->do_crop = 1; because btv->crop[1] may be
3461 inconsistent with fh->width or fh->height and apps
3464 crop->c = btv->crop[!!fh->do_crop].rect;
3482 retval = v4l2_prio_check(&btv->prio,&fh->prio);
3493 if (locked_btres(fh->btv, VIDEO_RESOURCES))
3527 fh->do_crop = 1;
3529 mutex_lock(&fh->cap.lock);
3531 if (fh->width < c.min_scaled_width) {
3532 fh->width = c.min_scaled_width;
3534 } else if (fh->width > c.max_scaled_width) {
3535 fh->width = c.max_scaled_width;
3539 if (fh->height < c.min_scaled_height) {
3540 fh->height = c.min_scaled_height;
3542 } else if (fh->height > c.max_scaled_height) {
3543 fh->height = c.max_scaled_height;
3547 mutex_unlock(&fh->cap.lock);
3571 mutex_unlock(&fh->cap.lock);
3582 struct bttv_fh *fh = file->private_data;
3589 tvnorm = fh->vbi_fmt.tvnorm;
3591 if (fh->vbi_fmt.fmt.start[0] != tvnorm->vbistart[0] ||
3592 fh->vbi_fmt.fmt.start[1] != tvnorm->vbistart[1] ||
3593 fh->vbi_fmt.fmt.count[0] != fh->vbi_fmt.fmt.count[1]) {
3601 bttv_switch_type(fh,V4L2_BUF_TYPE_VBI_CAPTURE);
3602 return (fh->vbi_fmt.fmt.count[0] * 2
3603 * fh->vbi_fmt.fmt.samples_per_line);
3614 struct bttv_fh *fh = file->private_data;
3617 if (fh->btv->errors)
3618 bttv_reinit_bt848(fh->btv);
3620 fh->btv->c.nr,(int)count,v4l2_type_names[fh->type]);
3622 switch (fh->type) {
3624 if (!check_alloc_btres(fh->btv, fh, RESOURCE_VIDEO_READ)) {
3625 /* VIDEO_READ in use by another fh,
3626 or VIDEO_STREAM by any fh. */
3629 retval = videobuf_read_one(&fh->cap, data, count, ppos,
3631 free_btres(fh->btv, fh, RESOURCE_VIDEO_READ);
3634 if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI))
3636 retval = videobuf_read_stream(&fh->vbi, data, count, ppos, 1,
3647 struct bttv_fh *fh = file->private_data;
3651 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
3652 if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI))
3654 return videobuf_poll_stream(file, &fh->vbi, wait);
3657 if (check_btres(fh,RESOURCE_VIDEO_STREAM)) {
3659 if (list_empty(&fh->cap.stream))
3661 buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
3664 mutex_lock(&fh->cap.lock);
3665 if (NULL == fh->cap.read_buf) {
3667 if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) {
3668 mutex_unlock(&fh->cap.lock);
3671 fh->cap.read_buf = videobuf_alloc(fh->cap.msize);
3672 if (NULL == fh->cap.read_buf) {
3673 mutex_unlock(&fh->cap.lock);
3676 fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR;
3677 field = videobuf_next_field(&fh->cap);
3678 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) {
3679 kfree (fh->cap.read_buf);
3680 fh->cap.read_buf = NULL;
3681 mutex_unlock(&fh->cap.lock);
3684 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
3685 fh->cap.read_off = 0;
3687 mutex_unlock(&fh->cap.lock);
3688 buf = (struct bttv_buffer*)fh->cap.read_buf;
3702 struct bttv_fh *fh;
3729 fh = kmalloc(sizeof(*fh),GFP_KERNEL);
3730 if (NULL == fh)
3732 file->private_data = fh;
3733 *fh = btv->init;
3734 fh->type = type;
3735 fh->ov.setup_ok = 0;
3736 v4l2_prio_open(&btv->prio,&fh->prio);
3738 videobuf_queue_init(&fh->cap, &bttv_video_qops,
3743 fh);
3744 videobuf_queue_init(&fh->vbi, &bttv_vbi_qops,
3749 fh);
3758 this fh, which is to say VIDIOC_G_CROP and scaling limit checks
3763 fh->do_crop = !reset_crop; /* module parameter */
3767 driver versions each fh has its own parameters. */
3768 bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm);
3776 struct bttv_fh *fh = file->private_data;
3777 struct bttv *btv = fh->btv;
3780 if (check_btres(fh, RESOURCE_OVERLAY))
3781 bttv_switch_overlay(btv,fh,NULL);
3784 if (check_btres(fh, RESOURCE_VIDEO_STREAM)) {
3785 videobuf_streamoff(&fh->cap);
3786 free_btres(btv,fh,RESOURCE_VIDEO_STREAM);
3788 if (fh->cap.read_buf) {
3789 buffer_release(&fh->cap,fh->cap.read_buf);
3790 kfree(fh->cap.read_buf);
3792 if (check_btres(fh, RESOURCE_VIDEO_READ)) {
3793 free_btres(btv, fh, RESOURCE_VIDEO_READ);
3797 if (check_btres(fh, RESOURCE_VBI)) {
3798 if (fh->vbi.streaming)
3799 videobuf_streamoff(&fh->vbi);
3800 if (fh->vbi.reading)
3801 videobuf_read_stop(&fh->vbi);
3802 free_btres(btv,fh,RESOURCE_VBI);
3806 videobuf_mmap_free(&fh->cap);
3807 videobuf_mmap_free(&fh->vbi);
3808 v4l2_prio_close(&btv->prio,&fh->prio);
3810 kfree(fh);
3820 struct bttv_fh *fh = file->private_data;
3823 fh->btv->c.nr, v4l2_type_names[fh->type],
3825 return videobuf_mmap_mapper(bttv_queue(fh),vma);