Show a patch.

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

{
    "id": 19885,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19885/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19885/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20240416091357.211951-18-mzamazal@redhat.com>",
    "date": "2024-04-16T09:13:53",
    "name": "[v8,17/18] libcamera: Add \"Software ISP benchmarking\" documentation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "c0cea652b6b96d23c1cf776223c68af3276069c1",
    "submitter": {
        "id": 177,
        "url": "https://patchwork.libcamera.org/api/1.1/people/177/?format=api",
        "name": "Milan Zamazal",
        "email": "mzamazal@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19885/mbox/",
    "series": [
        {
            "id": 4257,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4257/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4257",
            "date": "2024-04-16T09:13:36",
            "name": "libcamera: introduce Software ISP and Software IPA",
            "version": 8,
            "mbox": "https://patchwork.libcamera.org/series/4257/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19885/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19885/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 342DBBE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 16 Apr 2024 09:15:19 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B8F896336E;\n\tTue, 16 Apr 2024 11:15:18 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9385863366\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Apr 2024 11:15:08 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-308-RzYp8_bNMzCo1OM8ixiJsQ-1;\n\tTue, 16 Apr 2024 05:15:06 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD6CF3C000A8;\n\tTue, 16 Apr 2024 09:15:05 +0000 (UTC)",
            "from nuthatch.redhat.com (unknown [10.45.225.245])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 3787B2026964;\n\tTue, 16 Apr 2024 09:15:03 +0000 (UTC)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"hUH1XUXV\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1713258907;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=1WrIk2YyjdzCk85xMGw0sKBidVUpOqFk1DAvxeZCVRI=;\n\tb=hUH1XUXVzlV+q6Fau2MZ6JYwyOFl8Ujqlh+gkHHah9OxOiXPw8c59fPjdfoilEiNEmC14/\n\th+99itun3Slm0dZWsXNqCb6U57NQbvWJxKjTPJOc4EdMNyfDUY9+x65LfZ6bYlFxoBOz8Q\n\tFvNAknFM+BgWgr/lo5XWSOGuORbUXSo=",
        "X-MC-Unique": "RzYp8_bNMzCo1OM8ixiJsQ-1",
        "From": "Milan Zamazal <mzamazal@redhat.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Hans de Goede <hdegoede@redhat.com>, Milan Zamazal <mzamazal@redhat.com>,\n\tAndrei Konovalov <andrey.konovalov.ynk@gmail.com>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tMaxime Ripard <mripard@redhat.com>, Pavel Machek <pavel@ucw.cz>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tStefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v8 17/18] libcamera: Add \"Software ISP benchmarking\"\n\tdocumentation",
        "Date": "Tue, 16 Apr 2024 11:13:53 +0200",
        "Message-ID": "<20240416091357.211951-18-mzamazal@redhat.com>",
        "In-Reply-To": "<20240416091357.211951-1-mzamazal@redhat.com>",
        "References": "<20240416091357.211951-1-mzamazal@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.4",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Hans de Goede <hdegoede@redhat.com>\n\nAdd a \"Software ISP benchmarking\" documentation section which describes the\nperformance/power consumption measurements used during the Software ISP's\ndevelopment.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\n Documentation/index.rst                     |  1 +\n Documentation/meson.build                   |  1 +\n Documentation/software-isp-benchmarking.rst | 77 +++++++++++++++++++++\n 3 files changed, 79 insertions(+)\n create mode 100644 Documentation/software-isp-benchmarking.rst",
    "diff": "diff --git a/Documentation/index.rst b/Documentation/index.rst\nindex 63fac72d..5442ae75 100644\n--- a/Documentation/index.rst\n+++ b/Documentation/index.rst\n@@ -24,3 +24,4 @@\n    Lens driver requirements <lens_driver_requirements>\n    Python Bindings <python-bindings>\n    Camera Sensor Model <camera-sensor-model>\n+   SoftwareISP Benchmarking <software-isp-benchmarking>\ndiff --git a/Documentation/meson.build b/Documentation/meson.build\nindex 7a58fec8..3872e0a8 100644\n--- a/Documentation/meson.build\n+++ b/Documentation/meson.build\n@@ -80,6 +80,7 @@ if sphinx.found()\n         'lens_driver_requirements.rst',\n         'python-bindings.rst',\n         'sensor_driver_requirements.rst',\n+        'software-isp-benchmarking.rst',\n        '../README.rst',\n     ]\n \ndiff --git a/Documentation/software-isp-benchmarking.rst b/Documentation/software-isp-benchmarking.rst\nnew file mode 100644\nindex 00000000..b3033132\n--- /dev/null\n+++ b/Documentation/software-isp-benchmarking.rst\n@@ -0,0 +1,77 @@\n+.. SPDX-License-Identifier: CC-BY-SA-4.0\n+\n+.. _software-isp-benchmarking:\n+\n+Software ISP benchmarking\n+=========================\n+\n+The Software ISP is particularly sensitive to performance regressions therefore\n+it is a good idea to always benchmark the Software ISP before and after making\n+changes to it and ensure that there are no performance regressions.\n+\n+DebayerCpu class builtin benchmark\n+----------------------------------\n+\n+The DebayerCpu class has a builtin benchmark. This benchmark measures the time\n+spent on processing (collecting statistics and debayering) only, it does not\n+measure the time spent on capturing or outputting the frames.\n+\n+The builtin benchmark always runs. So this can be used by simply running \"cam\"\n+or \"qcam\" with a pipeline using the Software ISP.\n+\n+When it runs it will skip measuring the first 30 frames to allow the caches and\n+the CPU temperature (turbo-ing) to warm-up and then it measures 30 fps and shows\n+the total and per frame processing time using an info level log message:\n+\n+.. code-block:: text\n+\n+   INFO Debayer debayer_cpu.cpp:907 Processed 30 frames in 244317us, 8143 us/frame\n+\n+To get stable measurements it is advised to disable any other processes which\n+may cause significant CPU usage (e.g. disable wifi, bluetooth and browsers).\n+When possible it is also advisable to disable CPU turbo-ing and\n+frequency-scaling.\n+\n+For example when benchmarking on a Lenovo ThinkPad X1 Yoga Gen 8, with the\n+charger plugged in, the CPU can be fixed to run at 2 GHz using:\n+\n+.. code-block:: shell\n+\n+   sudo x86_energy_perf_policy --turbo-enable 0\n+   sudo cpupower frequency-set -d 2GHz -u 2GHz\n+\n+with these settings the builtin bench reports a processing time of ~7.8ms/frame\n+on this laptop for FHD SGRBG10 (unpacked) bayer data.\n+\n+Measuring power consumption\n+---------------------------\n+\n+Since the Software ISP is often used on mobile devices it is also important to\n+measure power consumption and ensure that that does not regress.\n+\n+For example to measure power consumption on a Lenovo ThinkPad X1 Yoga Gen 8 it\n+needs to be running on battery and it should be configured with its\n+platform-profile (/sys/firmware/acpi/platform_profile) set to balanced and with\n+its default turbo and frequency-scaling behavior to match real world usage.\n+\n+Then start qcam to capture a FHD picture at 30 fps and position the qcam window\n+so that it is fully visible. After this run the following command to monitor the\n+power consumption:\n+\n+.. code-block:: shell\n+\n+   watch -n 10 cat /sys/class/power_supply/BAT0/power_now /sys/class/hwmon/hwmon6/fan?_input\n+\n+Note this not only measures the power consumption in µW it also monitors the\n+speed of this laptop's 2 fans. This is important because depending on the\n+ambient temperature the 2 fans may spin up while testing and this will cause an\n+additional power consumption of approx. 0.5 W messing up the measurement.\n+\n+After starting qcam + the watch command let the laptop sit without using it for\n+2 minutes for the readings to stabilize. Then check that the fans have not\n+turned on and manually take a couple of consecutive power readings and average\n+these.\n+\n+On the example Lenovo ThinkPad X1 Yoga Gen 8 laptop this results in a measured\n+power consumption of approx. 13 W while running qcam versus approx. 4-5 W while\n+setting idle with its OLED panel on.\n",
    "prefixes": [
        "v8",
        "17/18"
    ]
}