Sub-device configuration models
cover Sub-device configuration models
Hello everyone,
I've been recently working (with others) on sub-device streams support as well as on internal pads. The two can be used to make sub-device configuration more versatile.
At the same time, the added interfaces are much more useful if we require specific semantics of those interfaces, so that the user space knows exactly what e.g. a given selection target signifies. However, as the same selection rectangle could be used for a different purpose on a non-raw sensor device, we need a way to tell how should the user space determine how to use a given interface.
I'm proposing to solve this problem by introducing sub-device configuration models, and by the common raw sensor model, also present in this patchset, in particular.
This has been (and will, for some time, continue to be) the reason why I have reviewed few sensor driver related patches lately. As we're introducing a new interface, it's beneficial to be able to use that interface right from the start, rather than trying to later on offer compatibility support, which is almost always a fair amount of work with less than desirable results in the driver.
With this solved, I believe we can enable the use of the streams UAPI.
Comments are welcome.
The compiled documentation can be found in <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/meta-format/output/userspace-api/media/v4l/dev-subdev.html#sub-device-configuration-models> and the patches here
<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=metadata>, i.e.
they're on top of the metadata set.
Sakari Ailus (4):
media: Documentation: Rework embedded data documentation
media: Documentation: Reword split of sensor driver to two classes
media: Documentation: Add subdev configuration models, raw sensor
model
media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
.../media/drivers/camera-sensor.rst | 28 +- .../media/v4l/common-raw-sensor.dia | 441 ++++++++++++++++++ .../media/v4l/common-raw-sensor.svg | 134 ++++++ .../userspace-api/media/v4l/dev-subdev.rst | 2 + .../media/v4l/ext-ctrls-image-process.rst | 4 + .../media/v4l/subdev-config-model.rst | 182 ++++++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 + include/uapi/linux/v4l2-controls.h | 3 + 8 files changed, 788 insertions(+), 11 deletions(-) create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.dia create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.svg create mode 100644 Documentation/userspace-api/media/v4l/subdev-config-model.rst
base-commit: 8e1285c798e1c1838a1ba68497849b2f57969fbc
Signature · 1 line
2.39.5
RFC 1/4 media: Documentation: Rework embedded data documentation
Rework embedded data documentation by removing the reference to the pixel data stream. The specific documentation of the embedded data interface will be elsewhere.
--- .../userspace-api/media/drivers/camera-sensor.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
Documentation/userspace-api/media/drivers/camera-sensor.rst +6 -7
@@ -111,13 +111,12 @@ the sensor configuration for the captured frame back to the host. While CSI-2 is the most common data interface used by such sensors, embedded data can be available on other interfaces as well. -Such sensors expose two internal sink pads (pads that have both the -``MEDIA_PAD_FL_SINK <MEDIA-PAD-FL-SINK>`` and ``MEDIA_PAD_FL_INTERNAL -<MEDIA-PAD-FL-INTERNAL>`` flags set) to model the source of the image and -embedded data streams. Both of these pads produces a single stream, and the -sub-device routes those streams to the external (source) pad. If the sub-device -driver supports disabling embedded data, this can be done by disabling the -embedded data route via the ``VIDIOC_SUBDEV_S_ROUTING`` IOCTL. +Embedded data support is indicated by an internal sink pad (pad that has both +the ``MEDIA_PAD_FL_SINK <MEDIA-PAD-FL-SINK>`` and ``MEDIA_PAD_FL_INTERNAL +<MEDIA-PAD-FL-INTERNAL>`` flags set) with a metadata format to model the +embedded data stream. If the sub-device driver supports disabling embedded data, +this can be done by disabling the embedded data route via the +``VIDIOC_SUBDEV_S_ROUTING`` IOCTL. In general, changing the embedded data format from the driver-configured values is not supported. The height of the metadata is device-specific and the width
Signature · 1 line
2.39.5
Re: [RFC 1/4] media: Documentation: Rework embedded data documentation
Hi Sakari
Quoted 3 lines · Sakari Ailus
Rework embedded data documentation by removing the reference to the pixel data stream. The specific documentation of the embedded data interface will be elsewhere.
I'm not sure how to interpret the last phrase. What specific documentation ? The formats description ? Should this be part of the commit message ?
Quoted 12 lines
Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/drivers/camera-sensor.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -111,13 +111,12 @@ the sensor configuration for the captured frame back to the host. While CSI-2 is the most common data interface used by such sensors, embedded data can be
Documentation/userspace-api/media/drivers/camera-sensor.rst the sensor configuration for the captured frame back to the host. While CSI-2 is · line 114
Quoted 10 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-7available on other interfaces as well. -Such sensors expose two internal sink pads (pads that have both the -``MEDIA_PAD_FL_SINK <MEDIA-PAD-FL-SINK>`` and ``MEDIA_PAD_FL_INTERNAL -<MEDIA-PAD-FL-INTERNAL>`` flags set) to model the source of the image and -embedded data streams. Both of these pads produces a single stream, and the -sub-device routes those streams to the external (source) pad. If the sub-device -driver supports disabling embedded data, this can be done by disabling the -embedded data route via the ``VIDIOC_SUBDEV_S_ROUTING`` IOCTL. +Embedded data support is indicated by an internal sink pad (pad that has both
"is indicated by the presence of an" ?
Documentation/userspace-api/media/drivers/camera-sensor.rst the sensor configuration for the captured frame back to the host. While CSI-2 is · line 119
Quoted 5 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +5
-0+the ``MEDIA_PAD_FL_SINK <MEDIA-PAD-FL-SINK>`` and ``MEDIA_PAD_FL_INTERNAL +<MEDIA-PAD-FL-INTERNAL>`` flags set) with a metadata format to model the +embedded data stream. If the sub-device driver supports disabling embedded data, +this can be done by disabling the embedded data route via the +``VIDIOC_SUBDEV_S_ROUTING`` IOCTL.
Quoted 7 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-1In general, changing the embedded data format from the driver-configured values is not supported. The height of the metadata is device-specific and the width --2.39.5
Re: [RFC 1/4] media: Documentation: Rework embedded data documentation
Hi Jacopo,
Quoted 9 lines · Jacopo Mondi
Hi Sakari
Quoted 3 lines · Sakari Ailus
Rework embedded data documentation by removing the reference to the pixel data stream. The specific documentation of the embedded data interface will be elsewhere.
I'm not sure how to interpret the last phrase. What specific documentation ? The formats description ? Should this be part of the
The embedded data interface. It'll be used by CCS and the new common raw sensor model.
I can add that.
Quoted 16 lines
commit message ?
Quoted 14 lines
Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/drivers/camera-sensor.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -111,13 +111,12 @@ the sensor configuration for the captured frame back to the host. While CSI-2 is the most common data interface used by such sensors, embedded data can be available on other interfaces as well.
Quoted 10 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst the sensor configuration for the captured frame back to the host. While CSI-2 is · line 114
Quoted 8 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-7-Such sensors expose two internal sink pads (pads that have both the -``MEDIA_PAD_FL_SINK <MEDIA-PAD-FL-SINK>`` and ``MEDIA_PAD_FL_INTERNAL -<MEDIA-PAD-FL-INTERNAL>`` flags set) to model the source of the image and -embedded data streams. Both of these pads produces a single stream, and the -sub-device routes those streams to the external (source) pad. If the sub-device -driver supports disabling embedded data, this can be done by disabling the -embedded data route via the ``VIDIOC_SUBDEV_S_ROUTING`` IOCTL. +Embedded data support is indicated by an internal sink pad (pad that has both"is indicated by the presence of an" ?
Sounds good.
Quoted 8 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst the sensor configuration for the captured frame back to the host. While CSI-2 is · line 119
Quoted 6 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +5
-0+the ``MEDIA_PAD_FL_SINK <MEDIA-PAD-FL-SINK>`` and ``MEDIA_PAD_FL_INTERNAL +<MEDIA-PAD-FL-INTERNAL>`` flags set) with a metadata format to model the +embedded data stream. If the sub-device driver supports disabling embedded data, +this can be done by disabling the embedded data route via the +``VIDIOC_SUBDEV_S_ROUTING`` IOCTL.Reviewed-by Jacopo Mondi <[email protected]>
Thanks!
Quoted 3 lines
Quoted 3 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-0In general, changing the embedded data format from the driver-configured values is not supported. The height of the metadata is device-specific and the width
Signature · 3 lines
Kind regards, Sakari Ailus
Re: [RFC 1/4] media: Documentation: Rework embedded data documentation
In reply to Sakari AilusHi Sakari,
Thank you for the patch.
Quoted 5 lines · Sakari Ailus
Rework embedded data documentation by removing the reference to the pixel data stream. The specific documentation of the embedded data interface will be elsewhere.
Signed-off-by Sakari Ailus <[email protected]>
(possibly with Jacopo's suggestion included)
Quoted 29 lines
--- .../userspace-api/media/drivers/camera-sensor.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)Documentation/userspace-api/media/drivers/camera-sensor.rst +6
-7@@ -111,13 +111,12 @@ the sensor configuration for the captured frame back to the host. While CSI-2 is the most common data interface used by such sensors, embedded data can be available on other interfaces as well. -Such sensors expose two internal sink pads (pads that have both the -``MEDIA_PAD_FL_SINK <MEDIA-PAD-FL-SINK>`` and ``MEDIA_PAD_FL_INTERNAL -<MEDIA-PAD-FL-INTERNAL>`` flags set) to model the source of the image and -embedded data streams. Both of these pads produces a single stream, and the -sub-device routes those streams to the external (source) pad. If the sub-device -driver supports disabling embedded data, this can be done by disabling the -embedded data route via the ``VIDIOC_SUBDEV_S_ROUTING`` IOCTL. +Embedded data support is indicated by an internal sink pad (pad that has both +the ``MEDIA_PAD_FL_SINK <MEDIA-PAD-FL-SINK>`` and ``MEDIA_PAD_FL_INTERNAL +<MEDIA-PAD-FL-INTERNAL>`` flags set) with a metadata format to model the +embedded data stream. If the sub-device driver supports disabling embedded data, +this can be done by disabling the embedded data route via the +``VIDIOC_SUBDEV_S_ROUTING`` IOCTL. In general, changing the embedded data format from the driver-configured valuesis not supported. The height of the metadata is device-specific and the width
Signature · 3 lines
Regards, Laurent Pinchart
RFC 2/4 media: Documentation: Reword split of sensor driver to two classes
In reply to Sakari AilusThe sensor drivers do not configure the output size of the sensors but the entire internal pipeline. Reflect this in the documentation.
--- .../userspace-api/media/drivers/camera-sensor.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Documentation/userspace-api/media/drivers/camera-sensor.rst +6 -4
@@ -10,11 +10,13 @@ used to control the camera sensor drivers. You may also find :ref:`media_writing_camera_sensor_drivers` useful. -Frame size ----------- +Sensor internal pipeline configuration +-------------------------------------- -There are two distinct ways to configure the frame size produced by camera -sensors. +The camera sensors have an internal processing pipeline including cropping and +binning functionality. The sensor drivers belong to two distinct classes, freely +configurable and register list based drivers, depending on how the driver +configures this functionality. Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.39.5
Re: [RFC 2/4] media: Documentation: Reword split of sensor driver to two classes
Hi Sakari
Quoted 14 lines · Sakari Ailus
The sensor drivers do not configure the output size of the sensors but the entire internal pipeline. Reflect this in the documentation.
Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/drivers/camera-sensor.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -10,11 +10,13 @@ used to control the camera sensor drivers.
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 16
Quoted 10 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +3
-4You may also find :ref:`media_writing_camera_sensor_drivers` useful. -Frame size ----------- +Sensor internal pipeline configuration +-------------------------------------- -There are two distinct ways to configure the frame size produced by camera -sensors. +The camera sensors have an internal processing pipeline including cropping and
As a non native speaker I'm probably wrong, but "The" followed by a plural name to identify a category sounds weird to me.
What about just
"Camera sensors have"
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 17
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+binning functionality. The sensor drivers belong to two distinct classes, freely
functionalities ?
Same question for "The sensor drivers", just "Sensor drivers" ?
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 18
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+configurable and register list based drivers, depending on how the driver
s/drivers/ones ?
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 19
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+configures this functionality.
configures the pipeline.
?
Quoted 7 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-1Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --2.39.5
Laurent Pinchart
Reviewed-byRe: [RFC 2/4] media: Documentation: Reword split of sensor driver to two classes
Quoted 29 lines · Jacopo Mondi
Quoted 14 lines · Sakari Ailus
The sensor drivers do not configure the output size of the sensors but the entire internal pipeline. Reflect this in the documentation.
Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/drivers/camera-sensor.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -10,11 +10,13 @@ used to control the camera sensor drivers.Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 16
Quoted 10 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +3
-4You may also find :ref:`media_writing_camera_sensor_drivers` useful. -Frame size ----------- +Sensor internal pipeline configuration +-------------------------------------- -There are two distinct ways to configure the frame size produced by camera -sensors. +The camera sensors have an internal processing pipeline including cropping andAs a non native speaker I'm probably wrong, but "The" followed by a plural name to identify a category sounds weird to me.
Quoted 2 lines
What about just
"Camera sensors have"
That's better, yes.
Quoted 3 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 17
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+binning functionality. The sensor drivers belong to two distinct classes, freelyfunctionalities ?
"functionality" is uncountable when it means "The ability to do a task, performance, or execution; a set of functions that something is able or equipped to perform".
Quoted 3 lines
Same question for "The sensor drivers", just "Sensor drivers" ?
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+configurable and register list based drivers, depending on how the driver
s/ based/-based/
Quoted 2 lines
s/drivers/ones ?
The English language is less concerned about repetitions than French, and I assume also Italian. "[...] and register list-based ones" sound less natural to me.
Quoted 3 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 19
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+configures this functionality.configures the pipeline.
Ack on this change.
Quoted 5 lines
?
Quoted 3 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-0Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC 2/4] media: Documentation: Reword split of sensor driver to two classes
Hi Laurent, Jacopo,
Quoted 30 lines · Laurent Pinchart
Quoted 29 lines · Jacopo Mondi
Quoted 14 lines · Sakari Ailus
The sensor drivers do not configure the output size of the sensors but the entire internal pipeline. Reflect this in the documentation.
Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/drivers/camera-sensor.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -10,11 +10,13 @@ used to control the camera sensor drivers.Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 16
Quoted 10 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +3
-4You may also find :ref:`media_writing_camera_sensor_drivers` useful. -Frame size ----------- +Sensor internal pipeline configuration +-------------------------------------- -There are two distinct ways to configure the frame size produced by camera -sensors. +The camera sensors have an internal processing pipeline including cropping andAs a non native speaker I'm probably wrong, but "The" followed by a plural name to identify a category sounds weird to me.
Quoted 4 lines
Quoted 2 lines
What about just
"Camera sensors have"That's better, yes.
Agreed.
Quoted 9 lines
Quoted 4 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 17
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+binning functionality. The sensor drivers belong to two distinct classes, freelyfunctionalities ?
"functionality" is uncountable when it means "The ability to do a task, performance, or execution; a set of functions that something is able or equipped to perform".
Quoted 5 lines
Quoted 3 lines
Same question for "The sensor drivers", just "Sensor drivers" ?
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+configurable and register list based drivers, depending on how the drivers/ based/-based/
There are about four other instances of this, I can change those too...
Quoted 7 lines
Quoted 3 lines
s/drivers/ones ?
The English language is less concerned about repetitions than French, and I assume also Italian. "[...] and register list-based ones" sound less natural to me.
Yes, yes, yes, yes.
Quoted 8 lines
Quoted 4 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 19
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+configures this functionality.configures the pipeline.
Ack on this change.
Reviewed-by Laurent Pinchart <[email protected]>
Thanks!
Signature · 3 lines
Regards, Sakari Ailus
Re: [RFC 2/4] media: Documentation: Reword split of sensor driver to two classes
Quoted 49 lines · Sakari Ailus
Hi Laurent, Jacopo,
Quoted 30 lines · Laurent Pinchart
Quoted 29 lines · Jacopo Mondi
Quoted 14 lines · Sakari Ailus
The sensor drivers do not configure the output size of the sensors but the entire internal pipeline. Reflect this in the documentation.
Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/drivers/camera-sensor.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Documentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -10,11 +10,13 @@ used to control the camera sensor drivers.Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 16
Quoted 10 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +3
-4You may also find :ref:`media_writing_camera_sensor_drivers` useful. -Frame size ----------- +Sensor internal pipeline configuration +-------------------------------------- -There are two distinct ways to configure the frame size produced by camera -sensors. +The camera sensors have an internal processing pipeline including cropping andAs a non native speaker I'm probably wrong, but "The" followed by a plural name to identify a category sounds weird to me.
Quoted 4 lines
Quoted 2 lines
What about just
"Camera sensors have"That's better, yes.
Agreed.
Quoted 9 lines
Quoted 4 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 17
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+binning functionality. The sensor drivers belong to two distinct classes, freelyfunctionalities ?
"functionality" is uncountable when it means "The ability to do a task, performance, or execution; a set of functions that something is able or equipped to perform".
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Same question for "The sensor drivers", just "Sensor drivers" ?
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+configurable and register list based drivers, depending on how the drivers/ based/-based/
There are about four other instances of this, I can change those too...
Those are register list-based drivers. Those drivers are register list based.
Quoted 18 lines
Quoted 6 lines
Quoted 2 lines
s/drivers/ones ?
The English language is less concerned about repetitions than French, and I assume also Italian. "[...] and register list-based ones" sound less natural to me.
Yes, yes, yes, yes.
Quoted 7 lines
Quoted 3 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst used to control the camera sensor drivers. · line 19
Quoted 1 line
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+configures this functionality.configures the pipeline.
Ack on this change.
Reviewed-by Laurent Pinchart <[email protected]>Thanks!
Signature · 3 lines
Regards, Laurent Pinchart
RFC 3/4 media: Documentation: Add subdev configuration models, raw sensor model
In reply to Sakari AilusSub-device configuration models define what V4L2 API elements are available on a compliant sub-device and how do they behave.
The patch also adds a model for common raw sensors.
--- .../media/drivers/camera-sensor.rst | 5 + .../media/v4l/common-raw-sensor.dia | 441 ++++++++++++++++++ .../media/v4l/common-raw-sensor.svg | 134 ++++++ .../userspace-api/media/v4l/dev-subdev.rst | 2 + .../media/v4l/subdev-config-model.rst | 180 +++++++ 5 files changed, 762 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.dia create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.svg create mode 100644 Documentation/userspace-api/media/v4l/subdev-config-model.rst
Documentation/userspace-api/media/drivers/camera-sensor.rst +5 -0
@@ -18,6 +18,9 @@ binning functionality. The sensor drivers belong to two distinct classes, freely configurable and register list based drivers, depending on how the driver configures this functionality. +Also see +:ref:`media_subdev_config_model_common_raw_sensor`. + Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -105,6 +108,8 @@ values programmed by the register sequences. The default values of these controls shall be 0 (disabled). Especially these controls shall not be inverted, independently of the sensor's mounting rotation. +.. _media_using_camera_sensor_drivers_embedded_data: + Embedded data -------------
Documentation/userspace-api/media/v4l/common-raw-sensor.dia new file +441 -0
441 lines not on this page · raw message
Documentation/userspace-api/media/v4l/common-raw-sensor.svg new file +134 -0
134 lines not on this page · raw message
Documentation/userspace-api/media/v4l/dev-subdev.rst +2 -0
@@ -838,3 +838,5 @@ stream while it may be possible to enable and disable the embedded data stream. The embedded data format does not need to be configured on the sensor's pads as the format is dictated by the pixel data format in this case. + +.. include:: subdev-config-model.rst
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +180 -0
180 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [RFC 3/4] media: Documentation: Add subdev configuration models, raw sensor model
Hi Sakari
Quoted 32 lines · Sakari Ailus
Sub-device configuration models define what V4L2 API elements are available on a compliant sub-device and how do they behave.
The patch also adds a model for common raw sensors.
Signed-off-by Sakari Ailus <[email protected]>--- .../media/drivers/camera-sensor.rst | 5 + .../media/v4l/common-raw-sensor.dia | 441 ++++++++++++++++++ .../media/v4l/common-raw-sensor.svg | 134 ++++++ .../userspace-api/media/v4l/dev-subdev.rst | 2 + .../media/v4l/subdev-config-model.rst | 180 +++++++ 5 files changed, 762 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.dia create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.svg create mode 100644 Documentation/userspace-api/media/v4l/subdev-config-model.rstDocumentation/userspace-api/media/drivers/camera-sensor.rst +3
-0@@ -18,6 +18,9 @@ binning functionality. The sensor drivers belong to two distinct classes, freely configurable and register list based drivers, depending on how the driver configures this functionality. +Also see +:ref:`media_subdev_config_model_common_raw_sensor`. + Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Documentation/userspace-api/media/drivers/camera-sensor.rst values programmed by the register sequences. The default values of these · line 115
Quoted 8 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +2
-0@@ -105,6 +108,8 @@ values programmed by the register sequences. The default values of these controls shall be 0 (disabled). Especially these controls shall not be inverted, independently of the sensor's mounting rotation. +.. _media_using_camera_sensor_drivers_embedded_data: + Embedded data -------------
[snip images]
Quoted 18 lines
Documentation/userspace-api/media/v4l/dev-subdev.rst +2
-0@@ -838,3 +838,5 @@ stream while it may be possible to enable and disable the embedded data stream. The embedded data format does not need to be configured on the sensor's pads as the format is dictated by the pixel data format in this case. + +.. include:: subdev-config-model.rstDocumentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0@@ -0,0 +1,180 @@ +.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later +
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 12
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+Sub-device configuration models +=============================== + +A sub-device configuration model specifies in detail what the user space can +expect from a sub-device in terms of V4L2 sub-device interface support, +including semantics specific to a given configuration model. + +A sub-device may implement more than one configuration model at the same +time. The implemented configuration models can be obtained from the sub-device's +``V4L2_CID_CONFIG_MODEL`` control.
Isn't a control an overkill ? Isn't enough to identify that a sensor produces RAW images and has an internal pad to the below description ?
Also, would it be the single sensor driver that has to correctly populate the control ?
Quoted 13 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +13
-0+ +.. _media_subdev_config_model_common_raw_sensor: + +Common raw camera sensor model +------------------------------ + +The common raw camera sensor model defines the configurability of a superset +that covers the vast majority of raw camera sensors. Not all of the +configuration and enumeration interfaces are offered by all drivers. + +A sub-device complies with the common raw sensor model if the +``V4L2_CONFIG_MODEL_COMMON_RAW`` bit is set in the ``V4L2_CID_CONFIG_MODEL`` +control of the sub-device.
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 35
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+ +The common raw camera sensor model is aligned with +:ref:`media_using_camera_sensor_drivers`. Please refer to that regarding aspects +not specified here. + +Each camera sensor implementing the common raw sensor model exposes a single +V4L2 sub-device. The sub-device contains a single source pad (0) and two or more +internal pads: an image data internal pad (1) and optionally an embedded data +pad (2). Additionally, further internal pads may be supported for other +features, in which case they are documented separately for the given device.
That's pretty easy to identify from userspace without a control, isn't it ?
Quoted 13 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +13
-0+ +This is show in :ref:`media_subdev_config_model_common_raw_sensor_subdev`. + +.. _media_subdev_config_model_common_raw_sensor_subdev: + +.. kernel-figure:: common-raw-sensor.svg + :alt: common-raw-sensor.svg + :align: center + + **Common raw sensor sub-device** + +Routes +^^^^^^
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 58
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+ +A sub-device conforming to common raw camera sensor model implements the +following routes. + +.. flat-table:: Routes + :header-rows: 1 + + * - Sink pad/stream + - Source pad/stream + - Static (X/M(aybe)/-)
afaiu either the route is Static (cannot be changed) or it is not. What does Maybe means here ?
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ - Mandatory (X/-) + - Synopsis + * - 1/0 + - 0/0 + - X
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 73
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+ - X + - Image data + * - 2/0 + - 0/1 + - M + - - + - Embedded data + +Some devices may support enabling and disabling the embedded data stream. Others +may not support it at all, in which case the embedded data route does not exist.
Does the driver need to expose a routing table at all if it has a single, immutable image data stream ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 77
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ +Sensor pixel array size, cropping and binning +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +
This is not something I was expecting here. We teach how to compute framerates for RAW sensors in camera-sensor.rst ("Using camera sensor drivers") specifying which controls a sensor driver should register and the expected controls units. It seems to me we define part of the expected interface exposed by a raw camera sensor there and part here. I wonder if camera-sensor.rst makes any sense at all if we define the "models" here.
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 83
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +6
-0+The sensor's pixel array is divided into one or more areas. The areas around the +edge of the pixel array, usually one one or more sides, may contain optical +black pixels, dummy pixels and other non-image pixels. + +A rectangle within the pixel area contains the visible pixels. Capturing the +non-visible pixels may be supported by the sensor.
This is a bit of simplification, as I presume there might be rectangles of visible pixels which overlap in the most advanced use cases.
https://git.libcamera.org/libcamera/libcamera.git/tree/src/libcamera/property_ids_core.yaml#n594
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 93
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+ +The sensor can perform three operations that affect the output image size. First +comes analogue crop. This configuration limits parts of the pixel array which +the sensor will read, affecting sensor timing as well. The granularity of the +analogue crop configuration varies greatly across sensors: some sensors support +a few different analogue crop configurations whereas others may support anything +divisible by a given number of pixels. + +The default analogue crop rectangle corresponds to the visible pixel area if +supported by the hardware.
In what sense "if supported by the hardware" ? Is this referring to the "visibile pixel area" ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 97
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ +In the next step, binning is performed on the image data read from camera +sensor's pixel array. This will effectively result in an image smaller than the +original by given proportions horizontally and vertically. Typical values are
s/proportions/scaling factors/ ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 101
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+1/2 and 1/3 but others may well be supported by the hardware as well. + +The combination of the analogue crop and binning operations may result in an +image size that may be larger than desirable. For this purpose, a digital crop
This is highly optional it seems.
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 111
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+operation may be performed on the binned image. The resulting image size is +further outputted by the sensor. + +.. flat-table:: Selection targets on pads + :header-rows: 1 + + * - Pad/Stream + - Selection target/format + - Mandatory (X/-) + - Synopsis
What about an R/W column ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 116
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ * - 1/0 + - Format + - X + - Image data format. The width and height fields of this format are the + same than those for the V4L2_SEL_TGT_CROP_BOUNDS rectangle. The media
Can sizes be changed at all ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 127
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +11
-0+ bus code of this format reflects the native pixel depth of the sensor. + * - 1/0 + - V4L2_SEL_TGT_NATIVE_SIZE + - X + - The full size of the pixel array, including all pixels in the pixel + array, even if they cannot be captured. This rectangle is relative to + the format on the same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_CROP_BOUNDS + - X + - The crop rectangle bounds. No pixels outside this area can be
I would describe it as "the readable part of the full pixel array area" instead of repeating "crop rectangle bounds"
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 133
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ captured. This rectangle is relative to the V4L2_SEL_TGT_NATIVE_SIZE + * - 1/0 + - V4L2_SEL_TGT_CROP_DEFAULT + - X + - The visible pixel area. This rectangle is relative to the
Isn't this the default analogue crop rectangle ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 145
Quoted 12 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +12
-0+ V4L2_SEL_TGT_NATIVE_SIZE rectangle on the same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_CROP + - \- + - Analogue crop. Analogue crop typically has a coarse granularity. This + rectangle is relative to the V4L2_SEL_TGT_NATIVE_SIZE rectangle on the + same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_COMPOSE + - \- + - Binning. This rectangle is relative to the V4L2_SEL_TGT_CROP + rectangle on the same (pad, stream).
The size ratio between the V4L2_SEL_TGT_CROP and V4L2_SEL_TGT_COMPOSE rectangles selects the desired binning factor.
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ * - 2/0 + - Format + - X + - Embedded data format. + * - 0/0
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 160
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+ - V4L2_SEL_TGT_CROP + - \- + - Digital crop. This rectangle is relative to the V4L2_SEL_TGT_COMPOSE + rectangle on (pad, stream) pair 1/0. + * - 0/0 + - Format + - X + - Image data source format. The width and height fields of the format are + the same than for the V4L2_SEL_TGT crop rectangle on (pad, stream) pair + 0/0 where as the media bus code reflects the pixel data output of the
s/where as/and ?
Or maybe I didn't get what you mean
Quoted 24 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +20
-1+ sensor. + * - 0/1 + - Format + - X + - Embedded data source format. + +Embedded data +^^^^^^^^^^^^^ + +The embedded data stream is produced by the sensor when the corresponding route +is enabled. The embedded data route may also be immutable or not exist at all, +in case the sensor (or the driver) does not support it. + +Generally the sensor embedded data width is determined by the width of the image +data whereas the number of lines are constant for the embedded data. The user +space may obtain the size of the embedded data once the image data size on the +source pad has been configured. + +Also see :ref:`media_using_camera_sensor_drivers_embedded_data`. + --2.39.5
Re: [RFC 3/4] media: Documentation: Add subdev configuration models, raw sensor model
Hello,
Quoted 26 lines · Jacopo Mondi
Quoted 25 lines · Sakari Ailus
Sub-device configuration models define what V4L2 API elements are available on a compliant sub-device and how do they behave.
The patch also adds a model for common raw sensors.
Signed-off-by Sakari Ailus <[email protected]>--- .../media/drivers/camera-sensor.rst | 5 + .../media/v4l/common-raw-sensor.dia | 441 ++++++++++++++++++ .../media/v4l/common-raw-sensor.svg | 134 ++++++ .../userspace-api/media/v4l/dev-subdev.rst | 2 + .../media/v4l/subdev-config-model.rst | 180 +++++++ 5 files changed, 762 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.dia create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.svg create mode 100644 Documentation/userspace-api/media/v4l/subdev-config-model.rstDocumentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -18,6 +18,9 @@ binning functionality. The sensor drivers belong to two distinct classes, freely configurable and register list based drivers, depending on how the driver configures this functionality.
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst binning functionality. The sensor drivers belong to two distinct classes, freely · line 22
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +2
-0+Also see +:ref:`media_subdev_config_model_common_raw_sensor`.
The line break doesn't seem necessary.
Quoted 8 lines
Quoted 8 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+ Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@@ -105,6 +108,8 @@ values programmed by the register sequences. The default values of these controls shall be 0 (disabled). Especially these controls shall not be inverted, independently of the sensor's mounting rotation.
Quoted 6 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst values programmed by the register sequences. The default values of these · line 114
Quoted 4 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +2
-0+.. _media_using_camera_sensor_drivers_embedded_data: + Embedded data -------------[snip images]
One day we should probably try to unify the look & feel of all diagrams in the V4L2 documentation. One day :-)
Quoted 10 lines
Documentation/userspace-api/media/v4l/dev-subdev.rst stream while it may be possible to enable and disable the embedded data stream. · line 842
Quoted 10 lines
Documentation/userspace-api/media/v4l/dev-subdev.rst +2
-0@@ -838,3 +838,5 @@ stream while it may be possible to enable and disable the embedded data stream. The embedded data format does not need to be configured on the sensor's pads as the format is dictated by the pixel data format in this case. + +.. include:: subdev-config-model.rst
I think we should reorganize the documentation at some point. Things are getting a bit too deep, with e.g. 4.13.5.1.2. That's for later. Splitting the configuration model to a separate file as done in this patch will be helpful.
Quoted 9 lines
Quoted 9 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +3
-0@@ -0,0 +1,180 @@ +.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later + +Sub-device configuration models
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +8
-0+=============================== + +A sub-device configuration model specifies in detail what the user space can +expect from a sub-device in terms of V4L2 sub-device interface support, +including semantics specific to a given configuration model. + +A sub-device may implement more than one configuration model at the same +time.
I wonder how that would work. I assume that, with the control being read-only, you don't envision userspace selecting a model at runtime, but rather drivers implementing the union (or intersection ?) of multiple models. Do you have use cases in mind, or is this only to prepare for a hypothetical future where this could happen ?
Quoted 5 lines
The implemented configuration models can be obtained from the sub-device's
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 12
Quoted 1 line
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +1
-0+``V4L2_CID_CONFIG_MODEL`` control.Isn't a control an overkill ? Isn't enough to identify that a sensor produces RAW images and has an internal pad to the below description ?
V4L2 has a set of low-level, generic interfaces such as pads (external and internal), formats, selection rectangles, routes, and controls. We have some documentation about how those should be used, with a relatively generic model defined in the "Order of configuration and format propagation" section of Documentation/userspace-api/media/v4l/dev-subdev.rst. The different API elements are however mostly defined independently of each other (very little is said about interactions between controls and formats or selection rectangles for instance), and we don't document how they should be mapped to device features. This results in different drivers for similar devices using the API elements differently, sometimes in ways that breach the documented API. Userspace ends up implementing heuristics and pray that thing work.
The whole idea behind configuration models is to avoid heuristics. That's why we want an explicit API element to indicate what configuration model a device supports, and document that model explicitly in the kernel documentation.
Quoted 10 lines
Also, would it be the single sensor driver that has to correctly populate the control ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 19
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +7
-0+ +.. _media_subdev_config_model_common_raw_sensor: + +Common raw camera sensor model +------------------------------ + +The common raw camera sensor model defines the configurability of a superset
A superset of what ? Reading the next sentence I suspect you mean that this model defines a set of features that compliant subdevs have to use as documented, but where some API elements could be left unused by a driver if the corresponding device doesn't implement the corresponding hardware feature. Clarifying this would be nice.
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 29
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+that covers the vast majority of raw camera sensors. Not all of the +configuration and enumeration interfaces are offered by all drivers. + +A sub-device complies with the common raw sensor model if the +``V4L2_CONFIG_MODEL_COMMON_RAW`` bit is set in the ``V4L2_CID_CONFIG_MODEL`` +control of the sub-device. + +The common raw camera sensor model is aligned with +:ref:`media_using_camera_sensor_drivers`. Please refer to that regarding aspects +not specified here.
Could we write this to emphasize the fact that media_using_camera_sensor_drivers defines concepts common to all camera sensors, while the model here focusses on how drivers expose API elements for this particular model ? "is aligned with" is a bit vague.
Quoted 9 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 35
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +6
-0+ +Each camera sensor implementing the common raw sensor model exposes a single +V4L2 sub-device. The sub-device contains a single source pad (0) and two or more +internal pads: an image data internal pad (1) and optionally an embedded data +pad (2). Additionally, further internal pads may be supported for other +features, in which case they are documented separately for the given device.That's pretty easy to identify from userspace without a control, isn't it ?
See above.
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 37
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+ +This is show in :ref:`media_subdev_config_model_common_raw_sensor_subdev`.
s/show/shown/
Maybe
This is show in the :ref:media_subdev_config_model_common_raw_sensor_subdev figure.
Or is there a sphinx directive other than ref that would automate this ?
Quoted 16 lines
Quoted 16 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +16
-0+ +.. _media_subdev_config_model_common_raw_sensor_subdev: + +.. kernel-figure:: common-raw-sensor.svg + :alt: common-raw-sensor.svg + :align: center + + **Common raw sensor sub-device** + +Routes +^^^^^^ + +A sub-device conforming to common raw camera sensor model implements the +following routes. + +.. flat-table:: Routes
Quoted 20 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 58
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ :header-rows: 1 + + * - Sink pad/stream + - Source pad/stream + - Static (X/M(aybe)/-)afaiu either the route is Static (cannot be changed) or it is not. What does Maybe means here ?
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +11
-0+ - Mandatory (X/-) + - Synopsis + * - 1/0 + - 0/0 + - X + - X + - Image data + * - 2/0 + - 0/1 + - M + - -
This is interpreted as a list, translated to
<ul class="simple">
<li></li>
</ul>
and rendered as •
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 73
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ - Embedded data + +Some devices may support enabling and disabling the embedded data stream. Others +may not support it at all, in which case the embedded data route does not exist.
"may not support it at all" can be interpreted as "maybe not support enabling and disabling it at all", i.e. only support a static always enabled route. Based on the last sentence that's not what you mean, it could be reworded.
Quoted 3 lines
Does the driver need to expose a routing table at all if it has a single, immutable image data stream ?
I think it should. If there are internal pads, they should be an internal routing table, at the very least for consistency. It will make userspace simpler I believe (and we can check that statement with a libcamera implementation :-)).
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 77
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ +Sensor pixel array size, cropping and binning +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +
Quoted 7 lines
This is not something I was expecting here. We teach how to compute framerates for RAW sensors in
camera-sensor.rst("Using camera sensor drivers") specifying which controls a sensor driver should register and the expected controls units. It seems to me we define part of the expected interface exposed by a raw camera sensor there and part here. I wonder ifcamera-sensor.rstmakes any sense at all if we define the "models" here.
Good question. I find the split to be a bit artificial indeed, and it's not clear where some of the parts should live. I think we still need a document that explains concept common to raw sensors, regardless of the model. We probably won't get the split entirely right on the first try, and that's fine with me, we can refine it later.
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 79
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+The sensor's pixel array is divided into one or more areas. The areas around the +edge of the pixel array, usually one one or more sides, may contain optical
"one one" ?
Quoted 3 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 82
Quoted 3 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +3
-0+black pixels, dummy pixels and other non-image pixels. + +A rectangle within the pixel area contains the visible pixels. Capturing the
Above you wrote "pixel array", and here "pixel area".
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 83
Quoted 1 line
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +1
-0+non-visible pixels may be supported by the sensor.This is a bit of simplification, as I presume there might be rectangles of visible pixels which overlap in the most advanced use cases.
https://git.libcamera.org/libcamera/libcamera.git/tree/src/libcamera/property_ids_core.yaml#n594
That's a more generic model. I'd like to see if there are sensors implementing it. Sakari, does CCS support that ?
This being said, we could restrict this subdev model to supporting only sensors with a rectangular visible pixels area.
Quoted 5 lines
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ +The sensor can perform three operations that affect the output image size. First +comes analogue crop. This configuration limits parts of the pixel array which +the sensor will read, affecting sensor timing as well. The granularity of the +analogue crop configuration varies greatly across sensors: some sensors support
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 93
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+a few different analogue crop configurations whereas others may support anything +divisible by a given number of pixels. + +The default analogue crop rectangle corresponds to the visible pixel area if +supported by the hardware.In what sense "if supported by the hardware" ? Is this referring to the "visibile pixel area" ?
I assume this means "if analogue crop is supported by the hardware". This should be clarified.
Quoted 14 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 97
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ +In the next step, binning is performed on the image data read from camera +sensor's pixel array. This will effectively result in an image smaller than the +original by given proportions horizontally and vertically. Typical values ares/proportions/scaling factors/ ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 101
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+1/2 and 1/3 but others may well be supported by the hardware as well. + +The combination of the analogue crop and binning operations may result in an +image size that may be larger than desirable. For this purpose, a digital cropThis is highly optional it seems.
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 103
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+operation may be performed on the binned image. The resulting image size is +further outputted by the sensor.
s/outputted/output/ ? I think "outputted" is correct, but I believe it's less common.
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 111
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +8
-0+ +.. flat-table:: Selection targets on pads + :header-rows: 1 + + * - Pad/Stream + - Selection target/format + - Mandatory (X/-) + - SynopsisWhat about an R/W column ?
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 116
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ * - 1/0 + - Format + - X + - Image data format. The width and height fields of this format are the + same than those for the V4L2_SEL_TGT_CROP_BOUNDS rectangle. The mediaCan sizes be changed at all ?
For the internal image pad, I wouldn't think so. I think it should expose the full readable array. Or, reading what you wrote below, do you envision this including non-readable pixels too ?
Mapping pixel array definitions from datasheets to formats and selection rectangles is hard, as datasheets, when they are available, are often confusing. Datasheets from different vendors, or even for different sensors of the same vendor, often have different models. I think we need to be extra precise here, and possibly work with sensor vendors. Using the CCS model as a base could be useful.
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 123
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +7
-0+ bus code of this format reflects the native pixel depth of the sensor. + * - 1/0 + - V4L2_SEL_TGT_NATIVE_SIZE + - X + - The full size of the pixel array, including all pixels in the pixel + array, even if they cannot be captured. This rectangle is relative to + the format on the same (pad, stream).
Mix of tabs and spaces.
What do you mean by "relative to the format on the same (pad, stream)" ? Does it mean the rectangle is expressed relatively to a rectangle defined as (0,0),(fmt.width x fmt.height) ? That doesn't seem to match the description of the format and V4L2_SEL_TGT_CROP_BOUNDS, as the format is defined as having the same width and height as V4L2_SEL_TGT_CROP_BOUNDS, and V4L2_SEL_TGT_CROP_BOUNDS is defined as being relative to V4L2_SEL_TGT_NATIVE_SIZE. I assume you mean something else, it should be clarified.
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 127
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ * - 1/0 + - V4L2_SEL_TGT_CROP_BOUNDS + - X + - The crop rectangle bounds. No pixels outside this area can beI would describe it as "the readable part of the full pixel array area" instead of repeating "crop rectangle bounds"
Agreed. I would also explicitly state this can include black pixels. I wonder if we should also define border pixels in this document.
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 133
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ captured. This rectangle is relative to the V4L2_SEL_TGT_NATIVE_SIZE + * - 1/0 + - V4L2_SEL_TGT_CROP_DEFAULT + - X + - The visible pixel area. This rectangle is relative to theIsn't this the default analogue crop rectangle ?
I assume so, and it should be documented as such explicitly. Also, if the default crop rectangle doesn't include some of the readable pixels,
Quoted 13 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 145
Quoted 12 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +12
-0+ V4L2_SEL_TGT_NATIVE_SIZE rectangle on the same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_CROP + - \- + - Analogue crop. Analogue crop typically has a coarse granularity. This + rectangle is relative to the V4L2_SEL_TGT_NATIVE_SIZE rectangle on the + same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_COMPOSE + - \- + - Binning. This rectangle is relative to the V4L2_SEL_TGT_CROP + rectangle on the same (pad, stream).
Quoted 17 lines
The size ratio between the
V4L2_SEL_TGT_CROPandV4L2_SEL_TGT_COMPOSErectangles selects the desired binning factor.Quoted 14 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +14
-0+ * - 2/0 + - Format + - X + - Embedded data format. + * - 0/0 + - V4L2_SEL_TGT_CROP + - \- + - Digital crop. This rectangle is relative to the V4L2_SEL_TGT_COMPOSE + rectangle on (pad, stream) pair 1/0. + * - 0/0 + - Format + - X + - Image data source format. The width and height fields of the format are + the same than for the V4L2_SEL_TGT crop rectangle on (pad, stream) pair
I think you meant "V4L2_SEL_TGT_CROP rectangle" here.
Quoted 10 lines
Quoted 1 line
+ 0/0 where as the media bus code reflects the pixel data output of the
s/where as/and ?
Or maybe I didn't get what you meanQuoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ sensor. + * - 0/1 + - Format + - X + - Embedded data source format.
I think we also need to consider skipping.
Quoted 15 lines
Quoted 15 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +15
-0+ +Embedded data +^^^^^^^^^^^^^ + +The embedded data stream is produced by the sensor when the corresponding route +is enabled. The embedded data route may also be immutable or not exist at all, +in case the sensor (or the driver) does not support it. + +Generally the sensor embedded data width is determined by the width of the image +data whereas the number of lines are constant for the embedded data. The user +space may obtain the size of the embedded data once the image data size on the +source pad has been configured. + +Also see :ref:`media_using_camera_sensor_drivers_embedded_data`. +
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC 3/4] media: Documentation: Add subdev configuration models, raw sensor model
Hi Jacopo, Laurent,
Thank you for the review.
Quoted 29 lines · Laurent Pinchart
Hello,
Quoted 26 lines · Jacopo Mondi
Quoted 25 lines · Sakari Ailus
Sub-device configuration models define what V4L2 API elements are available on a compliant sub-device and how do they behave.
The patch also adds a model for common raw sensors.
Signed-off-by Sakari Ailus <[email protected]>--- .../media/drivers/camera-sensor.rst | 5 + .../media/v4l/common-raw-sensor.dia | 441 ++++++++++++++++++ .../media/v4l/common-raw-sensor.svg | 134 ++++++ .../userspace-api/media/v4l/dev-subdev.rst | 2 + .../media/v4l/subdev-config-model.rst | 180 +++++++ 5 files changed, 762 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.dia create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.svg create mode 100644 Documentation/userspace-api/media/v4l/subdev-config-model.rstDocumentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -18,6 +18,9 @@ binning functionality. The sensor drivers belong to two distinct classes, freely configurable and register list based drivers, depending on how the driver configures this functionality.
Quoted 4 lines
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst binning functionality. The sensor drivers belong to two distinct classes, freely · line 22
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +2
-0+Also see +:ref:`media_subdev_config_model_common_raw_sensor`.The line break doesn't seem necessary.
I agree.
Quoted 16 lines
Quoted 9 lines
Quoted 9 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+ Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@@ -105,6 +108,8 @@ values programmed by the register sequences. The default values of these controls shall be 0 (disabled). Especially these controls shall not be inverted, independently of the sensor's mounting rotation.Quoted 6 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst values programmed by the register sequences. The default values of these · line 114
Quoted 4 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +2
-0+.. _media_using_camera_sensor_drivers_embedded_data: + Embedded data -------------[snip images]
Quoted 2 lines
One day we should probably try to unify the look & feel of all diagrams in the V4L2 documentation. One day :-)
That day may or may not come. :-)
Quoted 32 lines
Quoted 11 lines
Documentation/userspace-api/media/v4l/dev-subdev.rst stream while it may be possible to enable and disable the embedded data stream. · line 842
Quoted 11 lines
Documentation/userspace-api/media/v4l/dev-subdev.rst +2
-0@@ -838,3 +838,5 @@ stream while it may be possible to enable and disable the embedded data stream. The embedded data format does not need to be configured on the sensor's pads as the format is dictated by the pixel data format in this case. + +.. include:: subdev-config-model.rstI think we should reorganize the documentation at some point. Things are getting a bit too deep, with e.g. 4.13.5.1.2. That's for later. Splitting the configuration model to a separate file as done in this patch will be helpful.
Quoted 15 lines
Quoted 15 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +9
-0@@ -0,0 +1,180 @@ +.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later + +Sub-device configuration models +=============================== + +A sub-device configuration model specifies in detail what the user space can +expect from a sub-device in terms of V4L2 sub-device interface support, +including semantics specific to a given configuration model. +
Quoted 8 lines
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 11
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+A sub-device may implement more than one configuration model at the same +time.I wonder how that would work. I assume that, with the control being read-only, you don't envision userspace selecting a model at runtime, but rather drivers implementing the union (or intersection ?) of multiple models. Do you have use cases in mind, or is this only to prepare for a hypothetical future where this could happen ?
Let's suppose we would use configuration models to tell about other parts of the sub-device than just what pads, links and streams may be present. A number of things currently work implicitly, for instance whether a sensor frame time is configured through controls or a dedicated IOCTL. I'm not sure I'd add a configuration model for that exactly but something like that seems entirely reasonable. It'd be orthogonal to the common raw sensor model.
Quoted 28 lines
Quoted 6 lines
The implemented configuration models can be obtained from the sub-device's
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 12
Quoted 1 line
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +1
-0+``V4L2_CID_CONFIG_MODEL`` control.Isn't a control an overkill ? Isn't enough to identify that a sensor produces RAW images and has an internal pad to the below description ?
V4L2 has a set of low-level, generic interfaces such as pads (external and internal), formats, selection rectangles, routes, and controls. We have some documentation about how those should be used, with a relatively generic model defined in the "Order of configuration and format propagation" section of
Documentation/userspace-api/media/v4l/dev-subdev.rst. The different API elements are however mostly defined independently of each other (very little is said about interactions between controls and formats or selection rectangles for instance), and we don't document how they should be mapped to device features. This results in different drivers for similar devices using the API elements differently, sometimes in ways that breach the documented API. Userspace ends up implementing heuristics and pray that thing work.The whole idea behind configuration models is to avoid heuristics. That's why we want an explicit API element to indicate what configuration model a device supports, and document that model explicitly in the kernel documentation.
Quoted 3 lines
Also, would it be the single sensor driver that has to correctly populate the control ?
Quoted 13 lines
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 19
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +7
-0+ +.. _media_subdev_config_model_common_raw_sensor: + +Common raw camera sensor model +------------------------------ + +The common raw camera sensor model defines the configurability of a supersetA superset of what ? Reading the next sentence I suspect you mean that this model defines a set of features that compliant subdevs have to use as documented, but where some API elements could be left unused by a driver if the corresponding device doesn't implement the corresponding hardware feature. Clarifying this would be nice.
The intent is to say not everything may be impelemented by the sensors but there may be simpler ways to do that. How about:
The common raw camera sensor model defines a set of configuration options (formats, selections etc.) that cover the vast majority of funcitionality of raw camera sensors. Not all of the configuration and enumeration interfaces are offered by all drivers.
Quoted 16 lines
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 29
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+that covers the vast majority of raw camera sensors. Not all of the +configuration and enumeration interfaces are offered by all drivers. + +A sub-device complies with the common raw sensor model if the +``V4L2_CONFIG_MODEL_COMMON_RAW`` bit is set in the ``V4L2_CID_CONFIG_MODEL`` +control of the sub-device. + +The common raw camera sensor model is aligned with +:ref:`media_using_camera_sensor_drivers`. Please refer to that regarding aspects +not specified here.Could we write this to emphasize the fact that
media_using_camera_sensor_driversdefines concepts common to all camera sensors, while the model here focusses on how drivers expose API elements for this particular model ? "is aligned with" is a bit vague.
I think I'll just keep a reference here and add such a note to the other file.
Quoted 18 lines
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 35
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +6
-0+ +Each camera sensor implementing the common raw sensor model exposes a single +V4L2 sub-device. The sub-device contains a single source pad (0) and two or more +internal pads: an image data internal pad (1) and optionally an embedded data +pad (2). Additionally, further internal pads may be supported for other +features, in which case they are documented separately for the given device.That's pretty easy to identify from userspace without a control, isn't it ?
See above.
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 37
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+ +This is show in :ref:`media_subdev_config_model_common_raw_sensor_subdev`.s/show/shown/
Quoted 7 lines
Maybe
This is show in the :ref:
media_subdev_config_model_common_raw_sensor_subdevfigure.Or is there a sphinx directive other than ref that would automate this ?
As these will be links, I'd just keep it as-is. Adding the note on what the references are (figures, tables etc.) should be done separately from this, including numbering.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +16
-0+ +.. _media_subdev_config_model_common_raw_sensor_subdev: + +.. kernel-figure:: common-raw-sensor.svg + :alt: common-raw-sensor.svg + :align: center + + **Common raw sensor sub-device** + +Routes +^^^^^^ + +A sub-device conforming to common raw camera sensor model implements the +following routes. + +.. flat-table:: Routes
Quoted 8 lines
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 58
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ :header-rows: 1 + + * - Sink pad/stream + - Source pad/stream + - Static (X/M(aybe)/-)afaiu either the route is Static (cannot be changed) or it is not. What does Maybe means here ?
It depends on the device.
Quoted 13 lines
Quoted 12 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 69
Quoted 12 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +11
-0+ - Mandatory (X/-) + - Synopsis + * - 1/0 + - 0/0 + - X + - X + - Image data + * - 2/0 + - 0/1 + - M + - -
Quoted 7 lines
This is interpreted as a list, translated to
<ul class="simple">
<li></li>
</ul>and rendered as •
The backslash was missing, I'll add one.
Quoted 10 lines
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 73
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ - Embedded data + +Some devices may support enabling and disabling the embedded data stream. Others +may not support it at all, in which case the embedded data route does not exist."may not support it at all" can be interpreted as "maybe not support enabling and disabling it at all", i.e. only support a static always enabled route. Based on the last sentence that's not what you mean, it could be reworded.
How about:
Some devices do not support the embedded data stream, others do support it and in some of the latter, it can be turned on and off before streaming is started.
Quoted 9 lines
Quoted 4 lines
Does the driver need to expose a routing table at all if it has a single, immutable image data stream ?
I think it should. If there are internal pads, they should be an internal routing table, at the very least for consistency. It will make userspace simpler I believe (and we can check that statement with a libcamera implementation :-)).
I agree. The routing table does not only tell what's there, it also tells what's not.
Quoted 14 lines
Quoted 13 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 77
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ +Sensor pixel array size, cropping and binning +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +This is not something I was expecting here. We teach how to compute framerates for RAW sensors in
camera-sensor.rst("Using camera sensor drivers") specifying which controls a sensor driver should register and the expected controls units. It seems to me we define part of the expected interface exposed by a raw camera sensor there and part here. I wonder ifcamera-sensor.rstmakes any sense at all if we define the "models" here.
Quoted 5 lines
Good question. I find the split to be a bit artificial indeed, and it's not clear where some of the parts should live. I think we still need a document that explains concept common to raw sensors, regardless of the model. We probably won't get the split entirely right on the first try, and that's fine with me, we can refine it later.
There are some aspects that are different from what is documented and implemented elsewhere, such as some of the selectiong rectangles.
Quoted 5 lines
Quoted 3 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 79
Quoted 3 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+The sensor's pixel array is divided into one or more areas. The areas around the +edge of the pixel array, usually one one or more sides, may contain optical"one one" ?
One one might be enough indeed.
Quoted 6 lines
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 82
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +3
-0+black pixels, dummy pixels and other non-image pixels. + +A rectangle within the pixel area contains the visible pixels. Capturing theAbove you wrote "pixel array", and here "pixel area".
This should be pixel array, I'll fix it.
Quoted 8 lines
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 83
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +1
-0+non-visible pixels may be supported by the sensor.This is a bit of simplification, as I presume there might be rectangles of visible pixels which overlap in the most advanced use cases.
https://git.libcamera.org/libcamera/libcamera.git/tree/src/libcamera/property_ids_core.yaml#n594
Quoted 5 lines
That's a more generic model. I'd like to see if there are sensors implementing it. Sakari, does CCS support that ?
This being said, we could restrict this subdev model to supporting only sensors with a rectangular visible pixels area.
The current frame format descriptors in CCS can't, I'm not sure if vendors might prefer to be able to do that. The CSI-2 long packets (lines) still need to be the same length.
In practice the visible pixel areas are rectangular, at least in those sensor I've seen, so perhaps it's fine to indeed assume that.
Quoted 15 lines
Quoted 14 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 93
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+ +The sensor can perform three operations that affect the output image size. First +comes analogue crop. This configuration limits parts of the pixel array which +the sensor will read, affecting sensor timing as well. The granularity of the +analogue crop configuration varies greatly across sensors: some sensors support +a few different analogue crop configurations whereas others may support anything +divisible by a given number of pixels. + +The default analogue crop rectangle corresponds to the visible pixel area if +supported by the hardware.In what sense "if supported by the hardware" ? Is this referring to the "visibile pixel area" ?
Quoted 2 lines
I assume this means "if analogue crop is supported by the hardware". This should be clarified.
Yes, analogue crop is not supported by all sensors (nor drivers, even if the sensor does). I'd just do: s/if.*//.
Quoted 7 lines
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 97
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ +In the next step, binning is performed on the image data read from camera +sensor's pixel array. This will effectively result in an image smaller than the +original by given proportions horizontally and vertically. Typical values ares/proportions/scaling factors/ ?
How about "binning factors"?
Quoted 8 lines
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 101
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+1/2 and 1/3 but others may well be supported by the hardware as well. + +The combination of the analogue crop and binning operations may result in an +image size that may be larger than desirable. For this purpose, a digital cropThis is highly optional it seems.
Quoted 5 lines
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 103
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+operation may be performed on the binned image. The resulting image size is +further outputted by the sensor.s/outputted/output/ ? I think "outputted" is correct, but I believe it's less common.
Given how "put" inflects, it probably should be "output" indeed.
Quoted 18 lines
Quoted 18 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 111
Quoted 9 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +8
-0+ +.. flat-table:: Selection targets on pads + :header-rows: 1 + + * - Pad/Stream + - Selection target/format + - Mandatory (X/-) + - SynopsisWhat about an R/W column ?
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ * - 1/0 + - Format + - X + - Image data format. The width and height fields of this format are the + same than those for the V4L2_SEL_TGT_CROP_BOUNDS rectangle. The media
Quoted 5 lines
Quoted 1 line
Can sizes be changed at all ?
For the internal image pad, I wouldn't think so. I think it should expose the full readable array. Or, reading what you wrote below, do you envision this including non-readable pixels too ?
I don't -- they can't be accessed in any case. Timing information (such as the latching points) should probably be conveyed using a different API if they're needed.
Quoted 7 lines
Mapping pixel array definitions from datasheets to formats and selection rectangles is hard, as datasheets, when they are available, are often confusing. Datasheets from different vendors, or even for different sensors of the same vendor, often have different models. I think we need to be extra precise here, and possibly work with sensor vendors. Using the CCS model as a base could be useful.
I wouldn't necessarily try to convey what non-visiblepixels might be there, apart from in the documentation. These tend to be fairly vendor/sensor specific after all.
Quoted 11 lines
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 123
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +7
-0+ bus code of this format reflects the native pixel depth of the sensor. + * - 1/0 + - V4L2_SEL_TGT_NATIVE_SIZE + - X + - The full size of the pixel array, including all pixels in the pixel + array, even if they cannot be captured. This rectangle is relative to + the format on the same (pad, stream).Mix of tabs and spaces.
Quoted 3 lines
What do you mean by "relative to the format on the same (pad, stream)" ? Does it mean the rectangle is expressed relatively to a rectangle defined as (0,0),(fmt.width x fmt.height) ? That doesn't seem to match
Yes.
Quoted 5 lines
the description of the format and
V4L2_SEL_TGT_CROP_BOUNDS, as the format is defined as having the same width and height asV4L2_SEL_TGT_CROP_BOUNDS, andV4L2_SEL_TGT_CROP_BOUNDSis defined as being relative toV4L2_SEL_TGT_NATIVE_SIZE. I assume you mean something else, it should be clarified.
As discussed, I'll drop the NATIVE_SIZE rectangle from the documentation as redundant.
Quoted 11 lines
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 127
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ * - 1/0 + - V4L2_SEL_TGT_CROP_BOUNDS + - X + - The crop rectangle bounds. No pixels outside this area can beI would describe it as "the readable part of the full pixel array area" instead of repeating "crop rectangle bounds"
Agreed. I would also explicitly state this can include black pixels. I wonder if we should also define border pixels in this document.
I wouldn't try to convey in APIs what qualities different non-visible pixels might have or where they are located, just that they're non-visible pixels.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ captured. This rectangle is relative to the V4L2_SEL_TGT_NATIVE_SIZE + * - 1/0 + - V4L2_SEL_TGT_CROP_DEFAULT + - X + - The visible pixel area. This rectangle is relative to the
Quoted 4 lines
Quoted 1 line
Isn't this the default analogue crop rectangle ?
I assume so, and it should be documented as such explicitly. Also, if the default crop rectangle doesn't include some of the readable pixels,
It does indeed say this is the "visible pixel area". I can elaborate this in the analogue crop documentation -- it's possible the sensor doesn't support capturing just visible pixels, even if it's unlikely.
Quoted 32 lines
Quoted 14 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 145
Quoted 13 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +12
-0+ V4L2_SEL_TGT_NATIVE_SIZE rectangle on the same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_CROP + - \- + - Analogue crop. Analogue crop typically has a coarse granularity. This + rectangle is relative to the V4L2_SEL_TGT_NATIVE_SIZE rectangle on the + same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_COMPOSE + - \- + - Binning. This rectangle is relative to the V4L2_SEL_TGT_CROP + rectangle on the same (pad, stream).Quoted 17 lines
The size ratio between the
V4L2_SEL_TGT_CROPandV4L2_SEL_TGT_COMPOSErectangles selects the desired binning factor.Quoted 14 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +14
-0+ * - 2/0 + - Format + - X + - Embedded data format. + * - 0/0 + - V4L2_SEL_TGT_CROP + - \- + - Digital crop. This rectangle is relative to the V4L2_SEL_TGT_COMPOSE + rectangle on (pad, stream) pair 1/0. + * - 0/0 + - Format + - X + - Image data source format. The width and height fields of the format are + the same than for the V4L2_SEL_TGT crop rectangle on (pad, stream) pair
Quoted 1 line
I think you meant "
V4L2_SEL_TGT_CROPrectangle" here.
Yes.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
+ 0/0 where as the media bus code reflects the pixel data output of the
s/where as/and ?
Or maybe I didn't get what you mean
And works here, yes.
Quoted 8 lines
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 165
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ sensor. + * - 0/1 + - Format + - X + - Embedded data source format.I think we also need to consider skipping.
I'll add sub-sampling in v2.
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +15
-0+ +Embedded data +^^^^^^^^^^^^^ + +The embedded data stream is produced by the sensor when the corresponding route +is enabled. The embedded data route may also be immutable or not exist at all, +in case the sensor (or the driver) does not support it. + +Generally the sensor embedded data width is determined by the width of the image +data whereas the number of lines are constant for the embedded data. The user +space may obtain the size of the embedded data once the image data size on the +source pad has been configured. + +Also see :ref:`media_using_camera_sensor_drivers_embedded_data`. +
Signature · 3 lines
Kind regards, Sakari Ailus
Re: [RFC 3/4] media: Documentation: Add subdev configuration models, raw sensor model
Hi Sakari
Quoted 374 lines · Sakari Ailus
Hi Jacopo, Laurent,
Thank you for the review.
Quoted 29 lines · Laurent Pinchart
Hello,
Quoted 26 lines · Jacopo Mondi
Quoted 25 lines · Sakari Ailus
Sub-device configuration models define what V4L2 API elements are available on a compliant sub-device and how do they behave.
The patch also adds a model for common raw sensors.
Signed-off-by Sakari Ailus <[email protected]>--- .../media/drivers/camera-sensor.rst | 5 + .../media/v4l/common-raw-sensor.dia | 441 ++++++++++++++++++ .../media/v4l/common-raw-sensor.svg | 134 ++++++ .../userspace-api/media/v4l/dev-subdev.rst | 2 + .../media/v4l/subdev-config-model.rst | 180 +++++++ 5 files changed, 762 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.dia create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.svg create mode 100644 Documentation/userspace-api/media/v4l/subdev-config-model.rstDocumentation/userspace-api/media/drivers/camera-sensor.rst +0
-0@@ -18,6 +18,9 @@ binning functionality. The sensor drivers belong to two distinct classes, freely configurable and register list based drivers, depending on how the driver configures this functionality.Quoted 4 lines
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst binning functionality. The sensor drivers belong to two distinct classes, freely · line 22
Quoted 2 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +2
-0+Also see +:ref:`media_subdev_config_model_common_raw_sensor`.The line break doesn't seem necessary.
I agree.
Quoted 16 lines
Quoted 9 lines
Quoted 9 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +1
-0+ Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@@ -105,6 +108,8 @@ values programmed by the register sequences. The default values of these controls shall be 0 (disabled). Especially these controls shall not be inverted, independently of the sensor's mounting rotation.Quoted 6 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst values programmed by the register sequences. The default values of these · line 114
Quoted 4 lines
Documentation/userspace-api/media/drivers/camera-sensor.rst +2
-0+.. _media_using_camera_sensor_drivers_embedded_data: + Embedded data -------------[snip images]
Quoted 2 lines
One day we should probably try to unify the look & feel of all diagrams in the V4L2 documentation. One day :-)
That day may or may not come. :-)
Quoted 32 lines
Quoted 11 lines
Documentation/userspace-api/media/v4l/dev-subdev.rst stream while it may be possible to enable and disable the embedded data stream. · line 842
Quoted 11 lines
Documentation/userspace-api/media/v4l/dev-subdev.rst +2
-0@@ -838,3 +838,5 @@ stream while it may be possible to enable and disable the embedded data stream. The embedded data format does not need to be configured on the sensor's pads as the format is dictated by the pixel data format in this case. + +.. include:: subdev-config-model.rstI think we should reorganize the documentation at some point. Things are getting a bit too deep, with e.g. 4.13.5.1.2. That's for later. Splitting the configuration model to a separate file as done in this patch will be helpful.
Quoted 15 lines
Quoted 15 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +9
-0@@ -0,0 +1,180 @@ +.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later + +Sub-device configuration models +=============================== + +A sub-device configuration model specifies in detail what the user space can +expect from a sub-device in terms of V4L2 sub-device interface support, +including semantics specific to a given configuration model. +Quoted 8 lines
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 11
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+A sub-device may implement more than one configuration model at the same +time.I wonder how that would work. I assume that, with the control being read-only, you don't envision userspace selecting a model at runtime, but rather drivers implementing the union (or intersection ?) of multiple models. Do you have use cases in mind, or is this only to prepare for a hypothetical future where this could happen ?
Let's suppose we would use configuration models to tell about other parts of the sub-device than just what pads, links and streams may be present. A number of things currently work implicitly, for instance whether a sensor frame time is configured through controls or a dedicated IOCTL. I'm not sure I'd add a configuration model for that exactly but something like that seems entirely reasonable. It'd be orthogonal to the common raw sensor model.
Quoted 28 lines
Quoted 6 lines
The implemented configuration models can be obtained from the sub-device's
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 12
Quoted 1 line
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +1
-0+``V4L2_CID_CONFIG_MODEL`` control.Isn't a control an overkill ? Isn't enough to identify that a sensor produces RAW images and has an internal pad to the below description ?
V4L2 has a set of low-level, generic interfaces such as pads (external and internal), formats, selection rectangles, routes, and controls. We have some documentation about how those should be used, with a relatively generic model defined in the "Order of configuration and format propagation" section of
Documentation/userspace-api/media/v4l/dev-subdev.rst. The different API elements are however mostly defined independently of each other (very little is said about interactions between controls and formats or selection rectangles for instance), and we don't document how they should be mapped to device features. This results in different drivers for similar devices using the API elements differently, sometimes in ways that breach the documented API. Userspace ends up implementing heuristics and pray that thing work.The whole idea behind configuration models is to avoid heuristics. That's why we want an explicit API element to indicate what configuration model a device supports, and document that model explicitly in the kernel documentation.
Quoted 3 lines
Also, would it be the single sensor driver that has to correctly populate the control ?
Quoted 13 lines
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 19
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +7
-0+ +.. _media_subdev_config_model_common_raw_sensor: + +Common raw camera sensor model +------------------------------ + +The common raw camera sensor model defines the configurability of a supersetA superset of what ? Reading the next sentence I suspect you mean that this model defines a set of features that compliant subdevs have to use as documented, but where some API elements could be left unused by a driver if the corresponding device doesn't implement the corresponding hardware feature. Clarifying this would be nice.
The intent is to say not everything may be impelemented by the sensors but there may be simpler ways to do that. How about:
The common raw camera sensor model defines a set of configuration options (formats, selections etc.) that cover the vast majority of funcitionality of raw camera sensors. Not all of the configuration and enumeration interfaces are offered by all drivers.
Quoted 16 lines
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 29
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+that covers the vast majority of raw camera sensors. Not all of the +configuration and enumeration interfaces are offered by all drivers. + +A sub-device complies with the common raw sensor model if the +``V4L2_CONFIG_MODEL_COMMON_RAW`` bit is set in the ``V4L2_CID_CONFIG_MODEL`` +control of the sub-device. + +The common raw camera sensor model is aligned with +:ref:`media_using_camera_sensor_drivers`. Please refer to that regarding aspects +not specified here.Could we write this to emphasize the fact that
media_using_camera_sensor_driversdefines concepts common to all camera sensors, while the model here focusses on how drivers expose API elements for this particular model ? "is aligned with" is a bit vague.I think I'll just keep a reference here and add such a note to the other file.
Quoted 18 lines
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 35
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +6
-0+ +Each camera sensor implementing the common raw sensor model exposes a single +V4L2 sub-device. The sub-device contains a single source pad (0) and two or more +internal pads: an image data internal pad (1) and optionally an embedded data +pad (2). Additionally, further internal pads may be supported for other +features, in which case they are documented separately for the given device.That's pretty easy to identify from userspace without a control, isn't it ?
See above.
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 37
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+ +This is show in :ref:`media_subdev_config_model_common_raw_sensor_subdev`.s/show/shown/
Quoted 7 lines
Maybe
This is show in the :ref:
media_subdev_config_model_common_raw_sensor_subdevfigure.Or is there a sphinx directive other than ref that would automate this ?
As these will be links, I'd just keep it as-is. Adding the note on what the references are (figures, tables etc.) should be done separately from this, including numbering.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +16
-0+ +.. _media_subdev_config_model_common_raw_sensor_subdev: + +.. kernel-figure:: common-raw-sensor.svg + :alt: common-raw-sensor.svg + :align: center + + **Common raw sensor sub-device** + +Routes +^^^^^^ + +A sub-device conforming to common raw camera sensor model implements the +following routes. + +.. flat-table:: RoutesQuoted 8 lines
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 58
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ :header-rows: 1 + + * - Sink pad/stream + - Source pad/stream + - Static (X/M(aybe)/-)afaiu either the route is Static (cannot be changed) or it is not. What does Maybe means here ?
It depends on the device.
Quoted 13 lines
Quoted 12 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 69
Quoted 12 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +11
-0+ - Mandatory (X/-) + - Synopsis + * - 1/0 + - 0/0 + - X + - X + - Image data + * - 2/0 + - 0/1 + - M + - -Quoted 7 lines
This is interpreted as a list, translated to
<ul class="simple">
<li></li>
</ul>and rendered as •
The backslash was missing, I'll add one.
Quoted 10 lines
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 73
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ - Embedded data + +Some devices may support enabling and disabling the embedded data stream. Others +may not support it at all, in which case the embedded data route does not exist."may not support it at all" can be interpreted as "maybe not support enabling and disabling it at all", i.e. only support a static always enabled route. Based on the last sentence that's not what you mean, it could be reworded.
How about:
Some devices do not support the embedded data stream, others do support it and in some of the latter, it can be turned on and off before streaming is started.
Quoted 9 lines
Quoted 4 lines
Does the driver need to expose a routing table at all if it has a single, immutable image data stream ?
I think it should. If there are internal pads, they should be an internal routing table, at the very least for consistency. It will make userspace simpler I believe (and we can check that statement with a libcamera implementation :-)).
I agree. The routing table does not only tell what's there, it also tells what's not.
Quoted 14 lines
Quoted 13 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 77
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ +Sensor pixel array size, cropping and binning +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +This is not something I was expecting here. We teach how to compute framerates for RAW sensors in
camera-sensor.rst("Using camera sensor drivers") specifying which controls a sensor driver should register and the expected controls units. It seems to me we define part of the expected interface exposed by a raw camera sensor there and part here. I wonder ifcamera-sensor.rstmakes any sense at all if we define the "models" here.Quoted 5 lines
Good question. I find the split to be a bit artificial indeed, and it's not clear where some of the parts should live. I think we still need a document that explains concept common to raw sensors, regardless of the model. We probably won't get the split entirely right on the first try, and that's fine with me, we can refine it later.
There are some aspects that are different from what is documented and implemented elsewhere, such as some of the selectiong rectangles.
Quoted 5 lines
Quoted 3 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 79
Quoted 3 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+The sensor's pixel array is divided into one or more areas. The areas around the +edge of the pixel array, usually one one or more sides, may contain optical"one one" ?
One one might be enough indeed.
Quoted 6 lines
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 82
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +3
-0+black pixels, dummy pixels and other non-image pixels. + +A rectangle within the pixel area contains the visible pixels. Capturing theAbove you wrote "pixel array", and here "pixel area".
This should be pixel array, I'll fix it.
Quoted 8 lines
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 83
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +1
-0+non-visible pixels may be supported by the sensor.This is a bit of simplification, as I presume there might be rectangles of visible pixels which overlap in the most advanced use cases.
https://git.libcamera.org/libcamera/libcamera.git/tree/src/libcamera/property_ids_core.yaml#n594Quoted 5 lines
That's a more generic model. I'd like to see if there are sensors implementing it. Sakari, does CCS support that ?
This being said, we could restrict this subdev model to supporting only sensors with a rectangular visible pixels area.
The current frame format descriptors in CCS can't, I'm not sure if vendors might prefer to be able to do that. The CSI-2 long packets (lines) still need to be the same length.
In practice the visible pixel areas are rectangular, at least in those sensor I've seen, so perhaps it's fine to indeed assume that.
Quoted 15 lines
Quoted 14 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 93
Quoted 11 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+ +The sensor can perform three operations that affect the output image size. First +comes analogue crop. This configuration limits parts of the pixel array which +the sensor will read, affecting sensor timing as well. The granularity of the +analogue crop configuration varies greatly across sensors: some sensors support +a few different analogue crop configurations whereas others may support anything +divisible by a given number of pixels. + +The default analogue crop rectangle corresponds to the visible pixel area if +supported by the hardware.In what sense "if supported by the hardware" ? Is this referring to the "visibile pixel area" ?
Quoted 2 lines
I assume this means "if analogue crop is supported by the hardware". This should be clarified.
Yes, analogue crop is not supported by all sensors (nor drivers, even if the sensor does). I'd just do: s/if.*//.
Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 97
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ +In the next step, binning is performed on the image data read from camera +sensor's pixel array. This will effectively result in an image smaller than the +original by given proportions horizontally and vertically. Typical values ares/proportions/scaling factors/ ?
How about "binning factors"?
ack
Quoted 36 lines
Quoted 8 lines
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 101
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+1/2 and 1/3 but others may well be supported by the hardware as well. + +The combination of the analogue crop and binning operations may result in an +image size that may be larger than desirable. For this purpose, a digital cropThis is highly optional it seems.
Quoted 5 lines
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 103
Quoted 2 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +2
-0+operation may be performed on the binned image. The resulting image size is +further outputted by the sensor.s/outputted/output/ ? I think "outputted" is correct, but I believe it's less common.
Given how "put" inflects, it probably should be "output" indeed.
Quoted 20 lines
Quoted 19 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 111
Quoted 9 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +8
-0+ +.. flat-table:: Selection targets on pads + :header-rows: 1 + + * - Pad/Stream + - Selection target/format + - Mandatory (X/-) + - SynopsisWhat about an R/W column ?
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 116
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ * - 1/0 + - Format + - X + - Image data format. The width and height fields of this format are the + same than those for the V4L2_SEL_TGT_CROP_BOUNDS rectangle. The mediaCan sizes be changed at all ?
Quoted 8 lines
Quoted 3 lines
For the internal image pad, I wouldn't think so. I think it should expose the full readable array. Or, reading what you wrote below, do you envision this including non-readable pixels too ?
I don't -- they can't be accessed in any case. Timing information (such as the latching points) should probably be conveyed using a different API if they're needed.
Ok, what I was suggesting was to explicitly say those sizes are not modifiable.
Quoted 8 lines
Quoted 7 lines
Mapping pixel array definitions from datasheets to formats and selection rectangles is hard, as datasheets, when they are available, are often confusing. Datasheets from different vendors, or even for different sensors of the same vendor, often have different models. I think we need to be extra precise here, and possibly work with sensor vendors. Using the CCS model as a base could be useful.
Quoted 4 lines
I wouldn't necessarily try to convey what non-visiblepixels might be there, apart from in the documentation. These tend to be fairly vendor/sensor specific after all.
In the whole document, I would use one of "non-readable" and "non-visible".
Quoted 17 lines
Quoted 11 lines
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 123
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +7
-0+ bus code of this format reflects the native pixel depth of the sensor. + * - 1/0 + - V4L2_SEL_TGT_NATIVE_SIZE + - X + - The full size of the pixel array, including all pixels in the pixel + array, even if they cannot be captured. This rectangle is relative to + the format on the same (pad, stream).Mix of tabs and spaces.
Quoted 3 lines
What do you mean by "relative to the format on the same (pad, stream)" ? Does it mean the rectangle is expressed relatively to a rectangle defined as (0,0),(fmt.width x fmt.height) ? That doesn't seem to match
Yes.
Quoted 9 lines
Quoted 5 lines
the description of the format and
V4L2_SEL_TGT_CROP_BOUNDS, as the format is defined as having the same width and height asV4L2_SEL_TGT_CROP_BOUNDS, andV4L2_SEL_TGT_CROP_BOUNDSis defined as being relative toV4L2_SEL_TGT_NATIVE_SIZE. I assume you mean something else, it should be clarified.As discussed, I'll drop the
NATIVE_SIZErectangle from the documentation as redundant.
Doesn't it help reporting the full pixel array size (readable and non readable pixels ?). We care about that information in libcamera (also to comply with Android's requirement to expose the full pixel array size as a property of the camera)
I would just drop the "relative" part. NATIVE is a rectangle with top-left corner in position (0,0).
Quoted 110 lines
Quoted 11 lines
Quoted 8 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 127
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +4
-0+ * - 1/0 + - V4L2_SEL_TGT_CROP_BOUNDS + - X + - The crop rectangle bounds. No pixels outside this area can beI would describe it as "the readable part of the full pixel array area" instead of repeating "crop rectangle bounds"
Agreed. I would also explicitly state this can include black pixels. I wonder if we should also define border pixels in this document.
I wouldn't try to convey in APIs what qualities different non-visible pixels might have or where they are located, just that they're non-visible pixels.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ captured. This rectangle is relative to the V4L2_SEL_TGT_NATIVE_SIZE + * - 1/0 + - V4L2_SEL_TGT_CROP_DEFAULT + - X + - The visible pixel area. This rectangle is relative to theQuoted 4 lines
Quoted 1 line
Isn't this the default analogue crop rectangle ?
I assume so, and it should be documented as such explicitly. Also, if the default crop rectangle doesn't include some of the readable pixels,
It does indeed say this is the "visible pixel area". I can elaborate this in the analogue crop documentation -- it's possible the sensor doesn't support capturing just visible pixels, even if it's unlikely.
Quoted 32 lines
Quoted 14 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 145
Quoted 13 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +12
-0+ V4L2_SEL_TGT_NATIVE_SIZE rectangle on the same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_CROP + - \- + - Analogue crop. Analogue crop typically has a coarse granularity. This + rectangle is relative to the V4L2_SEL_TGT_NATIVE_SIZE rectangle on the + same (pad, stream). + * - 1/0 + - V4L2_SEL_TGT_COMPOSE + - \- + - Binning. This rectangle is relative to the V4L2_SEL_TGT_CROP + rectangle on the same (pad, stream).Quoted 17 lines
The size ratio between the
V4L2_SEL_TGT_CROPandV4L2_SEL_TGT_COMPOSErectangles selects the desired binning factor.Quoted 14 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +14
-0+ * - 2/0 + - Format + - X + - Embedded data format. + * - 0/0 + - V4L2_SEL_TGT_CROP + - \- + - Digital crop. This rectangle is relative to the V4L2_SEL_TGT_COMPOSE + rectangle on (pad, stream) pair 1/0. + * - 0/0 + - Format + - X + - Image data source format. The width and height fields of the format are + the same than for the V4L2_SEL_TGT crop rectangle on (pad, stream) pairQuoted 1 line
I think you meant "
V4L2_SEL_TGT_CROPrectangle" here.Yes.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
+ 0/0 where as the media bus code reflects the pixel data output of the
s/where as/and ?
Or maybe I didn't get what you meanAnd works here, yes.
Quoted 8 lines
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 165
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ sensor. + * - 0/1 + - Format + - X + - Embedded data source format.I think we also need to consider skipping.
I'll add sub-sampling in v2.
Quoted 17 lines
Quoted 16 lines
Quoted 6 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ +Embedded data +^^^^^^^^^^^^^ + +The embedded data stream is produced by the sensor when the corresponding routeDocumentation/userspace-api/media/v4l/subdev-config-model.rst line 180
Quoted 10 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +10
-0+is enabled. The embedded data route may also be immutable or not exist at all, +in case the sensor (or the driver) does not support it. + +Generally the sensor embedded data width is determined by the width of the image +data whereas the number of lines are constant for the embedded data. The user +space may obtain the size of the embedded data once the image data size on the +source pad has been configured. + +Also see :ref:`media_using_camera_sensor_drivers_embedded_data`. +--
Kind regards,Sakari Ailus
Re: [RFC 3/4] media: Documentation: Add subdev configuration models, raw sensor model
Hi Jacopo,
Quoted 12 lines · Jacopo Mondi
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 116
Quoted 5 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +5
-0+ * - 1/0 + - Format + - X + - Image data format. The width and height fields of this format are the + same than those for the V4L2_SEL_TGT_CROP_BOUNDS rectangle. The mediaCan sizes be changed at all ?
For the internal image pad, I wouldn't think so. I think it should expose the full readable array. Or, reading what you wrote below, do you envision this including non-readable pixels too ?
Quoted 7 lines
Quoted 4 lines
I don't -- they can't be accessed in any case. Timing information (such as the latching points) should probably be conveyed using a different API if they're needed.
Ok, what I was suggesting was to explicitly say those sizes are not modifiable.
I'll add that for v2.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Mapping pixel array definitions from datasheets to formats and selection rectangles is hard, as datasheets, when they are available, are often confusing. Datasheets from different vendors, or even for different sensors of the same vendor, often have different models. I think we need to be extra precise here, and possibly work with sensor vendors. Using the CCS model as a base could be useful.
Quoted 7 lines
Quoted 4 lines
I wouldn't necessarily try to convey what non-visiblepixels might be there, apart from in the documentation. These tend to be fairly vendor/sensor specific after all.
In the whole document, I would use one of "non-readable" and "non-visible".
I'll check these are the terms used. We won't probably say much -- if anything -- about non-readable pixels as there's (by definition) no way to access them.
Quoted 28 lines
Quoted 18 lines
Quoted 12 lines
Quoted 9 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 123
Quoted 9 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst new file +7
-0+ bus code of this format reflects the native pixel depth of the sensor. + * - 1/0 + - V4L2_SEL_TGT_NATIVE_SIZE + - X + - The full size of the pixel array, including all pixels in the pixel + array, even if they cannot be captured. This rectangle is relative to + the format on the same (pad, stream).Mix of tabs and spaces.
Quoted 3 lines
What do you mean by "relative to the format on the same (pad, stream)" ? Does it mean the rectangle is expressed relatively to a rectangle defined as (0,0),(fmt.width x fmt.height) ? That doesn't seem to match
Yes.
Quoted 9 lines
Quoted 5 lines
the description of the format and
V4L2_SEL_TGT_CROP_BOUNDS, as the format is defined as having the same width and height asV4L2_SEL_TGT_CROP_BOUNDS, andV4L2_SEL_TGT_CROP_BOUNDSis defined as being relative toV4L2_SEL_TGT_NATIVE_SIZE. I assume you mean something else, it should be clarified.As discussed, I'll drop the
NATIVE_SIZErectangle from the documentation as redundant.
Quoted 7 lines
Doesn't it help reporting the full pixel array size (readable and non readable pixels ?). We care about that information in libcamera (also to comply with Android's requirement to expose the full pixel array size as a property of the camera)
I would just drop the "relative" part. NATIVE is a rectangle with top-left corner in position (0,0).
It's the same information (apart from the mbus code) that can be obtained from the format on the internal pad. I'd avoid adding redundant selection targets.
Signature · 3 lines
Kind regards, Sakari Ailus
RFC 4/4 media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
In reply to Sakari AilusAdd the V4L2_CID_CONFIG_MODEL control for the configuration model.
--- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ .../userspace-api/media/v4l/subdev-config-model.rst | 2 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 4 files changed, 14 insertions(+)
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +4 -0
@@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`.
Documentation/userspace-api/media/v4l/subdev-config-model.rst +2 -0
@@ -1,5 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later +.. _media_subdev_config_model: + Sub-device configuration models ===============================
drivers/media/v4l2-core/v4l2-ctrls-defs.c +5 -0
@@ -1167,6 +1167,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_TEST_PATTERN :return "Test Pattern" ;case V4L2_CID_DEINTERLACING_MODE :return "Deinterlacing Mode" ;case V4L2_CID_DIGITAL_GAIN :return "Digital Gain" ; +case V4L2_CID_CONFIG_MODEL :return "Sub-device configuration model" ;/* DV controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */
@@ -1489,6 +1490,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_DV_RX_POWER_PRESENT : *type =V4L2_CTRL_TYPE_BITMASK ;break ; +case V4L2_CID_CONFIG_MODEL : + *flags |=V4L2_CTRL_FLAG_READ_ONLY ; + *type =V4L2_CTRL_TYPE_BITMASK ; +break ;case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE :case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT : *type =V4L2_CTRL_TYPE_INTEGER ;
include/uapi/linux/v4l2-controls.h +3 -0
@@ -1225,6 +1225,9 @@ enum v4l2_jpeg_chroma_subsampling {#define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)#define V4L2_CID_DEINTERLACING_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4)#define V4L2_CID_DIGITAL_GAIN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 5) +#define V4L2_CID_CONFIG_MODEL (V4L2_CID_IMAGE_PROC_CLASS_BASE + 6) + +#define V4L2_CID_CONFIG_MODEL_COMMON_RAW (1ULL << 0)/* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900)
Signature · 1 line
2.39.5
Re: [RFC 4/4] media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
Hi Sakari,
Thank you for the patch.
Quoted 27 lines · Sakari Ailus
Add the
V4L2_CID_CONFIG_MODELcontrol for the configuration model.Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ .../userspace-api/media/v4l/subdev-config-model.rst | 2 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 4 files changed, 14 insertions(+)Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +4
-0@@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`.Documentation/userspace-api/media/v4l/subdev-config-model.rst +0
-0
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 4
Quoted 4 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst +2
-0@@ -1,5 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later +.. _media_subdev_config_model: +
This could be moved to 3/4.
Quoted 40 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst +0
-0Sub-device configuration models ===============================drivers/media/v4l2-core/v4l2-ctrls-defs.c +5
-0@@ -1167,6 +1167,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_TEST_PATTERN :return "Test Pattern" ;case V4L2_CID_DEINTERLACING_MODE :return "Deinterlacing Mode" ;case V4L2_CID_DIGITAL_GAIN :return "Digital Gain" ; +case V4L2_CID_CONFIG_MODEL :return "Sub-device configuration model" ;/* DV controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1489,6 +1490,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_DV_RX_POWER_PRESENT : *type =V4L2_CTRL_TYPE_BITMASK ;break ; +case V4L2_CID_CONFIG_MODEL : + *flags |=V4L2_CTRL_FLAG_READ_ONLY ; + *type =V4L2_CTRL_TYPE_BITMASK ; +break ;case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE :case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT : *type =V4L2_CTRL_TYPE_INTEGER ;include/uapi/linux/v4l2-controls.h +3
-0@@ -1225,6 +1225,9 @@ enum v4l2_jpeg_chroma_subsampling {#define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)#define V4L2_CID_DEINTERLACING_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4)#define V4L2_CID_DIGITAL_GAIN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 5) +#define V4L2_CID_CONFIG_MODEL (V4L2_CID_IMAGE_PROC_CLASS_BASE + 6) + +#define V4L2_CID_CONFIG_MODEL_COMMON_RAW (1ULL << 0)/* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900)
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC 4/4] media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
Hi Laurent,
Quoted 10 lines · Laurent Pinchart
Documentation/userspace-api/media/v4l/subdev-config-model.rst line 4
Quoted 8 lines
index
8ec801998f5f..d4ae921b69c8100644Documentation/userspace-api/media/v4l/subdev-config-model.rst +2
-0@@ -1,5 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later +.. _media_subdev_config_model: +This could be moved to 3/4.
Yes, that's where it belongs indeed.
Quoted 2 lines
Reviewed-by Laurent Pinchart <[email protected]>
Thanks!
Signature · 1 line
Sakari Ailus
Re: [RFC 4/4] media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
In reply to Sakari AilusQuoted 15 lines · Sakari Ailus
Add the
V4L2_CID_CONFIG_MODELcontrol for the configuration model.Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ .../userspace-api/media/v4l/subdev-config-model.rst | 2 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 4 files changed, 14 insertions(+)Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0
-0
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 61
Quoted 7 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +4
-0@@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`.
First of all the naming is confusing: since this is specific to sub-devices, it should at least have 'SUBDEV' in the name. I first thought this reported the model name or something like that, I'm not sure "configuration model" is a very good name.
Secondly, is this supposed to be valid for all subdevices? Only for sensors? Would an HDMI-to-CSI bridge qualify?
Thirdly, only V4L2_CID_CONFIG_MODEL_COMMON_RAW is defined right now. What other models do you have in mind? What models can co-exist (since this is a bitmask)?
Finally, why choose a control for this? Should this perhaps be better done as a field in media_entity_desc/media_v2_entity?
Regards,
Hans
Quoted 17 lines
Documentation/userspace-api/media/v4l/subdev-config-model.rst +2
-0@@ -1,5 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later +.. _media_subdev_config_model: + Sub-device configuration models ===============================drivers/media/v4l2-core/v4l2-ctrls-defs.c +0
-0
drivers/media/v4l2-core/v4l2-ctrls-defs.c const char *v4l2_ctrl_get_name(u32 id) · line 1170
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ctrls-defs.c +1
-0@@ -1167,6 +1167,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_TEST_PATTERN :return "Test Pattern" ;case V4L2_CID_DEINTERLACING_MODE :return "Deinterlacing Mode" ;case V4L2_CID_DIGITAL_GAIN :return "Digital Gain" ; +case V4L2_CID_CONFIG_MODEL :return "Sub-device configuration model" ;
Start each word capitalized, just like all the other strings.
Quoted 28 lines
drivers/media/v4l2-core/v4l2-ctrls-defs.c +4
-0/* DV controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1489,6 +1490,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,case V4L2_CID_DV_RX_POWER_PRESENT : *type =V4L2_CTRL_TYPE_BITMASK ;break ; +case V4L2_CID_CONFIG_MODEL : + *flags |=V4L2_CTRL_FLAG_READ_ONLY ; + *type =V4L2_CTRL_TYPE_BITMASK ; +break ;case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE :case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT : *type =V4L2_CTRL_TYPE_INTEGER ;include/uapi/linux/v4l2-controls.h +3
-0@@ -1225,6 +1225,9 @@ enum v4l2_jpeg_chroma_subsampling {#define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)#define V4L2_CID_DEINTERLACING_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4)#define V4L2_CID_DIGITAL_GAIN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 5) +#define V4L2_CID_CONFIG_MODEL (V4L2_CID_IMAGE_PROC_CLASS_BASE + 6) + +#define V4L2_CID_CONFIG_MODEL_COMMON_RAW (1ULL << 0)/* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900)
Re: [RFC 4/4] media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
Hi Hans,
Thank you for the review.
Quoted 11 lines · Hans Verkuil
Quoted 10 lines · Sakari Ailus
Add the
V4L2_CID_CONFIG_MODELcontrol for the configuration model.Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ .../userspace-api/media/v4l/subdev-config-model.rst | 2 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 4 files changed, 14 insertions(+)
Quoted 15 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 61
Quoted 12 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +4
-0@@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`.First of all the naming is confusing: since this is specific to sub-devices, it should at least have 'SUBDEV' in the name. I first thought this reported the
I don't object in principle, but the reason why I didn't add that in v1 was the names would get quite long. Maybe V4L2_CID_SUBDEV_CFG_MODEL?
Quoted 2 lines
model name or something like that, I'm not sure "configuration model" is a very good name.
Feel free to propose a different one. :-)
Quoted 3 lines
Secondly, is this supposed to be valid for all subdevices? Only for sensors? Would an HDMI-to-CSI bridge qualify?
I think it could but we should have a use case for it. In other words, something we can't reasonably express using existing means. In this case it's a number of interfaces and device type specific behaviour (see the 3rd patch).
Quoted 3 lines
Thirdly, only
V4L2_CID_CONFIG_MODEL_COMMON_RAWis defined right now. What other models do you have in mind? What models can co-exist (since this is a bitmask)?
We could have different raw camera models if needed. I don't have any planned right now, though.
Quoted 3 lines
Finally, why choose a control for this? Should this perhaps be better done as a field in media_entity_desc/media_v2_entity?
I don't think it's a great fit. This is largely about V4L2 (to some but lesser extent about MC) and we traditionally have avoided MC -> V4L2 dependencies.
Signature · 3 lines
Kind regards, Sakari Ailus
Re: [RFC 4/4] media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
Quoted 32 lines · Sakari Ailus
Hi Hans,
Thank you for the review.
Quoted 11 lines · Hans Verkuil
Quoted 10 lines · Sakari Ailus
Add the
V4L2_CID_CONFIG_MODELcontrol for the configuration model.Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ .../userspace-api/media/v4l/subdev-config-model.rst | 2 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 4 files changed, 14 insertions(+)Quoted 15 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 61
Quoted 12 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +4
-0@@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`.First of all the naming is confusing: since this is specific to sub-devices, it should at least have 'SUBDEV' in the name. I first thought this reported the
Quoted 7 lines
I don't object in principle, but the reason why I didn't add that in v1 was the names would get quite long. Maybe
V4L2_CID_SUBDEV_CFG_MODEL?Quoted 2 lines
model name or something like that, I'm not sure "configuration model" is a very good name.
Feel free to propose a different one. :-)
I would, if I understood what you intend to achieve :-)
Quoted 18 lines
Quoted 4 lines
Secondly, is this supposed to be valid for all subdevices? Only for sensors? Would an HDMI-to-CSI bridge qualify?
I think it could but we should have a use case for it. In other words, something we can't reasonably express using existing means. In this case it's a number of interfaces and device type specific behaviour (see the 3rd patch).
Quoted 3 lines
Thirdly, only
V4L2_CID_CONFIG_MODEL_COMMON_RAWis defined right now. What other models do you have in mind? What models can co-exist (since this is a bitmask)?We could have different raw camera models if needed. I don't have any planned right now, though.
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Finally, why choose a control for this? Should this perhaps be better done as a field in media_entity_desc/media_v2_entity?
I don't think it's a great fit. This is largely about V4L2 (to some but lesser extent about MC) and we traditionally have avoided MC -> V4L2 dependencies.
It sounds a bit like you want to report what Mauro calls a 'Profile'.
But I would expect the control to be an enum and not a bitmask, since I would expect a device to fit just a single configuration mode, and not multiple modes.
Also, V4L2_CID_CONFIG_MODEL_COMMON_RAW applies only to sensors, right? So this should be V4L2_CID_CONFIG_MODEL_SENSOR_COMMON_RAW. But what is common about it and what is raw about it?
Isn't it the case that pretty much all sensor drivers fall into this category?
The only reason I see for this is if there are actually other configuration modes going to be added in the near future.
What I am missing in this RFC is a high-level view of why it is needed and how it is going to be used.
Perhaps I missed a discussion on linux-media?
Regards,
Hans
Re: [RFC 4/4] media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
Hello,
Quoted 32 lines · Hans Verkuil
Quoted 31 lines · Sakari Ailus
Quoted 11 lines · Hans Verkuil
Quoted 10 lines · Sakari Ailus
Add the
V4L2_CID_CONFIG_MODELcontrol for the configuration model.Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ .../userspace-api/media/v4l/subdev-config-model.rst | 2 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 4 files changed, 14 insertions(+)Quoted 15 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 61
Quoted 12 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +4
-0@@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`.First of all the naming is confusing: since this is specific to sub-devices, it should at least have 'SUBDEV' in the name. I first thought this reported the
I don't object in principle, but the reason why I didn't add that in v1 was the names would get quite long. Maybe
V4L2_CID_SUBDEV_CFG_MODEL?
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
model name or something like that, I'm not sure "configuration model" is a very good name.
Feel free to propose a different one. :-)
I would, if I understood what you intend to achieve :-)
I'll try to rephrase what Sakari wrote in the patches.
The V4L2 specification defines a subdev API that exposes three type of configuration elements: formats, selection rectangles and controls. The specification contains generic information about how those configuration elements behave, but not precisly how they apply to particular hardware features. We leave some leeway to drivers to decide how to map selection rectangles to device features, as long as they comply with the V4L2 specification. This is needed, as hardware features differ between devices, so it's the driver's responsibility to handle this mapping.
Unfortunately, this lack of clearly defined mapping in the specification has led to different drivers mapping the same hardware features to different API elements, or implementing the API elements with slightly different behaviours. Furthermore, many drivers have implemented selection rectangles in ways that do not comply with the V4L2 specification. All of this makes userspace development difficult.
We can't define precisely how all configuration elements apply to hardware features in a way that applies to all devices, as devices differ widely. We can however develop such precise definitions for classes of similar devices. In order to develop generic userspace code, we then need a way for subdevs to indicate which class they belong to. This is what the configuration model control does. The configuration model tells userspace which section of the V4L2 specification defines the precise behaviour of the device.
One example of how drivers implement features in different ways is skipping and binning. Some sensor drivers use selection rectangles, other just formats.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Secondly, is this supposed to be valid for all subdevices? Only for sensors? Would an HDMI-to-CSI bridge qualify?
I think it could but we should have a use case for it. In other words, something we can't reasonably express using existing means. In this case it's a number of interfaces and device type specific behaviour (see the 3rd patch).
The control can be used by any type of device, as long as someone documents a corresponding configuration model.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Thirdly, only
V4L2_CID_CONFIG_MODEL_COMMON_RAWis defined right now. What other models do you have in mind? What models can co-exist (since this is a bitmask)?We could have different raw camera models if needed. I don't have any planned right now, though.
CCS would be another model, although I'm not sure if any other driver would implement that model. Still, even if used by the CCS driver only, I think it would make sense to define a CCS model.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Finally, why choose a control for this? Should this perhaps be better done as a field in media_entity_desc/media_v2_entity?
I don't think it's a great fit. This is largely about V4L2 (to some but lesser extent about MC) and we traditionally have avoided MC -> V4L2 dependencies.
It sounds a bit like you want to report what Mauro calls a 'Profile'.
There are similarities but it's not the same concept. What Mauro named "profile" was more about which ioctls were implemented by the device, and less about their detailed behaviour.
Quoted 3 lines
But I would expect the control to be an enum and not a bitmask, since I would expect a device to fit just a single configuration mode, and not multiple modes.
I would have used an enum as well. In theory we could define models that cover non-overlaping parts of the device features, and a device could then implement multiple models, but I'm not sure that would happen.
Quoted 3 lines
Also,
V4L2_CID_CONFIG_MODEL_COMMON_RAWapplies only to sensors, right? So this should beV4L2_CID_CONFIG_MODEL_SENSOR_COMMON_RAW. But what is common about it and what is raw about it?
Yes, mentioning "SENSOR" in the name makes sense.
Quoted 2 lines
Isn't it the case that pretty much all sensor drivers fall into this category?
"raw" is by opposition to YUV sensors. YUV sensors (a.k.a. "smart sensors") require very different configuration parameters compared to raw sensors, so the model we're standardizing for raw sensors isn't applicable.
Quoted 2 lines
The only reason I see for this is if there are actually other configuration modes going to be added in the near future.
Even before we add a second model, this is useful for userspace. We have many camera sensor drivers that implement the V4L2 API in different (and sometimes non-compliant) ways. Knowing that a sensor is compatible with the new model we're defining will be useful for libcamera.
Quoted 4 lines
What I am missing in this RFC is a high-level view of why it is needed and how it is going to be used.
Perhaps I missed a discussion on linux-media?
Signature · 3 lines
Regards, Laurent Pinchart
Re: [RFC 4/4] media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
Hi Laurent,
Quoted 69 lines · Laurent Pinchart
Hello,
Quoted 32 lines · Hans Verkuil
Quoted 31 lines · Sakari Ailus
Quoted 11 lines · Hans Verkuil
Quoted 10 lines · Sakari Ailus
Add the
V4L2_CID_CONFIG_MODELcontrol for the configuration model.Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ .../userspace-api/media/v4l/subdev-config-model.rst | 2 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 4 files changed, 14 insertions(+)Quoted 15 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 61
Quoted 12 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +4
-0@@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`.First of all the naming is confusing: since this is specific to sub-devices, it should at least have 'SUBDEV' in the name. I first thought this reported the
I don't object in principle, but the reason why I didn't add that in v1 was the names would get quite long. Maybe
V4L2_CID_SUBDEV_CFG_MODEL?Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
model name or something like that, I'm not sure "configuration model" is a very good name.
Feel free to propose a different one. :-)
I would, if I understood what you intend to achieve :-)
I'll try to rephrase what Sakari wrote in the patches.
The V4L2 specification defines a subdev API that exposes three type of configuration elements: formats, selection rectangles and controls. The specification contains generic information about how those configuration elements behave, but not precisly how they apply to particular hardware features. We leave some leeway to drivers to decide how to map selection rectangles to device features, as long as they comply with the V4L2 specification. This is needed, as hardware features differ between devices, so it's the driver's responsibility to handle this mapping.
Unfortunately, this lack of clearly defined mapping in the specification has led to different drivers mapping the same hardware features to different API elements, or implementing the API elements with slightly different behaviours. Furthermore, many drivers have implemented selection rectangles in ways that do not comply with the V4L2 specification. All of this makes userspace development difficult.
We can't define precisely how all configuration elements apply to hardware features in a way that applies to all devices, as devices differ widely. We can however develop such precise definitions for classes of similar devices. In order to develop generic userspace code, we then need a way for subdevs to indicate which class they belong to. This is what the configuration model control does. The configuration model tells userspace which section of the V4L2 specification defines the precise behaviour of the device.
Quoted 3 lines
One example of how drivers implement features in different ways is skipping and binning. Some sensor drivers use selection rectangles, other just formats.
I'll use this text, with some modifications, in the documentation of sub-device configuration models.
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Secondly, is this supposed to be valid for all subdevices? Only for sensors? Would an HDMI-to-CSI bridge qualify?
I think it could but we should have a use case for it. In other words, something we can't reasonably express using existing means. In this case it's a number of interfaces and device type specific behaviour (see the 3rd patch).
The control can be used by any type of device, as long as someone documents a corresponding configuration model.
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Thirdly, only
V4L2_CID_CONFIG_MODEL_COMMON_RAWis defined right now. What other models do you have in mind? What models can co-exist (since this is a bitmask)?
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
We could have different raw camera models if needed. I don't have any planned right now, though.
CCS would be another model, although I'm not sure if any other driver would implement that model. Still, even if used by the CCS driver only, I think it would make sense to define a CCS model.
Currently the only way to determine CCS driver is being used is that some CCS specific controls are supported by the device. I'm beginning to lean towards having a CCS model, too. I'll add that in the next version.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Finally, why choose a control for this? Should this perhaps be better done as a field in media_entity_desc/media_v2_entity?
I don't think it's a great fit. This is largely about V4L2 (to some but lesser extent about MC) and we traditionally have avoided MC -> V4L2 dependencies.
Quoted 5 lines
Quoted 1 line
It sounds a bit like you want to report what Mauro calls a 'Profile'.
There are similarities but it's not the same concept. What Mauro named "profile" was more about which ioctls were implemented by the device, and less about their detailed behaviour.
I think it was only about the IOCTLs supported, that's it.
Quoted 8 lines
Quoted 4 lines
But I would expect the control to be an enum and not a bitmask, since I would expect a device to fit just a single configuration mode, and not multiple modes.
I would have used an enum as well. In theory we could define models that cover non-overlaping parts of the device features, and a device could then implement multiple models, but I'm not sure that would happen.
I'm open to making this an enum if you prefer that. My concern, and the reason why I used a bitmask, is that a sub-device could implement several models at a time. They could also be used to declare semantics of a specific part of the device interface, not the entire interface. For instance, analogue gain model could be an example of that albeit this likely could be derived from controls present.
Quoted 6 lines
Quoted 4 lines
Also,
V4L2_CID_CONFIG_MODEL_COMMON_RAWapplies only to sensors, right? So this should beV4L2_CID_CONFIG_MODEL_SENSOR_COMMON_RAW. But what is common about it and what is raw about it?Yes, mentioning "SENSOR" in the name makes sense.
That name is very long. :-( Anyway, I don't see this being an issue in practice so I'll use that in the next version.
Quoted 22 lines
Quoted 3 lines
Isn't it the case that pretty much all sensor drivers fall into this category?
"raw" is by opposition to YUV sensors. YUV sensors (a.k.a. "smart sensors") require very different configuration parameters compared to raw sensors, so the model we're standardizing for raw sensors isn't applicable.
Quoted 2 lines
The only reason I see for this is if there are actually other configuration modes going to be added in the near future.
Even before we add a second model, this is useful for userspace. We have many camera sensor drivers that implement the V4L2 API in different (and sometimes non-compliant) ways. Knowing that a sensor is compatible with the new model we're defining will be useful for libcamera.
Quoted 4 lines
What I am missing in this RFC is a high-level view of why it is needed and how it is going to be used.
Perhaps I missed a discussion on linux-media?
Signature · 3 lines
Kind regards, Sakari Ailus
Re: [RFC 4/4] media: v4l: ctrl: Add V4L2_CID_CONFIG_MODEL control
Quoted 123 lines · Sakari Ailus
Quoted 67 lines · Laurent Pinchart
Quoted 32 lines · Hans Verkuil
Quoted 31 lines · Sakari Ailus
Quoted 11 lines · Hans Verkuil
Quoted 10 lines · Sakari Ailus
Add the
V4L2_CID_CONFIG_MODELcontrol for the configuration model.Signed-off-by Sakari Ailus <[email protected]>--- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ .../userspace-api/media/v4l/subdev-config-model.rst | 2 ++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 4 files changed, 14 insertions(+)Quoted 15 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 61
Quoted 12 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +4
-0@@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`.First of all the naming is confusing: since this is specific to sub-devices, it should at least have 'SUBDEV' in the name. I first thought this reported the
I don't object in principle, but the reason why I didn't add that in v1 was the names would get quite long. Maybe
V4L2_CID_SUBDEV_CFG_MODEL?Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
model name or something like that, I'm not sure "configuration model" is a very good name.
Feel free to propose a different one. :-)
I would, if I understood what you intend to achieve :-)
I'll try to rephrase what Sakari wrote in the patches.
The V4L2 specification defines a subdev API that exposes three type of configuration elements: formats, selection rectangles and controls. The specification contains generic information about how those configuration elements behave, but not precisly how they apply to particular hardware features. We leave some leeway to drivers to decide how to map selection rectangles to device features, as long as they comply with the V4L2 specification. This is needed, as hardware features differ between devices, so it's the driver's responsibility to handle this mapping.
Unfortunately, this lack of clearly defined mapping in the specification has led to different drivers mapping the same hardware features to different API elements, or implementing the API elements with slightly different behaviours. Furthermore, many drivers have implemented selection rectangles in ways that do not comply with the V4L2 specification. All of this makes userspace development difficult.
We can't define precisely how all configuration elements apply to hardware features in a way that applies to all devices, as devices differ widely. We can however develop such precise definitions for classes of similar devices. In order to develop generic userspace code, we then need a way for subdevs to indicate which class they belong to. This is what the configuration model control does. The configuration model tells userspace which section of the V4L2 specification defines the precise behaviour of the device.
Quoted 3 lines
One example of how drivers implement features in different ways is skipping and binning. Some sensor drivers use selection rectangles, other just formats.
I'll use this text, with some modifications, in the documentation of sub-device configuration models.
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Secondly, is this supposed to be valid for all subdevices? Only for sensors? Would an HDMI-to-CSI bridge qualify?
I think it could but we should have a use case for it. In other words, something we can't reasonably express using existing means. In this case it's a number of interfaces and device type specific behaviour (see the 3rd patch).
The control can be used by any type of device, as long as someone documents a corresponding configuration model.
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Thirdly, only
V4L2_CID_CONFIG_MODEL_COMMON_RAWis defined right now. What other models do you have in mind? What models can co-exist (since this is a bitmask)?Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
We could have different raw camera models if needed. I don't have any planned right now, though.
CCS would be another model, although I'm not sure if any other driver would implement that model. Still, even if used by the CCS driver only, I think it would make sense to define a CCS model.
Currently the only way to determine CCS driver is being used is that some CCS specific controls are supported by the device. I'm beginning to lean towards having a CCS model, too. I'll add that in the next version.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Finally, why choose a control for this? Should this perhaps be better done as a field in media_entity_desc/media_v2_entity?
I don't think it's a great fit. This is largely about V4L2 (to some but lesser extent about MC) and we traditionally have avoided MC -> V4L2 dependencies.
Quoted 5 lines
Quoted 1 line
It sounds a bit like you want to report what Mauro calls a 'Profile'.
There are similarities but it's not the same concept. What Mauro named "profile" was more about which ioctls were implemented by the device, and less about their detailed behaviour.
I think it was only about the IOCTLs supported, that's it.
Quoted 7 lines
Quoted 3 lines
But I would expect the control to be an enum and not a bitmask, since I would expect a device to fit just a single configuration mode, and not multiple modes.
I would have used an enum as well. In theory we could define models that cover non-overlaping parts of the device features, and a device could then implement multiple models, but I'm not sure that would happen.
Quoted 6 lines
I'm open to making this an enum if you prefer that. My concern, and the reason why I used a bitmask, is that a sub-device could implement several models at a time. They could also be used to declare semantics of a specific part of the device interface, not the entire interface. For instance, analogue gain model could be an example of that albeit this likely could be derived from controls present.
That's what I understood from your initial proposal. I think it's an interesting idea, but I believe it's also too complex at this point. There would be lots of issues to solve, in particular how to define models to evoid overlaps between parts of the device. This could be explored, but will require substantial work to prototype, with support in enough drivers to get confidence the API would be right. At this point, I'd rather go for an enum and keep the "model of subdev models" simple.
Quoted 29 lines
Quoted 5 lines
Quoted 3 lines
Also,
V4L2_CID_CONFIG_MODEL_COMMON_RAWapplies only to sensors, right? So this should beV4L2_CID_CONFIG_MODEL_SENSOR_COMMON_RAW. But what is common about it and what is raw about it?Yes, mentioning "SENSOR" in the name makes sense.
That name is very long. :-( Anyway, I don't see this being an issue in practice so I'll use that in the next version.
Quoted 20 lines
Quoted 2 lines
Isn't it the case that pretty much all sensor drivers fall into this category?
"raw" is by opposition to YUV sensors. YUV sensors (a.k.a. "smart sensors") require very different configuration parameters compared to raw sensors, so the model we're standardizing for raw sensors isn't applicable.
Quoted 2 lines
The only reason I see for this is if there are actually other configuration modes going to be added in the near future.
Even before we add a second model, this is useful for userspace. We have many camera sensor drivers that implement the V4L2 API in different (and sometimes non-compliant) ways. Knowing that a sensor is compatible with the new model we're defining will be useful for libcamera.
Quoted 4 lines
What I am missing in this RFC is a high-level view of why it is needed and how it is going to be used.
Perhaps I missed a discussion on linux-media?
Signature · 3 lines
Regards, Laurent Pinchart
Hi, Sakari!
Quoted 26 lines · Sakari Ailus
Hello everyone,
I've been recently working (with others) on sub-device streams support as well as on internal pads. The two can be used to make sub-device configuration more versatile.
At the same time, the added interfaces are much more useful if we require specific semantics of those interfaces, so that the user space knows exactly what e.g. a given selection target signifies. However, as the same selection rectangle could be used for a different purpose on a non-raw sensor device, we need a way to tell how should the user space determine how to use a given interface.
I'm proposing to solve this problem by introducing sub-device configuration models, and by the common raw sensor model, also present in this patchset, in particular.
This has been (and will, for some time, continue to be) the reason why I have reviewed few sensor driver related patches lately. As we're introducing a new interface, it's beneficial to be able to use that interface right from the start, rather than trying to later on offer compatibility support, which is almost always a fair amount of work with less than desirable results in the driver.
With this solved, I believe we can enable the use of the streams UAPI.
Quoted 7 lines
Comments are welcome.
The compiled documentation can be found in <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/meta-format/output/userspace-api/media/v4l/dev-subdev.html#sub-device-configuration-models> and the patches here
<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=metadata>, i.e.
they're on top of the metadata set.
I've read the updated documentation you shared, and have a question concerning binning configuration. IIUC binning should be configured via set_selection(V4L2_SEL_TGT_COMPOSE). But I also see some existing drivers configure binning via set_fmt() (imx296) or both set_fmt() and set_selection(V4L2_SEL_TGT_COMPOSE) (imx274). What will be the right way to add binning support to a driver I care about (ov4689), which presently does not implement any binning configuration at all?
--
Best regards,
Mikhail
Hi Mikhail
Quoted 39 lines · Mikhail Rudenko
Hi, Sakari!
Quoted 26 lines · Sakari Ailus
Hello everyone,
I've been recently working (with others) on sub-device streams support as well as on internal pads. The two can be used to make sub-device configuration more versatile.
At the same time, the added interfaces are much more useful if we require specific semantics of those interfaces, so that the user space knows exactly what e.g. a given selection target signifies. However, as the same selection rectangle could be used for a different purpose on a non-raw sensor device, we need a way to tell how should the user space determine how to use a given interface.
I'm proposing to solve this problem by introducing sub-device configuration models, and by the common raw sensor model, also present in this patchset, in particular.
This has been (and will, for some time, continue to be) the reason why I have reviewed few sensor driver related patches lately. As we're introducing a new interface, it's beneficial to be able to use that interface right from the start, rather than trying to later on offer compatibility support, which is almost always a fair amount of work with less than desirable results in the driver.
With this solved, I believe we can enable the use of the streams UAPI.
Quoted 7 lines
Comments are welcome.
The compiled documentation can be found in <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/meta-format/output/userspace-api/media/v4l/dev-subdev.html#sub-device-configuration-models> and the patches here
<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=metadata>, i.e.
they're on top of the metadata set.
Quoted 3 lines
I've read the updated documentation you shared, and have a question concerning binning configuration. IIUC binning should be configured via
set_selection(V4L2_SEL_TGT_COMPOSE). But I also see some existing
set_selection(V4L2_SEL_TGT_COMPOSE) on the internal image pad, stream #0
Quoted 2 lines
drivers configure binning via
set_fmt()(imx296) or bothset_fmt()andset_selection(V4L2_SEL_TGT_COMPOSE)(imx274). What will be the right way
Existing drivers have adopted creative solutions to allow control of the binning factor but all of them are somewhat non-compliant with the specs (we went in great lenght in looking at these in the media summit 2 years ago). We didn't have internal pads at the time.
Quoted 2 lines
to add binning support to a driver I care about (ov4689), which presently does not implement any binning configuration at all?
Now that you can use internal pads, I would follow what is described in patch 3/4 of this series.
Thanks
j
Quoted 5 lines
--
Best regards,
Mikhail
Quoted 57 lines · Jacopo Mondi
Hi Mikhail
Quoted 39 lines · Mikhail Rudenko
Hi, Sakari!
Quoted 26 lines · Sakari Ailus
Hello everyone,
I've been recently working (with others) on sub-device streams support as well as on internal pads. The two can be used to make sub-device configuration more versatile.
At the same time, the added interfaces are much more useful if we require specific semantics of those interfaces, so that the user space knows exactly what e.g. a given selection target signifies. However, as the same selection rectangle could be used for a different purpose on a non-raw sensor device, we need a way to tell how should the user space determine how to use a given interface.
I'm proposing to solve this problem by introducing sub-device configuration models, and by the common raw sensor model, also present in this patchset, in particular.
This has been (and will, for some time, continue to be) the reason why I have reviewed few sensor driver related patches lately. As we're introducing a new interface, it's beneficial to be able to use that interface right from the start, rather than trying to later on offer compatibility support, which is almost always a fair amount of work with less than desirable results in the driver.
With this solved, I believe we can enable the use of the streams UAPI.
Quoted 7 lines
Comments are welcome.
The compiled documentation can be found in <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/meta-format/output/userspace-api/media/v4l/dev-subdev.html#sub-device-configuration-models> and the patches here
<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=metadata>, i.e.
they're on top of the metadata set.Quoted 3 lines
I've read the updated documentation you shared, and have a question concerning binning configuration. IIUC binning should be configured via
set_selection(V4L2_SEL_TGT_COMPOSE). But I also see some existing
set_selection(V4L2_SEL_TGT_COMPOSE)on the internal image pad, stream #0Quoted 2 lines
drivers configure binning via
set_fmt()(imx296) or bothset_fmt()andset_selection(V4L2_SEL_TGT_COMPOSE)(imx274). What will be the right wayExisting drivers have adopted creative solutions to allow control of the binning factor but all of them are somewhat non-compliant with the specs (we went in great lenght in looking at these in the media summit 2 years ago). We didn't have internal pads at the time.
Quoted 5 lines
Quoted 2 lines
to add binning support to a driver I care about (ov4689), which presently does not implement any binning configuration at all?
Now that you can use internal pads, I would follow what is described in patch 3/4 of this series.
Will do so, thanks!
Quoted 8 lines
Thanks
jQuoted 5 lines
--
Best regards,
Mikhail
--
Best regards,
Mikhail