if (fh->jpg_buffers.active == ZORAN_FREE) {
if (zr->jpg_buffers.active == ZORAN_FREE) {
zr->jpg_buffers = fh->jpg_buffers;
if (fh->jpg_buffers.active == ZORAN_FREE) {
if (zr->jpg_buffers.active == ZORAN_FREE) {
zr->jpg_buffers = fh->jpg_buffers;
/* see fs/device.c - the kernel already locks during open(),
* so locking ourselves only causes deadlocks */
/* see fs/device.c - the kernel already locks during open(),
* so locking ourselves only causes deadlocks */
ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
/* now, create the open()-specific file_ops struct */
ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
/* now, create the open()-specific file_ops struct */
/* kernel locks (fs/device.c), so don't do that ourselves
* (prevents deadlocks) */
/* kernel locks (fs/device.c), so don't do that ourselves
* (prevents deadlocks) */
* but moving the free code outside the munmap() handler fixes
* all this... If someone knows why, please explain me (Ronald)
*/
* but moving the free code outside the munmap() handler fixes
* all this... If someone knows why, please explain me (Ronald)
*/
/* we obtained it! Let's try to free some things */
if (fh->jpg_buffers.ready_to_be_freed)
jpg_fbuffer_free(file);
if (fh->v4l_buffers.ready_to_be_freed)
v4l_fbuffer_free(file);
/* we obtained it! Let's try to free some things */
if (fh->jpg_buffers.ready_to_be_freed)
jpg_fbuffer_free(file);
if (fh->v4l_buffers.ready_to_be_freed)
v4l_fbuffer_free(file);
vcap->maxwidth = BUZ_MAX_WIDTH;
vcap->maxheight = BUZ_MAX_HEIGHT;
vcap->minwidth = BUZ_MIN_WIDTH;
vcap->minheight = BUZ_MIN_HEIGHT;
vcap->maxwidth = BUZ_MAX_WIDTH;
vcap->maxheight = BUZ_MAX_HEIGHT;
vcap->minwidth = BUZ_MIN_WIDTH;
vcap->minheight = BUZ_MIN_HEIGHT;
* * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input."
* * ^^^^^^^
* * The famos BTTV driver has it implemented with a struct video_channel argument
* * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input."
* * ^^^^^^^
* * The famos BTTV driver has it implemented with a struct video_channel argument
"%s: VIDIOCSCHAN - channel=%d, norm=%d\n",
ZR_DEVNAME(zr), vchan->channel, vchan->norm);
"%s: VIDIOCSCHAN - channel=%d, norm=%d\n",
ZR_DEVNAME(zr), vchan->channel, vchan->norm);
if ((res = zoran_set_input(zr, vchan->channel)))
goto schan_unlock_and_return;
if ((res = zoran_set_norm(zr, vchan->norm)))
if ((res = zoran_set_input(zr, vchan->channel)))
goto schan_unlock_and_return;
if ((res = zoran_set_norm(zr, vchan->norm)))
dprintk(3, KERN_DEBUG "%s: VIDIOCGPICT\n", ZR_DEVNAME(zr));
memset(vpict, 0, sizeof(struct video_picture));
dprintk(3, KERN_DEBUG "%s: VIDIOCGPICT\n", ZR_DEVNAME(zr));
memset(vpict, 0, sizeof(struct video_picture));
dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr));
memset(vwin, 0, sizeof(struct video_window));
dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr));
memset(vwin, 0, sizeof(struct video_window));
vwin->x = fh->overlay_settings.x;
vwin->y = fh->overlay_settings.y;
vwin->width = fh->overlay_settings.width;
vwin->height = fh->overlay_settings.height;
vwin->x = fh->overlay_settings.x;
vwin->y = fh->overlay_settings.y;
vwin->width = fh->overlay_settings.width;
vwin->height = fh->overlay_settings.height;
ZR_DEVNAME(zr), vwin->x, vwin->y, vwin->width,
vwin->height, vwin->clipcount);
ZR_DEVNAME(zr), vwin->x, vwin->y, vwin->width,
vwin->height, vwin->clipcount);
res =
setup_window(file, vwin->x, vwin->y, vwin->width,
vwin->height, vwin->clips,
vwin->clipcount, NULL);
res =
setup_window(file, vwin->x, vwin->y, vwin->width,
vwin->height, vwin->clips,
vwin->clipcount, NULL);
res =
setup_fbuffer(file, vbuf->base, &zoran_formats[i],
vbuf->width, vbuf->height,
vbuf->bytesperline);
res =
setup_fbuffer(file, vbuf->base, &zoran_formats[i],
vbuf->width, vbuf->height,
vbuf->bytesperline);
ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height,
vmap->format);
ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height,
vmap->format);
/* The next mmap will map the V4L buffers */
fh->map_mode = ZORAN_MAP_MODE_RAW;
v4l1reqbuf_unlock_and_return:
/* The next mmap will map the V4L buffers */
fh->map_mode = ZORAN_MAP_MODE_RAW;
v4l1reqbuf_unlock_and_return:
* also be *_PLAY, but it doesn't matter here */
fh->map_mode = ZORAN_MAP_MODE_JPG_REC;
jpgreqbuf_unlock_and_return:
* also be *_PLAY, but it doesn't matter here */
fh->map_mode = ZORAN_MAP_MODE_JPG_REC;
jpgreqbuf_unlock_and_return:
decoder_command(zr, DECODER_SET_INPUT, &input);
decoder_command(zr, DECODER_SET_NORM, &zr->norm);
gstat_unlock_and_return:
decoder_command(zr, DECODER_SET_INPUT, &input);
decoder_command(zr, DECODER_SET_NORM, &zr->norm);
gstat_unlock_and_return:
if (fh->jpg_buffers.allocated ||
(fh->v4l_buffers.allocated &&
fh->v4l_buffers.active !=
if (fh->jpg_buffers.allocated ||
(fh->v4l_buffers.allocated &&
fh->v4l_buffers.active !=
dprintk(3, KERN_DEBUG "%s: VIDIOC_G_FBUF\n", ZR_DEVNAME(zr));
memset(fb, 0, sizeof(*fb));
dprintk(3, KERN_DEBUG "%s: VIDIOC_G_FBUF\n", ZR_DEVNAME(zr));
memset(fb, 0, sizeof(*fb));
fb->base = zr->buffer.base;
fb->fmt.width = zr->buffer.width;
fb->fmt.height = zr->buffer.height;
fb->base = zr->buffer.base;
fb->fmt.width = zr->buffer.width;
fb->fmt.height = zr->buffer.height;
fb->fmt.colorspace = V4L2_COLORSPACE_SRGB;
fb->fmt.field = V4L2_FIELD_INTERLACED;
fb->flags = V4L2_FBUF_FLAG_OVERLAY;
fb->fmt.colorspace = V4L2_COLORSPACE_SRGB;
fb->fmt.field = V4L2_FIELD_INTERLACED;
fb->flags = V4L2_FBUF_FLAG_OVERLAY;
res =
setup_fbuffer(file, fb->base, &zoran_formats[i],
fb->fmt.width, fb->fmt.height,
fb->fmt.bytesperline);
res =
setup_fbuffer(file, fb->base, &zoran_formats[i],
fb->fmt.width, fb->fmt.height,
fb->fmt.bytesperline);
KERN_DEBUG "%s: VIDIOC_QBUF - type=%d, index=%d\n",
ZR_DEVNAME(zr), buf->type, buf->index);
KERN_DEBUG "%s: VIDIOC_QBUF - type=%d, index=%d\n",
ZR_DEVNAME(zr), buf->type, buf->index);
dprintk(3, KERN_DEBUG "%s: VIDIOC_DQBUF - type=%d\n",
ZR_DEVNAME(zr), buf->type);
dprintk(3, KERN_DEBUG "%s: VIDIOC_DQBUF - type=%d\n",
ZR_DEVNAME(zr), buf->type);
if ((res = zoran_set_norm(zr, norm)))
goto sstd_unlock_and_return;
res = wait_grab_pending(zr);
sstd_unlock_and_return:
if ((res = zoran_set_norm(zr, norm)))
goto sstd_unlock_and_return;
res = wait_grab_pending(zr);
sstd_unlock_and_return:
if ((res = zoran_set_input(zr, *input)))
goto sinput_unlock_and_return;
/* Make sure the changes come into effect */
res = wait_grab_pending(zr);
sinput_unlock_and_return:
if ((res = zoran_set_input(zr, *input)))
goto sinput_unlock_and_return;
/* Make sure the changes come into effect */
res = wait_grab_pending(zr);
sinput_unlock_and_return:
cropcap->defrect.width = BUZ_MIN_WIDTH;
cropcap->defrect.height = BUZ_MIN_HEIGHT;
cropcap_unlock_and_return:
cropcap->defrect.width = BUZ_MIN_WIDTH;
cropcap->defrect.height = BUZ_MIN_HEIGHT;
cropcap_unlock_and_return:
ZR_DEVNAME(zr), crop->type, crop->c.left, crop->c.top,
crop->c.width, crop->c.height);
ZR_DEVNAME(zr), crop->type, crop->c.left, crop->c.top,
crop->c.width, crop->c.height);
zoran_v4l2_calc_bufsize(&fh->jpg_settings);
fh->jpg_settings.jpg_comp = *params = settings.jpg_comp;
sjpegc_unlock_and_return:
zoran_v4l2_calc_bufsize(&fh->jpg_settings);
fh->jpg_settings.jpg_comp = *params = settings.jpg_comp;
sjpegc_unlock_and_return:
if (fh->jpg_buffers.active != ZORAN_FREE) {
jpg_qbuf(file, -1, zr->codec_mode);
if (fh->jpg_buffers.active != ZORAN_FREE) {
jpg_qbuf(file, -1, zr->codec_mode);
if (fh->v4l_buffers.active != ZORAN_FREE) {
zr36057_set_memgrab(zr, 0);
if (fh->v4l_buffers.active != ZORAN_FREE) {
zr36057_set_memgrab(zr, 0);