[{"id":14422,"web_url":"https://patchwork.libcamera.org/comment/14422/","msgid":"<X+zPGR1l2RqkjLbq@pendragon.ideasonboard.com>","date":"2020-12-30T19:03:53","subject":"Re: [libcamera-devel] [PATCH v3 1/6] libcamera: Document sensor\n\tdriver requirements","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Dec 30, 2020 at 07:01:15PM +0100, Jacopo Mondi wrote:\n> Document the feature an image sensor driver has to provide to be\n> fully libcamera-compliant.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  Documentation/index.rst                      |  1 +\n>  Documentation/meson.build                    |  1 +\n>  Documentation/sensor_driver_requirements.rst | 61 ++++++++++++++++++++\n>  3 files changed, 63 insertions(+)\n>  create mode 100644 Documentation/sensor_driver_requirements.rst\n> \n> diff --git a/Documentation/index.rst b/Documentation/index.rst\n> index c49db18d52bd..285ca7c3e5ae 100644\n> --- a/Documentation/index.rst\n> +++ b/Documentation/index.rst\n> @@ -18,3 +18,4 @@\n>     Pipeline Handler Writer's Guide <guides/pipeline-handler>\n>     Tracing guide <guides/tracing>\n>     Environment variables <environment_variables>\n> +   Sensor driver requirements <sensor_driver_requirements>\n\nThis reminds me we'll probably need to organize the documents at some\npoint :-)\n\n> diff --git a/Documentation/meson.build b/Documentation/meson.build\n> index b1f5bb52474c..9950465ded6e 100644\n> --- a/Documentation/meson.build\n> +++ b/Documentation/meson.build\n> @@ -57,6 +57,7 @@ if sphinx.found()\n>          'guides/pipeline-handler.rst',\n>          'guides/tracing.rst',\n>          'index.rst',\n> +        'sensor_driver_requirements.rst',\n>         '../README.rst',\n>      ]\n>  \n> diff --git a/Documentation/sensor_driver_requirements.rst b/Documentation/sensor_driver_requirements.rst\n> new file mode 100644\n> index 000000000000..89ddd58a5ec6\n> --- /dev/null\n> +++ b/Documentation/sensor_driver_requirements.rst\n> @@ -0,0 +1,61 @@\n> +.. SPDX-License-Identifier: CC-BY-SA-4.0\n> +\n> +.. _sensor-driver-requirements:\n> +\n> +Sensor Driver Requirements\n> +==========================\n> +\n> +libcamera handles imaging devices in the CameraSensor class and defines\n> +through its API a consistent interface towards other library components.\n> +\n> +The CameraSensor class uses the V4L2 subdev kernel API to interface with the\n> +camera sensor through one or multiple sub-devices registered in userspace by\n\nDo you mean registered in kernel space ? Or maybe exposed to userspace ?\n\n> +the sensor driver.\n> +\n> +In order for libcamera to be fully operational and provide to applications and\n> +pipeline handlers all the required information to interface with the camera\n> +sensor, a set of mandatory and optional features the driver has to support\n> +have been defined.\n\ns/have/has/ (\"a set\")\n\n> +\n> +Mandatory Requirements\n> +----------------------\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> +\n> +* `V4L2_CID_HBLANK`_\n> +* `V4L2_CID_PIXEL_RATE`_\n> +\n> +.. _V4L2_CID_HBLANK: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-source.html\n> +.. _V4L2_CID_PIXEL_RATE: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-process.html\n> +\n> +Both controls are used to compute the sensor output timings.\n> +\n> +Optional Requirements\n> +---------------------\n> +\n> +The sensor driver should support the following V4L2 controls:\n> +\n> +* `V4L2_CID_CAMERA_ORIENTATION`_\n> +* `V4L2_CID_CAMERA_SENSOR_ROTATION`_\n> +\n> +.. _V4L2_CID_CAMERA_ORIENTATION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html\n> +.. _V4L2_CID_CAMERA_SENSOR_ROTATION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-process.html\n> +\n> +The controls are used to register the camera location and orientation.\n> +\n> +The sensor driver should implement support for the V4L2 Selection API,\n> +specifically it should implement support for the\n> +`VIDIOC_SUBDEV_G_SELECTION`_ ioctl with support for the following selection\n> +targets:\n> +\n> +.. _VIDIOC_SUBDEV_G_SELECTION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/vidioc-subdev-g-selection.html?highlight=g_selection#c.V4L.VIDIOC_SUBDEV_G_SELECTION\n> +\n> +* `V4L2_SEL_TGT_CROP_BOUNDS`_ to report the readable pixel array area size\n> +* `V4L2_SEL_TGT_CROP_DEFAULT`_ to report the active pixel array area size\n> +* `V4L2_SEL_TGT_CROP`_ to report the analogue selection rectangle\n\nI would add \"Support for the selectino API is scheduled to become a\nmandatory requirement in the near future.\"\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +.. _V4L2_SEL_TGT_CROP_BOUNDS: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html\n> +.. _V4L2_SEL_TGT_CROP_DEFAULT: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html\n> +.. _V4L2_SEL_TGT_CROP: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html","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 427CEC0F1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 30 Dec 2020 19:04:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C260F615B2;\n\tWed, 30 Dec 2020 20:04:06 +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 84F0360526\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 30 Dec 2020 20:04:05 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E344F2A3;\n\tWed, 30 Dec 2020 20:04:04 +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=\"GddIm+MW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1609355045;\n\tbh=F9KNYDKeXUfM4CsL3DPFzrmFkV8HeUzJdUqBVJaG/jc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=GddIm+MW6cnpC17i2hQPPtFqjQgdtpgaWfSPIzDU1yWShRJ+VYJ4u5vpxu03/JWhp\n\tAlAwPLCv6XiThhCxoCSQsMsi1nqG/sNs1MaFGZQISe4GS7GJgHVdIZR5xVrhkJY0sy\n\tzX1Tg6/xbomf7zfPria/eFY5T09HB2gyRUB7b8R8=","Date":"Wed, 30 Dec 2020 21:03:53 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<X+zPGR1l2RqkjLbq@pendragon.ideasonboard.com>","References":"<20201230180120.78407-1-jacopo@jmondi.org>\n\t<20201230180120.78407-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201230180120.78407-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v3 1/6] libcamera: Document sensor\n\tdriver requirements","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>","Cc":"libcamera-devel@lists.libcamera.org","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>"}}]