History

Merge tag 'media/v7.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab: - v4l2-core: added ISP statistics support and per-block validation - v4l2-core: Allow unknown HDR10 white point and luminance - New camera sensors: Sony IMX678 and IMX471m, Himax HM1092 IR sensor - New codec: Milos: VPU v2.0 codec support - isp driver: gained support for Dreamchip RPPX1 ISP framework - vsp1 driver: gained support for RZ/T2H and RZ/N2H - Novalake driver: gained CVS support for new NVL hardware - dvb-core: fix feed leak on failed DMX_ADD_PID - several driver fixes, cleanups and minor improvements * tag 'media/v7.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (308 commits) media: ipu-bridge: check all DMI entries when overriding sensor rotation media: v4l2-async: avoid deleting unlinked ASC entry on link error media: rzg2l-cru: Align bytesperline to hardware DMA stride requirement media: intel/ipu6: fix async notifier cleanup leak on parse error media: staging/ipu7: fix async notifier UAF on probe error path media: amd: isp4: fix self-deadlock in isp4sd_pwron_and_init() error path media: amd: isp4: release partial allocations in isp4if_alloc_fw_gpumem() media: rcar-isp: Fix VSPX reference leaks media: rcar-isp: Release ISPCORE resources media: i2c: imx415: Release runtime PM reference on VBLANK error media: i2c: imx415: Return test pattern write errors media: renesas: vsp1: Declare index variables in for loop statement media: renesas: vsp1: Make reset control optional to support platforms without a reset line media: dt-bindings: media: renesas,vsp1: Document RZ/T2H and RZ/N2H SoCs media: dt-bindings: media: renesas,fcp: Document RZ/T2H and RZ/N2H SoCs media: nxp: imx8-isi: Add additional 32-bit RGB format support media: nxp: imx8-isi: Add 16-bit raw Bayer format support media: nxp: imx8-isi: Implement per-stream reference counting for multiplexed streams media: nxp: imx8-isi: Use BIT_ULL() for 64-bit stream masks media: nxp: imx8-isi: Correct color map between V4L2 and ISI ...

Linus Torvalds committed 2 months ago

Commit f4cdf7c2 parents e5c91aa 4900cad351 files · +14635 −4658Browse files

Showing the changes to include/uapi/linux (5 of 351 files). Show all

Unified · Split

5 files
  1. include/uapi/linux/cec.h +2 −0
  2. include/uapi/linux/media/arm/mali-c55-config.h +85 −1
  3. include/uapi/linux/media/dreamchip/rppx1-config.h +730 −0
  4. include/uapi/linux/media/v4l2-isp.h +79 −46
  5. include/uapi/linux/videodev2.h +4 −0
include/uapi/linux/cec.h+2−0
@@ -403,6 +403,8 @@ struct cec_log_addrs { · 402 unmodified lines
403403 #define CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU (1 << 1)
404404 /* CDC-Only device: supports only CDC messages */
405405 #define CEC_LOG_ADDRS_FL_CDC_ONLY (1 << 2)
406+/* Configuration failed */
407+#define CEC_LOG_ADDRS_FL_CONFIG_FAILED (1 << 3)
406408
407409 /**
408410 * struct cec_drm_connector_info - tells which drm connector is
include/uapi/linux/media/arm/mali-c55-config.h+85−1
@@ -36,6 +36,9 @@ · 35 unmodified lines
3636 */
3737 #define MALI_C55_MAX_ZONES (15 * 15)
3838
39+/* Number of RGB gamma LUT entries. */
40+#define MALI_C55_NUM_GAMMA_LUT_ELEMENTS 129
41+
3942 /**
4043 * struct mali_c55_ae_1024bin_hist - Auto Exposure 1024-bin histogram statistics
4144 *
@@ -219,6 +222,9 @@ struct mali_c55_stats_buffer { · 177 unmodified lines
219222 * @MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP: Auto-white balance gains for AEXP-0 tap
220223 * @MALI_C55_PARAM_MESH_SHADING_CONFIG : Mesh shading tables configuration
221224 * @MALI_C55_PARAM_MESH_SHADING_SELECTION: Mesh shading table selection
225+ * @MALI_C55_PARAM_BLOCK_CCM: Colour correction matrix
226+ * @MALI_C55_PARAM_BLOCK_GAMMA_FR: Gamma gain and offset for FR pipe
227+ * @MALI_C55_PARAM_BLOCK_GAMMA_DS: Gamma gain and offset for DS pipe
222228 */
223229 enum mali_c55_param_block_type {
224230 MALI_C55_PARAM_BLOCK_SENSOR_OFFS,
@@ -232,6 +238,9 @@ enum mali_c55_param_block_type { · 7 unmodified lines
232238 MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP,
233239 MALI_C55_PARAM_MESH_SHADING_CONFIG,
234240 MALI_C55_PARAM_MESH_SHADING_SELECTION,
241+ MALI_C55_PARAM_BLOCK_CCM,
242+ MALI_C55_PARAM_BLOCK_GAMMA_FR,
243+ MALI_C55_PARAM_BLOCK_GAMMA_DS,
235244 };
236245
237246 /**
@@ -757,6 +766,78 @@ struct mali_c55_params_mesh_shading_selection { · 519 unmodified lines
757766 __u16 mesh_strength;
758767 };
759768
769+/**
770+ * struct mali_c55_params_ccm - Coefficients, offsets and gains for the colour
771+ * correction matrix
772+ *
773+ * The colour correction module converts images data from a sensor-specific
774+ * colour space to known one.
775+ *
776+ * Colour correction is applied after demosaicing and each pixel is represented
777+ * as a column vector of the three RGB colour channels on which the following
778+ * operations take place:
779+ * 1) An offset is subtracted from each colour channel
780+ * 2) Each colour channel is multiplied by a gain
781+ * 3) The pixel column vector is multiplied by the colour correction matrix
782+ *
783+ * This struct allows users to configure the coefficients for CCM and the
784+ * per-channel offsets and gains. The nine matrix coefficients are expressed as
785+ * 13 bits signed Q4.8 Sign/Magnitude fixed-point numbers, the three gain
786+ * multipliers are expressed as 12 bits unsigned Q4.8 fixed-point numbers and
787+ * the three offsets are expressed as a 12 bits unsigned integers.
788+ *
789+ * header.type should be set to MALI_C55_PARAM_BLOCK_CCM from
790+ * :c:type:`mali_c55_param_block_type`.
791+ *
792+ * @header: The Mali-C55 parameters block header
793+ * @coeffs: 3x3 color conversion matrix coefficients in sign/magnitude
794+ * Q4.8 format
795+ * @gains: Gains for red, green and blue channels in unsigned Q4.8 format
796+ * @offs: Offsets for red, green and blue channels
797+ */
798+struct mali_c55_params_ccm {
799+ struct v4l2_isp_params_block_header header;
800+ __u16 coeffs[3][3];
801+ __u16 gains[3];
802+ __u16 offs[3];
803+};
804+
805+/**
806+ * struct mali_c55_params_gamma - RGB Gamma correction
807+ *
808+ * Gamma correction is used to program a standard gamma curve such as the sRGB
809+ * one. It provides gains and offsets to implement contrast adjustments.
810+ *
811+ * Gamma correction is applied on both the FR and DS pipes separately in the RGB
812+ * colour domain where the following operations take place:
813+ * 1) An offset is subtracted from each colour channel
814+ * 2) Each colour channel is multiplied by a gain
815+ * 3) The Gamma LUT is applied to each colour channel
816+ *
817+ * The Gamma LUT has 129 entries where each node is an unsigned 12 bit number.
818+ * It is expected that LUT[0]=0 and LUT[128]=0xfff, with the other 127 values
819+ * defining the Gamma correction curve. The three gain multipliers are expressed
820+ * as 12-bits unsigned Q4.8 fixed-point numbers and the three offsets are
821+ * expressed as a 12-bits unsigned integers.
822+ *
823+ * As one Gamma correction block is available on both the FR and DS pipes, the
824+ * header.type field should be set to one of either
825+ * MALI_C55_PARAM_BLOCK_GAMMA_FR or MALI_C55_PARAM_BLOCK_GAMMA_DS from
826+ * :c:type:`mali_c55_param_block_type`.
827+ *
828+ * @header: The Mali-C55 parameters block header
829+ * @gains: Gains for the red, green and blue channel in unsigned Q4.8 format
830+ * @offs: Offsets subtracted from the red, green and blue channels
831+ * in unsigned 12 bits format
832+ * @lut: 129-node Gamma LUT in unsigned 12 bits format
833+ */
834+struct mali_c55_params_gamma {
835+ struct v4l2_isp_params_block_header header;
836+ __u16 gains[3];
837+ __u16 offs[3];
838+ __u32 lut[MALI_C55_NUM_GAMMA_LUT_ELEMENTS];
839+};
840+
760841 /**
761842 * define MALI_C55_PARAMS_MAX_SIZE - Maximum size of all Mali C55 Parameters
762843 *
@@ -780,6 +861,9 @@ struct mali_c55_params_mesh_shading_selection { · 17 unmodified lines
780861 sizeof(struct mali_c55_params_awb_config) + \
781862 sizeof(struct mali_c55_params_awb_gains) + \
782863 sizeof(struct mali_c55_params_mesh_shading_config) + \
783− sizeof(struct mali_c55_params_mesh_shading_selection))
864+ sizeof(struct mali_c55_params_mesh_shading_selection) + \
865+ sizeof(struct mali_c55_params_ccm) + \
866+ sizeof(struct mali_c55_params_gamma) + \
867+ sizeof(struct mali_c55_params_gamma))
784868
785869 #endif /* __UAPI_MALI_C55_CONFIG_H */
include/uapi/linux/media/dreamchip/rppx1-config.h+730−0
@@ -0,0 +1,730 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+/*
3+ * Dreamchip RPP-X1 ISP Driver - Userspace API
4+ *
5+ * Copyright (C) 2026 Renesas Electronics Corp.
6+ * Copyright (C) 2026 Ideas on Board Oy
7+ * Copyright (C) 2026 Ragnatech AB
8+ */
9+
10+#ifndef __UAPI_RPP_X1_CONFIG_H
11+#define __UAPI_RPP_X1_CONFIG_H
12+
13+#include <linux/media/v4l2-isp.h>
14+
15+/**
16+ * struct rppx1_window - Measurement window
17+ *
18+ * RPP-X1 measurement window. Different blocks use a window or multiple
19+ * windows for measurement purposes. This defines a common type for all of
20+ * them. The number of relevant bits depends on the block where the window is
21+ * used and is specified in the per-block description
22+ *
23+ * @h_offs: horizontal offset from the left of the frame in pixels
24+ * @v_offs: vertical offset from the top of the frame in pixels
25+ * @h_size: horizontal size of the window in pixels
26+ * @v_size: vertical size of the window in pixels
27+ */
28+struct rppx1_window {
29+ __u16 h_offs;
30+ __u16 v_offs;
31+ __u16 h_size;
32+ __u16 v_size;
33+};
34+
35+/**
36+ * enum rppx1_meas_chan - Measurement point for the Histogram and EXM Modules
37+ *
38+ * Measurement points for the RPP-X1 Histogram measurement module and Exposure
39+ * measurement module.
40+ *
41+ * All tap points are available for the PRE1/PRE2 pipes. Only
42+ * RPPX1_MEAS_CHAN_SEL4 and RPPX1_MEAS_CHAN_SEL7 are available for the
43+ * MAIN_POST pipe.
44+ *
45+ * @RPPX1_MEAS_CHAN_SEL0: after input acquisition
46+ * @RPPX1_MEAS_CHAN_SEL1: after black level subtraction
47+ * @RPPX1_MEAS_CHAN_SEL2: after sensor gamma linearization
48+ * @RPPX1_MEAS_CHAN_SEL3: after lens shading correction
49+ * @RPPX1_MEAS_CHAN_SEL4: after auto white balance gains
50+ * @RPPX1_MEAS_CHAN_SEL5: after defect pixel correction
51+ * @RPPX1_MEAS_CHAN_SEL6: after denoise pre-filter
52+ * @RPPX1_MEAS_CHAN_SEL7: after demosaicing
53+ */
54+enum rppx1_meas_chan {
55+ RPPX1_MEAS_CHAN_SEL0,
56+ RPPX1_MEAS_CHAN_SEL1,
57+ RPPX1_MEAS_CHAN_SEL2,
58+ RPPX1_MEAS_CHAN_SEL3,
59+ RPPX1_MEAS_CHAN_SEL4,
60+ RPPX1_MEAS_CHAN_SEL5,
61+ RPPX1_MEAS_CHAN_SEL6,
62+ RPPX1_MEAS_CHAN_SEL7,
63+};
64+
65+/* ---------------------------------------------------------------------------
66+ * Parameter Structures
67+ *
68+ * The same ISP block might be instantiated in multiple pipeliness and operate
69+ * on a different bitdepth/precision. For fields of varying length among
70+ * different instances of the same block, use a data type that can accommodate
71+ * the larger bitdepth/precision.
72+ */
73+
74+/**
75+ * enum rppx1_params_block_type - RPP-X1 extensible params block types
76+ *
77+ * NOTE: Only append to the enumeration as the numbers are uAPI.
78+ *
79+ * @RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST: AWB Measurement Configuration
80+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1: PRE1 pipe White Balance Gains
81+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2: PRE2 White Balance Gains
82+ * @RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST: MAIN_POST White Balance Gains
83+ * @RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1: PRE1 pipe Exposure Measurement
84+ * @RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2: PRE2 pipe Exposure Measurement
85+ * @RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE1: PRE1 pipe Histogram Measurement
86+ * @RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE2: PRE2 pipe Histogram Measurement
87+ * @RPPX1_PARAMS_BLOCK_TYPE_HIST_POST: POST pipe Histogram Measurement
88+ * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1: PRE1 pipe Black Level Subtraction
89+ * @RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2: PRE2 pipe Black Level Subtraction
90+ * @RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST: POST pipe Color Correction
91+ * @RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1: PRE1 pipe Lens Shading Correction
92+ * @RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2: PRE2 pipe Lens Shading Correction
93+ * @RPPX1_PARAMS_BLOCK_TYPE_GA_HV: Human Vision Pipe Gamma Out Correction
94+ * @RPPX1_PARAMS_BLOCK_TYPE_GA_MV: Machine Vision Gamma Out Correction
95+ * @RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE1: PRE1 pipe Linearization (Sensor De-gamma)
96+ * @RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE2: PRE2 pipe Linearization (Sensor De-gamma)
97+ */
98+enum rppx1_params_block_type {
99+ RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST,
100+ RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1,
101+ RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2,
102+ RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST,
103+ RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1,
104+ RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2,
105+ RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE1,
106+ RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE2,
107+ RPPX1_PARAMS_BLOCK_TYPE_HIST_POST,
108+ RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1,
109+ RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2,
110+ RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST,
111+ RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1,
112+ RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2,
113+ RPPX1_PARAMS_BLOCK_TYPE_GA_HV,
114+ RPPX1_PARAMS_BLOCK_TYPE_GA_MV,
115+ RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE1,
116+ RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE2,
117+};
118+
119+/**
120+ * enum rppx1_wbmeas_mode - AWB measurement mode
121+ *
122+ * @RPPX1_WBMEAS_MODE_YCBCR: YCbCr measurement mode
123+ * @RPPX1_WBMEAS_MODE_RGB: RGB measurement mode
124+ */
125+enum rppx1_wbmeas_mode {
126+ RPPX1_WBMEAS_MODE_YCBCR,
127+ RPPX1_WBMEAS_MODE_RGB,
128+};
129+
130+/**
131+ * struct rppx1_wbmeas_params - AWB measurement configuration
132+ *
133+ * The Auto-White Balance measurement module is available on the MAIN_POST pipe.
134+ * It supports two measurement modes, selected by the @mode field. The
135+ * measurement window is programmed through the @wnd field.
136+ *
137+ * To support measurement in YCbCr mode a color conversion matrix with
138+ * programmable offset is available in the @ccor_coeff and @ccor_offs fields.
139+ * The color conversion matrix coefficients are represented as 16 bits signed
140+ * Q4.12 numbers ranging from -8 to +7.99. The per-color channel offsets are
141+ * represented as 25 bits 2's complement integer numbers ranging from -16777216
142+ * to +16777215.
143+ *
144+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_WBMEAS_POST)
145+ * @wnd: measurement window
146+ * @mode: measurement mode (from enum rppx1_wbmeas_mode)
147+ * @ymax_cmp: enable Y_MAX compare using @max_y
148+ * @frames: number of frames for mean value calculation (0 = 1 frame)
149+ * @reserved: padding
150+ * @ref_cr_max_r: reference Cr or max red value in RGB mode, 24 bits
151+ * @ref_cb_max_b: reference Cb or max blue value in RGB mode, 24 bits
152+ * @min_y_max_g: luminance minimum value or max green value in RGB mode, 24 bits
153+ * @max_y: luminance maximum value, only valid if @mode is set to YCbCr and
154+ * @ymax_cmp is set to enabled, 24 bits
155+ * @max_csum: chrominance sum maximum value, 24 bits
156+ * @min_c: chrominance minimum value, 24 bits
157+ * @ccor_coeff: coefficients for color conversion matrix, signed 16 bits Q4.6
158+ * @reserved2: padding
159+ * @ccor_offs: R-G-B color conversion coefficients, signed 25 bits 2's complement
160+ * @reserved3: padding
161+ */
162+struct rppx1_wbmeas_params {
163+ struct v4l2_isp_params_block_header header;
164+ struct rppx1_window wnd;
165+ __u8 mode;
166+ __u8 ymax_cmp;
167+ __u8 frames;
168+ __u8 reserved;
169+ __u32 ref_cr_max_r;
170+ __u32 ref_cb_max_b;
171+ __u32 min_y_max_g;
172+ __u32 max_y;
173+ __u32 max_csum;
174+ __u32 min_c;
175+ __u16 ccor_coeff[3][3];
176+ __u16 reserved2;
177+ __u32 ccor_offs[3];
178+ __u32 reserved3;
179+};
180+
181+/**
182+ * struct rppx1_awbg_params - WB gain configuration
183+ *
184+ * The RPP-X1 White Balance Gain module is available in the PRE1 and PRE2
185+ * pre-fusion pipes and in the MAIN_POST post-fusion pipe. Userspace selects
186+ * which pipe to operate by setting the @header.type field to
187+ * RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1, RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2
188+ * or RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST.
189+ *
190+ * The White Balance module allows to specify per-color channel gains, expressed
191+ * as unsigned fixed-point values as 18 bits unsigned integers in Q6.12 format
192+ * with a maximum of 63.999.
193+ *
194+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE1 or
195+ * type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_PRE2 or
196+ * type = RPPX1_PARAMS_BLOCK_TYPE_AWBG_POST)
197+ * @gain_red: gain for red component, 18-bit (unsigned Q6.12)
198+ * @gain_green_r: gain for green component in red lines, 18-bit (unsigned Q6.12)
199+ * @gain_blue: gain for blue component, 18-bit (unsigned Q6.12)
200+ * @gain_green_b: gain for green component in blue lines, 18-bit (unsigned Q6.12)
201+ */
202+struct rppx1_awbg_params {
203+ struct v4l2_isp_params_block_header header;
204+ __u32 gain_red;
205+ __u32 gain_green_r;
206+ __u32 gain_blue;
207+ __u32 gain_green_b;
208+};
209+
210+/**
211+ * enum rppx1_exm_mode - Exposure measurement mode
212+ *
213+ * Exaposure measurement mode selection (RGB/Bayer).
214+ *
215+ * @RPPX1_EXP_MEASURING_MODE_DISABLED: no measurement
216+ * @RPPX1_EXP_MEASURING_MODE_RGB: Y/R/G/B measurement
217+ * @RPPX1_EXP_MEASURING_MODE_BAYER: Bayer RGB measurement
218+ */
219+enum rppx1_exm_mode {
220+ RPPX1_EXP_MEASURING_MODE_DISABLED,
221+ RPPX1_EXP_MEASURING_MODE_RGB,
222+ RPPX1_EXP_MEASURING_MODE_BAYER,
223+};
224+
225+/**
226+ * struct rppx1_exm_params - Exposure measurement configuration
227+ *
228+ * The RPP-X1 Exposure measurement unit is available on the PRE1 and PRE2
229+ * pre-fusion pipes. Userspace selects which pipe to operate by setting
230+ * the @header.type field to RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1 or
231+ * RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2.
232+ *
233+ * Exposure measurement is performed in the RGB or Bayer domain, according to
234+ * the setting of the @mode field. The exposure measurement tap point is
235+ * selected according to the value of @channel_sel.
236+ *
237+ * The exposure measurement is performed on an input window specified in @wnd.
238+ * To each color component a programmable weight coefficient is associated.
239+ * Coefficients are represented as unsigned 8 bits integer values in Q1.7 format
240+ * ranging from 0 to 1.992.
241+ *
242+ * The @last_line fields controls when the exposure measurement completes. It
243+ * is usually programmed to the value of (@wnd.v_offs + @wnd.v_size + 1).
244+ *
245+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE1 or
246+ * type = RPPX1_PARAMS_BLOCK_TYPE_EXM_PRE2)
247+ * @wnd: measurement window coordinates
248+ * @mode: exposure measure mode (from enum rppx1_exm_mode)
249+ * @last_line: line number for which the exposure measurement completes
250+ * @channel_sel: exposure measurement point (see enum rppx1_meas_chan)
251+ * @coeff_r: coefficient for the red Bayer sample or red color channel, Q1.7
252+ * @coeff_g_gr: coefficient for the green/red Bayer sample or green color channel, Q1.7
253+ * @coeff_b: coefficient for the blue Bayer sample or blue color channel, Q1.7
254+ * @coeff_gb: coefficient for the green/blue Bayer sample, unused in RGB mode, Q1.7
255+ * @reserved: padding
256+ */
257+struct rppx1_exm_params {
258+ struct v4l2_isp_params_block_header header;
259+ struct rppx1_window wnd;
260+ __u32 mode;
261+ __u32 last_line;
262+ __u8 channel_sel;
263+ __u8 coeff_r;
264+ __u8 coeff_g_gr;
265+ __u8 coeff_b;
266+ __u8 coeff_gb;
267+ __u8 reserved[3];
268+};
269+
270+/* Histogram */
271+#define RPPX1_HIST_WEIGHT_GRIDS_SIZE 25
272+
273+/**
274+ * enum rppx1_hist_mode - Histogram measurement mode
275+ *
276+ * Histogram measurement mode. Select which channel or combination of channels
277+ * the histogram measurement is performed on.
278+ *
279+ * @RPPX1_HIST_MODE_DISABLE: histogram disabled
280+ * @RPPX1_HIST_MODE_RGB_COMBINED: combined RGB histogram
281+ * @RPPX1_HIST_MODE_R_HISTOGRAM: red channel histogram
282+ * @RPPX1_HIST_MODE_GR_HISTOGRAM: green/red channel histogram
283+ * @RPPX1_HIST_MODE_B_HISTOGRAM: blue channel histogram
284+ * @RPPX1_HIST_MODE_GB_HISTOGRAM: green/blue histogram
285+ */
286+enum rppx1_hist_mode {
287+ RPPX1_HIST_MODE_DISABLE,
288+ RPPX1_HIST_MODE_RGB_COMBINED,
289+ RPPX1_HIST_MODE_R_HISTOGRAM,
290+ RPPX1_HIST_MODE_GR_HISTOGRAM,
291+ RPPX1_HIST_MODE_B_HISTOGRAM,
292+ RPPX1_HIST_MODE_GB_HISTOGRAM,
293+};
294+
295+/**
296+ * struct rppx1_hist_params - Histogram measurement configuration
297+ *
298+ * The RPP-X1 Histogram measurement unit is available on the PRE1, PRE2 and
299+ * MAIN_POST pipes. Userspace selects which pipe to operate by setting the
300+ * @header.type field to RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE1,
301+ * RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE2 or
302+ * RPPX1_PARAMS_BLOCK_TYPE_HIST_POST.
303+ *
304+ * The histogram measurement point is selected using the @channel field while
305+ * histogram measurement mode is selected using the @mode field.
306+ *
307+ * Histogram measurement is performed by programming subsampling factors using
308+ * the @v_stepsize and @h_step_inc fields and by weighted windowing, by
309+ * programming the size of the measurement window @wnd with @weights associated
310+ * to each cell of the 5x5 measurement grid. Weights are represented as 5 bits
311+ * integer values ranging from 0 to 16.
312+ *
313+ * The @last_line fields controls when the histogram measurement completes. It
314+ * is usually programmed to the value of (@wnd.v_offs + @wnd.v_size - 1).
315+ *
316+ * Histogram values are calculated by applying a per-color channel coefficient
317+ * represented as an 8 bits unsigned Q1.7 integer value. The @sample_offs and
318+ * @sample_shift fields allow to reduce the color dynamic range on which
319+ * histogram data are produced.
320+ *
321+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE1,
322+ * type = RPPX1_PARAMS_BLOCK_TYPE_HIST_PRE2 or
323+ * type = RPPX1_PARAMS_BLOCK_TYPE_HIST_POST)
324+ * @wnd: measurement window coordinates
325+ * @last_line: line number for which the histogram measurement completes
326+ * @v_stepsize: vertical subsampling divider, 7 bits
327+ * @h_step_inc: horizontal subsampling step counter, 17 bits
328+ * @sample_offs: sample offset, 24 bits
329+ * @mode: histogram measurement mode (from enum rppx1_hist_mode)
330+ * @channel_sel: histogram measurement point (see enum rppx1_meas_chan)
331+ * @weights: weighting factors for each sub-window (5x5 grid)
332+ * @coeff: R-G-B coefficients, 8 bits unsigned Q1.7
333+ * @sample_shift: sample shift, 4 bits
334+ * @reserved: padding
335+ */
336+struct rppx1_hist_params {
337+ struct v4l2_isp_params_block_header header;
338+ struct rppx1_window wnd;
339+ __u32 last_line;
340+ __u32 v_stepsize;
341+ __u32 h_step_inc;
342+ __u32 sample_offs;
343+ __u8 mode;
344+ __u8 channel_sel;
345+ __u8 weights[RPPX1_HIST_WEIGHT_GRIDS_SIZE];
346+ __u8 coeff[3];
347+ __u8 sample_shift;
348+ __u8 reserved;
349+};
350+
351+/**
352+ * struct rppx1_bls_fixed - BLS fixed subtraction values
353+ *
354+ * Fixed black level values subtracted from sensor data per Bayer channel.
355+ * Negative values result in addition.
356+ *
357+ * The PRE1 pipe BLS module operates on a 24-bits input data and fixed black
358+ * levels are stored as a signed 2's complement representation ranging from
359+ * -2^24 to 2^24-1.
360+ *
361+ * The PRE2 pipe BLS module operates on a 12-bits input data and fixed black
362+ * levels are stored as a signed 2's complement representation ranging from
363+ * -2^12 to 2^12-1.
364+ *
365+ * Userspace is expected to provide fixed black level values with a bit-depth
366+ * matching the one of pipe in use.
367+ *
368+ * These subtraction values are matched with the sensor native Bayer components
369+ * ordering according to the cropping configuration on the input port.
370+ *
371+ * @a: subtraction value for channel A
372+ * @b: subtraction value for channel B
373+ * @c: subtraction value for channel C
374+ * @d: subtraction value for channel D
375+ */
376+struct rppx1_bls_fixed {
377+ __u32 a;
378+ __u32 b;
379+ __u32 c;
380+ __u32 d;
381+};
382+
383+/**
384+ * enum rppx1_bls_mode - BLS subtraction mode
385+ *
386+ * Select if subtracted black level come from fixed or measured values.
387+ *
388+ * @RPPX1_BLS_MODE_FIXED: subtract fixed values
389+ * @RPPX1_BLS_MODE_MEAS: subtract measured values
390+ */
391+enum rppx1_bls_mode {
392+ RPPX1_BLS_MODE_FIXED,
393+ RPPX1_BLS_MODE_MEAS,
394+};
395+
396+/**
397+ * enum rppx1_bls_win_en: BLS measurement configuration
398+ *
399+ * Select the measurement window to use for measured black level values.
400+ *
401+ * @RPPX1_BLS_WIN_EN_OFF: disable measurement
402+ * @RPPX1_BLS_WIN_EN_WIN1: Enable measurement from window 1
403+ * @RPPX1_BLS_WIN_EN_WIN2: enable measurement from window 2
404+ * @RPPX1_BLS_WIN_EN_WIN12: enable measurement from window 1 and window 2
405+ */
406+enum rppx1_bls_win_en {
407+ RPPX1_BLS_WIN_EN_OFF,
408+ RPPX1_BLS_WIN_EN_WIN1,
409+ RPPX1_BLS_WIN_EN_WIN2,
410+ RPPX1_BLS_WIN_EN_WIN12,
411+};
412+
413+/**
414+ * struct rppx1_bls_params - RPP-X1 Black Level Subtraction Module
415+ *
416+ * The RPP-X1 Black Level Subtraction module is available on the PRE1 and PRE2
417+ * pre-fusion pipes. Userspace selects which pipe to operate by setting the
418+ * @header.type field to RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1 or
419+ * RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2.
420+ *
421+ * The BLS module operates on fixed or measured data according to the setting of
422+ * the @mode field. When RPPX1_BLS_MODE_FIXED is used userspace shall provide
423+ * the per-channel black levels in @fixed. When RPPX1_BLS_MODE_MEAS is used
424+ * userspace shall configure the measurement windows @window1 and optionally
425+ * @window2 to select the optically black pixels region in the input frame. The
426+ * @samples fields controls how many measure samples are used for averaging the
427+ * measured black levels.
428+ *
429+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE1 or
430+ * type == RPPX1_PARAMS_BLOCK_TYPE_BLS_PRE2)
431+ * @window1: BLS measurement window 1 (14 bits)
432+ * @window2: BLS measurement window 2 (14 bits)
433+ * @fixed: fixed subtraction values (see enum rppx1_bls_fixed)
434+ * @mode: BLS subtraction mode (see enum rppx1_bls_mode)
435+ * @en_windows: BLS measurement mode (see rppx1_bls_win_en)
436+ * @samples: log2 of the number of measured pixels per Bayer position
437+ * @reserved: padding
438+ */
439+struct rppx1_bls_params {
440+ struct v4l2_isp_params_block_header header;
441+ struct rppx1_window window1;
442+ struct rppx1_window window2;
443+ struct rppx1_bls_fixed fixed;
444+ __u8 mode;
445+ __u8 en_windows;
446+ __u8 samples;
447+ __u8 reserved[5];
448+};
449+
450+/**
451+ * struct rppx1_ccor_params - Color CORrection configuration
452+ *
453+ * The CCOR (Color Correction) module is available on the MAIN_POST pipe. It
454+ * performs color space correction on a pixel-per-pixel basis using a 3x3 matrix
455+ * of coefficients and per-color channel offsets.
456+ *
457+ * The matrix coefficients are represented as 16 bits signed fixed point values
458+ * in Q4.12 format ranging from -8 to +7.999.
459+ *
460+ * The per-channel color offsets are represented as 2's complement values
461+ * stored in 25 bits ranging from -16777216 to 16777215.
462+ *
463+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST)
464+ * @coeff: color correction matrix coefficients, 16 bits signed Q4.12
465+ * @reserved: padding
466+ * @offset: R, G, B offsets, 2's complement 25 bits
467+ */
468+struct rppx1_ccor_params {
469+ struct v4l2_isp_params_block_header header;
470+ __u16 coeff[3][3];
471+ __u16 reserved;
472+ __u32 offset[3];
473+};
474+
475+/* Lens Shade Correction */
476+#define RPPX1_LSC_SAMPLES_MAX 17
477+#define RPPX1_LSC_NUM_SECTORS 16
478+
479+/**
480+ * struct rppx1_lsc_params - Lens Shading Correction configuration
481+ *
482+ * The RPP-X1 Lens shading correction module is available on the PRE1 and PRE2
483+ * pre-fusion pipes. Userspace selects which pipe to operate by setting the
484+ * @header.type field to RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE1 or
485+ * RPPX1_PARAMS_BLOCK_TYPE_LSC_PRE2.
486+ *
487+ * The module applies per-color channel correction factors @r_data, @gr_data,
488+ * @gb_data and @b_data as a 16x16 grid mapped on the image. The size of each
489+ * grid segment is expressed by the @x_sect_size and @y_sect_size arrays. Each
490+ * segment shall be at least 8 pixels in size and the sum of all horizontal
491+ * segments @x_sect_size shall match the input frame size width.
492+ *
493+ * The correction factors values are expressed as unsigned Q2.10 integers
494+ * ranging from 1 to 3.999.
495+ *
496+ * Pre-calculated interpolation factors shall be provided in the @x_grad
497+ * and @y_grad fields, expressed as 12 bits integer values.
498+ *
499+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_LSC)
500+ * @r_data: correction factors for the red channel in Q2.10 format
501+ * @gr_data: correction factors for the green (red) channel in Q2.10 format
502+ * @gb_data: correction factors for the green (blue) channel in Q2.10 format
503+ * @b_data: correction factors for the blue channel in Q2.10 format
504+ * @x_grad: Interpolation gradients for each horizontal sector (12 bits)
505+ * @y_grad: Interpolation gradients for each vertical sector (12 bits)
506+ * @x_sect_size: Horizontal sectors sizes
507+ * @y_sect_size: Vertical sectors sizes
508+ */
509+struct rppx1_lsc_params {
510+ struct v4l2_isp_params_block_header header;
511+ __u16 r_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];
512+ __u16 gr_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];
513+ __u16 gb_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];
514+ __u16 b_data[RPPX1_LSC_SAMPLES_MAX][RPPX1_LSC_SAMPLES_MAX];
515+ __u16 x_grad[RPPX1_LSC_NUM_SECTORS];
516+ __u16 y_grad[RPPX1_LSC_NUM_SECTORS];
517+ __u16 x_sect_size[RPPX1_LSC_NUM_SECTORS];
518+ __u16 y_sect_size[RPPX1_LSC_NUM_SECTORS];
519+};
520+
521+/* Gamma Out */
522+#define RPPX1_GA_MAX_SAMPLES 17
523+
524+/**
525+ * enum rppx1_ga_seg_mode - Gamma out curve segmentation mode
526+ *
527+ * Segmentation mode of the 16 input sampling points for the Gamma Out
528+ * Correction module.
529+ *
530+ * @RPPX1_GA_SEG_MODE_LOGARITHMIC: logarithmic-like segmentation mode
531+ * @RPPX1_GA_SEG_MODE_EQUIDISTANT: equidistant segmentation mode
532+ */
533+enum rppx1_ga_seg_mode {
534+ RPPX1_GA_SEG_MODE_LOGARITHMIC,
535+ RPPX1_GA_SEG_MODE_EQUIDISTANT
536+};
537+
538+/**
539+ * struct rppx1_ga_params - Gamma Out Correction configuration
540+ *
541+ * The Gamma Out Correction module is available on the Human Vision Output
542+ * Pipe (HV) and the Machine Vision Output Pipe (MV). Userspace selects
543+ * which pipe to operate by setting the @header.type field to
544+ * RPPX1_PARAMS_BLOCK_TYPE_GA_HV or RPPX1_PARAMS_BLOCK_TYPE_GA_MV.
545+ *
546+ * The module allows to apply a @gamma_y gamma correction curve to RGB data
547+ * represented as a table of 16 entries. The 16 input sampling points can be
548+ * equidistant or segmented using a logarithmic scale according to the value of
549+ * @mode.
550+ *
551+ * The gamma curve values are 12 bits on the HV output pipe and 24 bits on the
552+ * MV output pipe. Userspace is expected to provide the curve values with a
553+ * bit-depth matching the one of pipe in use.
554+ *
555+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_GA_HV or
556+ * type = RPPX1_PARAMS_BLOCK_TYPE_GA_MV)
557+ * @gamma_y: gamma out curve y-axis values
558+ * @mode: gamma curve input segmentation mode (see rppx1_ga_seg_mode)
559+ * @reserved: padding
560+ */
561+struct rppx1_ga_params {
562+ struct v4l2_isp_params_block_header header;
563+ __u32 gamma_y[RPPX1_GA_MAX_SAMPLES];
564+ __u8 mode;
565+ __u8 reserved[3];
566+};
567+
568+/* Linearization (Sensor De-gamma) */
569+#define RPPX1_LIN_SAMPLE_POINTS_NUM 16
570+#define RPPX1_LIN_DEGAMMA_CURVE_NUM 17
571+
572+/**
573+ * struct rppx1_lin_params - Linearization (Sensor De-gamma) configuration
574+ *
575+ * The RPP-X1 linearization module is available on the PRE1 and PRE2 pre-fusion
576+ * pipes. Userspace selects which pipe to operate by setting the @header.type
577+ * field to RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE1 or
578+ * RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE2.
579+ *
580+ * The LIN module applies the per-color channel de-gamma linearization curves
581+ * @curve_r, @curve_g and @curve_b defined on the input sampling points @dx.
582+ *
583+ * For the PRE1 pipe the de-gamma curves values are 24-bits, for the PRE2 pipe
584+ * the de-gamma curve values are 12-bits.
585+ *
586+ * For the PRE1 pipe de-gamma module sampling points @dx values are in the range
587+ * [0, 15] (4 bits). For the PRE2 pipe de-gamma module sampling points values
588+ * are in the range [0, 7] (3 bits).
589+ *
590+ * Userspace is expected to provide the curve values and sampling points with a
591+ * bit-depth matching the one of pipe in use.
592+ *
593+ * @header: block header (type = RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE1 or
594+ * RPPX1_PARAMS_BLOCK_TYPE_LIN_PRE2)
595+ * @curve_r: de-gamma linearization curve for red channel
596+ * @curve_g: de-gamma linearization curve for green channel
597+ * @curve_b: de-gamma linearization curve for blue channel
598+ * @dx: input sampling points
599+ * @reserved: padding
600+ */
601+struct rppx1_lin_params {
602+ struct v4l2_isp_params_block_header header;
603+ __u32 curve_r[RPPX1_LIN_DEGAMMA_CURVE_NUM];
604+ __u32 curve_g[RPPX1_LIN_DEGAMMA_CURVE_NUM];
605+ __u32 curve_b[RPPX1_LIN_DEGAMMA_CURVE_NUM];
606+ __u8 dx[RPPX1_LIN_SAMPLE_POINTS_NUM];
607+ __u32 reserved;
608+};
609+
610+/**
611+ * RPPX1_PARAMS_MAX_SIZE - Maximum size of all RPP-X1 parameter blocks
612+ *
613+ * Some types are reported twice as the same block might be instantiated in
614+ * multiple pipes.
615+ */
616+#define RPPX1_PARAMS_MAX_SIZE \
617+ (sizeof(struct rppx1_wbmeas_params) + \
618+ sizeof(struct rppx1_awbg_params) + \
619+ sizeof(struct rppx1_awbg_params) + \
620+ sizeof(struct rppx1_awbg_params) + \
621+ sizeof(struct rppx1_exm_params) + \
622+ sizeof(struct rppx1_exm_params) + \
623+ sizeof(struct rppx1_hist_params) + \
624+ sizeof(struct rppx1_hist_params) + \
625+ sizeof(struct rppx1_hist_params) + \
626+ sizeof(struct rppx1_bls_params) + \
627+ sizeof(struct rppx1_bls_params) + \
628+ sizeof(struct rppx1_ccor_params) + \
629+ sizeof(struct rppx1_lsc_params) + \
630+ sizeof(struct rppx1_lsc_params) + \
631+ sizeof(struct rppx1_ga_params) + \
632+ sizeof(struct rppx1_ga_params) + \
633+ sizeof(struct rppx1_lin_params) + \
634+ sizeof(struct rppx1_lin_params))
635+
636+/* ---------------------------------------------------------------------------
637+ * Statistics Structures
638+ *
639+ * The same ISP block might be instantiated in multiple pipeliness and operate
640+ * on a different bitdepth/precision. For fields of varying length among
641+ * different instances of the same block, use a data type that can accommodate
642+ * the larger bitdepth/precision.
643+ */
644+
645+/**
646+ * enum rppx1_stats_block_type - RPP-X1 extensible stats block types
647+ *
648+ * NOTE: Only append to the enumeration as the numbers are uAPI.
649+ *
650+ * @RPPX1_STATS_BLOCK_TYPE_WBMEAS_POST: post-fusion white-balance measurement
651+ * @RPPX1_STATS_BLOCK_TYPE_EXM_PRE1: pre-fusion pipe1 exposure measurement
652+ * @RPPX1_STATS_BLOCK_TYPE_EXM_PRE2: pre-fusion pipe2 exposure measurement
653+ * @RPPX1_STATS_BLOCK_TYPE_HIST_PRE1: pre-fusion pipe1 histogram
654+ * @RPPX1_STATS_BLOCK_TYPE_HIST_PRE2: pre-fusion pipe2 histogram
655+ * @RPPX1_STATS_BLOCK_TYPE_HIST_POST: post-fusion histogram
656+ */
657+enum rppx1_stats_block_type {
658+ RPPX1_STATS_BLOCK_TYPE_WBMEAS_POST,
659+ RPPX1_STATS_BLOCK_TYPE_EXM_PRE1,
660+ RPPX1_STATS_BLOCK_TYPE_EXM_PRE2,
661+ RPPX1_STATS_BLOCK_TYPE_HIST_PRE1,
662+ RPPX1_STATS_BLOCK_TYPE_HIST_PRE2,
663+ RPPX1_STATS_BLOCK_TYPE_HIST_POST,
664+};
665+
666+/**
667+ * struct rppx1_wbmeas_stats - AWB statistics
668+ *
669+ * @header: block header (type = RPPX1_STATS_BLOCK_TYPE_WBMEAS_POST)
670+ * @cnt: Number of pixels matched
671+ * @mean_y_or_g: mean Y (or G in RGB mode) value, 24-bit
672+ * @mean_cb_or_b: mean Cb (or B in RGB mode) value, 24-bit
673+ * @mean_cr_or_r: mean Cr (or R in RGB mode) value, 24-bit
674+ */
675+struct rppx1_wbmeas_stats {
676+ struct v4l2_isp_block_header header;
677+ __u32 cnt;
678+ __u32 mean_y_or_g;
679+ __u32 mean_cb_or_b;
680+ __u32 mean_cr_or_r;
681+};
682+
683+/* Exposure Measurement */
684+#define RPPX1_EXM_NUM_WIN 25
685+
686+/**
687+ * struct rppx1_exm_stats - Exposure measurement
688+ *
689+ * RPP-X1 exposure measurement calculates the mean value on 25 programmable
690+ * windows on the input picture.
691+ *
692+ * @header: block header (type = RPPX1_STATS_BLOCK_TYPE_EXM_PRE1)
693+ * @exp_mean: mean luminance values per block, up to 20-bit
694+ * @reserved: padding
695+ */
696+struct rppx1_exm_stats {
697+ struct v4l2_isp_block_header header;
698+ __u32 exp_mean[RPPX1_EXM_NUM_WIN];
699+ __u32 reserved;
700+};
701+
702+/* Histogram */
703+#define RPPX1_HIST_NUM_BINS 32
704+
705+/**
706+ * struct rppx1_hist_stats - Histogram statistics
707+ *
708+ * @header: block header (type = RPPX1_STATS_BLOCK_TYPE_HIST_POST)
709+ * @hist_bins: accumulation histogram results in unsigned 20-bit Q16.4 format
710+ */
711+struct rppx1_hist_stats {
712+ struct v4l2_isp_block_header header;
713+ __u32 hist_bins[RPPX1_HIST_NUM_BINS];
714+};
715+
716+/**
717+ * RPPX1_STATS_MAX_SIZE - Maximum size of all RPP-X1 statistics
718+ *
719+ * Some types are reported twice as the same block might be instantiated in
720+ * multiple pipes.
721+ */
722+#define RPPX1_STATS_MAX_SIZE \
723+ (sizeof(struct rppx1_wbmeas_stats) + \
724+ sizeof(struct rppx1_exm_stats) + \
725+ sizeof(struct rppx1_exm_stats) + \
726+ sizeof(struct rppx1_hist_stats) + \
727+ sizeof(struct rppx1_hist_stats) + \
728+ sizeof(struct rppx1_hist_stats))
729+
730+#endif /* __UAPI_RPP_X1_CONFIG_H */
include/uapi/linux/media/v4l2-isp.h+79−46
@@ -13,25 +13,33 @@ · 12 unmodified lines
1313 #include <linux/types.h>
1414
1515 /**
16− * enum v4l2_isp_params_version - V4L2 ISP parameters versioning
16+ * enum v4l2_isp_version - V4L2 ISP serialization format versioning
1717 *
18− * @V4L2_ISP_PARAMS_VERSION_V0: First version of the V4L2 ISP parameters format
19− * (for compatibility)
20− * @V4L2_ISP_PARAMS_VERSION_V1: First version of the V4L2 ISP parameters format
18+ * @V4L2_ISP_VERSION_V0: First version of the V4L2 ISP serialization format
19+ * (for compatibility)
20+ * @V4L2_ISP_VERSION_V1: First version of the V4L2 ISP serialization format
2121 *
2222 * V0 and V1 are identical in order to support drivers compatible with the V4L2
23− * ISP parameters format already upstreamed which use either 0 or 1 as their
24− * versioning identifier. Both V0 and V1 refers to the first version of the
25− * V4L2 ISP parameters format.
23+ * ISP format already upstreamed which use either 0 or 1 as their versioning
24+ * identifier. Both V0 and V1 refers to the first version of the V4L2 ISP
25+ * serialization format.
2626 *
27− * Future revisions of the V4L2 ISP parameters format should start from the
27+ * Future revisions of the V4L2 ISP serialization format should start from the
2828 * value of 2.
2929 */
30−enum v4l2_isp_params_version {
31− V4L2_ISP_PARAMS_VERSION_V0 = 0,
32− V4L2_ISP_PARAMS_VERSION_V1
30+enum v4l2_isp_version {
31+ V4L2_ISP_VERSION_V0 = 0,
32+ V4L2_ISP_VERSION_V1
3333 };
3434
35+/*
36+ * Compatibility with existing users of v4l2_isp_params which pre-date the
37+ * introduction of v4l2_isp_stats.
38+ */
39+#define v4l2_isp_params_version v4l2_isp_version
40+#define V4L2_ISP_PARAMS_VERSION_V0 V4L2_ISP_VERSION_V0
41+#define V4L2_ISP_PARAMS_VERSION_V1 V4L2_ISP_VERSION_V1
42+
3543 #define V4L2_ISP_PARAMS_FL_BLOCK_DISABLE (1U << 0)
3644 #define V4L2_ISP_PARAMS_FL_BLOCK_ENABLE (1U << 1)
3745
@@ -39,64 +47,89 @@ enum v4l2_isp_params_version { · 1 unmodified line
3947 * Reserve the first 8 bits for V4L2_ISP_PARAMS_FL_* flag.
4048 *
4149 * Driver-specific flags should be defined as:
42− * #define DRIVER_SPECIFIC_FLAG0 ((1U << V4L2_ISP_PARAMS_FL_DRIVER_FLAGS(0))
43− * #define DRIVER_SPECIFIC_FLAG1 ((1U << V4L2_ISP_PARAMS_FL_DRIVER_FLAGS(1))
50+ * #define DRIVER_SPECIFIC_FLAG0 ((1U << V4L2_ISP_FL_DRIVER_FLAGS(0))
51+ * #define DRIVER_SPECIFIC_FLAG1 ((1U << V4L2_ISP_FL_DRIVER_FLAGS(1))
4452 */
45−#define V4L2_ISP_PARAMS_FL_DRIVER_FLAGS(n) ((n) + 8)
53+#define V4L2_ISP_FL_DRIVER_FLAGS(n) ((n) + 8)
4654
4755 /**
48− * struct v4l2_isp_params_block_header - V4L2 extensible parameters block header
49− * @type: The parameters block type (driver-specific)
56+ * struct v4l2_isp_block_header - V4L2 extensible block header
57+ * @type: The parameters or statistics block type (driver-specific)
5058 * @flags: A bitmask of block flags (driver-specific)
51− * @size: Size (in bytes) of the parameters block, including this header
59+ * @size: Size (in bytes) of the block, including this header
5260 *
53− * This structure represents the common part of all the ISP configuration
54− * blocks. Each parameters block shall embed an instance of this structure type
55− * as its first member, followed by the block-specific configuration data.
61+ * This structure represents the common part of all the ISP configuration or
62+ * statistic blocks. Each block shall embed an instance of this structure type
63+ * as its first member, followed by the block-specific configuration or
64+ * statistic data.
5665 *
5766 * The @type field is an ISP driver-specific value that identifies the block
58− * type. The @size field specifies the size of the parameters block.
67+ * type. The @size field specifies the size of the block, including this
68+ * header.
5969 *
60− * The @flags field is a bitmask of per-block flags V4L2_PARAMS_ISP_FL_* and
61− * driver-specific flags specified by the driver header.
70+ * The @flags field is a bitmask of per-block flags. If a block is used for
71+ * configuration parameters this field can be a combination of
72+ * V4L2_ISP_PARAMS_FL_* and driver-specific flags. If a block is used
73+ * for statistics this fields is used to report optional
74+ * driver-specific flags, if any.
6275 */
63−struct v4l2_isp_params_block_header {
76+struct v4l2_isp_block_header {
6477 __u16 type;
6578 __u16 flags;
6679 __u32 size;
6780 } __attribute__((aligned(8)));
6881
6982 /**
70− * struct v4l2_isp_params_buffer - V4L2 extensible parameters configuration
71− * @version: The parameters buffer version (driver-specific)
72− * @data_size: The configuration data effective size, excluding this header
73− * @data: The configuration data
83+ * v4l2_isp_params_block_header - V4L2 extensible parameters block header
84+ *
85+ * Compatibility with existing users of v4l2_isp_params_block_header
86+ * which pre-date the introduction of v4l2_isp_block_header.
87+ */
88+#define v4l2_isp_params_block_header v4l2_isp_block_header
89+
90+/**
91+ * struct v4l2_isp_buffer - V4L2 extensible buffer
92+ * @version: The extensible buffer version (driver-specific)
93+ * @data_size: The data effective size, excluding this header
94+ * @data: The configuration or statistics data
7495 *
75− * This structure contains the configuration parameters of the ISP algorithms,
76− * serialized by userspace into a data buffer. Each configuration parameter
77− * block is represented by a block-specific structure which contains a
78− * :c:type:`v4l2_isp_params_block_header` entry as first member. Userspace
79− * populates the @data buffer with configuration parameters for the blocks that
80− * it intends to configure. As a consequence, the data buffer effective size
81− * changes according to the number of ISP blocks that userspace intends to
82− * configure and is set by userspace in the @data_size field.
96+ * This structure contains ISP configuration parameters or ISP hardware
97+ * statistics serialized into a data buffer. Each block is represented by a
98+ * block-specific structure which contains a :c:type:`v4l2_isp_block_header`
99+ * entry as first member.
83100 *
84− * The parameters buffer is versioned by the @version field to allow modifying
85− * and extending its definition. Userspace shall populate the @version field to
86− * inform the driver about the version it intends to use. The driver will parse
87− * and handle the @data buffer according to the data layout specific to the
88− * indicated version and return an error if the desired version is not
101+ * When used for ISP parameters, userspace populates the @data buffer with
102+ * configuration parameters for the blocks that it intends to configure. As a
103+ * consequence, the data buffer effective size changes according to the number
104+ * of ISP blocks that userspace intends to configure.
105+ *
106+ * When used to report ISP statistics, the driver populates the @data buffer
107+ * with statistics for each supported measurement block.
108+ *
109+ * The buffer is versioned by the @version field to allow modifying
110+ * and extending its definition. The writer shall populate the @version field
111+ * to inform the reader about the version it intends to use. The reader will
112+ * parse and handle the @data buffer according to the data layout specific to
113+ * the indicated version and return an error if the desired version is not
89114 * supported.
90115 *
91− * For each ISP block that userspace wants to configure, a block-specific
92− * structure is appended to the @data buffer, one after the other without gaps
93− * in between. Userspace shall populate the @data_size field with the effective
94− * size, in bytes, of the @data buffer.
116+ * For each ISP block, a block-specific structure is appended to the @data
117+ * buffer, one after the other without gaps in between. The writer shall
118+ * populate the @data_size field with the effective size, in bytes, of the
119+ * @data buffer.
95120 */
96−struct v4l2_isp_params_buffer {
121+struct v4l2_isp_buffer {
97122 __u32 version;
98123 __u32 data_size;
99124 __u8 data[] __counted_by(data_size);
100125 };
101126
127+/**
128+ * v4l2_isp_params_buffer - V4L2 extensible parameters compatibility
129+ *
130+ * Compatibility with existing users of v4l2_isp_params_buffer which
131+ * pre-date the introduction of v4l2_isp_buffer.
132+ */
133+#define v4l2_isp_params_buffer v4l2_isp_buffer
134+
102135 #endif /* _UAPI_V4L2_ISP_H_ */
include/uapi/linux/videodev2.h+4−0
@@ -889,6 +889,10 @@ struct v4l2_pix_format { · 888 unmodified lines
889889 #define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P') /* ARM Mali-C55 Parameters */
890890 #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S') /* ARM Mali-C55 3A Statistics */
891891
892+/* Vendor specific - used for Dreamchip RPP-X1 ISP */
893+#define V4L2_META_FMT_RPPX1_PARAMS v4l2_fourcc('D', 'R', '1', 'P') /* Dreamchip RPP-X1 Parameters */
894+#define V4L2_META_FMT_RPPX1_STATS v4l2_fourcc('D', 'R', '1', 'S') /* Dreamchip RPP-X1 Statistics */
895+
892896 #ifdef __KERNEL__
893897 /*
894898 * Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when