{"id":573,"url":"https://patchwork.libcamera.org/api/1.1/patches/573/?format=json","web_url":"https://patchwork.libcamera.org/patch/573/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190213151027.6376-5-kieran.bingham@ideasonboard.com>","date":"2019-02-13T15:10:23","name":"[libcamera-devel,v2,4/8] libcamera: v4l2_device: Support queueing buffers to an output device","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"59922baefdbd811f868b5d54c471762121b8d7c9","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/573/mbox/","series":[{"id":181,"url":"https://patchwork.libcamera.org/api/1.1/series/181/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=181","date":"2019-02-13T15:10:19","name":"libcamera: v4l2_device buffer sharing","version":2,"mbox":"https://patchwork.libcamera.org/series/181/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/573/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/573/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@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 8A90C610B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Feb 2019 16:10:33 +0100 (CET)","from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 29FF99B0;\n\tWed, 13 Feb 2019 16:10:33 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1550070633;\n\tbh=q7Ytn3pTi34DJTXfOeovbc/1Zs5DwSIecgKK/3ycftU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=LhpZuA6SHDjMgm0d2cR21KQM5tElNYKalZY0m5Sp/JISC2CTqAHHgDXSDfN4gCiqW\n\tORVLtUuLdZnWG/1D1kxT75LfxFNonLo3liVZKsjsBMBTnCCTc5ozaotQMKjx7rJWxC\n\tpv9Fx6JWXBxIDv9TVtwaSQQnatpSGdgVrvbiJ/qk=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Wed, 13 Feb 2019 15:10:23 +0000","Message-Id":"<20190213151027.6376-5-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.19.1","In-Reply-To":"<20190213151027.6376-1-kieran.bingham@ideasonboard.com>","References":"<20190213151027.6376-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 4/8] libcamera: v4l2_device: Support\n\tqueueing 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:10:33 -0000"},"content":"To queue a buffer to an output device, we must set the buffer properties.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/v4l2_device.cpp | 19 ++++++++++++++++++-\n 1 file changed, 18 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 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}\n+\n \tLOG(V4L2, Debug) << \"Queueing buffer \" << buf.index;\n \n \tret = ioctl(fd_, VIDIOC_QBUF, &buf);\n","prefixes":["libcamera-devel","v2","4/8"]}