Lines Matching refs:vdec

195 	struct vdec_t *vdec = inst->priv;  in vdec_op_s_ctrl()  local
201 vdec->params.display_delay_enable = ctrl->val; in vdec_op_s_ctrl()
204 vdec->params.display_delay = ctrl->val; in vdec_op_s_ctrl()
265 struct vdec_t *vdec = inst->priv; in vdec_handle_resolution_change() local
273 if (!vdec->source_change) in vdec_handle_resolution_change()
280 vdec->source_change--; in vdec_handle_resolution_change()
287 struct vdec_t *vdec = inst->priv; in vdec_update_state() local
292 vdec->state = inst->state; in vdec_update_state()
294 vdec->state = VPU_CODEC_STATE_ACTIVE; in vdec_update_state()
299 vdec->state = VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE; in vdec_update_state()
313 struct vdec_t *vdec = inst->priv; in vdec_set_last_buffer_dequeued() local
318 if (vdec->eos_received) { in vdec_set_last_buffer_dequeued()
320 vdec->eos_received--; in vdec_set_last_buffer_dequeued()
338 struct vdec_t *vdec = inst->priv; in vdec_enum_fmt() local
343 if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) { in vdec_enum_fmt()
367 struct vdec_t *vdec = inst->priv; in vdec_g_fmt() local
386 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_g_fmt()
387 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_g_fmt()
388 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_g_fmt()
389 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_g_fmt()
398 struct vdec_t *vdec = inst->priv; in vdec_try_fmt() local
402 if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) { in vdec_try_fmt()
412 if (vdec->fixed_fmt) { in vdec_try_fmt()
413 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_try_fmt()
414 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_try_fmt()
415 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_try_fmt()
416 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_try_fmt()
434 struct vdec_t *vdec = inst->priv; in vdec_s_fmt_common() local
452 vdec->reset_codec = true; in vdec_s_fmt_common()
453 vdec->fixed_fmt = false; in vdec_s_fmt_common()
456 if (V4L2_TYPE_IS_OUTPUT(f->type) || !vdec->fixed_fmt) { in vdec_s_fmt_common()
474 if (!vdec->fixed_fmt) { in vdec_s_fmt_common()
476 vdec->params.codec_format = cur_fmt->pixfmt; in vdec_s_fmt_common()
477 vdec->codec_info.color_primaries = f->fmt.pix_mp.colorspace; in vdec_s_fmt_common()
478 vdec->codec_info.transfer_chars = f->fmt.pix_mp.xfer_func; in vdec_s_fmt_common()
479 vdec->codec_info.matrix_coeffs = f->fmt.pix_mp.ycbcr_enc; in vdec_s_fmt_common()
480 vdec->codec_info.full_range = f->fmt.pix_mp.quantization; in vdec_s_fmt_common()
482 vdec->params.output_format = cur_fmt->pixfmt; in vdec_s_fmt_common()
505 struct vdec_t *vdec = inst->priv; in vdec_s_fmt() local
513 if (V4L2_TYPE_IS_OUTPUT(f->type) && !vdec->fixed_fmt) { in vdec_s_fmt()
524 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_s_fmt()
525 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_s_fmt()
526 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_s_fmt()
527 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_s_fmt()
562 struct vdec_t *vdec = inst->priv; in vdec_drain() local
567 if (!vdec->drain) in vdec_drain()
573 if (!vdec->params.frame_count) { in vdec_drain()
579 vdec->params.end_flag = 1; in vdec_drain()
580 vpu_iface_set_decode_params(inst, &vdec->params, 1); in vdec_drain()
581 vdec->drain = 0; in vdec_drain()
582 vpu_trace(inst->dev, "[%d] frame_count = %d\n", inst->id, vdec->params.frame_count); in vdec_drain()
589 struct vdec_t *vdec = inst->priv; in vdec_cmd_start() local
601 if (vdec->eos_received) in vdec_cmd_start()
608 struct vdec_t *vdec = inst->priv; in vdec_cmd_stop() local
615 vdec->drain = 1; in vdec_cmd_stop()
691 struct vdec_t *vdec = inst->priv; in vdec_check_ready() local
696 if (vdec->req_frame_count) in vdec_check_ready()
712 struct vdec_t *vdec = inst->priv; in vdec_frame_decoded() local
719 if (!info || info->id >= ARRAY_SIZE(vdec->slots)) in vdec_frame_decoded()
723 vpu_buf = vdec->slots[info->id]; in vdec_frame_decoded()
744 vdec->decoded_frame_count++; in vdec_frame_decoded()
745 if (vdec->params.display_delay_enable) { in vdec_frame_decoded()
754 vbuf->sequence = vdec->sequence++; in vdec_frame_decoded()
758 vdec->display_frame_count++; in vdec_frame_decoded()
768 struct vdec_t *vdec = inst->priv; in vdec_find_buffer() local
771 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) { in vdec_find_buffer()
772 if (!vdec->slots[i]) in vdec_find_buffer()
774 if (luma == vdec->slots[i]->luma) in vdec_find_buffer()
775 return vdec->slots[i]; in vdec_find_buffer()
783 struct vdec_t *vdec = inst->priv; in vdec_buf_done() local
793 if (!vdec->params.display_delay_enable) in vdec_buf_done()
794 vdec->sequence++; in vdec_buf_done()
813 if (vpu_get_buffer_state(vbuf) == VPU_BUF_STATE_READY && vdec->params.display_delay_enable) in vdec_buf_done()
823 vbuf->sequence = vdec->sequence; in vdec_buf_done()
828 vdec->display_frame_count++; in vdec_buf_done()
831 inst->id, vdec->decoded_frame_count, vdec->display_frame_count, vdec->sequence); in vdec_buf_done()
836 struct vdec_t *vdec = inst->priv; in vdec_stop_done() local
840 vdec->seq_hdr_found = 0; in vdec_stop_done()
841 vdec->req_frame_count = 0; in vdec_stop_done()
842 vdec->reset_codec = false; in vdec_stop_done()
843 vdec->fixed_fmt = false; in vdec_stop_done()
844 vdec->params.end_flag = 0; in vdec_stop_done()
845 vdec->drain = 0; in vdec_stop_done()
846 vdec->params.frame_count = 0; in vdec_stop_done()
847 vdec->decoded_frame_count = 0; in vdec_stop_done()
848 vdec->display_frame_count = 0; in vdec_stop_done()
849 vdec->sequence = 0; in vdec_stop_done()
850 vdec->eos_received = 0; in vdec_stop_done()
851 vdec->is_source_changed = false; in vdec_stop_done()
852 vdec->source_change = 0; in vdec_stop_done()
859 struct vdec_t *vdec = inst->priv; in vdec_check_source_change() local
865 if (vdec->reset_codec) in vdec_check_source_change()
869 if (sibling && vdec->codec_info.pixfmt == sibling->pixfmt) in vdec_check_source_change()
870 vdec->codec_info.pixfmt = inst->cap_format.pixfmt; in vdec_check_source_change()
874 if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt) in vdec_check_source_change()
876 if (inst->cap_format.width != vdec->codec_info.decoded_width) in vdec_check_source_change()
878 if (inst->cap_format.height != vdec->codec_info.decoded_height) in vdec_check_source_change()
882 if (inst->crop.left != vdec->codec_info.offset_x) in vdec_check_source_change()
884 if (inst->crop.top != vdec->codec_info.offset_y) in vdec_check_source_change()
886 if (inst->crop.width != vdec->codec_info.width) in vdec_check_source_change()
888 if (inst->crop.height != vdec->codec_info.height) in vdec_check_source_change()
896 struct vdec_t *vdec = inst->priv; in vdec_init_fmt() local
901 f.fmt.pix_mp.pixelformat = vdec->codec_info.pixfmt; in vdec_init_fmt()
902 f.fmt.pix_mp.width = vdec->codec_info.decoded_width; in vdec_init_fmt()
903 f.fmt.pix_mp.height = vdec->codec_info.decoded_height; in vdec_init_fmt()
904 if (vdec->codec_info.progressive) in vdec_init_fmt()
910 inst->out_format.width = vdec->codec_info.width; in vdec_init_fmt()
911 inst->out_format.height = vdec->codec_info.height; in vdec_init_fmt()
916 struct vdec_t *vdec = inst->priv; in vdec_init_crop() local
918 inst->crop.left = vdec->codec_info.offset_x; in vdec_init_crop()
919 inst->crop.top = vdec->codec_info.offset_y; in vdec_init_crop()
920 inst->crop.width = vdec->codec_info.width; in vdec_init_crop()
921 inst->crop.height = vdec->codec_info.height; in vdec_init_crop()
926 struct vdec_t *vdec = inst->priv; in vdec_init_mbi() local
928 vdec->mbi.size = vdec->codec_info.mbi_size; in vdec_init_mbi()
929 vdec->mbi.max_count = ARRAY_SIZE(vdec->mbi.buffer); in vdec_init_mbi()
930 scnprintf(vdec->mbi.name, sizeof(vdec->mbi.name), "mbi"); in vdec_init_mbi()
931 vdec->mbi.type = MEM_RES_MBI; in vdec_init_mbi()
932 vdec->mbi.tag = vdec->seq_tag; in vdec_init_mbi()
937 struct vdec_t *vdec = inst->priv; in vdec_init_dcp() local
939 vdec->dcp.size = vdec->codec_info.dcp_size; in vdec_init_dcp()
940 vdec->dcp.max_count = ARRAY_SIZE(vdec->dcp.buffer); in vdec_init_dcp()
941 scnprintf(vdec->dcp.name, sizeof(vdec->dcp.name), "dcp"); in vdec_init_dcp()
942 vdec->dcp.type = MEM_RES_DCP; in vdec_init_dcp()
943 vdec->dcp.tag = vdec->seq_tag; in vdec_init_dcp()
1020 struct vdec_t *vdec = inst->priv; in vdec_response_frame_abnormal() local
1024 if (!vdec->req_frame_count) in vdec_response_frame_abnormal()
1029 info.tag = vdec->seq_tag + 0xf0; in vdec_response_frame_abnormal()
1033 vdec->req_frame_count--; in vdec_response_frame_abnormal()
1040 struct vdec_t *vdec = inst->priv; in vdec_response_frame() local
1048 if (vdec->aborting) in vdec_response_frame()
1051 if (!vdec->req_frame_count) in vdec_response_frame()
1057 if (vdec->slots[vbuf->vb2_buf.index]) { in vdec_response_frame()
1064 inst->id, vpu_codec_state_name(inst->state), vbuf->vb2_buf.index, vdec->seq_tag); in vdec_response_frame()
1070 info.tag = vdec->seq_tag; in vdec_response_frame()
1088 vdec->slots[info.id] = vpu_buf; in vdec_response_frame()
1089 vdec->req_frame_count--; in vdec_response_frame()
1096 struct vdec_t *vdec = inst->priv; in vdec_response_fs_request() local
1101 for (i = vdec->req_frame_count; i > 0; i--) in vdec_response_fs_request()
1106 for (i = vdec->req_frame_count; i > 0; i--) { in vdec_response_fs_request()
1110 if (vdec->eos_received) in vdec_response_fs_request()
1114 for (i = vdec->mbi.index; i < vdec->mbi.count; i++) { in vdec_response_fs_request()
1115 if (vdec_response_fs(inst, &vdec->mbi)) in vdec_response_fs_request()
1117 if (vdec->eos_received) in vdec_response_fs_request()
1120 for (i = vdec->dcp.index; i < vdec->dcp.count; i++) { in vdec_response_fs_request()
1121 if (vdec_response_fs(inst, &vdec->dcp)) in vdec_response_fs_request()
1123 if (vdec->eos_received) in vdec_response_fs_request()
1151 struct vdec_t *vdec = inst->priv; in vdec_clear_slots() local
1156 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) { in vdec_clear_slots()
1157 if (!vdec->slots[i]) in vdec_clear_slots()
1160 vpu_buf = vdec->slots[i]; in vdec_clear_slots()
1166 vdec->slots[i]->state = VPU_BUF_STATE_IDLE; in vdec_clear_slots()
1167 vdec->slots[i] = NULL; in vdec_clear_slots()
1173 struct vdec_t *vdec = inst->priv; in vdec_event_seq_hdr() local
1176 memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info)); in vdec_event_seq_hdr()
1180 vdec->codec_info.decoded_width, in vdec_event_seq_hdr()
1181 vdec->codec_info.decoded_height, in vdec_event_seq_hdr()
1182 vdec->codec_info.offset_x, in vdec_event_seq_hdr()
1183 vdec->codec_info.offset_y, in vdec_event_seq_hdr()
1184 vdec->codec_info.width, in vdec_event_seq_hdr()
1185 vdec->codec_info.height, in vdec_event_seq_hdr()
1189 vdec->is_source_changed = vdec_check_source_change(inst); in vdec_event_seq_hdr()
1194 if (!vdec->seq_hdr_found) { in vdec_event_seq_hdr()
1195 vdec->seq_tag = vdec->codec_info.tag; in vdec_event_seq_hdr()
1196 if (vdec->is_source_changed) { in vdec_event_seq_hdr()
1198 vdec->source_change++; in vdec_event_seq_hdr()
1200 vdec->is_source_changed = false; in vdec_event_seq_hdr()
1203 if (vdec->seq_tag != vdec->codec_info.tag) { in vdec_event_seq_hdr()
1206 inst->id, vdec->seq_tag, vdec->codec_info.tag); in vdec_event_seq_hdr()
1208 vdec->seq_hdr_found++; in vdec_event_seq_hdr()
1209 vdec->fixed_fmt = true; in vdec_event_seq_hdr()
1215 struct vdec_t *vdec = inst->priv; in vdec_event_resolution_change() local
1219 vdec->seq_tag = vdec->codec_info.tag; in vdec_event_resolution_change()
1220 vdec_clear_fs(&vdec->mbi); in vdec_event_resolution_change()
1221 vdec_clear_fs(&vdec->dcp); in vdec_event_resolution_change()
1225 if (vdec->is_source_changed) { in vdec_event_resolution_change()
1227 vdec->source_change++; in vdec_event_resolution_change()
1229 vdec->is_source_changed = false; in vdec_event_resolution_change()
1236 struct vdec_t *vdec = inst->priv; in vdec_event_req_fs() local
1245 vdec->req_frame_count++; in vdec_event_req_fs()
1248 vdec_request_one_fs(&vdec->mbi); in vdec_event_req_fs()
1251 vdec_request_one_fs(&vdec->dcp); in vdec_event_req_fs()
1257 vdec_alloc_fs(inst, &vdec->mbi); in vdec_event_req_fs()
1258 vdec_alloc_fs(inst, &vdec->dcp); in vdec_event_req_fs()
1267 struct vdec_t *vdec = inst->priv; in vdec_evnet_rel_fs() local
1271 if (!fs || fs->id >= ARRAY_SIZE(vdec->slots)) in vdec_evnet_rel_fs()
1282 vpu_buf = vdec->slots[fs->id]; in vdec_evnet_rel_fs()
1283 vdec->slots[fs->id] = NULL; in vdec_evnet_rel_fs()
1293 vdec->sequence++; in vdec_evnet_rel_fs()
1309 struct vdec_t *vdec = inst->priv; in vdec_event_eos() local
1313 vdec->params.frame_count, in vdec_event_eos()
1314 vdec->decoded_frame_count, in vdec_event_eos()
1315 vdec->display_frame_count, in vdec_event_eos()
1316 vdec->sequence); in vdec_event_eos()
1318 vdec->eos_received++; in vdec_event_eos()
1319 vdec->fixed_fmt = false; in vdec_event_eos()
1350 struct vdec_t *vdec = inst->priv; in vdec_process_output() local
1362 if (vdec->reset_codec) in vdec_process_output()
1382 vdec->params.frame_count++; in vdec_process_output()
1384 if (vdec->drain) in vdec_process_output()
1392 struct vdec_t *vdec = inst->priv; in vdec_process_capture() local
1398 if (vdec->reset_codec) in vdec_process_capture()
1410 struct vdec_t *vdec = inst->priv; in vdec_on_queue_empty() local
1416 if (vdec->eos_received) in vdec_on_queue_empty()
1422 struct vdec_t *vdec = inst->priv; in vdec_abort() local
1428 vdec->aborting = true; in vdec_abort()
1430 vdec->params.end_flag = 1; in vdec_abort()
1431 vpu_iface_set_decode_params(inst, &vdec->params, 1); in vdec_abort()
1442 vdec->params.frame_count, in vdec_abort()
1443 vdec->decoded_frame_count, in vdec_abort()
1444 vdec->display_frame_count, in vdec_abort()
1445 vdec->sequence); in vdec_abort()
1446 if (!vdec->seq_hdr_found) in vdec_abort()
1447 vdec->reset_codec = true; in vdec_abort()
1448 vdec->params.end_flag = 0; in vdec_abort()
1449 vdec->drain = 0; in vdec_abort()
1450 vdec->params.frame_count = 0; in vdec_abort()
1451 vdec->decoded_frame_count = 0; in vdec_abort()
1452 vdec->display_frame_count = 0; in vdec_abort()
1453 vdec->sequence = 0; in vdec_abort()
1454 vdec->aborting = false; in vdec_abort()
1460 struct vdec_t *vdec = inst->priv; in vdec_stop() local
1465 vdec_clear_fs(&vdec->mbi); in vdec_stop()
1466 vdec_clear_fs(&vdec->dcp); in vdec_stop()
1468 vpu_free_dma(&vdec->udata); in vdec_stop()
1472 vdec->reset_codec = false; in vdec_stop()
1484 struct vdec_t *vdec; in vdec_cleanup() local
1489 vdec = inst->priv; in vdec_cleanup()
1490 vfree(vdec); in vdec_cleanup()
1495 static void vdec_init_params(struct vdec_t *vdec) in vdec_init_params() argument
1497 vdec->params.frame_count = 0; in vdec_init_params()
1498 vdec->params.end_flag = 0; in vdec_init_params()
1503 struct vdec_t *vdec = inst->priv; in vdec_start() local
1511 if (!vdec->udata.virt) { in vdec_start()
1512 vdec->udata.length = 0x1000; in vdec_start()
1513 ret = vpu_alloc_dma(inst->core, &vdec->udata); in vdec_start()
1536 vdec->params.udata.base = vdec->udata.phys; in vdec_start()
1537 vdec->params.udata.size = vdec->udata.length; in vdec_start()
1538 ret = vpu_iface_set_decode_params(inst, &vdec->params, 0); in vdec_start()
1544 vdec_init_params(vdec); in vdec_start()
1555 vpu_free_dma(&vdec->udata); in vdec_start()
1562 struct vdec_t *vdec = inst->priv; in vdec_start_session() local
1566 if (vdec->reset_codec) in vdec_start_session()
1576 vdec_update_state(inst, vdec->state, 1); in vdec_start_session()
1577 vdec->eos_received = 0; in vdec_start_session()
1590 struct vdec_t *vdec = inst->priv; in vdec_stop_session() local
1597 vdec->drain = 0; in vdec_stop_session()
1601 vdec->eos_received = 0; in vdec_stop_session()
1611 struct vdec_t *vdec = inst->priv; in vdec_get_debug_info() local
1618 vdec->req_frame_count, in vdec_get_debug_info()
1619 vdec->codec_info.progressive ? 0 : 1); in vdec_get_debug_info()
1624 vdec->mbi.size, in vdec_get_debug_info()
1625 vdec->mbi.req_count, in vdec_get_debug_info()
1626 vdec->mbi.count, in vdec_get_debug_info()
1627 vdec->mbi.index); in vdec_get_debug_info()
1632 vdec->dcp.size, in vdec_get_debug_info()
1633 vdec->dcp.req_count, in vdec_get_debug_info()
1634 vdec->dcp.count, in vdec_get_debug_info()
1635 vdec->dcp.index); in vdec_get_debug_info()
1638 num = scnprintf(str, size, "input_frame_count = %d\n", vdec->params.frame_count); in vdec_get_debug_info()
1641 num = scnprintf(str, size, "decoded_frame_count = %d\n", vdec->decoded_frame_count); in vdec_get_debug_info()
1644 num = scnprintf(str, size, "display_frame_count = %d\n", vdec->display_frame_count); in vdec_get_debug_info()
1647 num = scnprintf(str, size, "sequence = %d\n", vdec->sequence); in vdec_get_debug_info()
1651 vdec->drain, vdec->eos_received, vdec->source_change); in vdec_get_debug_info()
1655 vdec->codec_info.frame_rate.numerator, in vdec_get_debug_info()
1656 vdec->codec_info.frame_rate.denominator); in vdec_get_debug_info()
1660 vdec->codec_info.color_primaries, in vdec_get_debug_info()
1661 vdec->codec_info.transfer_chars, in vdec_get_debug_info()
1662 vdec->codec_info.matrix_coeffs, in vdec_get_debug_info()
1663 vdec->codec_info.full_range, in vdec_get_debug_info()
1664 vdec->codec_info.vui_present); in vdec_get_debug_info()
1717 struct vdec_t *vdec; in vdec_open() local
1724 vdec = vzalloc(sizeof(*vdec)); in vdec_open()
1725 if (!vdec) { in vdec_open()
1733 inst->priv = vdec; in vdec_open()
1739 vdec->fixed_fmt = false; in vdec_open()
1740 vdec->state = VPU_CODEC_STATE_ACTIVE; in vdec_open()