[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202212200342.enOOw4XI-lkp@intel.com>
Date: Tue, 20 Dec 2022 03:16:10 +0800
From: kernel test robot <lkp@...el.com>
To: Benjamin Gaignard <benjamin.gaignard@...labora.com>,
ezequiel@...guardiasur.com.ar, p.zabel@...gutronix.de,
mchehab@...nel.org, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, heiko@...ech.de,
daniel.almeida@...labora.com, nicolas.dufresne@...labora.co.uk
Cc: oe-kbuild-all@...ts.linux.dev, linux-media@...r.kernel.org,
linux-rockchip@...ts.infradead.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kernel@...labora.com,
Benjamin Gaignard <benjamin.gaignard@...labora.com>
Subject: Re: [PATCH v1 7/9] media: verisilicon: Add Rockchip AV1 decoder
Hi Benjamin,
I love your patch! Yet something to improve:
[auto build test ERROR on media-tree/master]
[also build test ERROR on rockchip/for-next linus/master v6.1 next-20221219]
[cannot apply to pza/reset/next pza/imx-drm/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Benjamin-Gaignard/AV1-stateless-decoder-for-RK3588/20221220-000013
base: git://linuxtv.org/media_tree.git master
patch link: https://lore.kernel.org/r/20221219155616.848690-8-benjamin.gaignard%40collabora.com
patch subject: [PATCH v1 7/9] media: verisilicon: Add Rockchip AV1 decoder
config: sh-allmodconfig
compiler: sh4-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/218f790ae8939b4333c68c1d7b0051c7f1033c9c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Benjamin-Gaignard/AV1-stateless-decoder-for-RK3588/20221220-000013
git checkout 218f790ae8939b4333c68c1d7b0051c7f1033c9c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash drivers/media/platform/verisilicon/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All error/warnings (new ones prefixed by >>):
In file included from drivers/media/platform/verisilicon/hantro.h:28,
from drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:9:
drivers/media/platform/verisilicon/hantro_hw.h:273:34: error: field 'frame_type' has incomplete type
273 | enum v4l2_av1_frame_type frame_type;
| ^~~~~~~~~~
drivers/media/platform/verisilicon/hantro_hw.h:276:25: error: 'V4L2_AV1_NUM_REF_FRAMES' undeclared here (not in a function)
276 | u32 order_hints[V4L2_AV1_NUM_REF_FRAMES];
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/hantro_hw.h:41:34: error: 'V4L2_AV1_TOTAL_REFS_PER_FRAME' undeclared here (not in a function)
41 | #define AV1_MAX_FRAME_BUF_COUNT (V4L2_AV1_TOTAL_REFS_PER_FRAME + 1)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/hantro_hw.h:319:48: note: in expansion of macro 'AV1_MAX_FRAME_BUF_COUNT'
319 | struct hantro_av1_frame_ref frame_refs[AV1_MAX_FRAME_BUF_COUNT];
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_get_frame_index':
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:118:27: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
118 | int i, idx = frame->ref_frame_idx[ref];
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:123:26: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
123 | timestamp = frame->reference_frame_ts[idx];
| ^~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:112:72: warning: parameter 'ref' set but not used [-Wunused-but-set-parameter]
112 | static int rockchip_vpu981_get_frame_index(struct hantro_ctx *ctx, int ref)
| ~~~~^~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_frame_ref':
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:158:34: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
158 | frame->frame_width_minus_1 + 1;
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:160:34: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
160 | frame->frame_height_minus_1 + 1;
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:162:66: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
162 | av1_dec->frame_refs[i].frame_type = frame->frame_type;
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:163:66: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
163 | av1_dec->frame_refs[i].order_hint = frame->order_hint;
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:165:38: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
165 | frame->global_motion.type[V4L2_AV1_REF_LAST_FRAME + i];
| ^~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:165:59: error: 'V4L2_AV1_REF_LAST_FRAME' undeclared (first use in this function)
165 | frame->global_motion.type[V4L2_AV1_REF_LAST_FRAME + i];
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:165:59: note: each undeclared identifier is reported only once for each function it appears in
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:170:78: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
170 | av1_dec->frame_refs[i].order_hints[j] = frame->order_hints[j];
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_clean_refs':
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:209:41: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
209 | if (ctrls->frame->reference_frame_ts[ref] == timestamp)
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: At top level:
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:230:6: warning: no previous prototype for 'rockchip_vpu981_av1_dec_tiles_free' [-Wmissing-prototypes]
230 | void rockchip_vpu981_av1_dec_tiles_free(struct hantro_ctx *ctx)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_tiles_reallocate':
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:268:66: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_tile_group_entry'
268 | unsigned int num_tile_cols = 1 << ctrls->tile_group_entry->tile_col;
| ^~
In file included from include/vdso/const.h:5,
from include/linux/const.h:4,
from include/uapi/linux/kernel.h:6,
from include/linux/cache.h:5,
from include/linux/time.h:5,
from include/linux/videodev2.h:59,
from include/media/videobuf2-v4l2.h:15,
from include/media/v4l2-mem2mem.h:16,
from drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:8:
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:269:49: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
269 | unsigned int height = ALIGN(ctrls->frame->frame_height_minus_1 + 1, 64);
| ^~
include/uapi/linux/const.h:32:44: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:269:31: note: in expansion of macro 'ALIGN'
269 | unsigned int height = ALIGN(ctrls->frame->frame_height_minus_1 + 1, 64);
| ^~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:269:49: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
269 | unsigned int height = ALIGN(ctrls->frame->frame_height_minus_1 + 1, 64);
| ^~
include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:269:31: note: in expansion of macro 'ALIGN'
269 | unsigned int height = ALIGN(ctrls->frame->frame_height_minus_1 + 1, 64);
| ^~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:269:49: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
269 | unsigned int height = ALIGN(ctrls->frame->frame_height_minus_1 + 1, 64);
| ^~
include/uapi/linux/const.h:32:61: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:269:31: note: in expansion of macro 'ALIGN'
269 | unsigned int height = ALIGN(ctrls->frame->frame_height_minus_1 + 1, 64);
| ^~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: At top level:
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:327:6: warning: no previous prototype for 'rockchip_vpu981_av1_dec_exit' [-Wmissing-prototypes]
327 | void rockchip_vpu981_av1_dec_exit(struct hantro_ctx *ctx)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:363:5: warning: no previous prototype for 'rockchip_vpu981_av1_dec_init' [-Wmissing-prototypes]
363 | int rockchip_vpu981_av1_dec_init(struct hantro_ctx *ctx)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_prepare_run':
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:420:48: error: 'V4L2_CID_STATELESS_AV1_SEQUENCE' undeclared (first use in this function); did you mean 'V4L2_CID_STATELESS_MPEG2_SEQUENCE'?
420 | ctrls->sequence = hantro_get_ctrl(ctx, V4L2_CID_STATELESS_AV1_SEQUENCE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| V4L2_CID_STATELESS_MPEG2_SEQUENCE
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:425:34: error: 'V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY' undeclared (first use in this function)
425 | hantro_get_ctrl(ctx, V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:429:45: error: 'V4L2_CID_STATELESS_AV1_FRAME' undeclared (first use in this function); did you mean 'V4L2_CID_STATELESS_VP9_FRAME'?
429 | ctrls->frame = hantro_get_ctrl(ctx, V4L2_CID_STATELESS_AV1_FRAME);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| V4L2_CID_STATELESS_VP9_FRAME
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:434:34: error: 'V4L2_CID_STATELESS_AV1_FILM_GRAIN' undeclared (first use in this function); did you mean 'V4L2_CID_STATELESS_VP9_FRAME'?
434 | hantro_get_ctrl(ctx, V4L2_CID_STATELESS_AV1_FILM_GRAIN);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| V4L2_CID_STATELESS_VP9_FRAME
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_set_global_model':
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:507:57: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
507 | const struct v4l2_av1_global_motion *gm = &frame->global_motion;
| ^~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:513:41: error: 'V4L2_AV1_REFS_PER_FRAME' undeclared (first use in this function)
513 | for (ref_frame = 0; ref_frame < V4L2_AV1_REFS_PER_FRAME; ++ref_frame) {
| ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:519:43: error: invalid use of undefined type 'const struct v4l2_av1_global_motion'
519 | gm->params[V4L2_AV1_REF_LAST_FRAME + ref_frame][3];
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:519:52: error: 'V4L2_AV1_REF_LAST_FRAME' undeclared (first use in this function)
519 | gm->params[V4L2_AV1_REF_LAST_FRAME + ref_frame][3];
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:522:43: error: invalid use of undefined type 'const struct v4l2_av1_global_motion'
522 | gm->params[V4L2_AV1_REF_LAST_FRAME + ref_frame][2];
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:525:43: error: invalid use of undefined type 'const struct v4l2_av1_global_motion'
525 | gm->params[V4L2_AV1_REF_LAST_FRAME + ref_frame][i];
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:529:23: error: invalid use of undefined type 'const struct v4l2_av1_global_motion'
529 | if (gm->type[V4L2_AV1_REF_LAST_FRAME + ref_frame] <= V4L2_AV1_WARP_MODEL_AFFINE)
| ^~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:529:70: error: 'V4L2_AV1_WARP_MODEL_AFFINE' undeclared (first use in this function)
529 | if (gm->type[V4L2_AV1_REF_LAST_FRAME + ref_frame] <= V4L2_AV1_WARP_MODEL_AFFINE)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:531:44: error: invalid use of undefined type 'const struct v4l2_av1_global_motion'
531 | &gm->params[V4L2_AV1_REF_LAST_FRAME + ref_frame][0],
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_set_tile_info':
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:551:16: error: variable 'tile_info' has initializer but incomplete type
551 | struct v4l2_av1_tile_info tile_info = ctrls->frame->tile_info;
| ^~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:551:59: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
551 | struct v4l2_av1_tile_info tile_info = ctrls->frame->tile_info;
| ^~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:551:35: error: storage size of 'tile_info' isn't known
551 | struct v4l2_av1_tile_info tile_info = ctrls->frame->tile_info;
| ^~~~~~~~~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:585:44: error: invalid use of undefined type 'struct v4l2_ctrl_av1_tile_group_entry'
585 | start = group_entry[tile_id].tile_offset - group_entry[0].tile_offset;
| ^
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:585:53: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_tile_group_entry'
585 | start = group_entry[tile_id].tile_offset - group_entry[0].tile_offset;
| ^
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:585:79: error: invalid use of undefined type 'struct v4l2_ctrl_av1_tile_group_entry'
585 | start = group_entry[tile_id].tile_offset - group_entry[0].tile_offset;
| ^
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:585:82: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_tile_group_entry'
585 | start = group_entry[tile_id].tile_offset - group_entry[0].tile_offset;
| ^
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:592:50: error: invalid use of undefined type 'struct v4l2_ctrl_av1_tile_group_entry'
592 | end = start + group_entry[tile_id].tile_size;
| ^
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:592:59: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_tile_group_entry'
592 | end = start + group_entry[tile_id].tile_size;
| ^
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:551:35: warning: unused variable 'tile_info' [-Wunused-variable]
551 | struct v4l2_av1_tile_info tile_info = ctrls->frame->tile_info;
| ^~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_get_relative_dist':
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:623:35: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_sequence'
623 | int bits = ctrls->sequence->order_hint_bits - 1;
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:626:29: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_sequence'
626 | if (!ctrls->sequence->order_hint_bits)
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_set_frame_sign_bias':
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:644:22: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_sequence'
644 | if (!sequence->order_hint_bits || IS_INTRA(frame->frame_type)) {
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:644:57: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
644 | if (!sequence->order_hint_bits || IS_INTRA(frame->frame_type)) {
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:46:26: note: in definition of macro 'IS_INTRA'
46 | #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
| ^~~~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:46:34: error: 'V4L2_AV1_KEY_FRAME' undeclared (first use in this function)
46 | #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
| ^~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:644:43: note: in expansion of macro 'IS_INTRA'
644 | if (!sequence->order_hint_bits || IS_INTRA(frame->frame_type)) {
| ^~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:644:57: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
644 | if (!sequence->order_hint_bits || IS_INTRA(frame->frame_type)) {
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:46:58: note: in definition of macro 'IS_INTRA'
46 | #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
| ^~~~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:46:66: error: 'V4L2_AV1_INTRA_ONLY_FRAME' undeclared (first use in this function)
46 | #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:644:43: note: in expansion of macro 'IS_INTRA'
644 | if (!sequence->order_hint_bits || IS_INTRA(frame->frame_type)) {
| ^~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:657:76: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
657 | frame->order_hint);
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_set_ref':
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:675:30: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
675 | int cur_width = frame->frame_width_minus_1 + 1;
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:676:31: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
676 | int cur_height = frame->frame_height_minus_1 + 1;
| ^~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:664:70: warning: parameter 'idx' set but not used [-Wunused-but-set-parameter]
664 | rockchip_vpu981_av1_dec_set_ref(struct hantro_ctx *ctx, int ref, int idx,
| ~~~~^~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c: In function 'rockchip_vpu981_av1_dec_set_segmentation':
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:780:57: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
780 | const struct v4l2_av1_segmentation *seg = &frame->segmentation;
| ^~
>> drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:781:25: error: 'V4L2_AV1_MAX_SEGMENTS' undeclared (first use in this function)
781 | uint32_t segval[V4L2_AV1_MAX_SEGMENTS][V4L2_AV1_SEG_LVL_MAX] = { 0 };
| ^~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:781:48: error: 'V4L2_AV1_SEG_LVL_MAX' undeclared (first use in this function); did you mean 'V4L2_VP9_SEG_LVL_MAX'?
781 | uint32_t segval[V4L2_AV1_MAX_SEGMENTS][V4L2_AV1_SEG_LVL_MAX] = { 0 };
| ^~~~~~~~~~~~~~~~~~~~
| V4L2_VP9_SEG_LVL_MAX
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:785:19: error: invalid use of undefined type 'const struct v4l2_av1_segmentation'
785 | if (!!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_ENABLED)
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:785:29: error: 'V4L2_AV1_SEGMENTATION_FLAG_ENABLED' undeclared (first use in this function); did you mean 'V4L2_VP9_SEGMENTATION_FLAG_ENABLED'?
785 | if (!!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_ENABLED)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| V4L2_VP9_SEGMENTATION_FLAG_ENABLED
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:786:22: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
786 | && (frame->primary_ref_frame < V4L2_AV1_REFS_PER_FRAME)) {
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:786:44: error: 'V4L2_AV1_REFS_PER_FRAME' undeclared (first use in this function)
786 | && (frame->primary_ref_frame < V4L2_AV1_REFS_PER_FRAME)) {
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:787:69: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
787 | int idx = rockchip_vpu981_get_frame_index(ctx, frame->primary_ref_frame);
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:790:47: warning: variable 'chroma_addr' set but not used [-Wunused-but-set-variable]
790 | dma_addr_t luma_addr, chroma_addr, mv_addr = 0;
| ^~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:806:32: error: invalid use of undefined type 'const struct v4l2_av1_segmentation'
806 | !!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_TEMPORAL_UPDATE));
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:806:42: error: 'V4L2_AV1_SEGMENTATION_FLAG_TEMPORAL_UPDATE' undeclared (first use in this function); did you mean 'V4L2_VP9_SEGMENTATION_FLAG_TEMPORAL_UPDATE'?
806 | !!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_TEMPORAL_UPDATE));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| V4L2_VP9_SEGMENTATION_FLAG_TEMPORAL_UPDATE
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:808:32: error: invalid use of undefined type 'const struct v4l2_av1_segmentation'
808 | !!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_UPDATE_MAP));
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:808:42: error: 'V4L2_AV1_SEGMENTATION_FLAG_UPDATE_MAP' undeclared (first use in this function); did you mean 'V4L2_VP9_SEGMENTATION_FLAG_UPDATE_MAP'?
808 | !!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_UPDATE_MAP));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| V4L2_VP9_SEGMENTATION_FLAG_UPDATE_MAP
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:810:32: error: invalid use of undefined type 'const struct v4l2_av1_segmentation'
810 | !!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_ENABLED));
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:813:34: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
813 | !!(frame->flags & V4L2_AV1_FRAME_FLAG_ERROR_RESILIENT_MODE));
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:813:44: error: 'V4L2_AV1_FRAME_FLAG_ERROR_RESILIENT_MODE' undeclared (first use in this function); did you mean 'V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT'?
813 | !!(frame->flags & V4L2_AV1_FRAME_FLAG_ERROR_RESILIENT_MODE));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:815:27: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
815 | if (IS_INTRA(frame->frame_type)
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:46:26: note: in definition of macro 'IS_INTRA'
46 | #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
| ^~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:46:34: error: 'V4L2_AV1_KEY_FRAME' undeclared (first use in this function)
46 | #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
| ^~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:815:13: note: in expansion of macro 'IS_INTRA'
815 | if (IS_INTRA(frame->frame_type)
| ^~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:815:27: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
815 | if (IS_INTRA(frame->frame_type)
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:46:58: note: in definition of macro 'IS_INTRA'
46 | #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
| ^~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:46:66: error: 'V4L2_AV1_INTRA_ONLY_FRAME' undeclared (first use in this function)
46 | #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:815:13: note: in expansion of macro 'IS_INTRA'
815 | if (IS_INTRA(frame->frame_type)
| ^~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:816:24: error: invalid use of undefined type 'const struct v4l2_ctrl_av1_frame'
816 | || !!(frame->flags & V4L2_AV1_FRAME_FLAG_ERROR_RESILIENT_MODE)) {
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:820:19: error: invalid use of undefined type 'const struct v4l2_av1_segmentation'
820 | if (!!(seg->flags & V4L2_AV1_SEGMENTATION_FLAG_ENABLED)) {
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:824:32: error: invalid use of undefined type 'const struct v4l2_av1_segmentation'
824 | if (seg->feature_enabled[s] &
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:825:29: error: implicit declaration of function 'V4L2_AV1_SEGMENT_FEATURE_ENABLED'; did you mean 'V4L2_VP9_SEGMENT_FEATURE_ENABLED'? [-Werror=implicit-function-declaration]
825 | V4L2_AV1_SEGMENT_FEATURE_ENABLED(V4L2_AV1_SEG_LVL_ALT_Q)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| V4L2_VP9_SEGMENT_FEATURE_ENABLED
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:825:62: error: 'V4L2_AV1_SEG_LVL_ALT_Q' undeclared (first use in this function); did you mean 'V4L2_VP9_SEG_LVL_ALT_Q'?
825 | V4L2_AV1_SEGMENT_FEATURE_ENABLED(V4L2_AV1_SEG_LVL_ALT_Q)) {
| ^~~~~~~~~~~~~~~~~~~~~~
| V4L2_VP9_SEG_LVL_ALT_Q
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:828:48: error: invalid use of undefined type 'const struct v4l2_av1_segmentation'
828 | abs(seg->feature_data[s][V4L2_AV1_SEG_LVL_ALT_Q]));
| ^~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:33:31: note: in definition of macro 'CLIP3'
33 | #define CLIP3(l, h, v) ((v) < (l) ? (l) : ((v) > (h) ? (h) : (v)))
| ^
include/linux/math.h:143:17: note: in expansion of macro '__abs_choose_expr'
143 | #define abs(x) __abs_choose_expr(x, long long, \
| ^~~~~~~~~~~~~~~~~
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c:828:41: note: in expansion of macro 'abs'
vim +118 drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
45
> 46 #define IS_INTRA(type) ((type == V4L2_AV1_KEY_FRAME) || (type == V4L2_AV1_INTRA_ONLY_FRAME))
47
48 #define LST_BUF_IDX (V4L2_AV1_REF_LAST_FRAME - V4L2_AV1_REF_LAST_FRAME)
> 49 #define LST2_BUF_IDX (V4L2_AV1_REF_LAST2_FRAME - V4L2_AV1_REF_LAST_FRAME)
50 #define LST3_BUF_IDX (V4L2_AV1_REF_LAST3_FRAME - V4L2_AV1_REF_LAST_FRAME)
> 51 #define GLD_BUF_IDX (V4L2_AV1_REF_GOLDEN_FRAME - V4L2_AV1_REF_LAST_FRAME)
> 52 #define BWD_BUF_IDX (V4L2_AV1_REF_BWDREF_FRAME - V4L2_AV1_REF_LAST_FRAME)
> 53 #define ALT2_BUF_IDX (V4L2_AV1_REF_ALTREF2_FRAME - V4L2_AV1_REF_LAST_FRAME)
> 54 #define ALT_BUF_IDX (V4L2_AV1_REF_ALTREF_FRAME - V4L2_AV1_REF_LAST_FRAME)
55
56 #define DIV_LUT_PREC_BITS 14
57 #define DIV_LUT_BITS 8
58 #define DIV_LUT_NUM BIT(DIV_LUT_BITS)
59 #define WARP_PARAM_REDUCE_BITS 6
60 #define WARPEDMODEL_PREC_BITS 16
61
62 #define AV1_DIV_ROUND_UP_POW2(value, n) \
63 ({ \
64 typeof(n) _n = n; \
65 typeof(value) _value = value; \
66 (_value + (BIT(_n) >> 1)) >> _n; \
67 })
68
69 #define AV1_DIV_ROUND_UP_POW2_SIGNED(value, n) \
70 ({ \
71 typeof(n) _n_ = n; \
72 typeof(value) _value_ = value; \
73 (((_value_) < 0) ? -AV1_DIV_ROUND_UP_POW2(-(_value_), (_n_)) \
74 : AV1_DIV_ROUND_UP_POW2((_value_), (_n_))); \
75 })
76
77 struct rockchip_av1_film_grain {
78 uint8_t scaling_lut_y[256];
79 uint8_t scaling_lut_cb[256];
80 uint8_t scaling_lut_cr[256];
81 int16_t cropped_luma_grain_block[4096];
82 int16_t cropped_chroma_grain_block[1024 * 2];
83 };
84
85 static const short div_lut[DIV_LUT_NUM + 1] = {
86 16384, 16320, 16257, 16194, 16132, 16070, 16009, 15948, 15888, 15828, 15768,
87 15709, 15650, 15592, 15534, 15477, 15420, 15364, 15308, 15252, 15197, 15142,
88 15087, 15033, 14980, 14926, 14873, 14821, 14769, 14717, 14665, 14614, 14564,
89 14513, 14463, 14413, 14364, 14315, 14266, 14218, 14170, 14122, 14075, 14028,
90 13981, 13935, 13888, 13843, 13797, 13752, 13707, 13662, 13618, 13574, 13530,
91 13487, 13443, 13400, 13358, 13315, 13273, 13231, 13190, 13148, 13107, 13066,
92 13026, 12985, 12945, 12906, 12866, 12827, 12788, 12749, 12710, 12672, 12633,
93 12596, 12558, 12520, 12483, 12446, 12409, 12373, 12336, 12300, 12264, 12228,
94 12193, 12157, 12122, 12087, 12053, 12018, 11984, 11950, 11916, 11882, 11848,
95 11815, 11782, 11749, 11716, 11683, 11651, 11619, 11586, 11555, 11523, 11491,
96 11460, 11429, 11398, 11367, 11336, 11305, 11275, 11245, 11215, 11185, 11155,
97 11125, 11096, 11067, 11038, 11009, 10980, 10951, 10923, 10894, 10866, 10838,
98 10810, 10782, 10755, 10727, 10700, 10673, 10645, 10618, 10592, 10565, 10538,
99 10512, 10486, 10460, 10434, 10408, 10382, 10356, 10331, 10305, 10280, 10255,
100 10230, 10205, 10180, 10156, 10131, 10107, 10082, 10058, 10034, 10010, 9986,
101 9963, 9939, 9916, 9892, 9869, 9846, 9823, 9800, 9777, 9754, 9732,
102 9709, 9687, 9664, 9642, 9620, 9598, 9576, 9554, 9533, 9511, 9489,
103 9468, 9447, 9425, 9404, 9383, 9362, 9341, 9321, 9300, 9279, 9259,
104 9239, 9218, 9198, 9178, 9158, 9138, 9118, 9098, 9079, 9059, 9039,
105 9020, 9001, 8981, 8962, 8943, 8924, 8905, 8886, 8867, 8849, 8830,
106 8812, 8793, 8775, 8756, 8738, 8720, 8702, 8684, 8666, 8648, 8630,
107 8613, 8595, 8577, 8560, 8542, 8525, 8508, 8490, 8473, 8456, 8439,
108 8422, 8405, 8389, 8372, 8355, 8339, 8322, 8306, 8289, 8273, 8257,
109 8240, 8224, 8208, 8192,
110 };
111
> 112 static int rockchip_vpu981_get_frame_index(struct hantro_ctx *ctx, int ref)
113 {
114 struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;
115 struct hantro_av1_dec_ctrls *ctrls = &av1_dec->ctrls;
116 const struct v4l2_ctrl_av1_frame *frame = ctrls->frame;
117 u64 timestamp;
> 118 int i, idx = frame->ref_frame_idx[ref];
119
120 if (idx >= AV1_MAX_FRAME_BUF_COUNT || idx < 0)
121 return AV1_INVALID_IDX;
122
123 timestamp = frame->reference_frame_ts[idx];
124 for (i = 0; i < AV1_MAX_FRAME_BUF_COUNT; i++) {
125 if (av1_dec->frame_refs[i].ref_count == 0)
126 continue;
127 if (av1_dec->frame_refs[i].timestamp == timestamp)
128 return i;
129 }
130
131 return AV1_INVALID_IDX;
132 }
133
134 static int rockchip_vpu981_get_order_hint(struct hantro_ctx *ctx, int ref)
135 {
136 struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;
137 int idx = rockchip_vpu981_get_frame_index(ctx, ref);
138
139 if (idx != AV1_INVALID_IDX)
140 return av1_dec->frame_refs[idx].order_hint;
141
142 return 0;
143 }
144
145 static int rockchip_vpu981_av1_dec_frame_ref(struct hantro_ctx *ctx,
146 u64 timestamp)
147 {
148 struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;
149 struct hantro_av1_dec_ctrls *ctrls = &av1_dec->ctrls;
150 const struct v4l2_ctrl_av1_frame *frame = ctrls->frame;
151 int i;
152
153 for (i = 0; i < AV1_MAX_FRAME_BUF_COUNT; i++) {
154 if (av1_dec->frame_refs[i].ref_count == 0) {
155 int j;
156
157 av1_dec->frame_refs[i].width =
158 frame->frame_width_minus_1 + 1;
159 av1_dec->frame_refs[i].height =
160 frame->frame_height_minus_1 + 1;
161 av1_dec->frame_refs[i].timestamp = timestamp;
162 av1_dec->frame_refs[i].frame_type = frame->frame_type;
163 av1_dec->frame_refs[i].order_hint = frame->order_hint;
164 av1_dec->frame_refs[i].gm_mode =
> 165 frame->global_motion.type[V4L2_AV1_REF_LAST_FRAME + i];
166 if (!av1_dec->frame_refs[i].vb2_ref)
167 av1_dec->frame_refs[i].vb2_ref = hantro_get_dst_buf(ctx);
168
169 for (j = 0; j < V4L2_AV1_NUM_REF_FRAMES; j++)
170 av1_dec->frame_refs[i].order_hints[j] = frame->order_hints[j];
171
172 av1_dec->frame_refs[i].ref_count++;
173 av1_dec->current_frame_index = i;
174 return i;
175 }
176 }
177
178 return AV1_INVALID_IDX;
179 }
180
181 static void rockchip_vpu981_av1_dec_frame_unref(struct hantro_ctx *ctx, int idx)
182 {
183 struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;
184
185 if (idx < 0)
186 return;
187
188 av1_dec->frame_refs[idx].ref_count--;
189
190 if (av1_dec->frame_refs[idx].ref_count < 0)
191 pr_warn("AV1 reference frames refcounting error (idx %d)\n", idx);
192 }
193
194 static void rockchip_vpu981_av1_dec_clean_refs(struct hantro_ctx *ctx)
195 {
196 struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;
197 struct hantro_av1_dec_ctrls *ctrls = &av1_dec->ctrls;
198
199 int ref, idx;
200
201 for (idx = 0; idx < AV1_MAX_FRAME_BUF_COUNT; idx++) {
202 u64 timestamp = av1_dec->frame_refs[idx].timestamp;
203 bool used = false;
204
205 if (av1_dec->frame_refs[idx].ref_count == 0)
206 continue;
207
208 for (ref = 0; ref < V4L2_AV1_TOTAL_REFS_PER_FRAME; ref++) {
209 if (ctrls->frame->reference_frame_ts[ref] == timestamp)
210 used = true;
211 }
212
213 if (!used)
214 rockchip_vpu981_av1_dec_frame_unref(ctx, idx);
215 }
216 }
217
218 static size_t rockchip_vpu981_av1_dec_luma_size(struct hantro_ctx *ctx)
219 {
220 return ctx->dst_fmt.width * ctx->dst_fmt.height * ctx->bit_depth / 8;
221 }
222
223 static size_t rockchip_vpu981_av1_dec_chroma_size(struct hantro_ctx *ctx)
224 {
225 size_t cr_offset = rockchip_vpu981_av1_dec_luma_size(ctx);
226
227 return ALIGN((cr_offset * 3) / 2, 64);
228 }
229
> 230 void rockchip_vpu981_av1_dec_tiles_free(struct hantro_ctx *ctx)
231 {
232 struct hantro_dev *vpu = ctx->dev;
233 struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;
234
235 if (av1_dec->db_data_col.cpu)
236 dma_free_coherent(vpu->dev, av1_dec->db_data_col.size,
237 av1_dec->db_data_col.cpu,
238 av1_dec->db_data_col.dma);
239 av1_dec->db_data_col.cpu = NULL;
240
241 if (av1_dec->db_ctrl_col.cpu)
242 dma_free_coherent(vpu->dev, av1_dec->db_ctrl_col.size,
243 av1_dec->db_ctrl_col.cpu,
244 av1_dec->db_ctrl_col.dma);
245 av1_dec->db_ctrl_col.cpu = NULL;
246
247 if (av1_dec->cdef_col.cpu)
248 dma_free_coherent(vpu->dev, av1_dec->cdef_col.size,
249 av1_dec->cdef_col.cpu, av1_dec->cdef_col.dma);
250 av1_dec->cdef_col.cpu = NULL;
251
252 if (av1_dec->sr_col.cpu)
253 dma_free_coherent(vpu->dev, av1_dec->sr_col.size,
254 av1_dec->sr_col.cpu, av1_dec->sr_col.dma);
255 av1_dec->sr_col.cpu = NULL;
256
257 if (av1_dec->lr_col.cpu)
258 dma_free_coherent(vpu->dev, av1_dec->lr_col.size,
259 av1_dec->lr_col.cpu, av1_dec->lr_col.dma);
260 av1_dec->lr_col.cpu = NULL;
261 }
262
263 static int rockchip_vpu981_av1_dec_tiles_reallocate(struct hantro_ctx *ctx)
264 {
265 struct hantro_dev *vpu = ctx->dev;
266 struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;
267 struct hantro_av1_dec_ctrls *ctrls = &av1_dec->ctrls;
> 268 unsigned int num_tile_cols = 1 << ctrls->tile_group_entry->tile_col;
269 unsigned int height = ALIGN(ctrls->frame->frame_height_minus_1 + 1, 64);
270 unsigned int height_in_sb = height / 64;
271 unsigned int stripe_num = ((height + 8) + 63) / 64;
272 size_t size;
273
274 if (num_tile_cols <= av1_dec->num_tile_cols_allocated)
275 return 0;
276
277 rockchip_vpu981_av1_dec_tiles_free(ctx);
278
279 size = ALIGN(height * 12 * ctx->bit_depth / 8, 128) * num_tile_cols;
280 av1_dec->db_data_col.cpu = dma_alloc_coherent(vpu->dev, size,
281 &av1_dec->db_data_col.dma,
282 GFP_KERNEL);
283 if (!av1_dec->db_data_col.cpu)
284 goto buffer_allocation_error;
285 av1_dec->db_data_col.size = size;
286
287 size = ALIGN(height * 2 * 16 / 4, 128) * num_tile_cols;
288 av1_dec->db_ctrl_col.cpu = dma_alloc_coherent(vpu->dev, size,
289 &av1_dec->db_ctrl_col.dma,
290 GFP_KERNEL);
291 if (!av1_dec->db_ctrl_col.cpu)
292 goto buffer_allocation_error;
293 av1_dec->db_ctrl_col.size = size;
294
295 size = ALIGN(height_in_sb * 44 * ctx->bit_depth * 16 / 8, 128) * num_tile_cols;
296 av1_dec->cdef_col.cpu = dma_alloc_coherent(vpu->dev, size,
297 &av1_dec->cdef_col.dma,
298 GFP_KERNEL);
299 if (!av1_dec->cdef_col.cpu)
300 goto buffer_allocation_error;
301 av1_dec->cdef_col.size = size;
302
303 size = ALIGN(height_in_sb * (3040 + 1280), 128) * num_tile_cols;
304 av1_dec->sr_col.cpu = dma_alloc_coherent(vpu->dev, size,
305 &av1_dec->sr_col.dma,
306 GFP_KERNEL);
307 if (!av1_dec->sr_col.cpu)
308 goto buffer_allocation_error;
309 av1_dec->sr_col.size = size;
310
311 size = ALIGN(stripe_num * 1536 * ctx->bit_depth / 8, 128) * num_tile_cols;
312 av1_dec->lr_col.cpu = dma_alloc_coherent(vpu->dev, size,
313 &av1_dec->lr_col.dma,
314 GFP_KERNEL);
315 if (!av1_dec->lr_col.cpu)
316 goto buffer_allocation_error;
317 av1_dec->lr_col.size = size;
318
319 av1_dec->num_tile_cols_allocated = num_tile_cols;
320 return 0;
321
322 buffer_allocation_error:
323 rockchip_vpu981_av1_dec_tiles_free(ctx);
324 return -ENOMEM;
325 }
326
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (244361 bytes)
Powered by blists - more mailing lists