{"id":2471,"url":"https://patchwork.libcamera.org/api/patches/2471/?format=json","web_url":"https://patchwork.libcamera.org/patch/2471/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20191230120510.938333-22-niklas.soderlund@ragnatech.se>","date":"2019-12-30T12:05:06","name":"[libcamera-devel,v2,21/25] libcamera: v4l2_videodevice: Remove Buffer interface","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"53d3e9012e992e6b12bba9cb26acc0e6621634c5","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2471/mbox/","series":[{"id":593,"url":"https://patchwork.libcamera.org/api/series/593/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=593","date":"2019-12-30T12:04:45","name":"libcamera: Rework buffer API","version":2,"mbox":"https://patchwork.libcamera.org/series/593/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2471/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2471/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C0E79605D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Dec 2019 13:06:10 +0100 (CET)","from bismarck.berto.se (p4fca2fd0.dip0.t-ipconnect.de\n\t[79.202.47.208]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid c399f91a-2afc-11ea-a00b-005056917a89;\n\tMon, 30 Dec 2019 13:06:09 +0100 (CET)"],"X-Halon-ID":"c399f91a-2afc-11ea-a00b-005056917a89","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 30 Dec 2019 13:05:06 +0100","Message-Id":"<20191230120510.938333-22-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.24.1","In-Reply-To":"<20191230120510.938333-1-niklas.soderlund@ragnatech.se>","References":"<20191230120510.938333-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 21/25] libcamera: v4l2_videodevice:\n\tRemove Buffer interface","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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":"Mon, 30 Dec 2019 12:06:11 -0000"},"content":"The Buffer interface is no longer in use and can be removed. While doing\nso clean up the two odd names (dequeueFrameBuffer() and\nqueuedFrameBuffers_) that had to be used when adding the FrameBuffer\ninterface.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/v4l2_videodevice.h |  19 +-\n src/libcamera/pipeline/ipu3/ipu3.cpp     |   8 +-\n src/libcamera/pipeline/rkisp1/rkisp1.cpp |   6 +-\n src/libcamera/pipeline/uvcvideo.cpp      |   2 +-\n src/libcamera/pipeline/vimc.cpp          |   2 +-\n src/libcamera/v4l2_videodevice.cpp       | 337 +----------------------\n test/v4l2_videodevice/buffer_sharing.cpp |   4 +-\n test/v4l2_videodevice/capture_async.cpp  |   2 +-\n test/v4l2_videodevice/v4l2_m2mdevice.cpp |   4 +-\n 9 files changed, 30 insertions(+), 354 deletions(-)","diff":"diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex 97a79e56c647e7a6..ba03a087f918c2a7 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -194,19 +194,13 @@ public:\n \tint setFormat(V4L2DeviceFormat *format);\n \tImageFormats formats();\n \n-\tint exportBuffers(BufferPool *pool);\n-\tint importBuffers(BufferPool *pool);\n \tint exportBuffers(unsigned int count,\n \t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n \tint importBuffers(unsigned int count);\n \tint releaseBuffers();\n \n-\tint queueBuffer(Buffer *buffer);\n-\tstd::vector<std::unique_ptr<Buffer>> queueAllBuffers();\n-\tSignal<Buffer *> bufferReady;\n \tint queueBuffer(FrameBuffer *buffer);\n-\t/* todo: Rename to bufferReady when the Buffer version is removed */\n-\tSignal<FrameBuffer *> frameBufferReady;\n+\tSignal<FrameBuffer *> bufferReady;\n \n \tint streamOn();\n \tint streamOff();\n@@ -235,26 +229,19 @@ private:\n \tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n \n \tint requestBuffers(unsigned int count);\n-\tint createPlane(BufferMemory *buffer, unsigned int index,\n-\t\t\tunsigned int plane, unsigned int length);\n \tstd::unique_ptr<FrameBuffer> createFrameBuffer(const struct v4l2_buffer &buf);\n \tint exportDmabufFd(unsigned int index, unsigned int plane);\n \n-\tBuffer *dequeueBuffer();\n \tvoid bufferAvailable(EventNotifier *notifier);\n-\t/* todo: Rename to dequeueBuffer() when the Buffer version is removed */\n-\tFrameBuffer *dequeueFrameBuffer();\n+\tFrameBuffer *dequeuBuffer();\n \n \tV4L2Capability caps_;\n \n \tenum v4l2_buf_type bufferType_;\n \tenum v4l2_memory memoryType_;\n \n-\tBufferPool *bufferPool_;\n \tV4L2BufferCache *cache_;\n-\tstd::map<unsigned int, Buffer *> queuedBuffers_;\n-\t/* todo: Rename to queuedBuffers_ when the Buffer version is removed */\n-\tstd::map<unsigned int, FrameBuffer *> queuedFrameBuffers_;\n+\tstd::map<unsigned int, FrameBuffer *> queuedBuffers_;\n \n \tEventNotifier *fdEvent_;\n };\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 2f3ba2bf10f2f177..ea02a4e5f7f04718 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -905,13 +905,13 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t * associated ImgU input where they get processed and\n \t\t * returned through the ImgU main and secondary outputs.\n \t\t */\n-\t\tdata->cio2_.output_->frameBufferReady.connect(data.get(),\n+\t\tdata->cio2_.output_->bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n-\t\tdata->imgu_->input_->frameBufferReady.connect(data.get(),\n+\t\tdata->imgu_->input_->bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n-\t\tdata->imgu_->output_.dev->frameBufferReady.connect(data.get(),\n+\t\tdata->imgu_->output_.dev->bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n-\t\tdata->imgu_->viewfinder_.dev->frameBufferReady.connect(data.get(),\n+\t\tdata->imgu_->viewfinder_.dev->bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n \n \t\t/* Create and register the Camera instance. */\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex cc9c9ff961e948dc..7ed729fb7974d6ea 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -955,9 +955,9 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \tif (param_->open() < 0)\n \t\treturn false;\n \n-\tvideo_->frameBufferReady.connect(this, &PipelineHandlerRkISP1::bufferReady);\n-\tstat_->frameBufferReady.connect(this, &PipelineHandlerRkISP1::statReady);\n-\tparam_->frameBufferReady.connect(this, &PipelineHandlerRkISP1::paramReady);\n+\tvideo_->bufferReady.connect(this, &PipelineHandlerRkISP1::bufferReady);\n+\tstat_->bufferReady.connect(this, &PipelineHandlerRkISP1::statReady);\n+\tparam_->bufferReady.connect(this, &PipelineHandlerRkISP1::paramReady);\n \n \t/* Configure default links. */\n \tif (initLinks() < 0) {\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex c29bad707b464bcd..1eb809914f9aa0dc 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -351,7 +351,7 @@ int UVCCameraData::init(MediaEntity *entity)\n \tif (ret)\n \t\treturn ret;\n \n-\tvideo_->frameBufferReady.connect(this, &UVCCameraData::bufferReady);\n+\tvideo_->bufferReady.connect(this, &UVCCameraData::bufferReady);\n \n \t/* Initialise the supported controls. */\n \tconst ControlInfoMap &controls = video_->controls();\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex 33fec6520240b328..13a7fc6cb5294eec 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -439,7 +439,7 @@ int VimcCameraData::init(MediaDevice *media)\n \tif (video_->open())\n \t\treturn -ENODEV;\n \n-\tvideo_->frameBufferReady.connect(this, &VimcCameraData::bufferReady);\n+\tvideo_->bufferReady.connect(this, &VimcCameraData::bufferReady);\n \n \traw_ = new V4L2VideoDevice(media->getEntityByName(\"Raw Capture 1\"));\n \tif (raw_->open())\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex b380f08c1e880427..2aeaabf3c6ca1733 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -370,8 +370,7 @@ const std::string V4L2DeviceFormat::toString() const\n  * \\param[in] deviceNode The file-system path to the video device node\n  */\n V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode)\n-\t: V4L2Device(deviceNode), bufferPool_(nullptr), cache_(nullptr),\n-\t  fdEvent_(nullptr)\n+\t: V4L2Device(deviceNode), cache_(nullptr), fdEvent_(nullptr)\n {\n \t/*\n \t * We default to an MMAP based CAPTURE video device, however this will\n@@ -930,115 +929,6 @@ int V4L2VideoDevice::requestBuffers(unsigned int count)\n \treturn 0;\n }\n \n-/**\n- * \\brief Request buffers to be allocated from the video device and stored in\n- * the buffer pool provided.\n- * \\param[out] pool BufferPool to populate with buffers\n- * \\return 0 on success or a negative error code otherwise\n- */\n-int V4L2VideoDevice::exportBuffers(BufferPool *pool)\n-{\n-\tunsigned int i;\n-\tint ret;\n-\n-\tmemoryType_ = V4L2_MEMORY_MMAP;\n-\n-\tret = requestBuffers(pool->count());\n-\tif (ret)\n-\t\treturn ret;\n-\n-\t/* Map the buffers. */\n-\tfor (i = 0; i < pool->count(); ++i) {\n-\t\tstruct v4l2_plane planes[VIDEO_MAX_PLANES] = {};\n-\t\tstruct v4l2_buffer buf = {};\n-\t\tBufferMemory &buffer = pool->buffers()[i];\n-\n-\t\tbuf.index = i;\n-\t\tbuf.type = bufferType_;\n-\t\tbuf.memory = memoryType_;\n-\t\tbuf.length = VIDEO_MAX_PLANES;\n-\t\tbuf.m.planes = planes;\n-\n-\t\tret = ioctl(VIDIOC_QUERYBUF, &buf);\n-\t\tif (ret < 0) {\n-\t\t\tLOG(V4L2, Error)\n-\t\t\t\t<< \"Unable to query buffer \" << i << \": \"\n-\t\t\t\t<< strerror(-ret);\n-\t\t\tbreak;\n-\t\t}\n-\n-\t\tif (V4L2_TYPE_IS_MULTIPLANAR(buf.type)) {\n-\t\t\tfor (unsigned int p = 0; p < buf.length; ++p) {\n-\t\t\t\tret = createPlane(&buffer, i, p,\n-\t\t\t\t\t\t  buf.m.planes[p].length);\n-\t\t\t\tif (ret)\n-\t\t\t\t\tbreak;\n-\t\t\t}\n-\t\t} else {\n-\t\t\tret = createPlane(&buffer, i, 0, buf.length);\n-\t\t}\n-\n-\t\tif (ret) {\n-\t\t\tLOG(V4L2, Error) << \"Failed to create plane\";\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\n-\tif (ret) {\n-\t\trequestBuffers(0);\n-\t\tpool->destroyBuffers();\n-\t\treturn ret;\n-\t}\n-\n-\tbufferPool_ = pool;\n-\n-\treturn 0;\n-}\n-\n-int V4L2VideoDevice::createPlane(BufferMemory *buffer, unsigned int index,\n-\t\t\t\t unsigned int planeIndex, unsigned int length)\n-{\n-\tint fd;\n-\n-\tLOG(V4L2, Debug)\n-\t\t<< \"Buffer \" << index\n-\t\t<< \" plane \" << planeIndex\n-\t\t<< \": length=\" << length;\n-\n-\tfd = exportDmabufFd(index, planeIndex);\n-\tif (fd < 0)\n-\t\treturn fd;\n-\n-\tFrameBuffer::Plane plane;\n-\tplane.fd = FileDescriptor(fd);\n-\tplane.length = length;\n-\tbuffer->planes().emplace_back(plane);\n-\t::close(fd);\n-\n-\treturn 0;\n-}\n-\n-/**\n- * \\brief Import the externally allocated \\a pool of buffers\n- * \\param[in] pool BufferPool of buffers to import\n- * \\return 0 on success or a negative error code otherwise\n- */\n-int V4L2VideoDevice::importBuffers(BufferPool *pool)\n-{\n-\tint ret;\n-\n-\tmemoryType_ = V4L2_MEMORY_DMABUF;\n-\n-\tret = requestBuffers(pool->count());\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tLOG(V4L2, Debug) << \"provided pool of \" << pool->count() << \" buffers\";\n-\tbufferPool_ = pool;\n-\n-\treturn 0;\n-}\n-\n /**\n  * \\brief Allocate buffers from the video device\n  * \\param[in] count Number of buffers to allocate\n@@ -1180,7 +1070,6 @@ int V4L2VideoDevice::releaseBuffers()\n {\n \tLOG(V4L2, Debug) << \"Releasing buffers\";\n \n-\tbufferPool_ = nullptr;\n \tdelete cache_;\n \tcache_ = nullptr;\n \n@@ -1200,119 +1089,6 @@ int V4L2VideoDevice::releaseBuffers()\n  *\n  * \\return 0 on success or a negative error code otherwise\n  */\n-int V4L2VideoDevice::queueBuffer(Buffer *buffer)\n-{\n-\tstruct v4l2_plane v4l2Planes[VIDEO_MAX_PLANES] = {};\n-\tstruct v4l2_buffer buf = {};\n-\tint ret;\n-\n-\tbuf.index = buffer->index();\n-\tbuf.type = bufferType_;\n-\tbuf.memory = memoryType_;\n-\tbuf.field = V4L2_FIELD_NONE;\n-\n-\tbool multiPlanar = V4L2_TYPE_IS_MULTIPLANAR(buf.type);\n-\tBufferMemory *mem = &bufferPool_->buffers()[buf.index];\n-\tconst std::vector<FrameBuffer::Plane> &planes = mem->planes();\n-\n-\tif (buf.memory == V4L2_MEMORY_DMABUF) {\n-\t\tif (multiPlanar) {\n-\t\t\tfor (unsigned int p = 0; p < planes.size(); ++p)\n-\t\t\t\tv4l2Planes[p].m.fd = planes[p].fd.fd();\n-\t\t} else {\n-\t\t\tbuf.m.fd = planes[0].fd.fd();\n-\t\t}\n-\t}\n-\n-\tif (multiPlanar) {\n-\t\tbuf.length = planes.size();\n-\t\tbuf.m.planes = v4l2Planes;\n-\t}\n-\n-\tif (V4L2_TYPE_IS_OUTPUT(buf.type)) {\n-\t\tconst FrameMetadata &metadata = buffer->metadata();\n-\n-\t\tbuf.bytesused = metadata.planes[0].bytesused;\n-\t\tbuf.sequence = metadata.sequence;\n-\t\tbuf.timestamp.tv_sec = metadata.timestamp / 1000000000;\n-\t\tbuf.timestamp.tv_usec = (metadata.timestamp / 1000) % 1000000;\n-\t}\n-\n-\tLOG(V4L2, Debug) << \"Queueing buffer \" << buf.index;\n-\n-\tret = ioctl(VIDIOC_QBUF, &buf);\n-\tif (ret < 0) {\n-\t\tLOG(V4L2, Error)\n-\t\t\t<< \"Failed to queue buffer \" << buf.index << \": \"\n-\t\t\t<< strerror(-ret);\n-\t\treturn ret;\n-\t}\n-\n-\tif (queuedBuffers_.empty())\n-\t\tfdEvent_->setEnabled(true);\n-\n-\tqueuedBuffers_[buf.index] = buffer;\n-\n-\treturn 0;\n-}\n-\n-/**\n- * \\brief Queue all buffers into the video device\n- *\n- * When starting video capture users of the video device often need to queue\n- * all allocated buffers to the device. This helper method simplifies the\n- * implementation of the user by queuing all buffers and returning a vector of\n- * Buffer instances for each queued buffer.\n- *\n- * This method is meant to be used with video capture devices internal to a\n- * pipeline handler, such as ISP statistics capture devices, or raw CSI-2\n- * receivers. For video capture devices facing applications, buffers shall\n- * instead be queued when requests are received, and for video output devices,\n- * buffers shall be queued when frames are ready to be output.\n- *\n- * The caller shall ensure that the returned buffers vector remains valid until\n- * all the queued buffers are dequeued, either during capture, or by stopping\n- * the video device.\n- *\n- * Calling this method on an output device or on a device that has buffers\n- * already queued is an error and will return an empty vector.\n- *\n- * \\return A vector of queued buffers, which will be empty if an error occurs\n- */\n-std::vector<std::unique_ptr<Buffer>> V4L2VideoDevice::queueAllBuffers()\n-{\n-\tint ret;\n-\n-\tif (!queuedBuffers_.empty())\n-\t\treturn {};\n-\n-\tif (V4L2_TYPE_IS_OUTPUT(bufferType_))\n-\t\treturn {};\n-\n-\tstd::vector<std::unique_ptr<Buffer>> buffers;\n-\n-\tfor (unsigned int i = 0; i < bufferPool_->count(); ++i) {\n-\t\tBuffer *buffer = new Buffer(i);\n-\t\tbuffers.emplace_back(buffer);\n-\t\tret = queueBuffer(buffer);\n-\t\tif (ret)\n-\t\t\treturn {};\n-\t}\n-\n-\treturn buffers;\n-}\n-\n-/**\n- * \\brief Queue a buffer into the video device\n- * \\param[in] buffer The buffer to be queued\n- *\n- * For capture video devices the \\a buffer will be filled with data by the\n- * device. For output video devices the \\a buffer shall contain valid data and\n- * will be processed by the device. Once the device has finished processing the\n- * buffer, it will be available for dequeue.\n- *\n- * \\return 0 on success or a negative error code otherwise\n- */\n int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n {\n \tstruct v4l2_plane v4l2Planes[VIDEO_MAX_PLANES] = {};\n@@ -1372,66 +1148,14 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \t\treturn ret;\n \t}\n \n-\tif (queuedFrameBuffers_.empty())\n+\tif (queuedBuffers_.empty())\n \t\tfdEvent_->setEnabled(true);\n \n-\tqueuedFrameBuffers_[buf.index] = buffer;\n+\tqueuedBuffers_[buf.index] = buffer;\n \n \treturn 0;\n }\n \n-/**\n- * \\brief Dequeue the next available buffer from the video device\n- *\n- * This method dequeues the next available buffer from the device. If no buffer\n- * is available to be dequeued it will return nullptr immediately.\n- *\n- * \\return A pointer to the dequeued buffer on success, or nullptr otherwise\n- */\n-Buffer *V4L2VideoDevice::dequeueBuffer()\n-{\n-\tstruct v4l2_buffer buf = {};\n-\tstruct v4l2_plane planes[VIDEO_MAX_PLANES] = {};\n-\tint ret;\n-\n-\tbuf.type = bufferType_;\n-\tbuf.memory = memoryType_;\n-\n-\tif (V4L2_TYPE_IS_MULTIPLANAR(buf.type)) {\n-\t\tbuf.length = VIDEO_MAX_PLANES;\n-\t\tbuf.m.planes = planes;\n-\t}\n-\n-\tret = ioctl(VIDIOC_DQBUF, &buf);\n-\tif (ret < 0) {\n-\t\tLOG(V4L2, Error)\n-\t\t\t<< \"Failed to dequeue buffer: \" << strerror(-ret);\n-\t\treturn nullptr;\n-\t}\n-\n-\tLOG(V4L2, Debug) << \"Dequeuing buffer \" << buf.index;\n-\tASSERT(buf.index < bufferPool_->count());\n-\n-\tauto it = queuedBuffers_.find(buf.index);\n-\tBuffer *buffer = it->second;\n-\tqueuedBuffers_.erase(it);\n-\n-\tif (queuedBuffers_.empty())\n-\t\tfdEvent_->setEnabled(false);\n-\n-\tbuffer->index_ = buf.index;\n-\n-\tbuffer->metadata_.status = buf.flags & V4L2_BUF_FLAG_ERROR\n-\t\t\t\t ? FrameMetadata::FrameError\n-\t\t\t\t : FrameMetadata::FrameSuccess;\n-\tbuffer->metadata_.sequence = buf.sequence;\n-\tbuffer->metadata_.timestamp = buf.timestamp.tv_sec * 1000000000ULL\n-\t\t\t\t    + buf.timestamp.tv_usec * 1000ULL;\n-\tbuffer->metadata_.planes = { { buf.bytesused } };\n-\n-\treturn buffer;\n-}\n-\n /**\n  * \\brief Slot to handle completed buffer events from the V4L2 video device\n  * \\param[in] notifier The event notifier\n@@ -1444,30 +1168,12 @@ Buffer *V4L2VideoDevice::dequeueBuffer()\n  */\n void V4L2VideoDevice::bufferAvailable(EventNotifier *notifier)\n {\n-\t/**\n-\t * This is a hack which allows both Buffer and FrameBuffer interfaces\n-\t * to work with the same code base. This allows different parts of\n-\t * libcamera to migrate to FrameBuffer in different patches.\n-\t *\n-\t * If we have a cache_ we know FrameBuffer is in use.\n-\t *\n-\t * \\todo: Remove this hack when the Buffer interface is removed.\n-\t */\n-\tif (cache_) {\n-\t\tFrameBuffer *buffer = dequeueFrameBuffer();\n-\t\tif (!buffer)\n-\t\t\treturn;\n-\n-\t\t/* Notify anyone listening to the device. */\n-\t\tframeBufferReady.emit(buffer);\n-\t} else {\n-\t\tBuffer *buffer = dequeueBuffer();\n-\t\tif (!buffer)\n-\t\t\treturn;\n+\tFrameBuffer *buffer = dequeuBuffer();\n+\tif (!buffer)\n+\t\treturn;\n \n-\t\t/* Notify anyone listening to the device. */\n-\t\tbufferReady.emit(buffer);\n-\t}\n+\t/* Notify anyone listening to the device. */\n+\tbufferReady.emit(buffer);\n }\n \n /**\n@@ -1476,11 +1182,9 @@ void V4L2VideoDevice::bufferAvailable(EventNotifier *notifier)\n  * This method dequeues the next available buffer from the device. If no buffer\n  * is available to be dequeued it will return nullptr immediately.\n  *\n- * \\todo: Reanme to dequeueBuffer() once the FrameBuffer transition is complete\n- *\n  * \\return A pointer to the dequeued buffer on success, or nullptr otherwise\n  */\n-FrameBuffer *V4L2VideoDevice::dequeueFrameBuffer()\n+FrameBuffer *V4L2VideoDevice::dequeuBuffer()\n {\n \tstruct v4l2_buffer buf = {};\n \tstruct v4l2_plane planes[VIDEO_MAX_PLANES] = {};\n@@ -1507,11 +1211,11 @@ FrameBuffer *V4L2VideoDevice::dequeueFrameBuffer()\n \n \tcache_->put(buf.index);\n \n-\tauto it = queuedFrameBuffers_.find(buf.index);\n+\tauto it = queuedBuffers_.find(buf.index);\n \tFrameBuffer *buffer = it->second;\n-\tqueuedFrameBuffers_.erase(it);\n+\tqueuedBuffers_.erase(it);\n \n-\tif (queuedFrameBuffers_.empty())\n+\tif (queuedBuffers_.empty())\n \t\tfdEvent_->setEnabled(false);\n \n \tbuffer->metadata_.status = buf.flags & V4L2_BUF_FLAG_ERROR\n@@ -1534,11 +1238,6 @@ FrameBuffer *V4L2VideoDevice::dequeueFrameBuffer()\n \n /**\n  * \\var V4L2VideoDevice::bufferReady\n- * \\brief A Signal emitted when a buffer completes\n- */\n-\n-/**\n- * \\var V4L2VideoDevice::frameBufferReady\n  * \\brief A Signal emitted when a framebuffer completes\n  */\n \n@@ -1583,23 +1282,13 @@ int V4L2VideoDevice::streamOff()\n \n \t/* Send back all queued buffers. */\n \tfor (auto it : queuedBuffers_) {\n-\t\tunsigned int index = it.first;\n-\t\tBuffer *buffer = it.second;\n-\n-\t\tbuffer->index_ = index;\n-\t\tbuffer->cancel();\n-\t\tbufferReady.emit(buffer);\n-\t}\n-\n-\tfor (auto it : queuedFrameBuffers_) {\n \t\tFrameBuffer *buffer = it.second;\n \n \t\tbuffer->metadata_.status = FrameMetadata::FrameCancelled;\n-\t\tframeBufferReady.emit(buffer);\n+\t\tbufferReady.emit(buffer);\n \t}\n \n \tqueuedBuffers_.clear();\n-\tqueuedFrameBuffers_.clear();\n \tfdEvent_->setEnabled(false);\n \n \treturn 0;\ndiff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp\nindex 6acb06a24b47f653..fefa969a5f3926a2 100644\n--- a/test/v4l2_videodevice/buffer_sharing.cpp\n+++ b/test/v4l2_videodevice/buffer_sharing.cpp\n@@ -120,8 +120,8 @@ protected:\n \t\tTimer timeout;\n \t\tint ret;\n \n-\t\tcapture_->frameBufferReady.connect(this, &BufferSharingTest::captureBufferReady);\n-\t\toutput_->frameBufferReady.connect(this, &BufferSharingTest::outputBufferReady);\n+\t\tcapture_->bufferReady.connect(this, &BufferSharingTest::captureBufferReady);\n+\t\toutput_->bufferReady.connect(this, &BufferSharingTest::outputBufferReady);\n \n \t\tfor (const std::unique_ptr<FrameBuffer> &buffer : buffers_) {\n \t\t\tif (capture_->queueBuffer(buffer.get())) {\ndiff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp\nindex a57abed3bd0debc1..6a103a035f3d4635 100644\n--- a/test/v4l2_videodevice/capture_async.cpp\n+++ b/test/v4l2_videodevice/capture_async.cpp\n@@ -42,7 +42,7 @@ protected:\n \t\tif (ret < 0)\n \t\t\treturn TestFail;\n \n-\t\tcapture_->frameBufferReady.connect(this, &CaptureAsyncTest::receiveBuffer);\n+\t\tcapture_->bufferReady.connect(this, &CaptureAsyncTest::receiveBuffer);\n \n \t\tfor (const std::unique_ptr<FrameBuffer> &buffer : buffers_) {\n \t\t\tif (capture_->queueBuffer(buffer.get())) {\ndiff --git a/test/v4l2_videodevice/v4l2_m2mdevice.cpp b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\nindex 43b99c4f7ea9bf26..203afc4fc0339e24 100644\n--- a/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n+++ b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n@@ -124,8 +124,8 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tcapture->frameBufferReady.connect(this, &V4L2M2MDeviceTest::receiveCaptureBuffer);\n-\t\toutput->frameBufferReady.connect(this, &V4L2M2MDeviceTest::outputBufferComplete);\n+\t\tcapture->bufferReady.connect(this, &V4L2M2MDeviceTest::receiveCaptureBuffer);\n+\t\toutput->bufferReady.connect(this, &V4L2M2MDeviceTest::outputBufferComplete);\n \n \t\tfor (const std::unique_ptr<FrameBuffer> &buffer : captureBuffers_) {\n \t\t\tif (capture->queueBuffer(buffer.get())) {\n","prefixes":["libcamera-devel","v2","21/25"]}