Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/dev/video.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/dev/video.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.17 retrieving revision 1.17.8.2 diff -u -p -r1.17 -r1.17.8.2 --- src/sys/dev/video.c 2008/09/21 19:29:50 1.17 +++ src/sys/dev/video.c 2009/01/22 23:21:19 1.17.8.2 @@ -1,4 +1,4 @@ -/* $NetBSD: video.c,v 1.17 2008/09/21 19:29:50 jmcneill Exp $ */ +/* $NetBSD: video.c,v 1.17.8.2 2009/01/22 23:21:19 snj Exp $ */ /* * Copyright (c) 2008 Patrick Mahoney @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.17 2008/09/21 19:29:50 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.17.8.2 2009/01/22 23:21:19 snj Exp $"); #include "video.h" #if NVIDEO > 0 @@ -770,6 +770,7 @@ video_set_format(struct video_softc *sc, return err; video_format_to_v4l2_format(&vfmt, fmt); + sc->sc_stream_in.vs_format = vfmt; return 0; } @@ -969,6 +970,10 @@ video_dequeue_buf(struct video_softc *sc } else { /* Block until we have sample */ while ((vb = video_stream_dequeue(vs)) == NULL) { + if (!vs->vs_streaming) { + mutex_exit(&vs->vs_lock); + return EINVAL; + } err = cv_wait_sig(&vs->vs_sample_cv, &vs->vs_lock); if (err != 0) { @@ -1563,10 +1568,12 @@ videopoll(dev_t dev, int events, struct return POLLERR; } + mutex_enter(&vs->vs_lock); if (!SIMPLEQ_EMPTY(&sc->sc_stream_in.vs_egress)) revents |= events & (POLLIN | POLLRDNORM); else selrecord(l, &vs->vs_sel); + mutex_exit(&vs->vs_lock); return (revents); } @@ -1643,7 +1650,7 @@ video_stream_setup_bufs(struct video_str /* Ensure that all allocated buffers are queued and not under * userspace control. */ for (i = 0; i < vs->vs_nbufs; ++i) { - if (!(vs->vs_buf[i]->vb_buf->flags | V4L2_BUF_FLAG_QUEUED)) { + if (!(vs->vs_buf[i]->vb_buf->flags & V4L2_BUF_FLAG_QUEUED)) { mutex_exit(&vs->vs_lock); return EBUSY; }