[{"id":812,"web_url":"https://patchwork.libcamera.org/comment/812/","msgid":"<20190213154407.GG5332@pendragon.ideasonboard.com>","date":"2019-02-13T15:44:07","subject":"Re: [libcamera-devel] [PATCH v2 4/8] libcamera: v4l2_device:\n\tSupport queueing buffers to an output device","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Wed, Feb 13, 2019 at 03:10:23PM +0000, Kieran Bingham wrote:\n> To queue a buffer to an output device, we must set the buffer properties.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/libcamera/v4l2_device.cpp | 19 ++++++++++++++++++-\n>  1 file changed, 18 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 83073c28b817..8c038239cf24 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -299,7 +299,15 @@ int V4L2Device::open()\n>  \t\t\t    ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE\n>  \t\t\t    : V4L2_BUF_TYPE_VIDEO_OUTPUT;\n>  \n> -\tfdEvent_ = new EventNotifier(fd_, EventNotifier::Read);\n> +\t/*\n> +\t *  We wait for Read notifications on CAPTURE devices (POLLIN), and\n> +\t *  Write notifications for OUTPUT devices (POLLOUT).\n> +\t */\n> +\tif (caps_.isCapture())\n> +\t\tfdEvent_ = new EventNotifier(fd_, EventNotifier::Read);\n> +\telse\n> +\t\tfdEvent_ = new EventNotifier(fd_, EventNotifier::Write);\n> +\n>  \tfdEvent_->activated.connect(this, &V4L2Device::bufferAvailable);\n>  \tfdEvent_->setEnabled(false);\n>  \n> @@ -679,6 +687,15 @@ int V4L2Device::queueBuffer(Buffer *buffer)\n>  \t\tbuf.m.planes = planes;\n>  \t}\n>  \n> +\tif (V4L2_TYPE_IS_OUTPUT(bufferType_)) {\n> +\t\tbuf.bytesused = buffer->bytesused_;\n> +\t\tbuf.sequence = buffer->sequence_;\n> +\t\t/**\n> +\t\t * \\todo: Timestamp should be converted back to a struct\n> +\t\t * timeval for passing back into V4L2.\n> +\t\t */\n\t\tbuf.timestamp.tv_sec = buffer->timestamp / 1000000000;\n\t\tbuf.timestamp.tv_usec = (buffer->timestamp / 1000) % 1000000;\n\nWith this,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t}\n> +\n>  \tLOG(V4L2, Debug) << \"Queueing buffer \" << buf.index;\n>  \n>  \tret = ioctl(fd_, VIDIOC_QBUF, &buf);","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BCE83610AE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Feb 2019 16:44:10 +0100 (CET)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 330E185;\n\tWed, 13 Feb 2019 16:44:10 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1550072650;\n\tbh=WjaFcfSxRtpYv1plnlcG16tGf4FvG45ckbMxV5TqeEY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=j+iXVhti0SIhmrVSfEJpsTgMZ0NRV2rQtbMOJUqg3OBqjX28WMtAw+C0DbqOEnvTi\n\t8jf/St3vqvXB0A/DHE/tdal16G8q1H7lBZUcNEDqE7ZdQJhreyIRe/xR7FgE7gM5S+\n\t7IZaGj8A1z1aN4XkP8b++q6oKoYIYOmYuvSJcDi8=","Date":"Wed, 13 Feb 2019 17:44:07 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Message-ID":"<20190213154407.GG5332@pendragon.ideasonboard.com>","References":"<20190213151027.6376-1-kieran.bingham@ideasonboard.com>\n\t<20190213151027.6376-5-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190213151027.6376-5-kieran.bingham@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 4/8] libcamera: v4l2_device:\n\tSupport queueing buffers to an output device","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 13 Feb 2019 15:44:10 -0000"}}]