msm: camera: jpeg: Add UAPI support for JPEG retry mechanism

Add uapi structure to add support for enforcing the size
restriction on JPEG thumbnail images.

CRs-Fixed: 2999106
Change-Id: Icee615eb5674b3f0869631a57eed0d46aa6c2799
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
This commit is contained in:
Jigar Agrawal
2021-07-23 13:55:37 -07:00
parent 8b5f97b80f
commit b8951526bf
2 changed files with 99 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_JPEG_H__
@@ -9,38 +9,57 @@
#include <media/cam_defs.h>
/* enc, dma, cdm(enc/dma) are used in querycap */
#define CAM_JPEG_DEV_TYPE_ENC 0
#define CAM_JPEG_DEV_TYPE_DMA 1
#define CAM_JPEG_DEV_TYPE_MAX 2
#define CAM_JPEG_DEV_TYPE_ENC 0
#define CAM_JPEG_DEV_TYPE_DMA 1
#define CAM_JPEG_DEV_TYPE_MAX 2
#define CAM_JPEG_NUM_DEV_PER_RES_MAX 1
#define CAM_JPEG_NUM_DEV_PER_RES_MAX 1
/* definitions needed for jpeg aquire device */
#define CAM_JPEG_RES_TYPE_ENC 0
#define CAM_JPEG_RES_TYPE_DMA 1
#define CAM_JPEG_RES_TYPE_MAX 2
#define CAM_JPEG_RES_TYPE_ENC 0
#define CAM_JPEG_RES_TYPE_DMA 1
#define CAM_JPEG_RES_TYPE_MAX 2
/* packet opcode types */
#define CAM_JPEG_OPCODE_ENC_UPDATE 0
#define CAM_JPEG_OPCODE_DMA_UPDATE 1
#define CAM_JPEG_OPCODE_ENC_UPDATE 0
#define CAM_JPEG_OPCODE_DMA_UPDATE 1
/* ENC input port resource type */
#define CAM_JPEG_ENC_INPUT_IMAGE 0x0
#define CAM_JPEG_ENC_INPUT_IMAGE 0x0
/* ENC output port resource type */
#define CAM_JPEG_ENC_OUTPUT_IMAGE 0x1
#define CAM_JPEG_ENC_IO_IMAGES_MAX 0x2
#define CAM_JPEG_ENC_OUTPUT_IMAGE 0x1
#define CAM_JPEG_ENC_IO_IMAGES_MAX 0x2
/* DMA input port resource type */
#define CAM_JPEG_DMA_INPUT_IMAGE 0x0
#define CAM_JPEG_DMA_INPUT_IMAGE 0x0
/* DMA output port resource type */
#define CAM_JPEG_DMA_OUTPUT_IMAGE 0x1
#define CAM_JPEG_DMA_OUTPUT_IMAGE 0x1
#define CAM_JPEG_DMA_IO_IMAGES_MAX 0x2
#define CAM_JPEG_DMA_IO_IMAGES_MAX 0x2
/*JPEG Command Buffer Metadata types*/
#define CAM_JPEG_ENC_PACKET_CONFIG_DATA 0x00
#define CAM_JPEG_DMA_PACKET_PLANE0_CONFIG_DATA 0x01
#define CAM_JPEG_DMA_PACKET_PLANE1_CONFIG_DATA 0x02
#define CAM_JPEG_PACKET_INOUT_PARAM 0x03
#define CAM_JPEG_PACKET_GENERIC_BLOB 0x04
#define CAM_JPEG_IMAGE_MAX 0x2
/*JPEG Generic Blob Command buffer type*/
#define CAM_JPEG_THUMBNAIL_SIZE_BLOB 0x01
/**
* struct cam_jpeg_thumbnail_size_blob - Blob containing information about maximum size of the
* thumbnail image
*
* This blob contains information about the maximum size of the encoded thumbnail image that is
* considered valid.
*
* @threshold_size : Size threshold for the encoded Thumbnail image
* @reserved : Reserved field
*/
struct cam_jpeg_thumbnail_size_blob {
__u32 threshold_size;
__u32 reserved[3];
};
/**
* struct cam_jpeg_dev_ver - Device information for particular hw type
@@ -48,9 +67,9 @@
* This is used to get device version info of JPEG ENC, JPEG DMA
* from hardware and use this info in CAM_QUERY_CAP IOCTL
*
* @size : Size of struct passed
* @dev_type: Hardware type for the cap info(jpeg enc, jpeg dma)
* @hw_ver: Major, minor and incr values of a device version
* @size : Size of struct passed
* @dev_type : Hardware type for the cap info(jpeg enc, jpeg dma)
* @hw_ver : Major, minor and incr values of a device version
*/
struct cam_jpeg_dev_ver {
__u32 size;
@@ -61,12 +80,12 @@ struct cam_jpeg_dev_ver {
/**
* struct cam_jpeg_query_cap_cmd - JPEG query device capability payload
*
* @dev_iommu_handle: Jpeg iommu handles for secure/non secure
* @dev_iommu_handle : Jpeg iommu handles for secure/non secure
* modes
* @cdm_iommu_handle: Iommu handles for secure/non secure modes
* @num_enc: Number of encoder
* @num_dma: Number of dma
* @dev_ver: Returned device capability array
* @cdm_iommu_handle : Iommu handles for secure/non secure modes
* @num_enc : Number of encoder
* @num_dma : Number of dma
* @dev_ver : Returned device capability array
*/
struct cam_jpeg_query_cap_cmd {
struct cam_iommu_handle dev_iommu_handle;
@@ -79,10 +98,10 @@ struct cam_jpeg_query_cap_cmd {
/**
* struct cam_jpeg_res_info - JPEG output resource info
*
* @format: Format of the resource
* @width: Width in pixels
* @height: Height in lines
* @fps: Fps
* @format : Format of the resource
* @width : Width in pixels
* @height : Height in lines
* @fps : Fps
*/
struct cam_jpeg_res_info {
__u32 format;
@@ -94,10 +113,10 @@ struct cam_jpeg_res_info {
/**
* struct cam_jpeg_acquire_dev_info - An JPEG device info
*
* @dev_type: Device type (ENC/DMA)
* @reserved: Reserved Bytes
* @in_res: In resource info
* @in_res: Iut resource info
* @dev_type : Device type (ENC/DMA)
* @reserved : Reserved Bytes
* @in_res : In resource info
* @in_res : Iut resource info
*/
struct cam_jpeg_acquire_dev_info {
__u32 dev_type;
@@ -110,7 +129,7 @@ struct cam_jpeg_acquire_dev_info {
* struct cam_jpeg_config_inout_param_info - JPEG Config time
* input output params
*
* @clk_index: Input Param- clock selection index.(-1 default)
* @clk_index : Input Param- clock selection index.(-1 default)
* @output_size: Output Param - jpeg encode/dma output size in
* bytes
*/