[libcamera-devel,RFC,v1,0/5] Enabling AF algorithm to get the VCM attributes from the device driver
mbox series

Message ID 20220414074342.7455-1-hpa@redhat.com
Headers show
Series
  • Enabling AF algorithm to get the VCM attributes from the device driver
Related show

Message

Kate Hsuan April 14, 2022, 7:43 a.m. UTC
Some of the algorithm, such as autofocus needs the information from the
device to configure the range of the search or the maximum values of the
configurations. Currently, this information, such as VCM attributes was
hardcoded in the code so it can only be used for specific hardware. If the
device attributes can be got through the codes, the algorithm can be
dynamically configured based on the device attributes got from the kernel.

This work proposed an implementation that can be used to get the device
attribute from the kernel and allows the algorithm has a method to get the
device attribute without a specific call. Therefore, for example, the AF
algorithm can get the necessary maximum VCM steps value to configure itself.

First, VIDIOC_QUERYCTRL is used to get the device attributes for a given
control list. in other words, we can generate a control list and set a
control ID, such as V4L2_CID_FOCUS_ABSOLUTE to the list and then
this function will get the attribute and put maximum results to the control
list. Based on this, the interface can be implemented in each layer and
pass the values to the algorithms. Camara_lens is an entry to get the
maximum VCM steps value. Next, this action can be triggered in the pipeline
and the results will be stored in the "configInfo" before the IPA object is
created. Finally, after the IPA is created and initiated, the algorithm
can get the value from IPAContext.

Kate Hsuan (5):
  libcamera: v4l2_device: VIDIOC_QUERYCTRL call to fetch device
    attributes
  libcamera: camera_lens: Get maximum VCM steps
  ipa: ipu3: Variables to hold the maximum VCM steps
  libcamera: pipeline: ipu3: Get VCM information
  ipa: ipu3: af: Remove hardcoded maximum VCM steps

 include/libcamera/internal/camera_lens.h |  1 +
 include/libcamera/internal/v4l2_device.h |  2 ++
 include/libcamera/ipa/core.mojom         |  2 ++
 src/ipa/ipu3/algorithms/af.cpp           |  6 ++--
 src/ipa/ipu3/ipa_context.h               |  1 +
 src/ipa/ipu3/ipu3.cpp                    |  1 +
 src/libcamera/camera_lens.cpp            | 18 ++++++++++++
 src/libcamera/pipeline/ipu3/ipu3.cpp     | 15 ++++++++++
 src/libcamera/v4l2_device.cpp            | 37 ++++++++++++++++++++++++
 9 files changed, 80 insertions(+), 3 deletions(-)