Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5773c195 authored by Junzhe Zou's avatar Junzhe Zou
Browse files

msm: cam: add UAPI support for UBWC and HFR changes



Modify the camera interface to support UBWC and HFR feature.

CRs-Fixed: 2035990
Change-Id: If48954bf3aa7745d74dff8403b6472debfbb96a7
Signed-off-by: default avatarJunzhe Zou <jnzhezou@codeaurora.org>
parent 13ce0881
Loading
Loading
Loading
Loading
+135 −103
Original line number Original line Diff line number Diff line
@@ -21,12 +21,13 @@
#define CAM_HANDLE_MEM_HANDLE                   2
#define CAM_HANDLE_MEM_HANDLE                   2


/**
/**
 * struct cam_control - struct used by ioctl control for camera
 * struct cam_control - Structure used by ioctl control for camera
 *
 * @op_code:            This is the op code for camera control
 * @op_code:            This is the op code for camera control
 * @size:               control command size
 * @size:               Control command size
 * @handle_type:        user pointer or shared memory handle
 * @handle_type:        User pointer or shared memory handle
 * @reserved:           reserved field for 64 bit alignment
 * @reserved:           Reserved field for 64 bit alignment
 * @handle:             control command payload
 * @handle:             Control command payload
 */
 */
struct cam_control {
struct cam_control {
	uint32_t        op_code;
	uint32_t        op_code;
@@ -46,7 +47,7 @@ struct cam_control {
 * @major    : Hardware version major
 * @major    : Hardware version major
 * @minor    : Hardware version minor
 * @minor    : Hardware version minor
 * @incr     : Hardware version increment
 * @incr     : Hardware version increment
 * @reserved : reserved for 64 bit aligngment
 * @reserved : Reserved for 64 bit aligngment
 */
 */
struct cam_hw_version {
struct cam_hw_version {
	uint32_t major;
	uint32_t major;
@@ -141,6 +142,7 @@ struct cam_iommu_handle {
/* camera buffer direction */
/* camera buffer direction */
#define CAM_BUF_INPUT                           1
#define CAM_BUF_INPUT                           1
#define CAM_BUF_OUTPUT                          2
#define CAM_BUF_OUTPUT                          2
#define CAM_BUF_IN_OUT                          3


/* camera packet device Type */
/* camera packet device Type */
#define CAM_PACKET_DEV_BASE                     0
#define CAM_PACKET_DEV_BASE                     0
@@ -168,12 +170,20 @@ struct cam_iommu_handle {
#define CAM_PACKET_MAX_PLANES                   3
#define CAM_PACKET_MAX_PLANES                   3


/**
/**
 * struct cam_plane_cfg - plane configuration info
 * struct cam_plane_cfg - Plane configuration info
 *
 *
 * @width:                      plane width in pixels
 * @width:                      Plane width in pixels
 * @height:                     plane height in lines
 * @height:                     Plane height in lines
 * @plane_stride:               plane stride in pixel
 * @plane_stride:               Plane stride in pixel
 * @slice_height:               slice height in line (not used by ISP)
 * @slice_height:               Slice height in line (not used by ISP)
 * @meta_stride:                UBWC metadata stride
 * @meta_size:                  UBWC metadata plane size
 * @meta_offset:                UBWC metadata offset
 * @packer_config:              UBWC packer config
 * @mode_config:                UBWC mode config
 * @tile_config:                UBWC tile config
 * @h_init:                     UBWC horizontal initial coordinate in pixels
 * @v_init:                     UBWC vertical initial coordinate in lines
 *
 *
 */
 */
struct cam_plane_cfg {
struct cam_plane_cfg {
@@ -181,36 +191,74 @@ struct cam_plane_cfg {
	uint32_t                height;
	uint32_t                height;
	uint32_t                plane_stride;
	uint32_t                plane_stride;
	uint32_t                slice_height;
	uint32_t                slice_height;
	uint32_t                meta_stride;
	uint32_t                meta_size;
	uint32_t                meta_offset;
	uint32_t                packer_config;
	uint32_t                mode_config;
	uint32_t                tile_config;
	uint32_t                h_init;
	uint32_t                v_init;
};

/**
 * struct cam_cmd_buf_desc - Command buffer descriptor
 *
 * @mem_handle:                 Command buffer handle
 * @offset:                     Command start offset
 * @size:                       Size of the command buffer in bytes
 * @length:                     Used memory in command buffer in bytes
 * @type:                       Type of the command buffer
 * @meta_data:                  Data type for private command buffer
 *                              Between UMD and KMD
 *
 */
struct cam_cmd_buf_desc {
	int32_t                 mem_handle;
	uint32_t                offset;
	uint32_t                size;
	uint32_t                length;
	uint32_t                type;
	uint32_t                meta_data;
};
};


/**
/**
 * struct cam_buf_io_cfg - Buffer io configuration for buffers
 * struct cam_buf_io_cfg - Buffer io configuration for buffers
 *
 *
 * @mem_handle:                 mem_handle array for the buffers.
 * @mem_handle:                 Mem_handle array for the buffers.
 * @offsets:                    offsets for each planes in the buffer
 * @offsets:                    Offsets for each planes in the buffer
 * @planes:                     per plane information
 * @planes:                     Per plane information
 * @width:                      main plane width in pixel
 * @width:                      Main plane width in pixel
 * @height:                     main plane height in lines
 * @height:                     Main plane height in lines
 * @format:                     format of the buffer
 * @format:                     Format of the buffer
 * @color_space:                color space for the buffer
 * @color_space:                Color space for the buffer
 * @color_pattern:              color pattern in the buffer
 * @color_pattern:              Color pattern in the buffer
 * @bpp:                        bit per pixel
 * @bpp:                        Bit per pixel
 * @rotation:                   rotation information for the buffer
 * @rotation:                   Rotation information for the buffer
 * @resource_type:              resource type associated with the buffer
 * @resource_type:              Resource type associated with the buffer
 * @fence:                      fence handle
 * @fence:                      Fence handle
 * @cmd_buf_index:              command buffer index to patch the buffer info
 * @early_fence:                Fence handle for early signal
 * @cmd_buf_offset:             offset within the command buffer to patch
 * @aux_cmd_buf:                An auxiliary command buffer that may be
 * @flag:                       flags for extra information
 *                              used for programming the IO
 * @direction:                  buffer direction: input or output
 * @direction:                  Direction of the config
 * @padding:                    padding for the structure
 * @batch_size:                 Batch size in HFR mode
 * @subsample_pattern:          Subsample pattern. Used in HFR mode. It
 *                              should be consistent with batchSize and
 *                              CAMIF programming.
 * @subsample_period:           Subsample period. Used in HFR mode. It
 *                              should be consistent with batchSize and
 *                              CAMIF programming.
 * @framedrop_pattern:          Framedrop pattern
 * @framedrop_period:           Framedrop period
 * @flag:                       Flags for extra information
 * @direction:                  Buffer direction: input or output
 * @padding:                    Padding for the structure
 *
 *
 */
 */
struct cam_buf_io_cfg {
struct cam_buf_io_cfg {
	int32_t                         mem_handle[CAM_PACKET_MAX_PLANES];
	int32_t                         mem_handle[CAM_PACKET_MAX_PLANES];
	uint32_t                        offsets[CAM_PACKET_MAX_PLANES];
	uint32_t                        offsets[CAM_PACKET_MAX_PLANES];
	struct cam_plane_cfg            planes[CAM_PACKET_MAX_PLANES];
	struct cam_plane_cfg            planes[CAM_PACKET_MAX_PLANES];
	uint32_t                        width;
	uint32_t                        height;
	uint32_t                        format;
	uint32_t                        format;
	uint32_t                        color_space;
	uint32_t                        color_space;
	uint32_t                        color_pattern;
	uint32_t                        color_pattern;
@@ -218,42 +266,26 @@ struct cam_buf_io_cfg {
	uint32_t                        rotation;
	uint32_t                        rotation;
	uint32_t                        resource_type;
	uint32_t                        resource_type;
	int32_t                         fence;
	int32_t                         fence;
	uint32_t                        cmd_buf_index;
	int32_t                         early_fence;
	uint32_t                        cmd_buf_offset;
	struct cam_cmd_buf_desc         aux_cmd_buf;
	uint32_t                        flag;
	uint32_t                        direction;
	uint32_t                        direction;
	uint32_t                        batch_size;
	uint32_t                        subsample_pattern;
	uint32_t                        subsample_period;
	uint32_t                        framedrop_pattern;
	uint32_t                        framedrop_period;
	uint32_t                        flag;
	uint32_t                        padding;
	uint32_t                        padding;
};
};


/**
/**
 * struct cam_cmd_buf_desc - Command buffer descriptor
 * struct cam_packet_header - Camera packet header
 *
 *
 * @mem_handle:                 command buffer handle
 * @op_code:                    Camera packet opcode
 * @offset:                     command start offset
 * @size:                       Size of the camera packet in bytes
 * @size:                       size of the command buffer in bytes
 * @request_id:                 Request id for this camera packet
 * @length:                     used memory in command buffer in bytes
 * @flags:                      Flags for the camera packet
 * @type:                       type of the command buffer
 * @padding:                    Padding
 * @meta_data:                  data type for private command buffer
 *                              between UMD and KMD
 *
 */
struct cam_cmd_buf_desc {
	int32_t                 mem_handle;
	uint32_t                offset;
	uint32_t                size;
	uint32_t                length;
	uint32_t                type;
	uint32_t                meta_data;
};

/**
 * struct cam_packet_header - camera packet header
 *
 * @op_code:                    camera packet opcode
 * @size:                       size of the camera packet in bytes
 * @request_id:                 request id for this camera packet
 * @flags:                      flags for the camera packet
 * @dev_type:                   camera packet device type
 *
 *
 */
 */
struct cam_packet_header {
struct cam_packet_header {
@@ -261,16 +293,16 @@ struct cam_packet_header {
	uint32_t                size;
	uint32_t                size;
	uint64_t                request_id;
	uint64_t                request_id;
	uint32_t                flags;
	uint32_t                flags;
	uint32_t                dev_type;
	uint32_t                padding;
};
};


/**
/**
 * struct cam_patch_desc - Patch structure
 * struct cam_patch_desc - Patch structure
 *
 *
 * @dst_buf_hdl:                memory handle for the dest buffer
 * @dst_buf_hdl:                Memory handle for the dest buffer
 * @dst_offset:                 offset byte in the dest buffer
 * @dst_offset:                 Offset byte in the dest buffer
 * @src_buf_hdl:                memory handle for the source buffer
 * @src_buf_hdl:                Memory handle for the source buffer
 * @src_offset:                 offset byte in the source buffer
 * @src_offset:                 Offset byte in the source buffer
 *
 *
 */
 */
struct cam_patch_desc {
struct cam_patch_desc {
@@ -281,20 +313,20 @@ struct cam_patch_desc {
};
};


/**
/**
 * struct cam_packet - cam packet structure
 * struct cam_packet - Camera packet structure
 *
 *
 * @header:                     camera packet header
 * @header:                     Camera packet header
 * @cmd_buf_offset:             command buffer start offset
 * @cmd_buf_offset:             Command buffer start offset
 * @num_cmd_buf:                number of the command buffer in the packet
 * @num_cmd_buf:                Number of the command buffer in the packet
 * @io_config_offset:           buffer io configuration start offset
 * @io_config_offset:           Buffer io configuration start offset
 * @num_io_configs:             number of the buffer io configurations
 * @num_io_configs:             Number of the buffer io configurations
 * @patch_offset:               patch offset for the patch structure
 * @patch_offset:               Patch offset for the patch structure
 * @num_patches:                number of the patch structure
 * @num_patches:                Number of the patch structure
 * @kmd_cmd_buf_index:          command buffer index which contains extra
 * @kmd_cmd_buf_index:          Command buffer index which contains extra
 *                              space for the KMD buffer
 *                              space for the KMD buffer
 * @kmd_cmd_buf_offset:         offset from the beginning of the command
 * @kmd_cmd_buf_offset:         Offset from the beginning of the command
 *                              buffer for KMD usage.
 *                              buffer for KMD usage.
 * @payload:                    camera packet payload
 * @payload:                    Camera packet payload
 *
 *
 */
 */
struct cam_packet {
struct cam_packet {
@@ -313,10 +345,10 @@ struct cam_packet {


/* Release Device */
/* Release Device */
/**
/**
 * struct cam_release_dev_cmd - control payload for release devices
 * struct cam_release_dev_cmd - Control payload for release devices
 *
 *
 * @session_handle:             session handle for the release
 * @session_handle:             Session handle for the release
 * @dev_handle:                 device handle for the release
 * @dev_handle:                 Device handle for the release
 */
 */
struct cam_release_dev_cmd {
struct cam_release_dev_cmd {
	int32_t                 session_handle;
	int32_t                 session_handle;
@@ -325,10 +357,10 @@ struct cam_release_dev_cmd {


/* Start/Stop device */
/* Start/Stop device */
/**
/**
 * struct cam_start_stop_dev_cmd - control payload for start/stop device
 * struct cam_start_stop_dev_cmd - Control payload for start/stop device
 *
 *
 * @session_handle:             session handle for the start/stop command
 * @session_handle:             Session handle for the start/stop command
 * @dev_handle:                 device handle for the start/stop command
 * @dev_handle:                 Device handle for the start/stop command
 *
 *
 */
 */
struct cam_start_stop_dev_cmd {
struct cam_start_stop_dev_cmd {
@@ -338,12 +370,12 @@ struct cam_start_stop_dev_cmd {


/* Configure Device */
/* Configure Device */
/**
/**
 * struct cam_config_dev_cmd - command payload for configure device
 * struct cam_config_dev_cmd - Command payload for configure device
 *
 *
 * @session_handle:             session handle for the command
 * @session_handle:             Session handle for the command
 * @dev_handle:                 device handle for the command
 * @dev_handle:                 Device handle for the command
 * @offset:                     offset byte in the packet handle.
 * @offset:                     Offset byte in the packet handle.
 * @packet_handle:              packet memory handle for the actual packet:
 * @packet_handle:              Packet memory handle for the actual packet:
 *                              struct cam_packet.
 *                              struct cam_packet.
 *
 *
 */
 */
@@ -356,11 +388,11 @@ struct cam_config_dev_cmd {


/* Query Device Caps */
/* Query Device Caps */
/**
/**
 * struct cam_query_cap_cmd - payload for query device capability
 * struct cam_query_cap_cmd - Payload for query device capability
 *
 *
 * @size:               handle size
 * @size:               Handle size
 * @handle_type:        user pointer or shared memory handle
 * @handle_type:        User pointer or shared memory handle
 * @caps_handle:        device specific query command payload
 * @caps_handle:        Device specific query command payload
 *
 *
 */
 */
struct cam_query_cap_cmd {
struct cam_query_cap_cmd {
@@ -371,14 +403,14 @@ struct cam_query_cap_cmd {


/* Acquire Device */
/* Acquire Device */
/**
/**
 * struct cam_acquire_dev_cmd - control payload for acquire devices
 * struct cam_acquire_dev_cmd - Control payload for acquire devices
 *
 *
 * @session_handle:     session handle for the acquire command
 * @session_handle:     Session handle for the acquire command
 * @dev_handle:         device handle to be returned
 * @dev_handle:         Device handle to be returned
 * @handle_type:        resource handle type:
 * @handle_type:        Resource handle type:
 *                             1 = user poniter, 2 = mem handle
 *                      1 = user pointer, 2 = mem handle
 * @num_resources:      number of the resources to be acquired
 * @num_resources:      Number of the resources to be acquired
 * @resources_hdl:      resource handle that refers to the actual
 * @resources_hdl:      Resource handle that refers to the actual
 *                      resource array. Each item in this
 *                      resource array. Each item in this
 *                      array is device specific resource structure
 *                      array is device specific resource structure
 *
 *