1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 */ 6 7 #ifndef _SH_CSS_PARAMS_DVS_H_ 8 #define _SH_CSS_PARAMS_DVS_H_ 9 10 #include <linux/math.h> 11 12 #include <math_support.h> 13 #include <ia_css_types.h> 14 #include "gdc_global.h" /* gdc_warp_param_mem_t */ 15 16 #define DVS_ENV_MIN_X (12) 17 #define DVS_ENV_MIN_Y (12) 18 19 #define DVS_BLOCKDIM_X (64) /* X block height*/ 20 #define DVS_BLOCKDIM_Y_LUMA (64) /* Y block height*/ 21 #define DVS_BLOCKDIM_Y_CHROMA (32) /* UV height block size is half the Y block height*/ 22 23 /* ISP2400 */ 24 /* horizontal 64x64 blocks round up to DVS_BLOCKDIM_X, make even */ 25 #define DVS_NUM_BLOCKS_X(X) round_up(DIV_ROUND_UP((X), DVS_BLOCKDIM_X), 2) 26 #define DVS_NUM_BLOCKS_X_CHROMA(X) DIV_ROUND_UP((X), DVS_BLOCKDIM_X) 27 28 /* ISP2400 */ 29 /* vertical 64x64 blocks round up to DVS_BLOCKDIM_Y */ 30 #define DVS_NUM_BLOCKS_Y(X) DIV_ROUND_UP((X), DVS_BLOCKDIM_Y_LUMA) 31 #define DVS_NUM_BLOCKS_Y_CHROMA(X) DIV_ROUND_UP((X), DVS_BLOCKDIM_Y_CHROMA) 32 33 /* N blocks have N + 1 set of coords */ 34 #define DVS_TABLE_IN_BLOCKDIM_X_LUMA(X) (DVS_NUM_BLOCKS_X(X) + 1) 35 #define DVS_TABLE_IN_BLOCKDIM_X_CHROMA(X) (DVS_NUM_BLOCKS_X_CHROMA(X) + 1) 36 #define DVS_TABLE_IN_BLOCKDIM_Y_LUMA(X) (DVS_NUM_BLOCKS_Y(X) + 1) 37 #define DVS_TABLE_IN_BLOCKDIM_Y_CHROMA(X) (DVS_NUM_BLOCKS_Y_CHROMA(X) + 1) 38 39 #define DVS_COORD_FRAC_BITS (10) 40 41 /* ISP2400 */ 42 #define DVS_INPUT_BYTES_PER_PIXEL (1) 43 44 #define XMEM_ALIGN_LOG2 (5) 45 46 #define DVS_6AXIS_COORDS_ELEMS \ 47 round_up(sizeof(gdc_warp_param_mem_t), HIVE_ISP_DDR_WORD_BYTES) 48 49 /* currently we only support two output with the same resolution, output 0 is th default one. */ 50 #define DVS_6AXIS_BYTES(binary) \ 51 (DVS_6AXIS_COORDS_ELEMS \ 52 * DVS_NUM_BLOCKS_X((binary)->out_frame_info[0].res.width) \ 53 * DVS_NUM_BLOCKS_Y((binary)->out_frame_info[0].res.height)) 54 55 /* 56 * ISP2400: 57 * Bilinear interpolation (HRT_GDC_BLI_MODE) is the supported method currently. 58 * Bicubic interpolation (HRT_GDC_BCI_MODE) is not supported yet */ 59 #define DVS_GDC_INTERP_METHOD HRT_GDC_BLI_MODE 60 61 struct ia_css_dvs_6axis_config * 62 generate_dvs_6axis_table(const struct ia_css_resolution *frame_res, 63 const struct ia_css_resolution *dvs_offset); 64 65 struct ia_css_dvs_6axis_config * 66 generate_dvs_6axis_table_from_config(struct ia_css_dvs_6axis_config 67 *dvs_config_src); 68 69 void 70 free_dvs_6axis_table(struct ia_css_dvs_6axis_config **dvs_6axis_config); 71 72 void 73 copy_dvs_6axis_table(struct ia_css_dvs_6axis_config *dvs_config_dst, 74 const struct ia_css_dvs_6axis_config *dvs_config_src); 75 76 #endif 77