Show a patch.

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

{
    "id": 18094,
    "url": "https://patchwork.libcamera.org/api/patches/18094/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18094/",
    "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": "<20230105043726.679968-9-chenghaoyang@google.com>",
    "date": "2023-01-05T04:37:25",
    "name": "[libcamera-devel,v3,8/9] libcamera: pipeline: virtual: Queue requests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b87473ea2b8879f4b60c605a7f5833a4b659643a",
    "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/18094/mbox/",
    "series": [
        {
            "id": 3700,
            "url": "https://patchwork.libcamera.org/api/series/3700/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3700",
            "date": "2023-01-05T04:37:17",
            "name": "Virtual pipeline handler",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3700/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18094/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18094/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 4CC1EC3291\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Jan 2023 04:38:08 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 08999625F1;\n\tThu,  5 Jan 2023 05:38:08 +0100 (CET)",
            "from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com\n\t[IPv6:2607:f8b0:4864:20::1036])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6340B625F1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Jan 2023 05:38:03 +0100 (CET)",
            "by mail-pj1-x1036.google.com with SMTP id\n\tc2-20020a17090a020200b00226c762ed23so861829pjc.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 04 Jan 2023 20:38:03 -0800 (PST)",
            "from chenghaoyang-low.c.googlers.com.com\n\t(46.165.189.35.bc.googleusercontent.com. [35.189.165.46])\n\tby smtp.gmail.com with ESMTPSA id\n\tx23-20020a170902b41700b00188c5f0f9e9sm25015200plr.199.2023.01.04.20.38.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 04 Jan 2023 20:38:02 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1672893488;\n\tbh=mr5Sbr6Ad9FB1rrja5XwMm7+L+S22BtkUvzG9n9Aj04=;\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=PnSUeEMpZZXtz8DZrFohMknjUyY2Nd8g8RxrI88+SahCAEUeUy9X2yGSM8/j8MBVv\n\t10hOGE9SOsPesmKTSBWiNffUOHGw/yXMV0Ky2ZrizjqUwhQpKZyn5L+eynlcfLwO+R\n\toudl8l8DCNRTdeujIj2vLhaET34LcFathtxahSHsOnvVOK32kEJ9UW2v22dZTK7Ikj\n\tCPtc36DWx1xjklAEIxmMOB4m6DIQprN3fyEPZTTptKCPGO6kc/fp+dPPgDnBTkPbzW\n\tlyJjaGWEd9viYyH7wHx6blOE1TC9/KM3pUEU0qUnhmeOQpoDoBHM0kTuLhBcYXCB9q\n\tq6o0iNRVsvusw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=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=hd42uG5tbVV4XTVn78gvQUXhPXrwSqPdQZFKksMQ2iI=;\n\tb=ZQCkgI8IG7n/XNiVoqiKsdRh9foZTg6vaeNRwZZwHcJvaZWHldWKtnbbrcRlbCPg/2\n\ti9g1feXk4h4awnGT4t7RDwN/Mav+p5H06ufdMv7VCptfwGr82TIE+tBqwJFhUxTquwr2\n\twcgT6NH/BiPrc3VCitvdU73hiUfOFNvHojLdA="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"ZQCkgI8I\"; \n\tdkim-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=hd42uG5tbVV4XTVn78gvQUXhPXrwSqPdQZFKksMQ2iI=;\n\tb=hq0gG2EYuQpEGYyJQMtuF7vsZxefuRBW6W8verK0KAaumEds33N+Ykiz5DmunSCLOV\n\tu8CebLY/yZwr4p/MI74uHo0rtAmFnDqSFlAp9W50944GSp52+3TJkwOeMWZPRwUYLT2c\n\tDrS1qiQuJy+tyUScxGwi05ea+mpIOSwCkbtGgMOaHyCBB6NWXXrp0Lp20jryYVGbIbgU\n\t5e8Zk1I5/LoADnp+DKblAf1DEepaKAuKCkM5VpHltoRyvt3Isbp3cgoevp4FKKikOlmq\n\tPS3bpe28WOrAJ6CXnYdQqJ1u0Ow65b/7SriyaXcfGcmE5BSN1IwSAi9WOwdpcIfhIlUC\n\ts7Ag==",
        "X-Gm-Message-State": "AFqh2krJ83M+KKKB9rJaT4yAB/wOY8Kl9UsMFjDg/ikguXpvQm/EnIjw\n\tPeSRu0JyBlEBR/UZ93hT0VlabSg8GS9KxN9O",
        "X-Google-Smtp-Source": "AMrXdXv7NvyAuNyUyTkT5Y1BoB23gB1p87N74+GkXypPpOAKGIqLtMGx5VdRwgJKvCDa/KSU5QHRqA==",
        "X-Received": "by 2002:a05:6a21:99a4:b0:a3:94cd:1435 with SMTP id\n\tve36-20020a056a2199a400b000a394cd1435mr81893332pzb.38.1672893482748; \n\tWed, 04 Jan 2023 20:38:02 -0800 (PST)",
        "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  5 Jan 2023 04:37:25 +0000",
        "Message-Id": "<20230105043726.679968-9-chenghaoyang@google.com>",
        "X-Mailer": "git-send-email 2.39.0.314.g84b9a713c41-goog",
        "In-Reply-To": "<20230105043726.679968-1-chenghaoyang@google.com>",
        "References": "<20230105043726.679968-1-chenghaoyang@google.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 8/9] 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 Use UDMA to allocate buffers in the exportFrameBuffers API]\n\n[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 | 29 +++++++++++++++++++---\n 1 file changed, 26 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp\nindex ef2901e7..db6fe14c 100644\n--- a/src/libcamera/pipeline/virtual/virtual.cpp\n+++ b/src/libcamera/pipeline/virtual/virtual.cpp\n@@ -8,6 +8,8 @@\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 \n #include \"libcamera/internal/camera.h\"\n@@ -18,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@@ -214,6 +227,7 @@ int PipelineHandlerVirtual::exportFrameBuffers(Camera *camera, Stream *stream,\n \t(void)camera;\n \t(void)stream;\n \t(void)buffers;\n+\t// TODO: Use UDMA to allocate buffers.\n \treturn -1;\n }\n \n@@ -221,19 +235,28 @@ 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",
        "v3",
        "8/9"
    ]
}