Show a patch.

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

{
    "id": 10034,
    "url": "https://patchwork.libcamera.org/api/patches/10034/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10034/",
    "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": "<20201009122101.73858-8-jacopo@jmondi.org>",
    "date": "2020-10-09T12:20:58",
    "name": "[libcamera-devel,07/10] android: camera_device: Handle PIPELINE_MAX_DEPTH",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ea0a49944f59fb92b8f0bcbc2b459140d3c2adb4",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/10034/mbox/",
    "series": [
        {
            "id": 1370,
            "url": "https://patchwork.libcamera.org/api/series/1370/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1370",
            "date": "2020-10-09T12:20:51",
            "name": "android: Introduce draft controls",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1370/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10034/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10034/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 0CE75BEEE0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Oct 2020 12:17:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8CA33609C8;\n\tFri,  9 Oct 2020 14:17:15 +0200 (CEST)",
            "from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 08CC660725\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  9 Oct 2020 14:17:13 +0200 (CEST)",
            "from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id A1AFBC0004;\n\tFri,  9 Oct 2020 12:17:12 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.34.118.233",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  9 Oct 2020 14:20:58 +0200",
        "Message-Id": "<20201009122101.73858-8-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.28.0",
        "In-Reply-To": "<20201009122101.73858-1-jacopo@jmondi.org>",
        "References": "<20201009122101.73858-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 07/10] android: camera_device: Handle\n\tPIPELINE_MAX_DEPTH",
        "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": "Register the ANDROID_REQUEST_PIPELINE_MAX_DEPTH static property\ninspecting what the value returned by the pipeline handler\nthrough the properties::draft::PipelineMaxDepth libcamera property.\n\nReport the result metadata ANDROID_REQUEST_PIPELINE_DEPTH that\nreports the processing stage a frame went through by inspecting the\ncontrols::draft::PipelineDepth libcamera control reported in the\ncompleted Request.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 28 ++++++++++++++++++++++------\n src/android/camera_device.h   |  3 ++-\n 2 files changed, 24 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 0a94c1ae17ac..bccec358ea13 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -12,6 +12,7 @@\n #include <tuple>\n #include <vector>\n \n+#include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n #include <libcamera/formats.h>\n #include <libcamera/property_ids.h>\n@@ -576,6 +577,8 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\treturn nullptr;\n \t}\n \n+\tconst ControlList &cameraProperties = camera_->properties();\n+\n \t/* Color correction static metadata. */\n \tstd::vector<uint8_t> aberrationModes = {\n \t\tANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF,\n@@ -867,9 +870,12 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \tstaticMetadata_->addEntry(ANDROID_REQUEST_PARTIAL_RESULT_COUNT,\n \t\t\t\t  &partialResultCount, 1);\n \n-\tuint8_t maxPipelineDepth = 2;\n-\tstaticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH,\n-\t\t\t\t  &maxPipelineDepth, 1);\n+\tif (cameraProperties.contains(properties::draft::PipelineMaxDepth)) {\n+\t\tuint8_t maxPipelineDepth =\n+\t\t\tcameraProperties.get<int32_t>(properties::draft::PipelineMaxDepth);\n+\t\tstaticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH,\n+\t\t\t\t\t  &maxPipelineDepth, 1);\n+\t}\n \n \t/* LIMITED does not support reprocessing. */\n \tuint32_t maxNumInputStreams = 0;\n@@ -1480,7 +1486,8 @@ void CameraDevice::requestComplete(Request *request)\n \t * pipeline handlers) timestamp in the Request itself.\n \t */\n \tFrameBuffer *buffer = buffers.begin()->second;\n-\tresultMetadata = getResultMetadata(descriptor->frameNumber,\n+\tresultMetadata = getResultMetadata(request->metadata(),\n+\t\t\t\t\t   descriptor->frameNumber,\n \t\t\t\t\t   buffer->metadata().timestamp);\n \n \t/* Handle any JPEG compression. */\n@@ -1600,7 +1607,8 @@ void CameraDevice::notifyError(uint32_t frameNumber, camera3_stream_t *stream)\n  * Produce a set of fixed result metadata.\n  */\n std::unique_ptr<CameraMetadata>\n-CameraDevice::getResultMetadata([[maybe_unused]] int frame_number,\n+CameraDevice::getResultMetadata(ControlList &metadata,\n+\t\t\t\t[[maybe_unused]] int frame_number,\n \t\t\t\tint64_t timestamp)\n {\n \t/*\n@@ -1608,7 +1616,7 @@ CameraDevice::getResultMetadata([[maybe_unused]] int frame_number,\n \t * Currently: 18 entries, 62 bytes\n \t */\n \tstd::unique_ptr<CameraMetadata> resultMetadata =\n-\t\tstd::make_unique<CameraMetadata>(18, 62);\n+\t\tstd::make_unique<CameraMetadata>(19, 63);\n \tif (!resultMetadata->isValid()) {\n \t\tLOG(HAL, Error) << \"Failed to allocate static metadata\";\n \t\treturn nullptr;\n@@ -1658,6 +1666,14 @@ CameraDevice::getResultMetadata([[maybe_unused]] int frame_number,\n \tresultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER,\n \t\t\t\t &scene_flicker, 1);\n \n+\t/* Add metadata tags reported by libcamera. */\n+\tif (metadata.contains(controls::draft::PipelineDepth)) {\n+\t\tuint8_t pipeline_depth =\n+\t\t\tmetadata.get<int32_t>(controls::draft::PipelineDepth);\n+\t\tresultMetadata->addEntry(ANDROID_REQUEST_PIPELINE_DEPTH,\n+\t\t\t\t\t &pipeline_depth, 1);\n+\t}\n+\n \t/*\n \t * Return the result metadata pack even is not valid: get() will return\n \t * nullptr.\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 777d1a35e801..8cf1006c0840 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -102,7 +102,8 @@ private:\n \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n \tCameraMetadata *requestTemplatePreview();\n \tlibcamera::PixelFormat toPixelFormat(int format);\n-\tstd::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,\n+\tstd::unique_ptr<CameraMetadata> getResultMetadata(libcamera::ControlList &metadata,\n+\t\t\t\t\t\t\t  int frame_number,\n \t\t\t\t\t\t\t  int64_t timestamp);\n \n \tunsigned int id_;\n",
    "prefixes": [
        "libcamera-devel",
        "07/10"
    ]
}