<div dir="ltr"><div dir="ltr">Hi Jacopo,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 27, 2021 at 6:08 AM Jacopo Mondi <<a href="mailto:jacopo@jmondi.org">jacopo@jmondi.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Hiro,<br>
<br>
On Wed, May 19, 2021 at 04:59:38PM +0900, Hirokazu Honda wrote:<br>
> The V4L2 specification defines the sensor test pattern modes<br>
> through a menu control, where a numerical index is associated to<br>
> a string that describes the test pattern. The index-to-pattern<br>
> mapping is driver specific and requires a corresponding representation<br>
> in the library.<br>
><br>
> Add to the static list of CameraSensorProperties a map of indexes to<br>
> libcamera::controls::TestPatternModes values to be able to map the<br>
> indexes returned by the driver to the corresponding test pattern mode.<br>
><br>
> Signed-off-by: Hirokazu Honda <<a href="mailto:hiroh@chromium.org" target="_blank">hiroh@chromium.org</a>><br>
> ---<br>
>  .../internal/camera_sensor_properties.h       |  2 ++<br>
>  src/libcamera/camera_sensor_properties.cpp    | 22 +++++++++++++++++++<br>
>  2 files changed, 24 insertions(+)<br>
><br>
> diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h<br>
> index f5e242cb..88ec7261 100644<br>
> --- a/include/libcamera/internal/camera_sensor_properties.h<br>
> +++ b/include/libcamera/internal/camera_sensor_properties.h<br>
> @@ -7,6 +7,7 @@<br>
>  #ifndef __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__<br>
>  #define __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__<br>
><br>
> +#include <map><br>
>  #include <string><br>
><br>
>  #include <libcamera/geometry.h><br>
> @@ -17,6 +18,7 @@ struct CameraSensorProperties {<br>
>       static const CameraSensorProperties *get(const std::string &sensor);<br>
><br>
>       Size unitCellSize;<br>
> +     std::map<uint8_t, uint8_t> testPatternModeMap;<br>
>  };<br>
><br>
>  } /* namespace libcamera */<br>
> diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp<br>
> index 6ded31dc..3bf8e500 100644<br>
> --- a/src/libcamera/camera_sensor_properties.cpp<br>
> +++ b/src/libcamera/camera_sensor_properties.cpp<br>
> @@ -9,6 +9,8 @@<br>
><br>
>  #include <map><br>
><br>
> +#include <libcamera/control_ids.h><br>
> +<br>
>  #include "libcamera/internal/log.h"<br>
><br>
>  /**<br>
> @@ -34,6 +36,10 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties)<br>
>   *<br>
>   * \var CameraSensorProperties::unitCellSize<br>
>   * \brief The physical size of a pixel, including pixel edges, in nanometers.<br>
> + *<br>
> + * \var CameraSensorProperties::testPatternModeMap<br>
> + * \brief The table from a v4l2 menu index for V4L2_CID_TEST_PATTERN to the<br>
> + * control value of libcamera test pattern mode.<br>
<br>
How about:<br>
<br>
Map that associates the indexes of the sensor test pattern modes as<br>
returned by V4L2_CID_TEST_PATTERN with the corresponding TestPattern<br>
control value.<br>
<br>
>   */<br>
><br>
>  /**<br>
> @@ -47,12 +53,28 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen<br>
>       static const std::map<std::string, const CameraSensorProperties> sensorProps = {<br>
>               { "imx219", {<br>
>                       .unitCellSize = { 1120, 1120 },<br>
> +                     .testPatternModeMap = {<br>
> +                             { 0, controls::draft::TestPatternModeOff },<br>
> +                             { 1, controls::draft::TestPatternModeColorBars },<br>
> +                             { 2, controls::draft::TestPatternModeSolidColor },<br>
> +                             { 3, controls::draft::TestPatternModeColorBarsFadeToGray },<br>
> +                             { 4, controls::draft::TestPatternModePn9 },<br>
> +                     },<br>
>               } },<br>
>               { "ov5670", {<br>
>                       .unitCellSize = { 1120, 1120 },<br>
> +                     .testPatternModeMap = {<br>
> +                             { 0, controls::draft::TestPatternModeOff },<br>
> +                             { 1, controls::draft::TestPatternModeColorBars },<br>
> +                     },<br>
>               } },<br>
>               { "ov13858", {<br>
>                       .unitCellSize = { 1120, 1120 },<br>
> +                     .testPatternModeMap =  {<br>
> +                             { 0, controls::draft::TestPatternModeOff },<br>
> +                             { 1, controls::draft::TestPatternModeColorBars },<br>
> +                             { 2, controls::draft::TestPatternModeColorBarsFadeToGray },<br>
> +                     },<br>
>               } },<br>
<br>
This patch breaks compilation as it requires the .testPatternModeMap<br>
field to be defined for the ov5693 sensor too. I've now realized at<br>
the time that sensor was not in the database :)<br>
<br></blockquote><div><br></div><div>ov5693 is mainly used in MS surface tablets according to the commit message of the patch adding this.</div><div>Probably because of that, the sensor driver for it is not upstream to linux kernel and it is impossible to construct this table for ov5693.</div><div>I couldn't even test pattern modes supported by it.</div><div><br></div><div>Jean, do you know anything about this?</div><div><br></div><div>-Hiro</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>       };<br>
><br>
> --<br>
> 2.31.1.751.gd2f1c929bd-goog<br>
><br>
</blockquote></div></div>