Show a patch.

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

{
    "id": 12112,
    "url": "https://patchwork.libcamera.org/api/patches/12112/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12112/",
    "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": "<20210426083830.2965095-4-hiroh@chromium.org>",
    "date": "2021-04-26T08:38:30",
    "name": "[libcamera-devel,v3,3/3] android: CameraDevice: Implement HAL3 API flush",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "253683223f325539396891fa7c5c904043b521c6",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12112/mbox/",
    "series": [
        {
            "id": 1976,
            "url": "https://patchwork.libcamera.org/api/series/1976/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1976",
            "date": "2021-04-26T08:38:27",
            "name": "Support HAL3 API flush",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1976/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12112/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12112/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 30AA3BDC99\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Apr 2021 08:38:44 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF390688B9;\n\tMon, 26 Apr 2021 10:38:43 +0200 (CEST)",
            "from mail-pl1-x630.google.com (mail-pl1-x630.google.com\n\t[IPv6:2607:f8b0:4864:20::630])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E2F5A688B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Apr 2021 10:38:41 +0200 (CEST)",
            "by mail-pl1-x630.google.com with SMTP id t3so1252786plz.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Apr 2021 01:38:41 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:a407:b8c2:d8b:a449])\n\tby smtp.gmail.com with ESMTPSA id\n\te18sm4873728pgr.8.2021.04.26.01.38.39\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 26 Apr 2021 01:38:39 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"JbWUTsO+\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=hB4U1qnLM8I7fOVF5tDADuTX+WeJdZ8FPLjDox9q8+Q=;\n\tb=JbWUTsO+LTYR9abJRbOnmVrfdfOVGsjwZG3iL0wRYptQLwCJGTi1SGGh8pc7rWNf2f\n\tVazEIQZfPAIGcnH99IaQEefW0RZPCNSIpGXqEmx3qluoUIq7QeG/m6AY0DhL2cBMLolN\n\tigFI1gaK8EgigOAVOKucoffAYxWJm6iqNjfmI=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=hB4U1qnLM8I7fOVF5tDADuTX+WeJdZ8FPLjDox9q8+Q=;\n\tb=Ky+dAz82jvYGq6vIx/Xv0KGi5xfziFEMw/Y0hqg9KFd3eaL5NsmUEbSn+SiGi+oB5w\n\tongXRY+i5PnL7DqPZ45lB/N4OuYZOvGOqQ6oK2igSY7KGXVIjWqLWw9/AQbuYdpcjz9k\n\t2utAxOLct8A/7lFD3M0ETgu6Q3/0qWUBu+GlQ7pak6/g8xVmIeLhWqQTPHO2EL5FtObP\n\tcMSQ1wc5jx6J5XRIMmxDWMpDGn3B9+kUTdD/AFikniBSjGdzSKoQ43/IKN5BQ+1+vYRk\n\tRvywYLWzmVHQo4SQ2eTTDZGgefr6h/N1L5L9ZZcrXbCeslFcnxQdoJCshrCpzQuBzfKv\n\tK8Rw==",
        "X-Gm-Message-State": "AOAM532u4c1HpjQvdhTdvd7bcrwWOsZ/6mgOfAVtZIGEhxGdWe5kccSl\n\tXf4+lsEYcmxs5NhhS7GzIySilkAkqohXeg==",
        "X-Google-Smtp-Source": "ABdhPJxzDgE0FXq3jyW489rPYW+aVAIdSzSYzbLyRTrgm57h9hJuEISZ/55J0xzwPwjwLUQ+ERrCzA==",
        "X-Received": "by 2002:a17:90b:88d:: with SMTP id\n\tbj13mr13815365pjb.192.1619426320361; \n\tMon, 26 Apr 2021 01:38:40 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 26 Apr 2021 17:38:30 +0900",
        "Message-Id": "<20210426083830.2965095-4-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.31.1.498.g6c1eba8ee3d-goog",
        "In-Reply-To": "<20210426083830.2965095-1-hiroh@chromium.org>",
        "References": "<20210426083830.2965095-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3 3/3] android: CameraDevice: Implement\n\tHAL3 API flush",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "This implements flush(). It is mostly the same as close()\nthough the canceled events are reported with error messages.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 28 ++++++++++++++++++++++++++++\n src/android/camera_device.h   |  1 +\n src/android/camera_ops.cpp    |  8 ++++++--\n 3 files changed, 35 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 96c8d4a9..fb89195e 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -750,6 +750,15 @@ void CameraDevice::close()\n \tcamera_->release();\n }\n \n+int CameraDevice::flush()\n+{\n+\tstd::scoped_lock<std::mutex> halLock(halMutex_);\n+\n+\tstop();\n+\n+\treturn 0;\n+}\n+\n void CameraDevice::stop()\n {\n \tif (!running_)\n@@ -760,6 +769,25 @@ void CameraDevice::stop()\n \n \t{\n \t\tstd::scoped_lock<std::mutex> lock(mutex_);\n+\n+\t\tfor (auto &[cookie, descriptor] : descriptors_) {\n+\t\t\tLOG(HAL, Debug) << \"request is canceled: \" << cookie;\n+\n+\t\t\tcamera3_capture_result_t captureResult = {};\n+\t\t\tcaptureResult.frame_number = descriptor.frameNumber_;\n+\t\t\tcaptureResult.num_output_buffers = descriptor.buffers_.size();\n+\t\t\tfor (camera3_stream_buffer_t &buffer : descriptor.buffers_) {\n+\t\t\t\tbuffer.acquire_fence = -1;\n+\t\t\t\tbuffer.release_fence = -1;\n+\t\t\t\tbuffer.status = CAMERA3_BUFFER_STATUS_ERROR;\n+\t\t\t}\n+\t\t\tcaptureResult.output_buffers = descriptor.buffers_.data();\n+\n+\t\t\tnotifyError(descriptor.frameNumber_,\n+\t\t\t\t    descriptor.buffers_[0].stream);\n+\t\t\tcallbacks_->process_capture_result(callbacks_, &captureResult);\n+\t\t}\n+\n \t\tdescriptors_.clear();\n \t}\n \ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 325fb967..fa652c3c 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -41,6 +41,7 @@ public:\n \n \tint open(const hw_module_t *hardwareModule);\n \tvoid close();\n+\tint flush();\n \n \tunsigned int id() const { return id_; }\n \tcamera3_device_t *camera3Device() { return &camera3Device_; }\ndiff --git a/src/android/camera_ops.cpp b/src/android/camera_ops.cpp\nindex 696e8043..01458403 100644\n--- a/src/android/camera_ops.cpp\n+++ b/src/android/camera_ops.cpp\n@@ -66,9 +66,13 @@ static void hal_dev_dump([[maybe_unused]] const struct camera3_device *dev,\n {\n }\n \n-static int hal_dev_flush([[maybe_unused]] const struct camera3_device *dev)\n+static int hal_dev_flush(const struct camera3_device *dev)\n {\n-\treturn 0;\n+\tif (!dev)\n+\t\treturn -EINVAL;\n+\n+\tCameraDevice *camera = reinterpret_cast<CameraDevice *>(dev->priv);\n+\treturn camera->flush();\n }\n \n int hal_dev_close(hw_device_t *hw_device)\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "3/3"
    ]
}