New V4L2 control V4L2_CID_NOTIFY_GAINS
v5 cover New V4L2 control V4L2_CID_NOTIFY_GAINS
Hello again
Thanks for all the discussion on the previous (v4) version of this patch set. This new version addresses the points raised which were principally in improving the documentation.
There was also mention of the v4l2_ctrl_fill function. I haven't included this control there as the other "image source" controls aren't listed and it seems to me that it's up to the sensor what min/max/def to use, but please correct me on that if I've got that wrong!
Best regards
David
David Plowman (2):
media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAINS control
media: v4l2-ctrls: Document V4L2_CID_NOTIFY_GAINS control
.../media/v4l/ext-ctrls-image-source.rst | 20 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 + include/uapi/linux/v4l2-controls.h | 1 + 3 files changed, 22 insertions(+)
Signature · 1 line
2.30.2
PATCH v5 1/2 media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAINS control
We add a new control V4L2_CID_NOTIFY_GAINS which allows the sensor to be notified what gains will be applied to the different colour channels by subsequent processing (such as by an ISP), even though the sensor will not apply any of these gains itself.
For Bayer sensors this will be an array control taking 4 values which are the 4 gains arranged in the fixed order B, Gb, Gr and R, irrespective of the exact Bayer order of the sensor itself. The use of an array makes it straightforward to extend this control to non-Bayer sensors (for example, sensors with an RGBW pattern) in future.
The units are in all cases linear with the default value indicating a gain of exactly 1. For example, if the default value were reported as 128 then the value 256 would represent a gain of exactly 2.
--- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 + include/uapi/linux/v4l2-controls.h | 1 + 2 files changed, 2 insertions(+)
drivers/media/v4l2-core/v4l2-ctrls-defs.c +1 -0
@@ -1107,6 +1107,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_TEST_PATTERN_GREENR :return "Green (Red) Pixel Value" ;case V4L2_CID_TEST_PATTERN_BLUE :return "Blue Pixel Value" ;case V4L2_CID_TEST_PATTERN_GREENB :return "Green (Blue) Pixel Value" ; +case V4L2_CID_NOTIFY_GAINS :return "Notify Gains" ;/* Image processing controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */
include/uapi/linux/v4l2-controls.h +1 -0
@@ -1118,6 +1118,7 @@ enum v4l2_jpeg_chroma_subsampling {#define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)#define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)#define V4L2_CID_UNIT_CELL_SIZE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 8) +#define V4L2_CID_NOTIFY_GAINS (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 9)/* Image processing controls */
Signature · 1 line
2.30.2
Re: [PATCH v5 1/2] media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAINS control
Hi David,
Thank you for the patch.
Quoted 11 lines · David Plowman
We add a new control
V4L2_CID_NOTIFY_GAINSwhich allows the sensor to be notified what gains will be applied to the different colour channels by subsequent processing (such as by an ISP), even though the sensor will not apply any of these gains itself.For Bayer sensors this will be an array control taking 4 values which are the 4 gains arranged in the fixed order B, Gb, Gr and R, irrespective of the exact Bayer order of the sensor itself. The use of an array makes it straightforward to extend this control to non-Bayer sensors (for example, sensors with an RGBW pattern) in future.
Quoted 5 lines
The units are in all cases linear with the default value indicating a gain of exactly 1. For example, if the default value were reported as 128 then the value 256 would represent a gain of exactly 2.
Signed-off-by David Plowman <[email protected]>
Quoted 29 lines
--- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 + include/uapi/linux/v4l2-controls.h | 1 + 2 files changed, 2 insertions(+)drivers/media/v4l2-core/v4l2-ctrls-defs.c +1
-0@@ -1107,6 +1107,7 @@ const char *v4l2_ctrl_get_name(u32 id)case V4L2_CID_TEST_PATTERN_GREENR :return "Green (Red) Pixel Value" ;case V4L2_CID_TEST_PATTERN_BLUE :return "Blue Pixel Value" ;case V4L2_CID_TEST_PATTERN_GREENB :return "Green (Blue) Pixel Value" ; +case V4L2_CID_NOTIFY_GAINS :return "Notify Gains" ;/* Image processing controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ include/uapi/linux/v4l2-controls.h +1
-0@@ -1118,6 +1118,7 @@ enum v4l2_jpeg_chroma_subsampling {#define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)#define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)#define V4L2_CID_UNIT_CELL_SIZE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 8) +#define V4L2_CID_NOTIFY_GAINS (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 9)/* Image processing controls */
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v5 2/2 media: v4l2-ctrls: Document V4L2_CID_NOTIFY_GAINS control
In reply to David PlowmanAdd documentation for the V4L2_CID_NOTIFY_GAINS control.
This control is required by sensors that need to know what colour gains will be applied to pixels by downstream processing (such as by an ISP), though the sensor does not apply these gains itself.
--- .../media/v4l/ext-ctrls-image-source.rst | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)
Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +20 -0
@@ -72,3 +72,23 @@ Image Source Control IDs * - __u32 - ``height`` - Height of the area. + +``V4L2_CID_NOTIFY_GAINS (integer array)`` + The sensor is notified what gains will be applied to the different + colour channels by subsequent processing (such as by an ISP). The + sensor is merely informed of these values in case it performs + processing that requires them, but it does not apply them itself to + the output pixels. + + The use of an array allows this control to be extended to sensors + with, for example, non-Bayer CFAs (colour filter arrays). + + Currently it is defined only for Bayer sensors, and is an array + control taking 4 gain values, being the gains for each of the + Bayer channels. The gains are always in the order B, Gb, Gr and R, + irrespective of the exact Bayer order of the sensor itself. + + The units for the gain values are linear, with the default value + representing a gain of exactly 1. For example, if this default value + is reported as being (say) 128, then a value of 256 would represent + a gain of exactly 2.
Signature · 1 line
2.30.2
Re: [PATCH v5 2/2] media: v4l2-ctrls: Document V4L2_CID_NOTIFY_GAINS control
Hi David,
Thank you for the patch.
Quoted 24 lines · David Plowman
Add documentation for the
V4L2_CID_NOTIFY_GAINScontrol.This control is required by sensors that need to know what colour gains will be applied to pixels by downstream processing (such as by an ISP), though the sensor does not apply these gains itself.
Signed-off-by David Plowman <[email protected]>--- .../media/v4l/ext-ctrls-image-source.rst | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +5
-0@@ -72,3 +72,23 @@ Image Source Control IDs * - __u32 - ``height`` - Height of the area. + +``V4L2_CID_NOTIFY_GAINS (integer array)`` + The sensor is notified what gains will be applied to the different + colour channels by subsequent processing (such as by an ISP). The + sensor is merely informed of these values in case it performs
Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst Image Source Control IDs · line 89
Quoted 10 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +10
-0+ processing that requires them, but it does not apply them itself to + the output pixels. + + The use of an array allows this control to be extended to sensors + with, for example, non-Bayer CFAs (colour filter arrays). + + Currently it is defined only for Bayer sensors, and is an array + control taking 4 gain values, being the gains for each of the + Bayer channels. The gains are always in the order B, Gb, Gr and R, + irrespective of the exact Bayer order of the sensor itself.
I'd swap the above two paragraphs.
Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst Image Source Control IDs · line 94
Quoted 5 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +5
-0+ + The units for the gain values are linear, with the default value + representing a gain of exactly 1. For example, if this default value + is reported as being (say) 128, then a value of 256 would represent + a gain of exactly 2.
Maybe 1.0 and 2.0 instead of 1 and 2 to show that the gains values themselves can be fractional ?
With those two minor issues addressed if deemed to be worth it,
Signature · 3 lines
Regards, Laurent Pinchart