[{"id":16626,"web_url":"https://patchwork.libcamera.org/comment/16626/","msgid":"<YIe0G79K4k1yAFGv@pendragon.ideasonboard.com>","date":"2021-04-27T06:50:03","subject":"Re: [libcamera-devel] [PATCH v5 2/3] libcamera: camera_sensor:\n\tRegister static properties","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 Tue, Apr 13, 2021 at 12:14:38PM +0200, Jacopo Mondi wrote:\n> Register static properties, retrieved inspecting the sensor\n> database, in the CameraSensor class.\n> \n> Static properties are overridden by properties retrieved from\n> the kernel interface at run-time if any overlap between the two\n> sets occurs.\n> \n> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/camera_sensor.h |  1 +\n>  src/libcamera/camera_sensor.cpp            | 16 +++++++++++++++-\n>  2 files changed, 16 insertions(+), 1 deletion(-)\n> \n> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\n> index 3e98f71b5e7f..3fa3a419f94a 100644\n> --- a/include/libcamera/internal/camera_sensor.h\n> +++ b/include/libcamera/internal/camera_sensor.h\n> @@ -77,6 +77,7 @@ private:\n>  \tint generateId();\n>  \tint validateSensorDriver();\n>  \tvoid initVimcDefaultProperties();\n> +\tvoid initStaticProperties();\n>  \tint initProperties();\n>  \n>  \tconst MediaEntity *entity_;\n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index f7ed91d990f7..f218dc5e8a55 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -20,6 +20,7 @@\n>  \n>  #include \"libcamera/internal/bayer_format.h\"\n>  #include \"libcamera/internal/formats.h\"\n> +#include \"libcamera/internal/sensor_database.h\"\n>  #include \"libcamera/internal/sysfs.h\"\n>  #include \"libcamera/internal/utils.h\"\n>  \n> @@ -407,6 +408,16 @@ void CameraSensor::initVimcDefaultProperties()\n>  \tactiveArea_ = Rectangle(pixelArraySize_);\n>  }\n>  \n> +void CameraSensor::initStaticProperties()\n> +{\n> +\tconst CameraSensorProperties *props = SensorDatabase::get(model_);\n> +\tif (!props)\n> +\t\treturn;\n> +\n> +\t/* Register the properties retrieved from the sensor database. */\n> +\tproperties_.set(properties::UnitCellSize, props->unitCellSize);\n> +}\n> +\n>  int CameraSensor::initProperties()\n>  {\n>  \t/*\n> @@ -444,7 +455,10 @@ int CameraSensor::initProperties()\n>  \tif (ret)\n>  \t\treturn ret;\n>  \n> -\t/* Retrieve and store the camera sensor properties. */\n> +\t/* Initialize the static properties from the sensor database. */\n> +\tinitStaticProperties();\n> +\n> +\t/* Retrieve and register properties from the kernel interface. */\n>  \tconst ControlInfoMap &controls = subdev_->controls();\n>  \tint32_t propertyValue;\n>","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 9D582BDE19\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Apr 2021 06:50:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C7BF7688AE;\n\tTue, 27 Apr 2021 08:50:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6888B60512\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Apr 2021 08:50:09 +0200 (CEST)","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 DCF5DE9;\n\tTue, 27 Apr 2021 08:50:08 +0200 (CEST)"],"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=\"Kzm1CGeB\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1619506209;\n\tbh=PbjK9oQNK+p1wZmPbRFkf5hSsvtnUgvIdsqfrgrwebE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Kzm1CGeBW8tC3P57Slz6jm+IgaNP4/6cx2csigTIyt1s6sx2WmbtWQ+eQz1EYg4My\n\tCc88i70Sg9TxH/MC/AJVryxI4nV8o2wNL8zrGx6pgPx3l8QEZpRSAoy+3ucVyEoML1\n\tUYesIVRodWkGr9qf6WiNOySPABk4UO99v5jUPCKY=","Date":"Tue, 27 Apr 2021 09:50:03 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YIe0G79K4k1yAFGv@pendragon.ideasonboard.com>","References":"<20210413101439.14659-1-jacopo@jmondi.org>\n\t<20210413101439.14659-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210413101439.14659-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v5 2/3] libcamera: camera_sensor:\n\tRegister static properties","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":"Niklas =?utf-8?q?S=C3=B6derlund?=\n\t<niklas.soderlund+renesas@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]