Patch Detail
Show a patch.
GET /api/patches/16357/?format=api
{ "id": 16357, "url": "https://patchwork.libcamera.org/api/patches/16357/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16357/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20220623232210.18742-12-laurent.pinchart@ideasonboard.com>", "date": "2022-06-23T23:22:08", "name": "[libcamera-devel,11/13] gstreamer: Split request creation to a separate function", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ce3193e454cc6b4ce30e95e7847864a9a8472d4f", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16357/mbox/", "series": [ { "id": 3214, "url": "https://patchwork.libcamera.org/api/series/3214/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3214", "date": "2022-06-23T23:21:57", "name": "gstreamer: Queue multiple requests", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3214/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16357/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16357/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 206DFBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jun 2022 23:22:49 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A1A6D65643;\n\tFri, 24 Jun 2022 01:22:48 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 08BD265638\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jun 2022 01:22:34 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 81ED46BB;\n\tFri, 24 Jun 2022 01:22:33 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656026568;\n\tbh=yPq7c7ZfcOuJPpnugS8qksvhaHaqFLv94z6Yf6wu0fQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=uGyXCVMDUP1BpDLWD+Crlsvygx275xLOulO08XwLSeyYbA5WUMGbXI7g9R8V/8iKk\n\t6QM5NmhLTRgAa0jmks2NjzVBn8J0vP9Y3WSy5C6Umy9FzX3q1vUfodqFxKm24vXQox\n\tNX1pdNmcPGOn0yQfgF8RR9sHAjYS197nXClTmDwy1LIda1nT+XZuDCdSttBKkYGFqH\n\t0LkvBiAHRPPjutRh2UVrpLcChuvbsYy2fqdAuhccxusSp4EcIjoIqaqsLhUR2k6uGS\n\tiKg9Ju6L876Wob6VFVITUJWifA8sfTUXU6+M4sE8jU6JEtI8A1RFZ+EZjPNk9EuLBW\n\tFSB8KwfPn9tRg==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1656026553;\n\tbh=yPq7c7ZfcOuJPpnugS8qksvhaHaqFLv94z6Yf6wu0fQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=WSqWQPxKxyEp9xhW0tYZu37Z9stKFixMvkaZvdX/IUY7ZJvbSllCFSFNlMEThzcB3\n\tqryMtj0tlSUWcs9ZRs3+vwbOVbgYpPpWnvgo06mmOmfY2pzXDUr/I+ICuw92aY/0DD\n\tFykH6EEUW0kHbEAN5D6G052Vwko9b1xJOeUgf62Q=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"WSqWQPxK\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 24 Jun 2022 02:22:08 +0300", "Message-Id": "<20220623232210.18742-12-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20220623232210.18742-1-laurent.pinchart@ideasonboard.com>", "References": "<20220623232210.18742-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 11/13] gstreamer: Split request creation\n\tto a separate function", "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>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Cc": "Nicolas Dufresne <nicolas.dufresne@collabora.com>,\n\tVedant Paranjape <vedantparanjape160201@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "In order to prepare for creation and queuing of multiple requests, move\nthe request creation and queueing code to a separate function. No\nfunctional change intended.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 76 +++++++++++++++++--------------\n 1 file changed, 42 insertions(+), 34 deletions(-)", "diff": "diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 58a322b251c7..fb39d6093a3f 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -123,6 +123,7 @@ struct GstLibcameraSrcState {\n \n \tguint group_id_;\n \n+\tint queueRequest();\n \tvoid requestCompleted(Request *request);\n };\n \n@@ -160,6 +161,44 @@ GstStaticPadTemplate request_src_template = {\n \t\"src_%u\", GST_PAD_SRC, GST_PAD_REQUEST, TEMPLATE_CAPS\n };\n \n+int GstLibcameraSrcState::queueRequest()\n+{\n+\tstd::unique_ptr<Request> request = cam_->createRequest();\n+\tif (!request)\n+\t\treturn -ENOMEM;\n+\n+\tstd::unique_ptr<RequestWrap> wrap =\n+\t\tstd::make_unique<RequestWrap>(std::move(request));\n+\n+\tfor (GstPad *srcpad : srcpads_) {\n+\t\tStream *stream = gst_libcamera_pad_get_stream(srcpad);\n+\t\tGstLibcameraPool *pool = gst_libcamera_pad_get_pool(srcpad);\n+\t\tGstBuffer *buffer;\n+\t\tGstFlowReturn ret;\n+\n+\t\tret = gst_buffer_pool_acquire_buffer(GST_BUFFER_POOL(pool),\n+\t\t\t\t\t\t &buffer, nullptr);\n+\t\tif (ret != GST_FLOW_OK) {\n+\t\t\t/*\n+\t\t\t * RequestWrap has ownership of the request, and we\n+\t\t\t * won't be queueing this one due to lack of buffers.\n+\t\t\t */\n+\t\t\treturn -ENOBUFS;\n+\t\t}\n+\n+\t\twrap->attachBuffer(stream, buffer);\n+\t}\n+\n+\tGST_TRACE_OBJECT(src_, \"Requesting buffers\");\n+\tcam_->queueRequest(wrap->request_.get());\n+\n+\tMutexLocker locker(lock_);\n+\tqueuedRequests_.push(std::move(wrap));\n+\n+\t/* The RequestWrap will be deleted in the completion handler. */\n+\treturn 0;\n+}\n+\n void\n GstLibcameraSrcState::requestCompleted(Request *request)\n {\n@@ -269,8 +308,8 @@ gst_libcamera_src_task_run(gpointer user_data)\n \tGstLibcameraSrc *self = GST_LIBCAMERA_SRC(user_data);\n \tGstLibcameraSrcState *state = self->state;\n \n-\tstd::unique_ptr<Request> request = state->cam_->createRequest();\n-\tif (!request) {\n+\tint err = state->queueRequest();\n+\tif (err == -ENOMEM) {\n \t\tGST_ELEMENT_ERROR(self, RESOURCE, NO_SPACE_LEFT,\n \t\t\t\t (\"Failed to allocate request for camera '%s'.\",\n \t\t\t\t state->cam_->id().c_str()),\n@@ -279,38 +318,7 @@ gst_libcamera_src_task_run(gpointer user_data)\n \t\treturn;\n \t}\n \n-\tstd::unique_ptr<RequestWrap> wrap =\n-\t\tstd::make_unique<RequestWrap>(std::move(request));\n-\n-\tfor (GstPad *srcpad : state->srcpads_) {\n-\t\tStream *stream = gst_libcamera_pad_get_stream(srcpad);\n-\t\tGstLibcameraPool *pool = gst_libcamera_pad_get_pool(srcpad);\n-\t\tGstBuffer *buffer;\n-\t\tGstFlowReturn ret;\n-\n-\t\tret = gst_buffer_pool_acquire_buffer(GST_BUFFER_POOL(pool),\n-\t\t\t\t\t\t &buffer, nullptr);\n-\t\tif (ret != GST_FLOW_OK) {\n-\t\t\t/*\n-\t\t\t * RequestWrap has ownership of the request, and we\n-\t\t\t * won't be queueing this one due to lack of buffers.\n-\t\t\t */\n-\t\t\twrap.release();\n-\t\t\tbreak;\n-\t\t}\n-\n-\t\twrap->attachBuffer(stream, buffer);\n-\t}\n-\n-\tif (wrap) {\n-\t\tGST_TRACE_OBJECT(self, \"Requesting buffers\");\n-\t\tstate->cam_->queueRequest(wrap->request_.get());\n-\n-\t\tMutexLocker locker(state->lock_);\n-\t\tstate->queuedRequests_.push(std::move(wrap));\n-\n-\t\t/* The RequestWrap will be deleted in the completion handler. */\n-\t}\n+\tstd::unique_ptr<RequestWrap> wrap;\n \n \t{\n \t\tMutexLocker locker(state->lock_);\n", "prefixes": [ "libcamera-devel", "11/13" ] }