[{"id":15911,"web_url":"https://patchwork.libcamera.org/comment/15911/","msgid":"<YF0THeYaLfXSRqHl@oden.dyn.berto.se>","date":"2021-03-25T22:47:57","subject":"Re: [libcamera-devel] [PATCH v3 2/3] libcamera: camera_sensor:\n\tRegister static properties","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2021-03-25 14:51:15 +0100, 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> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nI like this change very much.\n\nReviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>\n\n> ---\n>  include/libcamera/internal/camera_sensor.h |  1 +\n>  src/libcamera/camera_sensor.cpp            | 24 +++++++++++++++++++++-\n>  2 files changed, 24 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..c012385ff056 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> @@ -266,6 +267,9 @@ int CameraSensor::init()\n>  \tif (ret)\n>  \t\treturn ret;\n>  \n> +\t/* Initialize the static properties from the sensor database. */\n> +\tinitStaticProperties();\n> +\n>  \tret = initProperties();\n>  \tif (ret)\n>  \t\treturn ret;\n> @@ -407,6 +411,21 @@ void CameraSensor::initVimcDefaultProperties()\n>  \tactiveArea_ = Rectangle(pixelArraySize_);\n>  }\n>  \n> +void CameraSensor::initStaticProperties()\n> +{\n> +\tconst SensorInfo *info = SensorDatabase::get(model_);\n> +\tif (!info) {\n> +\t\tLOG(CameraSensor, Warning)\n> +\t\t\t<< \"No static properties available for '\" << model_ << \"'\";\n> +\t\tLOG(CameraSensor, Warning)\n> +\t\t\t<< \"Please consider updating the sensor database\";\n> +\t\treturn;\n> +\t}\n> +\n> +\t/* Register the properties retrieved from the sensor database. */\n> +\tproperties_.set(properties::UnitCellSize, info->unitCellSize);\n> +}\n> +\n>  int CameraSensor::initProperties()\n>  {\n>  \t/*\n> @@ -444,7 +463,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>  \n> -- \n> 2.30.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 CC87DBDC66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Mar 2021 22:48:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 87C4B68D65;\n\tThu, 25 Mar 2021 23:48:00 +0100 (CET)","from mail-lj1-x234.google.com (mail-lj1-x234.google.com\n\t[IPv6:2a00:1450:4864:20::234])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3F4CA603FE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 23:47:59 +0100 (CET)","by mail-lj1-x234.google.com with SMTP id 15so5291175ljj.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 15:47:59 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tr123sm673411lff.27.2021.03.25.15.47.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 25 Mar 2021 15:47:58 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"Lq7AyLQs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=Qe3kPxiufWC7g1EKAccGxiS9yMGZoGVPsZukbVd4Vdk=;\n\tb=Lq7AyLQsWgz4Z8MpijjliSK5WpWIrc+Sdhh1zzZlT144X1n7CKjL7ZjvjX9OcDKy2A\n\t3OiU1j1on8b3y2y1Rz+a63Vaixi9qT395NET4+KoeLTKGju1Ls28xqIiXzh3vA5ONyZv\n\tfSKZSAjZx2Td/bYoP5H13OY6X9W1P26t9t1DNBn4YgfcaylCIi7bFWWE97PMn0FEqWcl\n\tU7ilVADPbjwVBN4quX3udtsnJpvufd5YlHAPGhLtsu4OdZCp/PBADwIKjK3Drk8vCLdd\n\t+4CaB/YnqiHQ3R31+PdFnPfk+Qp5/YtyOVDRMTr3doJvor3GquxF39Sz7hjFC4sx47nc\n\ty1aA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=Qe3kPxiufWC7g1EKAccGxiS9yMGZoGVPsZukbVd4Vdk=;\n\tb=GxjbQL8T+O3JobuEKYDwx6kAV2+v8YByUR61FWY63WjqQCHy7nLXUHtDbeXdn20DQr\n\t20BiCQymudjljBN14XDJ0EwoCQ/JlJCweSDYOOo+shd6isojNAqyGNO6NeJ67fYYlzJv\n\tqq8DY+RMW+9PowTGWOYjM67R8dpUC1SnLsnZiuC1w6HvHGRcgaxId5aFqUEdySsPXdn3\n\tDyxw5Ud+mYyEQlpCJ9wBo1ulKlfBIKgdvSZbFNJFjQ9hGc9tsbqxpdiXUr/T2Qm+KYDz\n\tUKNWOPLOVpN/5DEz1O6+rz7QabJ3LfRMYJhcdtsQGx8PiDqWbnvRxYcfHlYgxIXf69+r\n\tvsOg==","X-Gm-Message-State":"AOAM531JW4xc8hPQLwwNrLjtOsSGmMt4pp+xKbUpgK+CaTvkkgMWKFF9\n\tUNZyAv5qm/E1Cfbo3VIdij95pg==","X-Google-Smtp-Source":"ABdhPJx8fZor/8eY2L+pke57+3vx+fZX80jZsoBtCV34WPZmKJSlyFsDLw2Tw165mRVp7Y7EH0Sb6Q==","X-Received":"by 2002:a2e:988f:: with SMTP id\n\tb15mr7370165ljj.394.1616712478611; \n\tThu, 25 Mar 2021 15:47:58 -0700 (PDT)","Date":"Thu, 25 Mar 2021 23:47:57 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YF0THeYaLfXSRqHl@oden.dyn.berto.se>","References":"<20210325135116.21548-1-jacopo@jmondi.org>\n\t<20210325135116.21548-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210325135116.21548-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v3 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":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]