Patch Detail
Show a patch.
GET /api/patches/17787/?format=api
{ "id": 17787, "url": "https://patchwork.libcamera.org/api/patches/17787/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17787/", "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": "<20221111133025.3102-2-david.plowman@raspberrypi.com>", "date": "2022-11-11T13:30:24", "name": "[libcamera-devel,1/2] libcamera: Add a PipelineHandler::releaseDevice method", "commit_ref": "a5fdf63e90d8e9559f53f7bf5b0504f30ce69656", "pull_url": null, "state": "accepted", "archived": false, "hash": "ea166098214b15b0426ec4d2055826d2c69736c8", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17787/mbox/", "series": [ { "id": 3606, "url": "https://patchwork.libcamera.org/api/series/3606/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3606", "date": "2022-11-11T13:30:23", "name": "Notify pipeline handlers when a camera is released", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3606/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17787/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17787/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 AD475BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Nov 2022 13:30:33 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C8B263083;\n\tFri, 11 Nov 2022 14:30:32 +0100 (CET)", "from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5CB4A61F3F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Nov 2022 14:30:30 +0100 (CET)", "by mail-wr1-x42a.google.com with SMTP id bs21so6499358wrb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Nov 2022 05:30:30 -0800 (PST)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tbk11-20020a0560001d8b00b002416f0f1e96sm1511487wrb.43.2022.11.11.05.30.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 11 Nov 2022 05:30:28 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668173432;\n\tbh=fKCjuchVPMbesWQYjeiftTEko07Xml5FLwoitmHa4Cg=;\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:\n\tFrom;\n\tb=v5KqQvOW/tf4WGk1sMfu56qk2N8CLbzPZhgUY8AQuVSvy7Io4ZGCPt+WtGChjaDVu\n\tBoMSvI+onE8MZ46FLX5Qh02UD4HL3+Ya2uCKx0wT+lTrXKt8Jgw6QaI7xttC5eyOZB\n\t15dFLJB+k6d3GDW8QD3LXbArVvnbxFa76MN1YVSJPGPYGiv5TF+TWFEN6mGd8tFG2r\n\tsx7t/uB7sy/Ck09IrZj6T4dhe0yOdVz+axaUCqAJXiAbZNWqXPVtgAzLWjTNaNVTO4\n\tgkUfEoBKOzUnLziEtbpMu2dIpejFVEtLPGJm0+GAQXRoJYtM1ob6Zrk2aIwysaVEfq\n\tj1DO8AfMi7Zgw==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Zo4d71AdERN8fZ/JHuXKVhjeQpHhFVQuWoMCupOI2Pg=;\n\tb=QEyZ+PStte+fktFlS00Y/77mZNEikdodixXBorzy/S07V6wnX9ZQ3wVGRFe1iuyppo\n\t1aArnN9YkQtNnVLRRFVZMz0mBp3KSgr0T0zLba7gYax9jzLj7gtjhR2W87553z5LnR1n\n\tRVMoyBzWBtQl8yKyEeyL9RuZzCSj/+zCnD097oN1PjblSQkdf/cXHIOB06DKjQmdMAID\n\ts7CZAUPrTt3zt/G09NbmP95tVQ9D4vB6S6xldfQ73H7E/YQtY6fd4gcl591Ce2wSwKH1\n\t7CJkxARBJA7rmWxeIo/776+dVKw1XTs6t34rnKOHxQS1ibLpjNDxP/DPYfGO0nOUALUL\n\td2dQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"QEyZ+PSt\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=Zo4d71AdERN8fZ/JHuXKVhjeQpHhFVQuWoMCupOI2Pg=;\n\tb=PGJB4zqYakzIRnFH5qRgon2Yo6OAtk6QMrOnGa0IlMhmU2WgcMZ+nYIpXAusNsPtWA\n\tZftn3rDHQcCukWpj8Ecc/0BOch1OUbHe9wZTCtFe378wQMxQk2Emk+2tNxcGbIhHf+bo\n\tayyeT6zEQ99Av95gWRVA8Zdim1ynAk2yumtiaw2PtNe/5wQPNfbc69i0fZ4+Wy+3a3QF\n\tyXpD8R19qyXeEZSG8bmLhL+zdb45sjTrbZJqvEmTbvml8AxFBlxD/SBhcYZ+H8GW7EGc\n\tHkdSCpC4hOUIfvLZl5kkil+F8+CjBRSHrOKjASviDoSB9dYTkTmeJZ+rg78V7C+t/1Km\n\tcqHA==", "X-Gm-Message-State": "ANoB5pm3deL4SDzY3VeM7ptsD0dhjw+vxK+FHLciA/tQw1b8er50t4EZ\n\t6wNMnPnj5HciFf4towi2PxACC75r2aLV+w==", "X-Google-Smtp-Source": "AA0mqf7SV0BjYlla2iubTzbHDt/adL+1urIOzHb7WuvUIxtzpvxo7DZo/Fq9Oz02bIqandG3K1VJbw==", "X-Received": "by 2002:a05:6000:1373:b0:236:c206:b2b1 with SMTP id\n\tq19-20020a056000137300b00236c206b2b1mr1240840wrz.624.1668173429543; \n\tFri, 11 Nov 2022 05:30:29 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 11 Nov 2022 13:30:24 +0000", "Message-Id": "<20221111133025.3102-2-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20221111133025.3102-1-david.plowman@raspberrypi.com>", "References": "<20221111133025.3102-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/2] libcamera: Add a\n\tPipelineHandler::releaseDevice method", "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": "David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "David Plowman <david.plowman@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "This notifies pipeline handlers when a camera is released, in case\nthey want to free any resources or memory buffers.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/pipeline_handler.h | 4 +++-\n src/libcamera/camera.cpp | 2 +-\n src/libcamera/pipeline_handler.cpp | 16 +++++++++++++++-\n 3 files changed, 19 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex 96aab9d6..ec4f662d 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -46,7 +46,7 @@ public:\n \t\t\t\t\tconst DeviceMatch &dm);\n \n \tbool acquire();\n-\tvoid release();\n+\tvoid release(Camera *camera);\n \n \tvirtual std::unique_ptr<CameraConfiguration> generateConfiguration(Camera *camera,\n \t\tconst StreamRoles &roles) = 0;\n@@ -74,6 +74,8 @@ protected:\n \tvirtual int queueRequestDevice(Camera *camera, Request *request) = 0;\n \tvirtual void stopDevice(Camera *camera) = 0;\n \n+\tvirtual void releaseDevice(Camera *camera);\n+\n \tCameraManager *manager_;\n \n private:\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex c4f65c1a..2d947a44 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -870,7 +870,7 @@ int Camera::release()\n \t\treturn ret == -EACCES ? -EBUSY : ret;\n \n \tif (d->isAcquired())\n-\t\td->pipe_->release();\n+\t\td->pipe_->release(this);\n \n \td->setState(Private::CameraAvailable);\n \ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 825aff5a..cfade490 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -183,6 +183,7 @@ bool PipelineHandler::acquire()\n \n /**\n * \\brief Release exclusive access to the pipeline handler\n+ * \\param[in] camera The camera for which to release data\n *\n * This function releases access to the pipeline handler previously acquired by\n * a call to acquire(). Every release() call shall match a previous successful\n@@ -196,7 +197,7 @@ bool PipelineHandler::acquire()\n *\n * \\sa acquire()\n */\n-void PipelineHandler::release()\n+void PipelineHandler::release(Camera *camera)\n {\n \tMutexLocker locker(lock_);\n \n@@ -204,9 +205,22 @@ void PipelineHandler::release()\n \n \tunlockMediaDevices();\n \n+\treleaseDevice(camera);\n+\n \t--useCount_;\n }\n \n+/**\n+ * \\brief Release resources associated with this camera\n+ * \\param[in] camera The camera for which to release resources\n+ *\n+ * Pipeline handlers may override this in order to perform cleanup operations\n+ * when a camera is released, such as freeing memory.\n+ */\n+void PipelineHandler::releaseDevice([[maybe_unused]] Camera *camera)\n+{\n+}\n+\n void PipelineHandler::unlockMediaDevices()\n {\n \tfor (std::shared_ptr<MediaDevice> &media : mediaDevices_)\n", "prefixes": [ "libcamera-devel", "1/2" ] }