Message ID | 20210412075702.9955-3-jacopo@jmondi.org |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, thanks for the patch. On Mon, Apr 12, 2021 at 4:56 PM Jacopo Mondi <jacopo@jmondi.org> wrote: > > Register static properties, retrieved inspecting the sensor > database, in the CameraSensor class. > > Static properties are overridden by properties retrieved from > the kernel interface at run-time if any overlap between the two > sets occurs. > > Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > include/libcamera/internal/camera_sensor.h | 1 + > src/libcamera/camera_sensor.cpp | 24 +++++++++++++++++++++- > 2 files changed, 24 insertions(+), 1 deletion(-) > > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h > index 3e98f71b5e7f..3fa3a419f94a 100644 > --- a/include/libcamera/internal/camera_sensor.h > +++ b/include/libcamera/internal/camera_sensor.h > @@ -77,6 +77,7 @@ private: > int generateId(); > int validateSensorDriver(); > void initVimcDefaultProperties(); > + void initStaticProperties(); > int initProperties(); > > const MediaEntity *entity_; > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp > index f7ed91d990f7..c012385ff056 100644 > --- a/src/libcamera/camera_sensor.cpp > +++ b/src/libcamera/camera_sensor.cpp > @@ -20,6 +20,7 @@ > > #include "libcamera/internal/bayer_format.h" > #include "libcamera/internal/formats.h" > +#include "libcamera/internal/sensor_database.h" > #include "libcamera/internal/sysfs.h" > #include "libcamera/internal/utils.h" > > @@ -266,6 +267,9 @@ int CameraSensor::init() > if (ret) > return ret; > > + /* Initialize the static properties from the sensor database. */ > + initStaticProperties(); > + > ret = initProperties(); > if (ret) > return ret; > @@ -407,6 +411,21 @@ void CameraSensor::initVimcDefaultProperties() > activeArea_ = Rectangle(pixelArraySize_); > } > > +void CameraSensor::initStaticProperties() > +{ > + const SensorInfo *info = SensorDatabase::get(model_); > + if (!info) { > + LOG(CameraSensor, Warning) > + << "No static properties available for '" << model_ << "'"; > + LOG(CameraSensor, Warning) > + << "Please consider updating the sensor database"; > + return; > + } > + > + /* Register the properties retrieved from the sensor database. */ > + properties_.set(properties::UnitCellSize, info->unitCellSize); > +} > + > int CameraSensor::initProperties() > { > /* > @@ -444,7 +463,10 @@ int CameraSensor::initProperties() > if (ret) > return ret; > > - /* Retrieve and store the camera sensor properties. */ > + /* Initialize the static properties from the sensor database. */ > + initStaticProperties(); > + > + /* Retrieve and register properties from the kernel interface. */ > const ControlInfoMap &controls = subdev_->controls(); > int32_t propertyValue; > > -- Reviewed-by: Hirokazu Honda <hiroh@chromium.org> -Hiro > 2.31.1 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi Jacopo, Thank you for the patch. On Mon, Apr 12, 2021 at 09:57:01AM +0200, Jacopo Mondi wrote: > Register static properties, retrieved inspecting the sensor > database, in the CameraSensor class. > > Static properties are overridden by properties retrieved from > the kernel interface at run-time if any overlap between the two > sets occurs. > > Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > include/libcamera/internal/camera_sensor.h | 1 + > src/libcamera/camera_sensor.cpp | 24 +++++++++++++++++++++- > 2 files changed, 24 insertions(+), 1 deletion(-) > > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h > index 3e98f71b5e7f..3fa3a419f94a 100644 > --- a/include/libcamera/internal/camera_sensor.h > +++ b/include/libcamera/internal/camera_sensor.h > @@ -77,6 +77,7 @@ private: > int generateId(); > int validateSensorDriver(); > void initVimcDefaultProperties(); > + void initStaticProperties(); > int initProperties(); > > const MediaEntity *entity_; > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp > index f7ed91d990f7..c012385ff056 100644 > --- a/src/libcamera/camera_sensor.cpp > +++ b/src/libcamera/camera_sensor.cpp > @@ -20,6 +20,7 @@ > > #include "libcamera/internal/bayer_format.h" > #include "libcamera/internal/formats.h" > +#include "libcamera/internal/sensor_database.h" > #include "libcamera/internal/sysfs.h" > #include "libcamera/internal/utils.h" > > @@ -266,6 +267,9 @@ int CameraSensor::init() > if (ret) > return ret; > > + /* Initialize the static properties from the sensor database. */ > + initStaticProperties(); > + > ret = initProperties(); > if (ret) > return ret; > @@ -407,6 +411,21 @@ void CameraSensor::initVimcDefaultProperties() > activeArea_ = Rectangle(pixelArraySize_); > } > > +void CameraSensor::initStaticProperties() > +{ > + const SensorInfo *info = SensorDatabase::get(model_); > + if (!info) { > + LOG(CameraSensor, Warning) > + << "No static properties available for '" << model_ << "'"; > + LOG(CameraSensor, Warning) > + << "Please consider updating the sensor database"; Should we move this to the get() function in patch 1/3 ? I'm not sure if we'll get more users of the sensor database, but if we do, that will avoid duplicating the error message. > + return; > + } > + > + /* Register the properties retrieved from the sensor database. */ > + properties_.set(properties::UnitCellSize, info->unitCellSize); > +} > + > int CameraSensor::initProperties() > { > /* > @@ -444,7 +463,10 @@ int CameraSensor::initProperties() > if (ret) > return ret; > > - /* Retrieve and store the camera sensor properties. */ > + /* Initialize the static properties from the sensor database. */ > + initStaticProperties(); Is there a need to call this function twice, here and in CameraSensor::init() ? > + > + /* Retrieve and register properties from the kernel interface. */ > const ControlInfoMap &controls = subdev_->controls(); > int32_t propertyValue; >
Hi Laurent, On Tue, Apr 13, 2021 at 04:47:19AM +0300, Laurent Pinchart wrote: > Hi Jacopo, > > Thank you for the patch. > > On Mon, Apr 12, 2021 at 09:57:01AM +0200, Jacopo Mondi wrote: > > Register static properties, retrieved inspecting the sensor > > database, in the CameraSensor class. > > > > Static properties are overridden by properties retrieved from > > the kernel interface at run-time if any overlap between the two > > sets occurs. > > > > Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > --- > > include/libcamera/internal/camera_sensor.h | 1 + > > src/libcamera/camera_sensor.cpp | 24 +++++++++++++++++++++- > > 2 files changed, 24 insertions(+), 1 deletion(-) > > > > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h > > index 3e98f71b5e7f..3fa3a419f94a 100644 > > --- a/include/libcamera/internal/camera_sensor.h > > +++ b/include/libcamera/internal/camera_sensor.h > > @@ -77,6 +77,7 @@ private: > > int generateId(); > > int validateSensorDriver(); > > void initVimcDefaultProperties(); > > + void initStaticProperties(); > > int initProperties(); > > > > const MediaEntity *entity_; > > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp > > index f7ed91d990f7..c012385ff056 100644 > > --- a/src/libcamera/camera_sensor.cpp > > +++ b/src/libcamera/camera_sensor.cpp > > @@ -20,6 +20,7 @@ > > > > #include "libcamera/internal/bayer_format.h" > > #include "libcamera/internal/formats.h" > > +#include "libcamera/internal/sensor_database.h" > > #include "libcamera/internal/sysfs.h" > > #include "libcamera/internal/utils.h" > > > > @@ -266,6 +267,9 @@ int CameraSensor::init() > > if (ret) > > return ret; > > > > + /* Initialize the static properties from the sensor database. */ > > + initStaticProperties(); > > + > > ret = initProperties(); > > if (ret) > > return ret; > > @@ -407,6 +411,21 @@ void CameraSensor::initVimcDefaultProperties() > > activeArea_ = Rectangle(pixelArraySize_); > > } > > > > +void CameraSensor::initStaticProperties() > > +{ > > + const SensorInfo *info = SensorDatabase::get(model_); > > + if (!info) { > > + LOG(CameraSensor, Warning) > > + << "No static properties available for '" << model_ << "'"; > > + LOG(CameraSensor, Warning) > > + << "Please consider updating the sensor database"; > > Should we move this to the get() function in patch 1/3 ? I'm not sure if > we'll get more users of the sensor database, but if we do, that will > avoid duplicating the error message. > > > + return; > > + } > > + > > + /* Register the properties retrieved from the sensor database. */ > > + properties_.set(properties::UnitCellSize, info->unitCellSize); > > +} > > + > > int CameraSensor::initProperties() > > { > > /* > > @@ -444,7 +463,10 @@ int CameraSensor::initProperties() > > if (ret) > > return ret; > > > > - /* Retrieve and store the camera sensor properties. */ > > + /* Initialize the static properties from the sensor database. */ > > + initStaticProperties(); > > Is there a need to call this function twice, here and in > CameraSensor::init() ? > Uuuups, leftover.. I'll remove the call in CameraSensor::init() as this function needs to be called after model_ has been populated Thanks j > > + > > + /* Retrieve and register properties from the kernel interface. */ > > const ControlInfoMap &controls = subdev_->controls(); > > int32_t propertyValue; > > > > -- > Regards, > > Laurent Pinchart
diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 3e98f71b5e7f..3fa3a419f94a 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -77,6 +77,7 @@ private: int generateId(); int validateSensorDriver(); void initVimcDefaultProperties(); + void initStaticProperties(); int initProperties(); const MediaEntity *entity_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index f7ed91d990f7..c012385ff056 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -20,6 +20,7 @@ #include "libcamera/internal/bayer_format.h" #include "libcamera/internal/formats.h" +#include "libcamera/internal/sensor_database.h" #include "libcamera/internal/sysfs.h" #include "libcamera/internal/utils.h" @@ -266,6 +267,9 @@ int CameraSensor::init() if (ret) return ret; + /* Initialize the static properties from the sensor database. */ + initStaticProperties(); + ret = initProperties(); if (ret) return ret; @@ -407,6 +411,21 @@ void CameraSensor::initVimcDefaultProperties() activeArea_ = Rectangle(pixelArraySize_); } +void CameraSensor::initStaticProperties() +{ + const SensorInfo *info = SensorDatabase::get(model_); + if (!info) { + LOG(CameraSensor, Warning) + << "No static properties available for '" << model_ << "'"; + LOG(CameraSensor, Warning) + << "Please consider updating the sensor database"; + return; + } + + /* Register the properties retrieved from the sensor database. */ + properties_.set(properties::UnitCellSize, info->unitCellSize); +} + int CameraSensor::initProperties() { /* @@ -444,7 +463,10 @@ int CameraSensor::initProperties() if (ret) return ret; - /* Retrieve and store the camera sensor properties. */ + /* Initialize the static properties from the sensor database. */ + initStaticProperties(); + + /* Retrieve and register properties from the kernel interface. */ const ControlInfoMap &controls = subdev_->controls(); int32_t propertyValue;