Lines Matching +full:y +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright 2020-2021 NXP
18 #include <media/videobuf2-v4l2.h>
19 #include <media/videobuf2-dma-contig.h>
51 //x means source data , y means destination data
52 #define STREAM_CONFIG_FORMAT_SET(x, y) CONFIG_SET(x, y, 0, 0x0000000F) argument
53 #define STREAM_CONFIG_STRBUFIDX_SET(x, y) CONFIG_SET(x, y, 8, 0x00000300) argument
54 #define STREAM_CONFIG_NOSEQ_SET(x, y) CONFIG_SET(x, y, 10, 0x00000400) argument
55 #define STREAM_CONFIG_DEBLOCK_SET(x, y) CONFIG_SET(x, y, 11, 0x00000800) argument
56 #define STREAM_CONFIG_DERING_SET(x, y) CONFIG_SET(x, y, 12, 0x00001000) argument
57 #define STREAM_CONFIG_IBWAIT_SET(x, y) CONFIG_SET(x, y, 13, 0x00002000) argument
58 #define STREAM_CONFIG_FBC_SET(x, y) CONFIG_SET(x, y, 14, 0x00004000) argument
59 #define STREAM_CONFIG_PLAY_MODE_SET(x, y) CONFIG_SET(x, y, 16, 0x00030000) argument
60 #define STREAM_CONFIG_ENABLE_DCP_SET(x, y) CONFIG_SET(x, y, 20, 0x00100000) argument
61 #define STREAM_CONFIG_NUM_STR_BUF_SET(x, y) CONFIG_SET(x, y, 21, 0x00600000) argument
62 #define STREAM_CONFIG_MALONE_USAGE_SET(x, y) CONFIG_SET(x, y, 23, 0x01800000) argument
63 #define STREAM_CONFIG_MULTI_VID_SET(x, y) CONFIG_SET(x, y, 25, 0x02000000) argument
64 #define STREAM_CONFIG_OBFUSC_EN_SET(x, y) CONFIG_SET(x, y, 26, 0x04000000) argument
65 #define STREAM_CONFIG_RC4_EN_SET(x, y) CONFIG_SET(x, y, 27, 0x08000000) argument
66 #define STREAM_CONFIG_MCX_SET(x, y) CONFIG_SET(x, y, 28, 0x10000000) argument
67 #define STREAM_CONFIG_PES_SET(x, y) CONFIG_SET(x, y, 29, 0x20000000) argument
68 #define STREAM_CONFIG_NUM_DBE_SET(x, y) CONFIG_SET(x, y, 30, 0x40000000) argument
69 #define STREAM_CONFIG_FS_CTRL_MODE_SET(x, y) CONFIG_SET(x, y, 31, 0x80000000) argument
352 unsigned long offset; in vpu_malone_init_rpc() local
355 if (rpc->phys < boot_addr) in vpu_malone_init_rpc()
358 iface = rpc->virt; in vpu_malone_init_rpc()
359 base_phy_addr = rpc->phys - boot_addr; in vpu_malone_init_rpc()
360 hc = shared->priv; in vpu_malone_init_rpc()
362 shared->iface = iface; in vpu_malone_init_rpc()
363 shared->boot_addr = boot_addr; in vpu_malone_init_rpc()
365 iface->exec_base_addr = base_phy_addr; in vpu_malone_init_rpc()
366 iface->exec_area_size = rpc->length; in vpu_malone_init_rpc()
368 offset = sizeof(struct malone_iface); in vpu_malone_init_rpc()
369 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
371 shared->cmd_desc = &iface->cmd_buffer_desc.buffer; in vpu_malone_init_rpc()
372 shared->cmd_mem_vir = rpc->virt + offset; in vpu_malone_init_rpc()
373 iface->cmd_buffer_desc.buffer.start = in vpu_malone_init_rpc()
374 iface->cmd_buffer_desc.buffer.rptr = in vpu_malone_init_rpc()
375 iface->cmd_buffer_desc.buffer.wptr = phy_addr; in vpu_malone_init_rpc()
376 iface->cmd_buffer_desc.buffer.end = iface->cmd_buffer_desc.buffer.start + CMD_SIZE; in vpu_malone_init_rpc()
377 offset += CMD_SIZE; in vpu_malone_init_rpc()
378 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
380 shared->msg_desc = &iface->msg_buffer_desc.buffer; in vpu_malone_init_rpc()
381 shared->msg_mem_vir = rpc->virt + offset; in vpu_malone_init_rpc()
382 iface->msg_buffer_desc.buffer.start = in vpu_malone_init_rpc()
383 iface->msg_buffer_desc.buffer.wptr = in vpu_malone_init_rpc()
384 iface->msg_buffer_desc.buffer.rptr = phy_addr; in vpu_malone_init_rpc()
385 iface->msg_buffer_desc.buffer.end = iface->msg_buffer_desc.buffer.start + MSG_SIZE; in vpu_malone_init_rpc()
386 offset += MSG_SIZE; in vpu_malone_init_rpc()
387 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
389 iface->codec_param_tab_desc.array_base = phy_addr; in vpu_malone_init_rpc()
390 hc->codec_param = rpc->virt + offset; in vpu_malone_init_rpc()
391 offset += CODEC_SIZE; in vpu_malone_init_rpc()
392 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
394 iface->jpeg_param_tab_desc.array_base = phy_addr; in vpu_malone_init_rpc()
395 hc->jpg = rpc->virt + offset; in vpu_malone_init_rpc()
396 offset += JPEG_SIZE; in vpu_malone_init_rpc()
397 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
399 iface->seq_info_tab_desc.array_base = phy_addr; in vpu_malone_init_rpc()
400 hc->seq_mem = rpc->virt + offset; in vpu_malone_init_rpc()
401 offset += SEQ_SIZE; in vpu_malone_init_rpc()
402 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
404 iface->pic_info_tab_desc.array_base = phy_addr; in vpu_malone_init_rpc()
405 hc->pic_mem = rpc->virt + offset; in vpu_malone_init_rpc()
406 offset += PIC_SIZE; in vpu_malone_init_rpc()
407 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
409 iface->gop_info_tab_desc.array_base = phy_addr; in vpu_malone_init_rpc()
410 hc->gop_mem = rpc->virt + offset; in vpu_malone_init_rpc()
411 offset += GOP_SIZE; in vpu_malone_init_rpc()
412 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
414 iface->qmeter_info_tab_desc.array_base = phy_addr; in vpu_malone_init_rpc()
415 hc->qmeter_mem = rpc->virt + offset; in vpu_malone_init_rpc()
416 offset += QMETER_SIZE; in vpu_malone_init_rpc()
417 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
419 iface->dbglog_desc.addr = phy_addr; in vpu_malone_init_rpc()
420 iface->dbglog_desc.size = DBGLOG_SIZE; in vpu_malone_init_rpc()
421 hc->dbglog_mem = rpc->virt + offset; in vpu_malone_init_rpc()
422 offset += DBGLOG_SIZE; in vpu_malone_init_rpc()
423 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
426 iface->eng_access_buff_desc[i].buffer.start = in vpu_malone_init_rpc()
427 iface->eng_access_buff_desc[i].buffer.wptr = in vpu_malone_init_rpc()
428 iface->eng_access_buff_desc[i].buffer.rptr = phy_addr; in vpu_malone_init_rpc()
429 iface->eng_access_buff_desc[i].buffer.end = in vpu_malone_init_rpc()
430 iface->eng_access_buff_desc[i].buffer.start + ENG_SIZE; in vpu_malone_init_rpc()
431 offset += ENG_SIZE; in vpu_malone_init_rpc()
432 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
436 iface->encrypt_info[i] = phy_addr; in vpu_malone_init_rpc()
437 offset += sizeof(struct vpu_malone_encrypt_info); in vpu_malone_init_rpc()
438 phy_addr = base_phy_addr + offset; in vpu_malone_init_rpc()
441 rpc->bytesused = offset; in vpu_malone_init_rpc()
447 struct malone_iface *iface = shared->iface; in vpu_malone_set_log_buf()
449 iface->debug_buffer_desc.buffer.start = in vpu_malone_set_log_buf()
450 iface->debug_buffer_desc.buffer.wptr = in vpu_malone_set_log_buf()
451 iface->debug_buffer_desc.buffer.rptr = log->phys - shared->boot_addr; in vpu_malone_set_log_buf()
452 iface->debug_buffer_desc.buffer.end = iface->debug_buffer_desc.buffer.start + log->length; in vpu_malone_set_log_buf()
463 struct malone_iface *iface = shared->iface; in vpu_malone_set_system_cfg()
464 struct vpu_rpc_system_config *config = &iface->system_cfg; in vpu_malone_set_system_cfg()
465 struct vpu_dec_ctrl *hc = shared->priv; in vpu_malone_set_system_cfg()
470 u32 offset = get_str_buffer_offset(i); in vpu_malone_set_system_cfg() local
472 hc->buf_addr[i] = regs_base + offset; in vpu_malone_set_system_cfg()
473 hc->str_buf[i] = regs + offset; in vpu_malone_set_system_cfg()
479 struct malone_iface *iface = shared->iface; in vpu_malone_get_version()
481 return iface->fw_version; in vpu_malone_get_version()
493 struct malone_iface *iface = shared->iface; in vpu_malone_config_stream_buffer()
494 struct vpu_dec_ctrl *hc = shared->priv; in vpu_malone_config_stream_buffer()
495 struct vpu_malone_str_buffer __iomem *str_buf = hc->str_buf[instance]; in vpu_malone_config_stream_buffer()
497 writel(buf->phys, &str_buf->start); in vpu_malone_config_stream_buffer()
498 writel(buf->phys, &str_buf->rptr); in vpu_malone_config_stream_buffer()
499 writel(buf->phys, &str_buf->wptr); in vpu_malone_config_stream_buffer()
500 writel(buf->phys + buf->length, &str_buf->end); in vpu_malone_config_stream_buffer()
501 writel(0x1, &str_buf->lwm); in vpu_malone_config_stream_buffer()
503 iface->stream_buffer_desc[instance][0] = hc->buf_addr[instance]; in vpu_malone_config_stream_buffer()
512 struct vpu_dec_ctrl *hc = shared->priv; in vpu_malone_get_stream_buffer_desc()
513 struct vpu_malone_str_buffer __iomem *str_buf = hc->str_buf[instance]; in vpu_malone_get_stream_buffer_desc()
516 desc->wptr = readl(&str_buf->wptr); in vpu_malone_get_stream_buffer_desc()
517 desc->rptr = readl(&str_buf->rptr); in vpu_malone_get_stream_buffer_desc()
518 desc->start = readl(&str_buf->start); in vpu_malone_get_stream_buffer_desc()
519 desc->end = readl(&str_buf->end); in vpu_malone_get_stream_buffer_desc()
529 writel(wptr, &str_buf->wptr); in vpu_malone_update_wptr()
536 writel(rptr, &str_buf->rptr); in vpu_malone_update_rptr()
542 struct vpu_dec_ctrl *hc = shared->priv; in vpu_malone_update_stream_buffer()
543 struct vpu_malone_str_buffer __iomem *str_buf = hc->str_buf[instance]; in vpu_malone_update_stream_buffer()
598 struct malone_iface *iface = shared->iface; in vpu_malone_set_stream_cfg()
599 u32 *curr_str_cfg = &iface->stream_config[instance]; in vpu_malone_set_stream_cfg()
624 struct malone_iface *iface = shared->iface; in vpu_malone_set_params()
625 struct vpu_dec_ctrl *hc = shared->priv; in vpu_malone_set_params()
628 malone_format = vpu_malone_format_remap(params->codec_format); in vpu_malone_set_params()
630 return -EINVAL; in vpu_malone_set_params()
631 iface->udata_buffer[instance].base = params->udata.base; in vpu_malone_set_params()
632 iface->udata_buffer[instance].slot_size = params->udata.size; in vpu_malone_set_params()
638 hc->jpg[instance].jpg_mjpeg_mode = 1; in vpu_malone_set_params()
640 hc->jpg[instance].jpg_mjpeg_interlaced = 0; in vpu_malone_set_params()
643 hc->codec_param[instance].disp_imm = params->b_dis_reorder ? 1 : 0; in vpu_malone_set_params()
644 hc->codec_param[instance].dbglog_enable = 0; in vpu_malone_set_params()
645 iface->dbglog_desc.level = 0; in vpu_malone_set_params()
647 if (params->b_non_frame) in vpu_malone_set_params()
648 iface->stream_buff_info[instance].stream_input_mode = NON_FRAME_LVL; in vpu_malone_set_params()
650 iface->stream_buff_info[instance].stream_input_mode = FRAME_LVL; in vpu_malone_set_params()
651 iface->stream_buff_info[instance].stream_buffer_threshold = 0; in vpu_malone_set_params()
652 iface->stream_buff_info[instance].stream_pic_input_count = 0; in vpu_malone_set_params()
659 struct malone_iface *iface = shared->iface; in vpu_malone_is_non_frame_mode()
661 if (iface->stream_buff_info[instance].stream_input_mode == NON_FRAME_LVL) in vpu_malone_is_non_frame_mode()
671 struct malone_iface *iface = shared->iface; in vpu_malone_update_params()
673 if (params->end_flag) in vpu_malone_update_params()
674 iface->stream_buff_info[instance].stream_pic_end_flag = params->end_flag; in vpu_malone_update_params()
675 params->end_flag = 0; in vpu_malone_update_params()
686 return -EINVAL; in vpu_malone_set_decode_params()
737 pkt->hdr.num = 7; in vpu_malone_pack_fs_alloc()
738 pkt->data[0] = fs->id | (fs->tag << 24); in vpu_malone_pack_fs_alloc()
739 pkt->data[1] = fs->luma_addr; in vpu_malone_pack_fs_alloc()
740 if (fs->type == MEM_RES_FRAME) { in vpu_malone_pack_fs_alloc()
744 * same fd -- usage of NXP codec2. Need to manually in vpu_malone_pack_fs_alloc()
745 * offset chroma addr. in vpu_malone_pack_fs_alloc()
747 if (fs->luma_addr == fs->chroma_addr) in vpu_malone_pack_fs_alloc()
748 fs->chroma_addr = fs->luma_addr + fs->luma_size; in vpu_malone_pack_fs_alloc()
749 pkt->data[2] = fs->luma_addr + fs->luma_size / 2; in vpu_malone_pack_fs_alloc()
750 pkt->data[3] = fs->chroma_addr; in vpu_malone_pack_fs_alloc()
751 pkt->data[4] = fs->chroma_addr + fs->chromau_size / 2; in vpu_malone_pack_fs_alloc()
752 pkt->data[5] = fs->bytesperline; in vpu_malone_pack_fs_alloc()
754 pkt->data[2] = fs->luma_size; in vpu_malone_pack_fs_alloc()
755 pkt->data[3] = 0; in vpu_malone_pack_fs_alloc()
756 pkt->data[4] = 0; in vpu_malone_pack_fs_alloc()
757 pkt->data[5] = 0; in vpu_malone_pack_fs_alloc()
759 pkt->data[6] = fs_type[fs->type]; in vpu_malone_pack_fs_alloc()
765 pkt->hdr.num = 1; in vpu_malone_pack_fs_release()
766 pkt->data[0] = fs->id | (fs->tag << 24); in vpu_malone_pack_fs_release()
772 struct timespec64 ts = ns_to_timespec64(info->timestamp); in vpu_malone_pack_timestamp()
774 pkt->hdr.num = 3; in vpu_malone_pack_timestamp()
776 pkt->data[0] = ts.tv_sec; in vpu_malone_pack_timestamp()
777 pkt->data[1] = ts.tv_nsec; in vpu_malone_pack_timestamp()
778 pkt->data[2] = info->size; in vpu_malone_pack_timestamp()
789 pkt->hdr.id = ret; in vpu_malone_pack_cmd()
790 pkt->hdr.num = 0; in vpu_malone_pack_cmd()
791 pkt->hdr.index = index; in vpu_malone_pack_cmd()
805 pkt->hdr.index = index; in vpu_malone_pack_cmd()
816 u32 interlaced = info->progressive ? 0 : 1; in vpu_malone_fill_planes()
818 info->bytesperline[0] = 0; in vpu_malone_fill_planes()
819 info->sizeimage[0] = vpu_helper_get_plane_size(info->pixfmt, in vpu_malone_fill_planes()
820 info->decoded_width, in vpu_malone_fill_planes()
821 info->decoded_height, in vpu_malone_fill_planes()
823 info->stride, in vpu_malone_fill_planes()
825 &info->bytesperline[0]); in vpu_malone_fill_planes()
826 info->bytesperline[1] = 0; in vpu_malone_fill_planes()
827 info->sizeimage[1] = vpu_helper_get_plane_size(info->pixfmt, in vpu_malone_fill_planes()
828 info->decoded_width, in vpu_malone_fill_planes()
829 info->decoded_height, in vpu_malone_fill_planes()
831 info->stride, in vpu_malone_fill_planes()
833 &info->bytesperline[1]); in vpu_malone_fill_planes()
838 u32 chunks = info->num_dfe_area >> MALONE_DCP_CHUNK_BIT; in vpu_malone_init_seq_hdr()
842 info->mbi_size = (info->sizeimage[0] + info->sizeimage[1]) >> 2; in vpu_malone_init_seq_hdr()
843 info->mbi_size = ALIGN(info->mbi_size, MALONE_ALIGN_MBI); in vpu_malone_init_seq_hdr()
845 info->dcp_size = MALONE_DCP_SIZE_MAX; in vpu_malone_init_seq_hdr()
851 mb_w = DIV_ROUND_UP(info->decoded_width, 16); in vpu_malone_init_seq_hdr()
852 mb_h = DIV_ROUND_UP(info->decoded_height, 16); in vpu_malone_init_seq_hdr()
854 info->dcp_size = mb_num * MALONE_DCP_FIXED_MB_ALLOC * chunks; in vpu_malone_init_seq_hdr()
855 info->dcp_size = clamp_t(u32, info->dcp_size, in vpu_malone_init_seq_hdr()
863 info->num_ref_frms = pkt->data[0]; in vpu_malone_unpack_seq_hdr()
864 info->num_dpb_frms = pkt->data[1]; in vpu_malone_unpack_seq_hdr()
865 info->num_dfe_area = pkt->data[2]; in vpu_malone_unpack_seq_hdr()
866 info->progressive = pkt->data[3]; in vpu_malone_unpack_seq_hdr()
867 info->width = pkt->data[5]; in vpu_malone_unpack_seq_hdr()
868 info->height = pkt->data[4]; in vpu_malone_unpack_seq_hdr()
869 info->decoded_width = pkt->data[12]; in vpu_malone_unpack_seq_hdr()
870 info->decoded_height = pkt->data[11]; in vpu_malone_unpack_seq_hdr()
871 info->frame_rate.numerator = 1000; in vpu_malone_unpack_seq_hdr()
872 info->frame_rate.denominator = pkt->data[8]; in vpu_malone_unpack_seq_hdr()
873 info->dsp_asp_ratio = pkt->data[9]; in vpu_malone_unpack_seq_hdr()
874 info->level_idc = pkt->data[10]; in vpu_malone_unpack_seq_hdr()
875 info->bit_depth_luma = pkt->data[13]; in vpu_malone_unpack_seq_hdr()
876 info->bit_depth_chroma = pkt->data[14]; in vpu_malone_unpack_seq_hdr()
877 info->chroma_fmt = pkt->data[15]; in vpu_malone_unpack_seq_hdr()
878 info->color_primaries = vpu_color_cvrt_primaries_i2v(pkt->data[16]); in vpu_malone_unpack_seq_hdr()
879 info->transfer_chars = vpu_color_cvrt_transfers_i2v(pkt->data[17]); in vpu_malone_unpack_seq_hdr()
880 info->matrix_coeffs = vpu_color_cvrt_matrix_i2v(pkt->data[18]); in vpu_malone_unpack_seq_hdr()
881 info->full_range = vpu_color_cvrt_full_range_i2v(pkt->data[19]); in vpu_malone_unpack_seq_hdr()
882 info->vui_present = pkt->data[20]; in vpu_malone_unpack_seq_hdr()
883 info->mvc_num_views = pkt->data[21]; in vpu_malone_unpack_seq_hdr()
884 info->offset_x = pkt->data[23]; in vpu_malone_unpack_seq_hdr()
885 info->offset_y = pkt->data[25]; in vpu_malone_unpack_seq_hdr()
886 info->tag = pkt->data[27]; in vpu_malone_unpack_seq_hdr()
887 if (info->bit_depth_luma > 8) in vpu_malone_unpack_seq_hdr()
888 info->pixfmt = V4L2_PIX_FMT_NV12M_10BE_8L128; in vpu_malone_unpack_seq_hdr()
890 info->pixfmt = V4L2_PIX_FMT_NV12M_8L128; in vpu_malone_unpack_seq_hdr()
891 if (info->frame_rate.numerator && info->frame_rate.denominator) { in vpu_malone_unpack_seq_hdr()
894 rational_best_approximation(info->frame_rate.numerator, in vpu_malone_unpack_seq_hdr()
895 info->frame_rate.denominator, in vpu_malone_unpack_seq_hdr()
896 info->frame_rate.numerator, in vpu_malone_unpack_seq_hdr()
897 info->frame_rate.denominator, in vpu_malone_unpack_seq_hdr()
899 info->frame_rate.numerator = n; in vpu_malone_unpack_seq_hdr()
900 info->frame_rate.denominator = d; in vpu_malone_unpack_seq_hdr()
908 info->id = pkt->data[7]; in vpu_malone_unpack_pic_info()
909 info->luma = pkt->data[0]; in vpu_malone_unpack_pic_info()
910 info->start = pkt->data[10]; in vpu_malone_unpack_pic_info()
911 info->end = pkt->data[12]; in vpu_malone_unpack_pic_info()
912 info->pic_size = pkt->data[11]; in vpu_malone_unpack_pic_info()
913 info->stride = pkt->data[5]; in vpu_malone_unpack_pic_info()
914 info->consumed_count = pkt->data[13]; in vpu_malone_unpack_pic_info()
915 if (info->id == MALONE_SKIPPED_FRAME_ID) in vpu_malone_unpack_pic_info()
916 info->skipped = 1; in vpu_malone_unpack_pic_info()
918 info->skipped = 0; in vpu_malone_unpack_pic_info()
924 info->type = pkt->data[1]; in vpu_malone_unpack_req_frame()
930 info->id = pkt->data[0]; in vpu_malone_unpack_rel_frame()
931 info->type = pkt->data[1]; in vpu_malone_unpack_rel_frame()
932 info->not_displayed = pkt->data[2]; in vpu_malone_unpack_rel_frame()
938 struct timespec64 ts = { pkt->data[9], pkt->data[10] }; in vpu_malone_unpack_buff_rdy()
940 info->id = pkt->data[0]; in vpu_malone_unpack_buff_rdy()
941 info->luma = pkt->data[1]; in vpu_malone_unpack_buff_rdy()
942 info->stride = pkt->data[3]; in vpu_malone_unpack_buff_rdy()
943 if (info->id == MALONE_SKIPPED_FRAME_ID) in vpu_malone_unpack_buff_rdy()
944 info->skipped = 1; in vpu_malone_unpack_buff_rdy()
946 info->skipped = 0; in vpu_malone_unpack_buff_rdy()
948 info->timestamp = timespec64_to_ns(&ts); in vpu_malone_unpack_buff_rdy()
954 return -EINVAL; in vpu_malone_unpack_msg_data()
956 switch (pkt->hdr.id) { in vpu_malone_unpack_msg_data()
1014 if (s->scode_type == type && s->pixelformat == fmt) in get_padding_scode()
1037 return -EINVAL; in vpu_malone_add_padding_scode()
1039 wptr = readl(&str_buf->wptr); in vpu_malone_add_padding_scode()
1040 if (wptr < stream_buffer->phys || wptr > stream_buffer->phys + stream_buffer->length) in vpu_malone_add_padding_scode()
1041 return -EINVAL; in vpu_malone_add_padding_scode()
1042 if (wptr == stream_buffer->phys + stream_buffer->length) in vpu_malone_add_padding_scode()
1043 wptr = stream_buffer->phys; in vpu_malone_add_padding_scode()
1044 size = ALIGN(wptr, 4) - wptr; in vpu_malone_add_padding_scode()
1049 size = sizeof(ps->data); in vpu_malone_add_padding_scode()
1050 ret = vpu_helper_copy_to_stream_buffer(stream_buffer, &wptr, size, (void *)ps->data); in vpu_malone_add_padding_scode()
1052 return -EINVAL; in vpu_malone_add_padding_scode()
1055 size = padding_size - sizeof(ps->data); in vpu_malone_add_padding_scode()
1069 struct vpu_dec_ctrl *hc = shared->priv; in vpu_malone_add_scode()
1070 struct vpu_malone_str_buffer __iomem *str_buf = hc->str_buf[instance]; in vpu_malone_add_scode()
1071 int ret = -EINVAL; in vpu_malone_add_scode()
1113 /* payload_size = buffer_size + itself_size(16) - start_code(4) */ in set_payload_hdr()
1144 /* 0-3byte signature "DKIF" */ in set_vp8_ivf_seqhdr()
1149 /* 4-5byte version: should be 0*/ in set_vp8_ivf_seqhdr()
1152 /* 6-7 length of Header */ in set_vp8_ivf_seqhdr()
1155 /* 8-11 VP8 fourcc */ in set_vp8_ivf_seqhdr()
1160 /* 12-13 width in pixels */ in set_vp8_ivf_seqhdr()
1163 /* 14-15 height in pixels */ in set_vp8_ivf_seqhdr()
1166 /* 16-19 frame rate */ in set_vp8_ivf_seqhdr()
1171 /* 20-23 time scale */ in set_vp8_ivf_seqhdr()
1176 /* 24-27 number frames */ in set_vp8_ivf_seqhdr()
1181 /* 28-31 reserved */ in set_vp8_ivf_seqhdr()
1187 * firmware just parse 64-bit timestamp(8 bytes). in set_vp8_ivf_pichdr()
1198 /* 0-2 Number of frames, used default value 0xFF */ in set_vc1_rcv_seqhdr()
1206 /* 4-7 extension data size */ in set_vc1_rcv_seqhdr()
1211 /* 8-11 extension data */ in set_vc1_rcv_seqhdr()
1255 scode->inst->out_format.width, in vpu_malone_insert_scode_seq()
1256 scode->inst->out_format.height); in vpu_malone_insert_scode_seq()
1257 ret = vpu_helper_copy_to_stream_buffer(&scode->inst->stream_buffer, in vpu_malone_insert_scode_seq()
1258 &scode->wptr, in vpu_malone_insert_scode_seq()
1274 ext_size + vb2_get_plane_payload(scode->vb, 0), in vpu_malone_insert_scode_pic()
1275 scode->inst->out_format.width, in vpu_malone_insert_scode_pic()
1276 scode->inst->out_format.height); in vpu_malone_insert_scode_pic()
1277 ret = vpu_helper_copy_to_stream_buffer(&scode->inst->stream_buffer, in vpu_malone_insert_scode_pic()
1278 &scode->wptr, in vpu_malone_insert_scode_pic()
1293 vbuf = to_vb2_v4l2_buffer(scode->vb); in vpu_malone_insert_scode_vc1_g_pic()
1294 data = vb2_plane_vaddr(scode->vb, 0); in vpu_malone_insert_scode_vc1_g_pic()
1296 if (scode->inst->total_input_count == 0 || vpu_vb_is_codecconfig(vbuf)) in vpu_malone_insert_scode_vc1_g_pic()
1302 ret = vpu_helper_copy_to_stream_buffer(&scode->inst->stream_buffer, in vpu_malone_insert_scode_vc1_g_pic()
1303 &scode->wptr, in vpu_malone_insert_scode_vc1_g_pic()
1317 if (scode->inst->total_input_count) in vpu_malone_insert_scode_vc1_l_seq()
1319 scode->need_data = 0; in vpu_malone_insert_scode_vc1_l_seq()
1327 vb2_plane_vaddr(scode->vb, 0), in vpu_malone_insert_scode_vc1_l_seq()
1328 scode->inst->out_format.width, in vpu_malone_insert_scode_vc1_l_seq()
1329 scode->inst->out_format.height); in vpu_malone_insert_scode_vc1_l_seq()
1330 ret = vpu_helper_copy_to_stream_buffer(&scode->inst->stream_buffer, in vpu_malone_insert_scode_vc1_l_seq()
1331 &scode->wptr, in vpu_malone_insert_scode_vc1_l_seq()
1353 set_vc1_rcv_pichdr(rcv_pichdr, vb2_get_plane_payload(scode->vb, 0)); in vpu_malone_insert_scode_vc1_l_pic()
1354 ret = vpu_helper_copy_to_stream_buffer(&scode->inst->stream_buffer, in vpu_malone_insert_scode_vc1_l_pic()
1355 &scode->wptr, in vpu_malone_insert_scode_vc1_l_pic()
1376 scode->inst->out_format.width, in vpu_malone_insert_scode_vp8_seq()
1377 scode->inst->out_format.height); in vpu_malone_insert_scode_vp8_seq()
1378 ret = vpu_helper_copy_to_stream_buffer(&scode->inst->stream_buffer, in vpu_malone_insert_scode_vp8_seq()
1379 &scode->wptr, in vpu_malone_insert_scode_vp8_seq()
1400 set_vp8_ivf_pichdr(ivf_hdr, vb2_get_plane_payload(scode->vb, 0)); in vpu_malone_insert_scode_vp8_pic()
1401 ret = vpu_helper_copy_to_stream_buffer(&scode->inst->stream_buffer, in vpu_malone_insert_scode_vp8_pic()
1402 &scode->wptr, in vpu_malone_insert_scode_vp8_pic()
1447 if (!scode || !scode->inst || !scode->vb) in vpu_malone_insert_scode()
1450 scode->need_data = 1; in vpu_malone_insert_scode()
1451 handler = get_scode_handler(scode->inst->out_format.pixfmt); in vpu_malone_insert_scode()
1457 if (handler->insert_scode_seq) in vpu_malone_insert_scode()
1458 ret = handler->insert_scode_seq(scode); in vpu_malone_insert_scode()
1461 if (handler->insert_scode_pic) in vpu_malone_insert_scode()
1462 ret = handler->insert_scode_pic(scode); in vpu_malone_insert_scode()
1477 u32 wptr = readl(&str_buf->wptr); in vpu_malone_input_frame_data()
1486 if (vbuf->sequence == 0 || vpu_vb_is_codecconfig(vbuf)) in vpu_malone_input_frame_data()
1490 return -ENOMEM; in vpu_malone_input_frame_data()
1500 return -ENOMEM; in vpu_malone_input_frame_data()
1504 ret = vpu_helper_copy_to_stream_buffer(&inst->stream_buffer, in vpu_malone_input_frame_data()
1509 return -ENOMEM; in vpu_malone_input_frame_data()
1515 ret = vpu_malone_add_scode(inst->core->iface, in vpu_malone_input_frame_data()
1516 inst->id, in vpu_malone_input_frame_data()
1517 &inst->stream_buffer, in vpu_malone_input_frame_data()
1518 inst->out_format.pixfmt, in vpu_malone_input_frame_data()
1531 u32 wptr = readl(&str_buf->wptr); in vpu_malone_input_stream_data()
1534 ret = vpu_helper_copy_to_stream_buffer(&inst->stream_buffer, in vpu_malone_input_stream_data()
1539 return -ENOMEM; in vpu_malone_input_stream_data()
1560 struct vpu_dec_ctrl *hc = shared->priv; in vpu_malone_input_frame()
1562 struct vpu_malone_str_buffer __iomem *str_buf = hc->str_buf[inst->id]; in vpu_malone_input_frame()
1563 u32 disp_imm = hc->codec_param[inst->id].disp_imm; in vpu_malone_input_frame()
1567 if (vpu_malone_is_non_frame_mode(shared, inst->id)) in vpu_malone_input_frame()
1582 inst->extra_size += size; in vpu_malone_input_frame()
1585 if (inst->extra_size) { in vpu_malone_input_frame()
1586 size += inst->extra_size; in vpu_malone_input_frame()
1587 inst->extra_size = 0; in vpu_malone_input_frame()
1590 ret = vpu_malone_input_ts(inst, vb->timestamp, size); in vpu_malone_input_frame()
1599 struct malone_iface *iface = shared->iface; in vpu_malone_check_ready()
1600 struct vpu_rpc_buffer_desc *desc = &iface->api_cmd_buffer_desc[instance]; in vpu_malone_check_ready()
1601 u32 size = desc->end - desc->start; in vpu_malone_check_ready()
1602 u32 rptr = desc->rptr; in vpu_malone_check_ready()
1603 u32 wptr = desc->wptr; in vpu_malone_check_ready()
1609 used = (wptr + size - rptr) % size; in vpu_malone_check_ready()
1632 return -EINVAL; in vpu_malone_pre_cmd()
1639 struct malone_iface *iface = shared->iface; in vpu_malone_post_cmd()
1640 struct vpu_rpc_buffer_desc *desc = &iface->api_cmd_buffer_desc[instance]; in vpu_malone_post_cmd()
1642 desc->wptr++; in vpu_malone_post_cmd()
1643 if (desc->wptr == desc->end) in vpu_malone_post_cmd()
1644 desc->wptr = desc->start; in vpu_malone_post_cmd()
1651 struct malone_iface *iface = shared->iface; in vpu_malone_init_instance()
1652 struct vpu_rpc_buffer_desc *desc = &iface->api_cmd_buffer_desc[instance]; in vpu_malone_init_instance()
1654 desc->wptr = desc->rptr; in vpu_malone_init_instance()
1655 if (desc->wptr == desc->end) in vpu_malone_init_instance()
1656 desc->wptr = desc->start; in vpu_malone_init_instance()
1663 struct malone_iface *iface = shared->iface; in vpu_malone_get_max_instance_count()
1665 return iface->max_streams; in vpu_malone_get_max_instance_count()