Show a patch.

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

{
    "id": 11074,
    "url": "https://patchwork.libcamera.org/api/patches/11074/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11074/",
    "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": "<20210131181722.5410-3-laurent.pinchart@ideasonboard.com>",
    "date": "2021-01-31T18:17:21",
    "name": "[libcamera-devel,2/3] libcamera: camera_sensor: Restrict sensor info to raw sensors",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "35cca044b74bfdf7ef49cf708cab87da77a75178",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": {
        "id": 14,
        "url": "https://patchwork.libcamera.org/api/users/14/?format=api",
        "username": "pinchartl",
        "first_name": "Laurent",
        "last_name": "Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/11074/mbox/",
    "series": [
        {
            "id": 1631,
            "url": "https://patchwork.libcamera.org/api/series/1631/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1631",
            "date": "2021-01-31T18:17:19",
            "name": "Restore CameraSensor usage for YUV sensors",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1631/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11074/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11074/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 BDDB4BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 31 Jan 2021 18:17:51 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 59243683E0;\n\tSun, 31 Jan 2021 19:17:50 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 44060683D0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 31 Jan 2021 19:17:47 +0100 (CET)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CED7B813\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 31 Jan 2021 19:17:46 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"XcO6DvCK\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1612117067;\n\tbh=TfzdSlaQsQ8zYZbBfJMLhBO3eZ20WrPDWWeyelTBvCE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=XcO6DvCKC+pyLN6y4Idi8GlQ0NpXpSGelT8EDanDgiPEKMcYMy4lGDHLxlWzAnGsp\n\tK2K51SzmnSjbpitJjZdTH8COe0+vswScQg9WnYbRltDl+RvWu2UVUqhVv6/Zptnbiw\n\thVBrR/LsKuSJo/wsDhGq9BDq/Fd1TBaRo/E2LH44=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 31 Jan 2021 20:17:21 +0200",
        "Message-Id": "<20210131181722.5410-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.28.0",
        "In-Reply-To": "<20210131181722.5410-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20210131181722.5410-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 2/3] libcamera: camera_sensor: Restrict\n\tsensor info to raw sensors",
        "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": "YUV sensors don't provide the necessary information to fill\nCameraSensorInfo, as they include an ISP and provide a higher-level API\nthat doesn't always expose low-level information. The CameraSensor class\nmakes low-level V4L2 controls mandatory for all sensors, which prevents\nusage of YUV sensors with the simple pipeline handler.\n\nMake CameraSensor::sensorInfo() available for raw sensors only. This\nwon't introduce any regression in pipeline handlers that currently use\nthe sensorInfo() function as they all operate with raw sensors, and\nwon't be a limitation for the simple pipeline handler as well as it\ndoesn't use sensor info. If part of the sensor info (such as the active\npixel array size for instance) becomes useful to expose for YUV sensors\nin the future, the sensorInfo() function can be extended to report that\ninformation only and skip data that is only available for raw sensors.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n Documentation/sensor_driver_requirements.rst |  2 +-\n src/libcamera/camera_sensor.cpp              | 59 ++++++++++++--------\n 2 files changed, 36 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/Documentation/sensor_driver_requirements.rst b/Documentation/sensor_driver_requirements.rst\nindex 6dcd4e68d64d..64e00fd5fc7c 100644\n--- a/Documentation/sensor_driver_requirements.rst\n+++ b/Documentation/sensor_driver_requirements.rst\n@@ -22,7 +22,7 @@ Mandatory Requirements\n \n The sensor driver is assumed to be fully compliant with the V4L2 specification.\n \n-The sensor driver shall support the following V4L2 controls:\n+For RAW sensors, the sensor driver shall support the following V4L2 controls:\n \n * `V4L2_CID_EXPOSURE`_\n * `V4L2_CID_HBLANK`_\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 35312857ff90..10713d3a0c29 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -246,27 +246,6 @@ int CameraSensor::init()\n \n int CameraSensor::validateSensorDriver()\n {\n-\t/*\n-\t * Make sure the sensor driver supports the mandatory controls\n-\t * required by the CameraSensor class.\n-\t */\n-\tconst std::vector<uint32_t> mandatoryControls{\n-\t\tV4L2_CID_EXPOSURE,\n-\t\tV4L2_CID_HBLANK,\n-\t\tV4L2_CID_PIXEL_RATE,\n-\t};\n-\n-\tControlList ctrls = subdev_->getControls(mandatoryControls);\n-\tif (ctrls.empty()) {\n-\t\tLOG(CameraSensor, Error)\n-\t\t\t<< \"Mandatory V4L2 controls not available\";\n-\t\tLOG(CameraSensor, Error)\n-\t\t\t<< \"The sensor kernel driver needs to be fixed\";\n-\t\tLOG(CameraSensor, Error)\n-\t\t\t<< \"See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information\";\n-\t\treturn -EINVAL;\n-\t}\n-\n \t/*\n \t * Optional controls are used to register optional sensor properties. If\n \t * not present, some values will be defaulted.\n@@ -276,7 +255,7 @@ int CameraSensor::validateSensorDriver()\n \t\tV4L2_CID_CAMERA_SENSOR_ROTATION,\n \t};\n \n-\tctrls = subdev_->getControls(optionalControls);\n+\tControlList ctrls = subdev_->getControls(optionalControls);\n \tif (ctrls.empty())\n \t\tLOG(CameraSensor, Debug) << \"Optional V4L2 controls not supported\";\n \n@@ -326,6 +305,30 @@ int CameraSensor::validateSensorDriver()\n \t\t\t<< \"See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information\";\n \t}\n \n+\tif (!bayerFormat_)\n+\t\treturn 0;\n+\n+\t/*\n+\t * For raw sensors, make sure the sensor driver supports the controls\n+\t * required by the CameraSensor class.\n+\t */\n+\tconst std::vector<uint32_t> mandatoryControls{\n+\t\tV4L2_CID_EXPOSURE,\n+\t\tV4L2_CID_HBLANK,\n+\t\tV4L2_CID_PIXEL_RATE,\n+\t};\n+\n+\tctrls = subdev_->getControls(mandatoryControls);\n+\tif (ctrls.empty()) {\n+\t\tLOG(CameraSensor, Error)\n+\t\t\t<< \"Mandatory V4L2 controls not available\";\n+\t\tLOG(CameraSensor, Error)\n+\t\t\t<< \"The sensor kernel driver needs to be fixed\";\n+\t\tLOG(CameraSensor, Error)\n+\t\t\t<< \"See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information\";\n+\t\treturn -EINVAL;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -662,13 +665,21 @@ int CameraSensor::setControls(ControlList *ctrls)\n  * \\brief Assemble and return the camera sensor info\n  * \\param[out] info The camera sensor info\n  *\n- * The CameraSensorInfo content is assembled by inspecting the currently\n- * applied sensor configuration and the sensor static properties.\n+ * This function fills \\a info with information that describes the camera sensor\n+ * and its current configuration. The information combines static data (such as\n+ * the the sensor model or active pixel array size) and data specific to the\n+ * current sensor configuration (such as the line length and pixel rate).\n+ *\n+ * Sensor information is only available for raw sensors. When called for a YUV\n+ * sensor, this function returns -EINVAL.\n  *\n  * \\return 0 on success, a negative error code otherwise\n  */\n int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n {\n+\tif (!bayerFormat_)\n+\t\treturn -EINVAL;\n+\n \tinfo->model = model();\n \n \t/*\n",
    "prefixes": [
        "libcamera-devel",
        "2/3"
    ]
}