Show a patch.

GET /api/1.1/patches/2609/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2609,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2609/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2609/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20200112010212.2609025-28-niklas.soderlund@ragnatech.se>",
    "date": "2020-01-12T01:02:07",
    "name": "[libcamera-devel,v4,27/32] libcamera: v4l2_videodevice: Remove Buffer interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "47beebd5a19ebd907d81863fddb16185d11dc776",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2609/mbox/",
    "series": [
        {
            "id": 617,
            "url": "https://patchwork.libcamera.org/api/1.1/series/617/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=617",
            "date": "2020-01-12T01:01:40",
            "name": "libcamera: Rework buffer API",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/617/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2609/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2609/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 51929606E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Jan 2020 02:03:26 +0100 (CET)",
            "from bismarck.berto.se (p54ac5d7b.dip0.t-ipconnect.de\n\t[84.172.93.123]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 53c14987-34d7-11ea-b6d8-005056917f90;\n\tSun, 12 Jan 2020 02:03:21 +0100 (CET)"
        ],
        "X-Halon-ID": "53c14987-34d7-11ea-b6d8-005056917f90",
        "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": "Sun, 12 Jan 2020 02:02:07 +0100",
        "Message-Id": "<20200112010212.2609025-28-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200112010212.2609025-1-niklas.soderlund@ragnatech.se>",
        "References": "<20200112010212.2609025-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 27/32] 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": "Sun, 12 Jan 2020 01:03:26 -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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n* Changes since v2\n- Renamed createFrameBuffer() to createBuffer()\n- Rename dequeuBuffer() to dequeueBuffer()\n---\n src/libcamera/include/v4l2_videodevice.h |  21 +-\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       | 339 +----------------------\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, 33 insertions(+), 355 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex 09967d3c6ae59044..e4d35ab3ef360c6f 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -182,19 +182,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@@ -223,26 +217,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+\tstd::unique_ptr<FrameBuffer> createBuffer(const struct v4l2_buffer &buf);\n \tFileDescriptor 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 *dequeueBuffer();\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 065f5d980b68e1cf..1ea4d938ad88ae21 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -903,13 +903,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 d669d2ded89607d2..da6e079f51620234 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -950,9 +950,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 66380e29e1a78e13..67d29b7919e46801 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -352,7 +352,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 5e0f5c63b7fbe86a..4cfdb5ae79ce5779 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -437,7 +437,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 ed5b2377b806f19c..f00da22f1caa4105 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -410,8 +410,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@@ -970,112 +969,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-\tLOG(V4L2, Debug)\n-\t\t<< \"Buffer \" << index\n-\t\t<< \" plane \" << planeIndex\n-\t\t<< \": length=\" << length;\n-\n-\tFileDescriptor fd = exportDmabufFd(index, planeIndex);\n-\tif (!fd.isValid())\n-\t\treturn -EINVAL;\n-\n-\tFrameBuffer::Plane plane;\n-\tplane.fd = fd;\n-\tplane.length = length;\n-\tbuffer->planes().push_back(plane);\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@@ -1114,7 +1007,7 @@ int V4L2VideoDevice::exportBuffers(unsigned int count,\n \t\t\tgoto err_buf;\n \t\t}\n \n-\t\tstd::unique_ptr<FrameBuffer> buffer = createFrameBuffer(buf);\n+\t\tstd::unique_ptr<FrameBuffer> buffer = createBuffer(buf);\n \t\tif (!buffer) {\n \t\t\tLOG(V4L2, Error) << \"Unable to create buffer\";\n \t\t\tret = -EINVAL;\n@@ -1137,7 +1030,7 @@ err_buf:\n }\n \n std::unique_ptr<FrameBuffer>\n-V4L2VideoDevice::createFrameBuffer(const struct v4l2_buffer &buf)\n+V4L2VideoDevice::createBuffer(const struct v4l2_buffer &buf)\n {\n \tconst bool multiPlanar = V4L2_TYPE_IS_MULTIPLANAR(buf.type);\n \tconst unsigned int numPlanes = multiPlanar ? buf.length : 1;\n@@ -1217,127 +1110,12 @@ int V4L2VideoDevice::releaseBuffers()\n {\n \tLOG(V4L2, Debug) << \"Releasing buffers\";\n \n-\tbufferPool_ = nullptr;\n \tdelete cache_;\n \tcache_ = nullptr;\n \n \treturn requestBuffers(0);\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(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\tif (!metadata.planes.empty())\n-\t\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 to the video device\n  * \\param[in] buffer The buffer to be queued\n@@ -1414,66 +1192,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@@ -1486,30 +1212,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 = dequeueBuffer();\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@@ -1518,11 +1226,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 Rename 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::dequeueBuffer()\n {\n \tstruct v4l2_buffer buf = {};\n \tstruct v4l2_plane planes[VIDEO_MAX_PLANES] = {};\n@@ -1549,11 +1255,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@@ -1576,11 +1282,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@@ -1625,23 +1326,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",
        "v4",
        "27/32"
    ]
}