drivers/staging/media/ipu3/ipu3-css-params.c:1211:1: warning: the frame size of 2500 bytes is larger than 1024 bytes

From: kernel test robot
Date: Mon Aug 31 2020 - 08:29:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f75aef392f869018f78cfedf3c320a6b3fcfda6b
commit: 0887a7ebc97770c7870abf3075a2e8cd502a7f52 ubsan: add trap instrumentation option
date: 5 months ago
config: i386-randconfig-r026-20200831 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
git checkout 0887a7ebc97770c7870abf3075a2e8cd502a7f52
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from drivers/staging/media/ipu3/ipu3-css.h:10,
from drivers/staging/media/ipu3/ipu3-css-params.c:6:
drivers/staging/media/ipu3/ipu3-abi.h:1250:1: warning: alignment 1 of 'struct imgu_abi_awb_fr_config' is less than 32 [-Wpacked-not-aligned]
1250 | } __packed;
| ^
drivers/staging/media/ipu3/ipu3-css-params.c: In function 'imgu_css_osys_calc':
>> drivers/staging/media/ipu3/ipu3-css-params.c:1211:1: warning: the frame size of 2500 bytes is larger than 1024 bytes [-Wframe-larger-than=]
1211 | }
| ^

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0887a7ebc97770c7870abf3075a2e8cd502a7f52
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0887a7ebc97770c7870abf3075a2e8cd502a7f52
vim +1211 drivers/staging/media/ipu3/ipu3-css-params.c

e11110a5b74487 Yong Zhi 2018-12-06 845
e11110a5b74487 Yong Zhi 2018-12-06 846 /*
e11110a5b74487 Yong Zhi 2018-12-06 847 * This function configures the Output Formatter System, given the number of
e11110a5b74487 Yong Zhi 2018-12-06 848 * stripes, scaler luma and chrome parameters
e11110a5b74487 Yong Zhi 2018-12-06 849 */
27b795adb3c221 Yong Zhi 2019-02-07 850 static int imgu_css_osys_calc(struct imgu_css *css, unsigned int pipe,
51abe041c5ed56 Bingbu Cao 2018-12-06 851 unsigned int stripes,
e11110a5b74487 Yong Zhi 2018-12-06 852 struct imgu_abi_osys_config *osys,
27b795adb3c221 Yong Zhi 2019-02-07 853 struct imgu_css_scaler_info *scaler_luma,
27b795adb3c221 Yong Zhi 2019-02-07 854 struct imgu_css_scaler_info *scaler_chroma,
e11110a5b74487 Yong Zhi 2018-12-06 855 struct imgu_abi_stripes block_stripes[])
e11110a5b74487 Yong Zhi 2018-12-06 856 {
27b795adb3c221 Yong Zhi 2019-02-07 857 struct imgu_css_frame_params frame_params[IMGU_ABI_OSYS_PINS];
27b795adb3c221 Yong Zhi 2019-02-07 858 struct imgu_css_stripe_params stripe_params[IPU3_UAPI_MAX_STRIPES];
e11110a5b74487 Yong Zhi 2018-12-06 859 struct imgu_abi_osys_formatter_params *param;
e11110a5b74487 Yong Zhi 2018-12-06 860 unsigned int pin, s;
27b795adb3c221 Yong Zhi 2019-02-07 861 struct imgu_css_pipe *css_pipe = &css->pipes[pipe];
e11110a5b74487 Yong Zhi 2018-12-06 862
e11110a5b74487 Yong Zhi 2018-12-06 863 memset(osys, 0, sizeof(*osys));
e11110a5b74487 Yong Zhi 2018-12-06 864
e11110a5b74487 Yong Zhi 2018-12-06 865 /* Compute the frame and stripe params */
27b795adb3c221 Yong Zhi 2019-02-07 866 if (imgu_css_osys_calc_frame_and_stripe_params(css, stripes, osys,
e11110a5b74487 Yong Zhi 2018-12-06 867 scaler_luma,
e11110a5b74487 Yong Zhi 2018-12-06 868 scaler_chroma,
e11110a5b74487 Yong Zhi 2018-12-06 869 frame_params,
51abe041c5ed56 Bingbu Cao 2018-12-06 870 stripe_params, pipe))
e11110a5b74487 Yong Zhi 2018-12-06 871 return -EINVAL;
e11110a5b74487 Yong Zhi 2018-12-06 872
e11110a5b74487 Yong Zhi 2018-12-06 873 /* Output formatter system parameters */
e11110a5b74487 Yong Zhi 2018-12-06 874
e11110a5b74487 Yong Zhi 2018-12-06 875 for (s = 0; s < stripes; s++) {
e11110a5b74487 Yong Zhi 2018-12-06 876 struct imgu_abi_osys_scaler_params *scaler =
e11110a5b74487 Yong Zhi 2018-12-06 877 &osys->scaler[s].param;
e11110a5b74487 Yong Zhi 2018-12-06 878 int fifo_addr_fmt = IMGU_FIFO_ADDR_SCALER_TO_FMT;
e11110a5b74487 Yong Zhi 2018-12-06 879 int fifo_addr_ack = IMGU_FIFO_ADDR_SCALER_TO_SP;
e11110a5b74487 Yong Zhi 2018-12-06 880
e11110a5b74487 Yong Zhi 2018-12-06 881 /* OUTPUT 0 / PIN 0 is only Scaler output */
e11110a5b74487 Yong Zhi 2018-12-06 882 scaler->inp_buf_y_st_addr = IMGU_VMEM1_INP_BUF_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 883
e11110a5b74487 Yong Zhi 2018-12-06 884 /*
e11110a5b74487 Yong Zhi 2018-12-06 885 * = (IMGU_OSYS_BLOCK_WIDTH / IMGU_VMEM1_ELEMS_PER_VEC)
e11110a5b74487 Yong Zhi 2018-12-06 886 * = (2 * IPU3_UAPI_ISP_VEC_ELEMS) /
e11110a5b74487 Yong Zhi 2018-12-06 887 * (IMGU_HIVE_OF_SYS_OF_SYSTEM_NWAYS)
e11110a5b74487 Yong Zhi 2018-12-06 888 * = 2 * 64 / 32 = 4
e11110a5b74487 Yong Zhi 2018-12-06 889 */
e11110a5b74487 Yong Zhi 2018-12-06 890 scaler->inp_buf_y_line_stride = IMGU_VMEM1_Y_STRIDE;
e11110a5b74487 Yong Zhi 2018-12-06 891 /*
e11110a5b74487 Yong Zhi 2018-12-06 892 * = (IMGU_VMEM1_V_OFFSET + VMEM1_uv_size)
e11110a5b74487 Yong Zhi 2018-12-06 893 * = (IMGU_VMEM1_U_OFFSET + VMEM1_uv_size) +
e11110a5b74487 Yong Zhi 2018-12-06 894 * (VMEM1_y_size / 4)
e11110a5b74487 Yong Zhi 2018-12-06 895 * = (VMEM1_y_size) + (VMEM1_y_size / 4) +
e11110a5b74487 Yong Zhi 2018-12-06 896 * (IMGU_OSYS_BLOCK_HEIGHT * IMGU_VMEM1_Y_STRIDE)/4
e11110a5b74487 Yong Zhi 2018-12-06 897 * = (IMGU_OSYS_BLOCK_HEIGHT * IMGU_VMEM1_Y_STRIDE)
e11110a5b74487 Yong Zhi 2018-12-06 898 */
e11110a5b74487 Yong Zhi 2018-12-06 899 scaler->inp_buf_y_buffer_stride = IMGU_VMEM1_BUF_SIZE;
e11110a5b74487 Yong Zhi 2018-12-06 900 scaler->inp_buf_u_st_addr = IMGU_VMEM1_INP_BUF_ADDR +
e11110a5b74487 Yong Zhi 2018-12-06 901 IMGU_VMEM1_U_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 902 scaler->inp_buf_v_st_addr = IMGU_VMEM1_INP_BUF_ADDR +
e11110a5b74487 Yong Zhi 2018-12-06 903 IMGU_VMEM1_V_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 904 scaler->inp_buf_uv_line_stride = IMGU_VMEM1_UV_STRIDE;
e11110a5b74487 Yong Zhi 2018-12-06 905 scaler->inp_buf_uv_buffer_stride = IMGU_VMEM1_BUF_SIZE;
e11110a5b74487 Yong Zhi 2018-12-06 906 scaler->inp_buf_chunk_width = stripe_params[s].chunk_width;
e11110a5b74487 Yong Zhi 2018-12-06 907 scaler->inp_buf_nr_buffers = IMGU_OSYS_NUM_INPUT_BUFFERS;
e11110a5b74487 Yong Zhi 2018-12-06 908
e11110a5b74487 Yong Zhi 2018-12-06 909 /* Output buffers */
e11110a5b74487 Yong Zhi 2018-12-06 910 scaler->out_buf_y_st_addr = IMGU_VMEM1_INT_BUF_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 911 scaler->out_buf_y_line_stride = stripe_params[s].block_width /
e11110a5b74487 Yong Zhi 2018-12-06 912 IMGU_VMEM1_ELEMS_PER_VEC;
e11110a5b74487 Yong Zhi 2018-12-06 913 scaler->out_buf_y_buffer_stride = IMGU_VMEM1_BUF_SIZE;
e11110a5b74487 Yong Zhi 2018-12-06 914 scaler->out_buf_u_st_addr = IMGU_VMEM1_INT_BUF_ADDR +
e11110a5b74487 Yong Zhi 2018-12-06 915 IMGU_VMEM1_U_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 916 scaler->out_buf_v_st_addr = IMGU_VMEM1_INT_BUF_ADDR +
e11110a5b74487 Yong Zhi 2018-12-06 917 IMGU_VMEM1_V_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 918 scaler->out_buf_uv_line_stride = stripe_params[s].block_width /
e11110a5b74487 Yong Zhi 2018-12-06 919 IMGU_VMEM1_ELEMS_PER_VEC / 2;
e11110a5b74487 Yong Zhi 2018-12-06 920 scaler->out_buf_uv_buffer_stride = IMGU_VMEM1_BUF_SIZE;
e11110a5b74487 Yong Zhi 2018-12-06 921 scaler->out_buf_nr_buffers = IMGU_OSYS_NUM_INTERM_BUFFERS;
e11110a5b74487 Yong Zhi 2018-12-06 922
e11110a5b74487 Yong Zhi 2018-12-06 923 /* Intermediate buffers */
e11110a5b74487 Yong Zhi 2018-12-06 924 scaler->int_buf_y_st_addr = IMGU_VMEM2_BUF_Y_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 925 scaler->int_buf_y_line_stride = IMGU_VMEM2_BUF_Y_STRIDE;
e11110a5b74487 Yong Zhi 2018-12-06 926 scaler->int_buf_u_st_addr = IMGU_VMEM2_BUF_U_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 927 scaler->int_buf_v_st_addr = IMGU_VMEM2_BUF_V_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 928 scaler->int_buf_uv_line_stride = IMGU_VMEM2_BUF_UV_STRIDE;
e11110a5b74487 Yong Zhi 2018-12-06 929 scaler->int_buf_height = IMGU_VMEM2_LINES_PER_BLOCK;
e11110a5b74487 Yong Zhi 2018-12-06 930 scaler->int_buf_chunk_width = stripe_params[s].chunk_height;
e11110a5b74487 Yong Zhi 2018-12-06 931 scaler->int_buf_chunk_height = stripe_params[s].block_width;
e11110a5b74487 Yong Zhi 2018-12-06 932
e11110a5b74487 Yong Zhi 2018-12-06 933 /* Context buffers */
e11110a5b74487 Yong Zhi 2018-12-06 934 scaler->ctx_buf_hor_y_st_addr = IMGU_VMEM3_HOR_Y_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 935 scaler->ctx_buf_hor_u_st_addr = IMGU_VMEM3_HOR_U_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 936 scaler->ctx_buf_hor_v_st_addr = IMGU_VMEM3_HOR_V_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 937 scaler->ctx_buf_ver_y_st_addr = IMGU_VMEM3_VER_Y_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 938 scaler->ctx_buf_ver_u_st_addr = IMGU_VMEM3_VER_U_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 939 scaler->ctx_buf_ver_v_st_addr = IMGU_VMEM3_VER_V_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 940
e11110a5b74487 Yong Zhi 2018-12-06 941 /* Addresses for release-input and process-output tokens */
e11110a5b74487 Yong Zhi 2018-12-06 942 scaler->release_inp_buf_addr = fifo_addr_ack;
e11110a5b74487 Yong Zhi 2018-12-06 943 scaler->release_inp_buf_en = 1;
e11110a5b74487 Yong Zhi 2018-12-06 944 scaler->release_out_buf_en = 1;
e11110a5b74487 Yong Zhi 2018-12-06 945 scaler->process_out_buf_addr = fifo_addr_fmt;
e11110a5b74487 Yong Zhi 2018-12-06 946
e11110a5b74487 Yong Zhi 2018-12-06 947 /* Settings dimensions, padding, cropping */
e11110a5b74487 Yong Zhi 2018-12-06 948 scaler->input_image_y_width = stripe_params[s].input_width;
e11110a5b74487 Yong Zhi 2018-12-06 949 scaler->input_image_y_height = stripe_params[s].input_height;
e11110a5b74487 Yong Zhi 2018-12-06 950 scaler->input_image_y_start_column =
e11110a5b74487 Yong Zhi 2018-12-06 951 stripe_params[s].start_column_y;
e11110a5b74487 Yong Zhi 2018-12-06 952 scaler->input_image_uv_start_column =
e11110a5b74487 Yong Zhi 2018-12-06 953 stripe_params[s].start_column_uv;
e11110a5b74487 Yong Zhi 2018-12-06 954 scaler->input_image_y_left_pad = stripe_params[s].pad_left_y;
e11110a5b74487 Yong Zhi 2018-12-06 955 scaler->input_image_uv_left_pad = stripe_params[s].pad_left_uv;
e11110a5b74487 Yong Zhi 2018-12-06 956 scaler->input_image_y_right_pad = stripe_params[s].pad_right_y;
e11110a5b74487 Yong Zhi 2018-12-06 957 scaler->input_image_uv_right_pad =
e11110a5b74487 Yong Zhi 2018-12-06 958 stripe_params[s].pad_right_uv;
e11110a5b74487 Yong Zhi 2018-12-06 959 scaler->input_image_y_top_pad = stripe_params[s].pad_top_y;
e11110a5b74487 Yong Zhi 2018-12-06 960 scaler->input_image_uv_top_pad = stripe_params[s].pad_top_uv;
e11110a5b74487 Yong Zhi 2018-12-06 961 scaler->input_image_y_bottom_pad =
e11110a5b74487 Yong Zhi 2018-12-06 962 stripe_params[s].pad_bottom_y;
e11110a5b74487 Yong Zhi 2018-12-06 963 scaler->input_image_uv_bottom_pad =
e11110a5b74487 Yong Zhi 2018-12-06 964 stripe_params[s].pad_bottom_uv;
e11110a5b74487 Yong Zhi 2018-12-06 965 scaler->processing_mode = stripe_params[s].processing_mode;
e11110a5b74487 Yong Zhi 2018-12-06 966 scaler->scaling_ratio = stripe_params[s].phase_step;
e11110a5b74487 Yong Zhi 2018-12-06 967 scaler->y_left_phase_init = stripe_params[s].phase_init_left_y;
e11110a5b74487 Yong Zhi 2018-12-06 968 scaler->uv_left_phase_init =
e11110a5b74487 Yong Zhi 2018-12-06 969 stripe_params[s].phase_init_left_uv;
e11110a5b74487 Yong Zhi 2018-12-06 970 scaler->y_top_phase_init = stripe_params[s].phase_init_top_y;
e11110a5b74487 Yong Zhi 2018-12-06 971 scaler->uv_top_phase_init = stripe_params[s].phase_init_top_uv;
e11110a5b74487 Yong Zhi 2018-12-06 972 scaler->coeffs_exp_shift = stripe_params[s].exp_shift;
e11110a5b74487 Yong Zhi 2018-12-06 973 scaler->out_y_left_crop = stripe_params[s].crop_left_y;
e11110a5b74487 Yong Zhi 2018-12-06 974 scaler->out_uv_left_crop = stripe_params[s].crop_left_uv;
e11110a5b74487 Yong Zhi 2018-12-06 975 scaler->out_y_top_crop = stripe_params[s].crop_top_y;
e11110a5b74487 Yong Zhi 2018-12-06 976 scaler->out_uv_top_crop = stripe_params[s].crop_top_uv;
e11110a5b74487 Yong Zhi 2018-12-06 977
e11110a5b74487 Yong Zhi 2018-12-06 978 for (pin = 0; pin < IMGU_ABI_OSYS_PINS; pin++) {
e11110a5b74487 Yong Zhi 2018-12-06 979 int in_fifo_addr;
e11110a5b74487 Yong Zhi 2018-12-06 980 int out_fifo_addr;
e11110a5b74487 Yong Zhi 2018-12-06 981 int block_width_vecs;
e11110a5b74487 Yong Zhi 2018-12-06 982 int input_width_s;
e11110a5b74487 Yong Zhi 2018-12-06 983 int input_width_vecs;
e11110a5b74487 Yong Zhi 2018-12-06 984 int input_buf_y_st_addr;
e11110a5b74487 Yong Zhi 2018-12-06 985 int input_buf_u_st_addr;
e11110a5b74487 Yong Zhi 2018-12-06 986 int input_buf_v_st_addr;
e11110a5b74487 Yong Zhi 2018-12-06 987 int input_buf_y_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 988 int input_buf_uv_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 989 int output_buf_y_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 990 int output_buf_uv_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 991 int output_buf_nr_y_lines;
e11110a5b74487 Yong Zhi 2018-12-06 992 int block_height;
e11110a5b74487 Yong Zhi 2018-12-06 993 int block_width;
e11110a5b74487 Yong Zhi 2018-12-06 994 struct imgu_abi_osys_frame_params *fr_pr;
e11110a5b74487 Yong Zhi 2018-12-06 995
e11110a5b74487 Yong Zhi 2018-12-06 996 fr_pr = &osys->frame[pin].param;
e11110a5b74487 Yong Zhi 2018-12-06 997
e11110a5b74487 Yong Zhi 2018-12-06 998 /* Frame parameters */
e11110a5b74487 Yong Zhi 2018-12-06 999 fr_pr->enable = frame_params[pin].enable;
e11110a5b74487 Yong Zhi 2018-12-06 1000 fr_pr->format = frame_params[pin].format;
e11110a5b74487 Yong Zhi 2018-12-06 1001 fr_pr->mirror = frame_params[pin].mirror;
e11110a5b74487 Yong Zhi 2018-12-06 1002 fr_pr->flip = frame_params[pin].flip;
e11110a5b74487 Yong Zhi 2018-12-06 1003 fr_pr->tiling = frame_params[pin].tiling;
e11110a5b74487 Yong Zhi 2018-12-06 1004 fr_pr->width = frame_params[pin].width;
e11110a5b74487 Yong Zhi 2018-12-06 1005 fr_pr->height = frame_params[pin].height;
e11110a5b74487 Yong Zhi 2018-12-06 1006 fr_pr->stride = frame_params[pin].stride;
e11110a5b74487 Yong Zhi 2018-12-06 1007 fr_pr->scaled = frame_params[pin].scaled;
e11110a5b74487 Yong Zhi 2018-12-06 1008
e11110a5b74487 Yong Zhi 2018-12-06 1009 /* Stripe parameters */
e11110a5b74487 Yong Zhi 2018-12-06 1010 osys->stripe[s].crop_top[pin] =
e11110a5b74487 Yong Zhi 2018-12-06 1011 frame_params[pin].crop_top;
e11110a5b74487 Yong Zhi 2018-12-06 1012 osys->stripe[s].input_width =
e11110a5b74487 Yong Zhi 2018-12-06 1013 stripe_params[s].input_width;
e11110a5b74487 Yong Zhi 2018-12-06 1014 osys->stripe[s].input_height =
e11110a5b74487 Yong Zhi 2018-12-06 1015 stripe_params[s].input_height;
e11110a5b74487 Yong Zhi 2018-12-06 1016 osys->stripe[s].block_height =
e11110a5b74487 Yong Zhi 2018-12-06 1017 stripe_params[s].block_height;
e11110a5b74487 Yong Zhi 2018-12-06 1018 osys->stripe[s].block_width =
e11110a5b74487 Yong Zhi 2018-12-06 1019 stripe_params[s].block_width;
e11110a5b74487 Yong Zhi 2018-12-06 1020 osys->stripe[s].output_width[pin] =
e11110a5b74487 Yong Zhi 2018-12-06 1021 stripe_params[s].output_width[pin];
e11110a5b74487 Yong Zhi 2018-12-06 1022 osys->stripe[s].output_height[pin] =
e11110a5b74487 Yong Zhi 2018-12-06 1023 stripe_params[s].output_height[pin];
e11110a5b74487 Yong Zhi 2018-12-06 1024
e11110a5b74487 Yong Zhi 2018-12-06 1025 if (s == 0) {
e11110a5b74487 Yong Zhi 2018-12-06 1026 /* Only first stripe should do left cropping */
e11110a5b74487 Yong Zhi 2018-12-06 1027 osys->stripe[s].crop_left[pin] =
e11110a5b74487 Yong Zhi 2018-12-06 1028 frame_params[pin].crop_left;
e11110a5b74487 Yong Zhi 2018-12-06 1029 osys->stripe[s].output_offset[pin] =
e11110a5b74487 Yong Zhi 2018-12-06 1030 stripe_params[s].output_offset[pin];
e11110a5b74487 Yong Zhi 2018-12-06 1031 } else {
e11110a5b74487 Yong Zhi 2018-12-06 1032 /*
e11110a5b74487 Yong Zhi 2018-12-06 1033 * Stripe offset for other strips should be
e11110a5b74487 Yong Zhi 2018-12-06 1034 * adjusted according to the cropping done
e11110a5b74487 Yong Zhi 2018-12-06 1035 * at the first strip
e11110a5b74487 Yong Zhi 2018-12-06 1036 */
e11110a5b74487 Yong Zhi 2018-12-06 1037 osys->stripe[s].crop_left[pin] = 0;
e11110a5b74487 Yong Zhi 2018-12-06 1038 osys->stripe[s].output_offset[pin] =
e11110a5b74487 Yong Zhi 2018-12-06 1039 (stripe_params[s].output_offset[pin] -
e11110a5b74487 Yong Zhi 2018-12-06 1040 osys->stripe[0].crop_left[pin]);
e11110a5b74487 Yong Zhi 2018-12-06 1041 }
e11110a5b74487 Yong Zhi 2018-12-06 1042
e11110a5b74487 Yong Zhi 2018-12-06 1043 if (!frame_params[pin].enable)
e11110a5b74487 Yong Zhi 2018-12-06 1044 continue;
e11110a5b74487 Yong Zhi 2018-12-06 1045
e11110a5b74487 Yong Zhi 2018-12-06 1046 /* Formatter: configurations */
e11110a5b74487 Yong Zhi 2018-12-06 1047
e11110a5b74487 Yong Zhi 2018-12-06 1048 /*
e11110a5b74487 Yong Zhi 2018-12-06 1049 * Get the dimensions of the input blocks of the
e11110a5b74487 Yong Zhi 2018-12-06 1050 * formatter, which is the same as the output
e11110a5b74487 Yong Zhi 2018-12-06 1051 * blocks of the scaler.
e11110a5b74487 Yong Zhi 2018-12-06 1052 */
e11110a5b74487 Yong Zhi 2018-12-06 1053 if (frame_params[pin].scaled) {
e11110a5b74487 Yong Zhi 2018-12-06 1054 block_height = stripe_params[s].block_height;
e11110a5b74487 Yong Zhi 2018-12-06 1055 block_width = stripe_params[s].block_width;
e11110a5b74487 Yong Zhi 2018-12-06 1056 } else {
e11110a5b74487 Yong Zhi 2018-12-06 1057 block_height = IMGU_OSYS_BLOCK_HEIGHT;
e11110a5b74487 Yong Zhi 2018-12-06 1058 block_width = IMGU_OSYS_BLOCK_WIDTH;
e11110a5b74487 Yong Zhi 2018-12-06 1059 }
e11110a5b74487 Yong Zhi 2018-12-06 1060 block_width_vecs =
e11110a5b74487 Yong Zhi 2018-12-06 1061 block_width / IMGU_VMEM1_ELEMS_PER_VEC;
e11110a5b74487 Yong Zhi 2018-12-06 1062 /*
e11110a5b74487 Yong Zhi 2018-12-06 1063 * The input/output line stride depends on the
e11110a5b74487 Yong Zhi 2018-12-06 1064 * block size.
e11110a5b74487 Yong Zhi 2018-12-06 1065 */
e11110a5b74487 Yong Zhi 2018-12-06 1066 input_buf_y_line_stride = block_width_vecs;
e11110a5b74487 Yong Zhi 2018-12-06 1067 input_buf_uv_line_stride = block_width_vecs / 2;
e11110a5b74487 Yong Zhi 2018-12-06 1068 output_buf_y_line_stride = block_width_vecs;
e11110a5b74487 Yong Zhi 2018-12-06 1069 output_buf_uv_line_stride = block_width_vecs / 2;
e11110a5b74487 Yong Zhi 2018-12-06 1070 output_buf_nr_y_lines = block_height;
e11110a5b74487 Yong Zhi 2018-12-06 1071 if (frame_params[pin].format ==
e11110a5b74487 Yong Zhi 2018-12-06 1072 IMGU_ABI_OSYS_FORMAT_NV12 ||
e11110a5b74487 Yong Zhi 2018-12-06 1073 frame_params[pin].format ==
e11110a5b74487 Yong Zhi 2018-12-06 1074 IMGU_ABI_OSYS_FORMAT_NV21)
e11110a5b74487 Yong Zhi 2018-12-06 1075 output_buf_uv_line_stride =
e11110a5b74487 Yong Zhi 2018-12-06 1076 output_buf_y_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 1077
e11110a5b74487 Yong Zhi 2018-12-06 1078 /*
e11110a5b74487 Yong Zhi 2018-12-06 1079 * Tiled outputs use a different output buffer
e11110a5b74487 Yong Zhi 2018-12-06 1080 * configuration. The input (= scaler output) block
e11110a5b74487 Yong Zhi 2018-12-06 1081 * width translates to a tile height, and the block
e11110a5b74487 Yong Zhi 2018-12-06 1082 * height to the tile width. The default block size of
e11110a5b74487 Yong Zhi 2018-12-06 1083 * 128x32 maps exactly onto a 4kB tile (512x8) for Y.
e11110a5b74487 Yong Zhi 2018-12-06 1084 * For UV, the tile width is always half.
e11110a5b74487 Yong Zhi 2018-12-06 1085 */
e11110a5b74487 Yong Zhi 2018-12-06 1086 if (frame_params[pin].tiling) {
e11110a5b74487 Yong Zhi 2018-12-06 1087 output_buf_nr_y_lines = 8;
e11110a5b74487 Yong Zhi 2018-12-06 1088 output_buf_y_line_stride = 512 /
e11110a5b74487 Yong Zhi 2018-12-06 1089 IMGU_VMEM1_ELEMS_PER_VEC;
e11110a5b74487 Yong Zhi 2018-12-06 1090 output_buf_uv_line_stride = 256 /
e11110a5b74487 Yong Zhi 2018-12-06 1091 IMGU_VMEM1_ELEMS_PER_VEC;
e11110a5b74487 Yong Zhi 2018-12-06 1092 }
e11110a5b74487 Yong Zhi 2018-12-06 1093
e11110a5b74487 Yong Zhi 2018-12-06 1094 /*
e11110a5b74487 Yong Zhi 2018-12-06 1095 * Store the output buffer line stride. Will be
e11110a5b74487 Yong Zhi 2018-12-06 1096 * used to compute buffer offsets in boundary
e11110a5b74487 Yong Zhi 2018-12-06 1097 * conditions when output blocks are partially
e11110a5b74487 Yong Zhi 2018-12-06 1098 * outside the image.
e11110a5b74487 Yong Zhi 2018-12-06 1099 */
e11110a5b74487 Yong Zhi 2018-12-06 1100 osys->stripe[s].buf_stride[pin] =
e11110a5b74487 Yong Zhi 2018-12-06 1101 output_buf_y_line_stride *
e11110a5b74487 Yong Zhi 2018-12-06 1102 IMGU_HIVE_OF_SYS_OF_SYSTEM_NWAYS;
e11110a5b74487 Yong Zhi 2018-12-06 1103 if (frame_params[pin].scaled) {
e11110a5b74487 Yong Zhi 2018-12-06 1104 /*
e11110a5b74487 Yong Zhi 2018-12-06 1105 * The input buffs are the intermediate
e11110a5b74487 Yong Zhi 2018-12-06 1106 * buffers (scalers' output)
e11110a5b74487 Yong Zhi 2018-12-06 1107 */
e11110a5b74487 Yong Zhi 2018-12-06 1108 input_buf_y_st_addr = IMGU_VMEM1_INT_BUF_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 1109 input_buf_u_st_addr = IMGU_VMEM1_INT_BUF_ADDR +
e11110a5b74487 Yong Zhi 2018-12-06 1110 IMGU_VMEM1_U_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 1111 input_buf_v_st_addr = IMGU_VMEM1_INT_BUF_ADDR +
e11110a5b74487 Yong Zhi 2018-12-06 1112 IMGU_VMEM1_V_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 1113 } else {
e11110a5b74487 Yong Zhi 2018-12-06 1114 /*
e11110a5b74487 Yong Zhi 2018-12-06 1115 * The input bufferss are the buffers
e11110a5b74487 Yong Zhi 2018-12-06 1116 * filled by the SP
e11110a5b74487 Yong Zhi 2018-12-06 1117 */
e11110a5b74487 Yong Zhi 2018-12-06 1118 input_buf_y_st_addr = IMGU_VMEM1_INP_BUF_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 1119 input_buf_u_st_addr = IMGU_VMEM1_INP_BUF_ADDR +
e11110a5b74487 Yong Zhi 2018-12-06 1120 IMGU_VMEM1_U_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 1121 input_buf_v_st_addr = IMGU_VMEM1_INP_BUF_ADDR +
e11110a5b74487 Yong Zhi 2018-12-06 1122 IMGU_VMEM1_V_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 1123 }
e11110a5b74487 Yong Zhi 2018-12-06 1124
e11110a5b74487 Yong Zhi 2018-12-06 1125 /*
e11110a5b74487 Yong Zhi 2018-12-06 1126 * The formatter input width must be rounded to
e11110a5b74487 Yong Zhi 2018-12-06 1127 * the block width. Otherwise the formatter will
e11110a5b74487 Yong Zhi 2018-12-06 1128 * not recognize the end of the line, resulting
e11110a5b74487 Yong Zhi 2018-12-06 1129 * in incorrect tiling (system may hang!) and
e11110a5b74487 Yong Zhi 2018-12-06 1130 * possibly other problems.
e11110a5b74487 Yong Zhi 2018-12-06 1131 */
e11110a5b74487 Yong Zhi 2018-12-06 1132 input_width_s =
e11110a5b74487 Yong Zhi 2018-12-06 1133 roundup(stripe_params[s].output_width[pin],
e11110a5b74487 Yong Zhi 2018-12-06 1134 block_width);
e11110a5b74487 Yong Zhi 2018-12-06 1135 input_width_vecs = input_width_s /
e11110a5b74487 Yong Zhi 2018-12-06 1136 IMGU_VMEM1_ELEMS_PER_VEC;
e11110a5b74487 Yong Zhi 2018-12-06 1137 out_fifo_addr = IMGU_FIFO_ADDR_FMT_TO_SP;
e11110a5b74487 Yong Zhi 2018-12-06 1138 /*
e11110a5b74487 Yong Zhi 2018-12-06 1139 * Process-output tokens must be sent to the SP.
e11110a5b74487 Yong Zhi 2018-12-06 1140 * When scaling, the release-input tokens can be
e11110a5b74487 Yong Zhi 2018-12-06 1141 * sent directly to the scaler, otherwise the
e11110a5b74487 Yong Zhi 2018-12-06 1142 * formatter should send them to the SP.
e11110a5b74487 Yong Zhi 2018-12-06 1143 */
e11110a5b74487 Yong Zhi 2018-12-06 1144 if (frame_params[pin].scaled)
e11110a5b74487 Yong Zhi 2018-12-06 1145 in_fifo_addr = IMGU_FIFO_ADDR_FMT_TO_SCALER;
e11110a5b74487 Yong Zhi 2018-12-06 1146 else
e11110a5b74487 Yong Zhi 2018-12-06 1147 in_fifo_addr = IMGU_FIFO_ADDR_FMT_TO_SP;
e11110a5b74487 Yong Zhi 2018-12-06 1148
e11110a5b74487 Yong Zhi 2018-12-06 1149 /* Formatter */
e11110a5b74487 Yong Zhi 2018-12-06 1150 param = &osys->formatter[s][pin].param;
e11110a5b74487 Yong Zhi 2018-12-06 1151
e11110a5b74487 Yong Zhi 2018-12-06 1152 param->format = frame_params[pin].format;
e11110a5b74487 Yong Zhi 2018-12-06 1153 param->flip = frame_params[pin].flip;
e11110a5b74487 Yong Zhi 2018-12-06 1154 param->mirror = frame_params[pin].mirror;
e11110a5b74487 Yong Zhi 2018-12-06 1155 param->tiling = frame_params[pin].tiling;
e11110a5b74487 Yong Zhi 2018-12-06 1156 param->reduce_range = frame_params[pin].reduce_range;
e11110a5b74487 Yong Zhi 2018-12-06 1157 param->alpha_blending = 0;
e11110a5b74487 Yong Zhi 2018-12-06 1158 param->release_inp_addr = in_fifo_addr;
e11110a5b74487 Yong Zhi 2018-12-06 1159 param->release_inp_en = 1;
e11110a5b74487 Yong Zhi 2018-12-06 1160 param->process_out_buf_addr = out_fifo_addr;
e11110a5b74487 Yong Zhi 2018-12-06 1161 param->image_width_vecs = input_width_vecs;
e11110a5b74487 Yong Zhi 2018-12-06 1162 param->image_height_lines =
e11110a5b74487 Yong Zhi 2018-12-06 1163 stripe_params[s].output_height[pin];
e11110a5b74487 Yong Zhi 2018-12-06 1164 param->inp_buff_y_st_addr = input_buf_y_st_addr;
e11110a5b74487 Yong Zhi 2018-12-06 1165 param->inp_buff_y_line_stride = input_buf_y_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 1166 param->inp_buff_y_buffer_stride = IMGU_VMEM1_BUF_SIZE;
e11110a5b74487 Yong Zhi 2018-12-06 1167 param->int_buff_u_st_addr = input_buf_u_st_addr;
e11110a5b74487 Yong Zhi 2018-12-06 1168 param->int_buff_v_st_addr = input_buf_v_st_addr;
e11110a5b74487 Yong Zhi 2018-12-06 1169 param->inp_buff_uv_line_stride =
e11110a5b74487 Yong Zhi 2018-12-06 1170 input_buf_uv_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 1171 param->inp_buff_uv_buffer_stride = IMGU_VMEM1_BUF_SIZE;
e11110a5b74487 Yong Zhi 2018-12-06 1172 param->out_buff_level = 0;
e11110a5b74487 Yong Zhi 2018-12-06 1173 param->out_buff_nr_y_lines = output_buf_nr_y_lines;
e11110a5b74487 Yong Zhi 2018-12-06 1174 param->out_buff_u_st_offset = IMGU_VMEM1_U_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 1175 param->out_buff_v_st_offset = IMGU_VMEM1_V_OFFSET;
e11110a5b74487 Yong Zhi 2018-12-06 1176 param->out_buff_y_line_stride =
e11110a5b74487 Yong Zhi 2018-12-06 1177 output_buf_y_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 1178 param->out_buff_uv_line_stride =
e11110a5b74487 Yong Zhi 2018-12-06 1179 output_buf_uv_line_stride;
e11110a5b74487 Yong Zhi 2018-12-06 1180 param->hist_buff_st_addr = IMGU_VMEM1_HST_BUF_ADDR;
e11110a5b74487 Yong Zhi 2018-12-06 1181 param->hist_buff_line_stride =
e11110a5b74487 Yong Zhi 2018-12-06 1182 IMGU_VMEM1_HST_BUF_STRIDE;
e11110a5b74487 Yong Zhi 2018-12-06 1183 param->hist_buff_nr_lines = IMGU_VMEM1_HST_BUF_NLINES;
e11110a5b74487 Yong Zhi 2018-12-06 1184 }
e11110a5b74487 Yong Zhi 2018-12-06 1185 }
e11110a5b74487 Yong Zhi 2018-12-06 1186
e11110a5b74487 Yong Zhi 2018-12-06 1187 block_stripes[0].offset = 0;
e11110a5b74487 Yong Zhi 2018-12-06 1188 if (stripes <= 1) {
e11110a5b74487 Yong Zhi 2018-12-06 1189 block_stripes[0].width = stripe_params[0].input_width;
e11110a5b74487 Yong Zhi 2018-12-06 1190 block_stripes[0].height = stripe_params[0].input_height;
e11110a5b74487 Yong Zhi 2018-12-06 1191 } else {
e11110a5b74487 Yong Zhi 2018-12-06 1192 struct imgu_fw_info *bi =
51abe041c5ed56 Bingbu Cao 2018-12-06 1193 &css->fwp->binary_header[css_pipe->bindex];
51abe041c5ed56 Bingbu Cao 2018-12-06 1194 unsigned int sp_block_width =
51abe041c5ed56 Bingbu Cao 2018-12-06 1195 bi->info.isp.sp.block.block_width *
51abe041c5ed56 Bingbu Cao 2018-12-06 1196 IPU3_UAPI_ISP_VEC_ELEMS;
e11110a5b74487 Yong Zhi 2018-12-06 1197
e11110a5b74487 Yong Zhi 2018-12-06 1198 block_stripes[0].width = roundup(stripe_params[0].input_width,
e11110a5b74487 Yong Zhi 2018-12-06 1199 sp_block_width);
e11110a5b74487 Yong Zhi 2018-12-06 1200 block_stripes[1].offset =
51abe041c5ed56 Bingbu Cao 2018-12-06 1201 rounddown(css_pipe->rect[IPU3_CSS_RECT_GDC].width -
e11110a5b74487 Yong Zhi 2018-12-06 1202 stripe_params[1].input_width, sp_block_width);
e11110a5b74487 Yong Zhi 2018-12-06 1203 block_stripes[1].width =
51abe041c5ed56 Bingbu Cao 2018-12-06 1204 roundup(css_pipe->rect[IPU3_CSS_RECT_GDC].width -
e11110a5b74487 Yong Zhi 2018-12-06 1205 block_stripes[1].offset, sp_block_width);
51abe041c5ed56 Bingbu Cao 2018-12-06 1206 block_stripes[0].height = css_pipe->rect[IPU3_CSS_RECT_GDC].height;
e11110a5b74487 Yong Zhi 2018-12-06 1207 block_stripes[1].height = block_stripes[0].height;
e11110a5b74487 Yong Zhi 2018-12-06 1208 }
e11110a5b74487 Yong Zhi 2018-12-06 1209
e11110a5b74487 Yong Zhi 2018-12-06 1210 return 0;
e11110a5b74487 Yong Zhi 2018-12-06 @1211 }
e11110a5b74487 Yong Zhi 2018-12-06 1212

:::::: The code at line 1211 was first introduced by commit
:::::: e11110a5b74487cfc99dad8a5744fe26782f5d9c media: staging/intel-ipu3: css: Compute and program ccs

:::::: TO: Yong Zhi <yong.zhi@xxxxxxxxx>
:::::: CC: Mauro Carvalho Chehab <mchehab+samsung@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip