tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4 head: 885f54059e5be0bbd38287623c841b1e4db1aa57 commit: 5fa56a01339db0586f27519d81aa226f1bb49f03 [12/43] FROMLIST: media: mtk-vcodec: vdec: support stateless H.264 decoding config: m68k-randconfig-r011-20210402 (attached as .config) compiler: m68k-linux-gcc (GCC) 9.3.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 git remote add chrome-os https://chromium.googlesource.com/chromiumos/third_party/kernel git fetch --no-tags chrome-os chromeos-5.4 git checkout 5fa56a01339db0586f27519d81aa226f1bb49f03 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from include/linux/kernel.h:11, from include/linux/list.h:9, from include/linux/module.h:9, from drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c:3: include/linux/scatterlist.h: In function 'sg_set_buf': arch/m68k/include/asm/page_no.h:33:50: warning: ordered comparison of pointer with null pointer [-Wextra] 33 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ | ^~ include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' 78 | # define unlikely(x) __builtin_expect(!!(x), 0) | ^ include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~ include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~~~~~~~~~~ drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c: In function 'get_vdec_decode_parameters': >> drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c:464:18: warning: variable 'dpb_fields' set but not used [-Wunused-but-set-variable] 464 | enum v4l2_field dpb_fields[V4L2_H264_NUM_DPB_ENTRIES]; | ^~~~~~~~~~ drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c: In function 'get_pic_info': >> drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c:569:27: warning: parameter 'pic' set but not used [-Wunused-but-set-parameter] 569 | struct vdec_pic_info *pic) | ~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c: In function 'vdec_h264_slice_decode': >> drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c:701:28: warning: variable 'src_buf_info' set but not used [-Wunused-but-set-variable] 701 | struct mtk_video_dec_buf *src_buf_info; | ^~~~~~~~~~~~ vim +/dpb_fields +464 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c 451 452 static void get_vdec_decode_parameters(struct vdec_h264_slice_inst *inst) 453 { 454 const struct v4l2_ctrl_h264_decode_params *dec_params = 455 get_ctrl_ptr(inst->ctx, V4L2_CID_STATELESS_H264_DECODE_PARAMS); 456 const struct v4l2_ctrl_h264_sps *sps = 457 get_ctrl_ptr(inst->ctx, V4L2_CID_STATELESS_H264_SPS); 458 const struct v4l2_ctrl_h264_pps *pps = 459 get_ctrl_ptr(inst->ctx, V4L2_CID_STATELESS_H264_PPS); 460 const struct v4l2_ctrl_h264_scaling_matrix *scaling_matrix = 461 get_ctrl_ptr(inst->ctx, V4L2_CID_STATELESS_H264_SCALING_MATRIX); 462 struct mtk_h264_dec_slice_param *slice_param = &inst->h264_slice_param; 463 struct v4l2_h264_reflist_builder reflist_builder; > 464 enum v4l2_field dpb_fields[V4L2_H264_NUM_DPB_ENTRIES]; 465 u8 *p0_reflist = slice_param->decode_params.ref_pic_list_p0; 466 u8 *b0_reflist = slice_param->decode_params.ref_pic_list_b0; 467 u8 *b1_reflist = slice_param->decode_params.ref_pic_list_b1; 468 int i; 469 470 update_dpb(dec_params, inst->dpb); 471 472 get_h264_sps_parameters(&slice_param->sps, sps); 473 get_h264_pps_parameters(&slice_param->pps, pps); 474 get_h264_scaling_matrix(&slice_param->scaling_matrix, scaling_matrix); 475 get_h264_decode_parameters(&slice_param->decode_params, dec_params, 476 inst->dpb); 477 get_h264_dpb_list(inst, slice_param); 478 479 /* Prepare the fields for our reference lists */ 480 for (i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) 481 dpb_fields[i] = slice_param->h264_dpb_info[i].field; 482 /* Build the reference lists */ 483 v4l2_h264_init_reflist_builder(&reflist_builder, dec_params, sps, 484 inst->dpb); 485 v4l2_h264_build_p_ref_list(&reflist_builder, p0_reflist); 486 v4l2_h264_build_b_ref_lists(&reflist_builder, b0_reflist, b1_reflist); 487 /* Adapt the built lists to the firmware's expectations */ 488 fixup_ref_list(p0_reflist, reflist_builder.num_valid); 489 fixup_ref_list(b0_reflist, reflist_builder.num_valid); 490 fixup_ref_list(b1_reflist, reflist_builder.num_valid); 491 492 memcpy(&inst->vsi_ctx.h264_slice_params, slice_param, 493 sizeof(inst->vsi_ctx.h264_slice_params)); 494 } 495 496 static unsigned int get_mv_buf_size(unsigned int width, unsigned int height) 497 { 498 int unit_size = (width / MB_UNIT_LEN) * (height / MB_UNIT_LEN) + 8; 499 500 return HW_MB_STORE_SZ * unit_size; 501 } 502 503 static int allocate_predication_buf(struct vdec_h264_slice_inst *inst) 504 { 505 int err = 0; 506 507 inst->pred_buf.size = BUF_PREDICTION_SZ; 508 err = mtk_vcodec_mem_alloc(inst->ctx, &inst->pred_buf); 509 if (err) { 510 mtk_vcodec_err(inst, "failed to allocate ppl buf"); 511 return err; 512 } 513 514 inst->vsi_ctx.pred_buf_dma = inst->pred_buf.dma_addr; 515 return 0; 516 } 517 518 static void free_predication_buf(struct vdec_h264_slice_inst *inst) 519 { 520 struct mtk_vcodec_mem *mem = NULL; 521 522 mtk_vcodec_debug_enter(inst); 523 524 inst->vsi_ctx.pred_buf_dma = 0; 525 mem = &inst->pred_buf; 526 if (mem->va) 527 mtk_vcodec_mem_free(inst->ctx, mem); 528 } 529 530 static int alloc_mv_buf(struct vdec_h264_slice_inst *inst, 531 struct vdec_pic_info *pic) 532 { 533 int i; 534 int err; 535 struct mtk_vcodec_mem *mem = NULL; 536 unsigned int buf_sz = get_mv_buf_size(pic->buf_w, pic->buf_h); 537 538 mtk_v4l2_debug(3, "size = 0x%lx", buf_sz); 539 for (i = 0; i < H264_MAX_MV_NUM; i++) { 540 mem = &inst->mv_buf[i]; 541 if (mem->va) 542 mtk_vcodec_mem_free(inst->ctx, mem); 543 mem->size = buf_sz; 544 err = mtk_vcodec_mem_alloc(inst->ctx, mem); 545 if (err) { 546 mtk_vcodec_err(inst, "failed to allocate mv buf"); 547 return err; 548 } 549 inst->vsi_ctx.mv_buf_dma[i] = mem->dma_addr; 550 } 551 552 return 0; 553 } 554 555 static void free_mv_buf(struct vdec_h264_slice_inst *inst) 556 { 557 int i; 558 struct mtk_vcodec_mem *mem = NULL; 559 560 for (i = 0; i < H264_MAX_MV_NUM; i++) { 561 inst->vsi_ctx.mv_buf_dma[i] = 0; 562 mem = &inst->mv_buf[i]; 563 if (mem->va) 564 mtk_vcodec_mem_free(inst->ctx, mem); 565 } 566 } 567 568 static void get_pic_info(struct vdec_h264_slice_inst *inst, > 569 struct vdec_pic_info *pic) 570 { 571 struct mtk_vcodec_ctx *ctx = inst->ctx; 572 573 ctx->picinfo.buf_w = (ctx->picinfo.pic_w + 15) & 0xFFFFFFF0; 574 ctx->picinfo.buf_h = (ctx->picinfo.pic_h + 31) & 0xFFFFFFE0; 575 ctx->picinfo.fb_sz[0] = ctx->picinfo.buf_w * ctx->picinfo.buf_h; 576 ctx->picinfo.fb_sz[1] = ctx->picinfo.fb_sz[0] >> 1; 577 inst->vsi_ctx.dec.cap_num_planes = 578 ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes; 579 580 pic = &ctx->picinfo; 581 mtk_vcodec_debug(inst, "pic(%d, %d), buf(%d, %d)", 582 ctx->picinfo.pic_w, ctx->picinfo.pic_h, 583 ctx->picinfo.buf_w, ctx->picinfo.buf_h); 584 mtk_vcodec_debug(inst, "Y/C(%d, %d)", ctx->picinfo.fb_sz[0], 585 ctx->picinfo.fb_sz[1]); 586 587 if ((ctx->last_decoded_picinfo.pic_w != ctx->picinfo.pic_w) || 588 (ctx->last_decoded_picinfo.pic_h != ctx->picinfo.pic_h)) { 589 inst->vsi_ctx.dec.resolution_changed = true; 590 if ((ctx->last_decoded_picinfo.buf_w != ctx->picinfo.buf_w) || 591 (ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h)) 592 inst->vsi_ctx.dec.realloc_mv_buf = true; 593 594 mtk_v4l2_debug(1, "ResChg: (%d %d) : old(%d, %d) -> new(%d, %d)", 595 inst->vsi_ctx.dec.resolution_changed, 596 inst->vsi_ctx.dec.realloc_mv_buf, 597 ctx->last_decoded_picinfo.pic_w, 598 ctx->last_decoded_picinfo.pic_h, 599 ctx->picinfo.pic_w, ctx->picinfo.pic_h); 600 } 601 } 602 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org