at master 4.1 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2/* 3 * Video4Linux2 generic ISP parameters and statistics support 4 * 5 * Copyright (C) 2025 Ideas On Board Oy 6 * Author: Jacopo Mondi <jacopo.mondi@ideasonboard.com> 7 */ 8 9#ifndef _UAPI_V4L2_ISP_H_ 10#define _UAPI_V4L2_ISP_H_ 11 12#include <linux/stddef.h> 13#include <linux/types.h> 14 15/** 16 * enum v4l2_isp_params_version - V4L2 ISP parameters versioning 17 * 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 21 * 22 * 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. 26 * 27 * Future revisions of the V4L2 ISP parameters format should start from the 28 * value of 2. 29 */ 30enum v4l2_isp_params_version { 31 V4L2_ISP_PARAMS_VERSION_V0 = 0, 32 V4L2_ISP_PARAMS_VERSION_V1 33}; 34 35#define V4L2_ISP_PARAMS_FL_BLOCK_DISABLE (1U << 0) 36#define V4L2_ISP_PARAMS_FL_BLOCK_ENABLE (1U << 1) 37 38/* 39 * Reserve the first 8 bits for V4L2_ISP_PARAMS_FL_* flag. 40 * 41 * 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)) 44 */ 45#define V4L2_ISP_PARAMS_FL_DRIVER_FLAGS(n) ((n) + 8) 46 47/** 48 * struct v4l2_isp_params_block_header - V4L2 extensible parameters block header 49 * @type: The parameters block type (driver-specific) 50 * @flags: A bitmask of block flags (driver-specific) 51 * @size: Size (in bytes) of the parameters block, including this header 52 * 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. 56 * 57 * 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. 59 * 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. 62 */ 63struct v4l2_isp_params_block_header { 64 __u16 type; 65 __u16 flags; 66 __u32 size; 67} __attribute__((aligned(8))); 68 69/** 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 74 * 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. 83 * 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 89 * supported. 90 * 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. 95 */ 96struct v4l2_isp_params_buffer { 97 __u32 version; 98 __u32 data_size; 99 __u8 data[] __counted_by(data_size); 100}; 101 102#endif /* _UAPI_V4L2_ISP_H_ */