Patch Detail
Show a patch.
GET /api/patches/18407/?format=api
{ "id": 18407, "url": "https://patchwork.libcamera.org/api/patches/18407/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18407/", "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": "<20230315102300.2265491-6-chenghaoyang@google.com>", "date": "2023-03-15T10:22:59", "name": "[libcamera-devel,v4,5/6] libcamera: pipeline: virtual: Queue requests", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "9ef5e589f19909dcb7daa40b0683df2a9599d9d0", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18407/mbox/", "series": [ { "id": 3806, "url": "https://patchwork.libcamera.org/api/series/3806/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3806", "date": "2023-03-15T10:22:54", "name": "Virtual pipeline handler", "version": 4, "mbox": "https://patchwork.libcamera.org/series/3806/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18407/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18407/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 5A50FC329E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Mar 2023 10:23:18 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C6BF762720;\n\tWed, 15 Mar 2023 11:23:17 +0100 (CET)", "from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com\n\t[IPv6:2607:f8b0:4864:20::102a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A7F8E62715\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Mar 2023 11:23:13 +0100 (CET)", "by mail-pj1-x102a.google.com with SMTP id\n\t6-20020a17090a190600b00237c5b6ecd7so1310483pjg.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Mar 2023 03:23:13 -0700 (PDT)", "from chenghaoyang-low.c.googlers.com.com\n\t(112.157.221.35.bc.googleusercontent.com. [35.221.157.112])\n\tby smtp.gmail.com with ESMTPSA id\n\tf11-20020a17090274cb00b001a0450da45csm3262786plt.185.2023.03.15.03.23.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 15 Mar 2023 03:23:11 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678875797;\n\tbh=ppahLEFxghQOZXjso3nMbvU03EQJIwl/rSdRn2e8Btw=;\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=SNoWQ7Og0OXApHl1YatLhgRgDnCn22NruOZIqvZRbfn+PKL2rSB8fvkS8Zn8fOdJJ\n\t+SD91ZBYAPyiwuUHffu180YLqH68xxtnDFUHFbCTPaBV1dLVDrZgAuvVRxJj9JPNfB\n\tVQpJ7IGgCyUwo84+X6pCs1B0+p6/QqZH/W6HcLHrGjkRA7jJ9brZ6l2m2ZsgroMM5M\n\tIKKiLHYl5e64f1+/nxEROOfl1KBQ6ATTK2jdgq8kq9itJrw4XIm4YKY7KjNZTDGzQY\n\t5t6u74yhiVDZT8/iv9uRWhvPK3uARxTUZ0E5P/nMy7zbWJP4TYQMumTV4iw3ehVEAK\n\t8RtL3G5km9Caw==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1678875792;\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=T6nNXjaAf2/txHwK1qVPMwGGVG0jr+2dbEowFjzsCkA=;\n\tb=QGRalPTkRdaWfgtra+D6xRe/7eL4boQBDI/Qf9idpZZdcjb8jzphUr0C3cSJkPO/RK\n\tuuOa8Y8JKmGnN5+eoAUhTBM3qVCE9CtwW0rlXCdFtPB+P3bJcNzKR4m53f3Xo43clxQc\n\t+NFjYlpNuCBYS8kaZtlnPYiUPRhlMoXKFcjVg=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"QGRalPTk\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1678875792;\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=T6nNXjaAf2/txHwK1qVPMwGGVG0jr+2dbEowFjzsCkA=;\n\tb=0eUWp4nniwS4Bo4vtQW87oo6kmfhWJ1jNshPfJ1KHs8ogsUwIJKlx9hwIapTdR0dZh\n\tEWdIJ5oLR71m1v5Q43ugiV+G7Z4MSUtiVEmBiO2oLEpop515vipJDqsnsEPJbjtQSPC/\n\tutHfxqEKkNM+pZaqm2s0jKU90BSrByEYEvRK4JM7imIMRezS2PofFbFO1OX5X52qQFNj\n\t94doqSjAbgZxkyECGr/4+SvbddntYIdlnJtAmZ77qebec1OZapj5D2ChkNDHNWC2FE0X\n\tWqUfuNLXbrClZgF2M4yTT8r1NzjJ7xm03mNbJRYgPvvgNKxRO+qvGVo/+xm3M5IWGJhd\n\tHS3Q==", "X-Gm-Message-State": "AO0yUKXun1B3XFazfR/+nqC+ogNkyKCEUKPLVzpHGkDXVKLBmqd69cxT\n\tH8Sdvv702PHM6OFPsyCNuLe2zLKk+Q9xGi5eHm8=", "X-Google-Smtp-Source": "AK7set8d+8zMtqqBstcaMF9K4tW144Fxc5GkQ1th2QO1LBCA1f7vH0nwecNRke7l1l/JwPiCa41Dng==", "X-Received": "by 2002:a17:90b:3ce:b0:23b:2f4f:1a9b with SMTP id\n\tgo14-20020a17090b03ce00b0023b2f4f1a9bmr14867155pjb.37.1678875792010; \n\tWed, 15 Mar 2023 03:23:12 -0700 (PDT)", "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 15 Mar 2023 10:22:59 +0000", "Message-Id": "<20230315102300.2265491-6-chenghaoyang@google.com>", "X-Mailer": "git-send-email 2.40.0.rc1.284.g88254d51c5-goog", "In-Reply-To": "<20230315102300.2265491-1-chenghaoyang@google.com>", "References": "<20230315102300.2265491-1-chenghaoyang@google.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 5/6] libcamera: pipeline: virtual:\n\tQueue requests", "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": "Harvey Yang via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Harvey Yang <chenghaoyang@chromium.org>", "Cc": "Harvey Yang <chenghaoyang@google.com>,\n\tHarvey Yang <chenghaoyang@chromium.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "[todo Read frames from the virtual video if any]\n\nCurrently we only use external buffers and complete them immediately\nwith green frames.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n src/libcamera/pipeline/virtual/virtual.cpp | 39 ++++++++++++++++++----\n 1 file changed, 32 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp\nindex b0e6de20..b91e7000 100644\n--- a/src/libcamera/pipeline/virtual/virtual.cpp\n+++ b/src/libcamera/pipeline/virtual/virtual.cpp\n@@ -8,7 +8,10 @@\n #include <libcamera/base/log.h>\n \n #include <libcamera/camera.h>\n+#include <libcamera/control_ids.h>\n+#include <libcamera/controls.h>\n #include <libcamera/formats.h>\n+#include <libcamera/heap_allocator.h>\n \n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/pipeline_handler.h\"\n@@ -17,6 +20,17 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(VIRTUAL)\n \n+uint64_t CurrentTimestamp()\n+{\n+\tstruct timespec ts;\n+\tif (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) {\n+\t\tLOG(VIRTUAL, Error) << \"Get clock time fails\";\n+\t\treturn 0;\n+\t}\n+\n+\treturn ts.tv_sec * 1'000'000'000LL + ts.tv_nsec;\n+}\n+\n class VirtualCameraData : public Camera::Private\n {\n public:\n@@ -74,6 +88,8 @@ private:\n \t{\n \t\treturn static_cast<VirtualCameraData *>(camera->_d());\n \t}\n+\n+\tHeapAllocator heapAllocator_;\n };\n \n VirtualCameraConfiguration::VirtualCameraConfiguration(VirtualCameraData *data)\n@@ -208,29 +224,38 @@ int PipelineHandlerVirtual::configure(Camera *camera, CameraConfiguration *confi\n int PipelineHandlerVirtual::exportFrameBuffers(Camera *camera, Stream *stream,\n \t\t\t\t\t std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n {\n-\t(void)camera;\n-\t(void)stream;\n-\t(void)buffers;\n-\treturn -1;\n+\tif (!heapAllocator_.isValid())\n+\t\treturn -ENOBUFS;\n+\n+\treturn heapAllocator_.exportFrameBuffers(camera, stream, buffers);\n }\n \n int PipelineHandlerVirtual::start(Camera *camera, const ControlList *controls)\n {\n \t(void)camera;\n \t(void)controls;\n-\treturn -1;\n+\t// TODO: Start reading the virtual video if any.\n+\treturn 0;\n }\n \n void PipelineHandlerVirtual::stopDevice(Camera *camera)\n {\n \t(void)camera;\n+\t// TODO: Reset the virtual video if any.\n }\n \n int PipelineHandlerVirtual::queueRequestDevice(Camera *camera, Request *request)\n {\n \t(void)camera;\n-\t(void)request;\n-\treturn -1;\n+\n+\t// TODO: Read from the virtual video if any.\n+\tfor (auto it : request->buffers())\n+\t\tcompleteBuffer(request, it.second);\n+\n+\trequest->metadata().set(controls::SensorTimestamp, CurrentTimestamp());\n+\tcompleteRequest(request);\n+\n+\treturn 0;\n }\n \n bool PipelineHandlerVirtual::match(DeviceEnumerator *enumerator)\n", "prefixes": [ "libcamera-devel", "v4", "5/6" ] }