Lines Matching full:vdec
195 struct vdec_t *vdec = inst->priv; in vdec_op_s_ctrl() local
200 vdec->params.display_delay_enable = ctrl->val; in vdec_op_s_ctrl()
203 vdec->params.display_delay = ctrl->val; in vdec_op_s_ctrl()
263 struct vdec_t *vdec = inst->priv; in vdec_handle_resolution_change() local
271 if (!vdec->source_change) in vdec_handle_resolution_change()
278 vdec->source_change--; in vdec_handle_resolution_change()
285 struct vdec_t *vdec = inst->priv; in vdec_update_state() local
290 vdec->state = inst->state; in vdec_update_state()
292 vdec->state = VPU_CODEC_STATE_ACTIVE; in vdec_update_state()
297 vdec->state = VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE; in vdec_update_state()
311 struct vdec_t *vdec = inst->priv; in vdec_set_last_buffer_dequeued() local
316 if (vdec->eos_received) { in vdec_set_last_buffer_dequeued()
318 vdec->eos_received--; in vdec_set_last_buffer_dequeued()
336 struct vdec_t *vdec = inst->priv; in vdec_enum_fmt() local
341 if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) { in vdec_enum_fmt()
365 struct vdec_t *vdec = inst->priv; in vdec_g_fmt() local
384 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_g_fmt()
385 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_g_fmt()
386 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_g_fmt()
387 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_g_fmt()
396 struct vdec_t *vdec = inst->priv; in vdec_try_fmt() local
400 if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) { in vdec_try_fmt()
410 if (vdec->fixed_fmt) { in vdec_try_fmt()
411 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_try_fmt()
412 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_try_fmt()
413 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_try_fmt()
414 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_try_fmt()
432 struct vdec_t *vdec = inst->priv; in vdec_s_fmt_common() local
450 vdec->reset_codec = true; in vdec_s_fmt_common()
451 vdec->fixed_fmt = false; in vdec_s_fmt_common()
454 if (V4L2_TYPE_IS_OUTPUT(f->type) || !vdec->fixed_fmt) { in vdec_s_fmt_common()
472 if (!vdec->fixed_fmt) { in vdec_s_fmt_common()
474 vdec->params.codec_format = cur_fmt->pixfmt; in vdec_s_fmt_common()
475 vdec->codec_info.color_primaries = f->fmt.pix_mp.colorspace; in vdec_s_fmt_common()
476 vdec->codec_info.transfer_chars = f->fmt.pix_mp.xfer_func; in vdec_s_fmt_common()
477 vdec->codec_info.matrix_coeffs = f->fmt.pix_mp.ycbcr_enc; in vdec_s_fmt_common()
478 vdec->codec_info.full_range = f->fmt.pix_mp.quantization; in vdec_s_fmt_common()
480 vdec->params.output_format = cur_fmt->pixfmt; in vdec_s_fmt_common()
503 struct vdec_t *vdec = inst->priv; in vdec_s_fmt() local
511 if (V4L2_TYPE_IS_OUTPUT(f->type) && !vdec->fixed_fmt) { in vdec_s_fmt()
522 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_s_fmt()
523 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_s_fmt()
524 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_s_fmt()
525 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_s_fmt()
560 struct vdec_t *vdec = inst->priv; in vdec_drain() local
565 if (!vdec->drain) in vdec_drain()
571 if (!vdec->params.frame_count) { in vdec_drain()
577 vdec->params.end_flag = 1; in vdec_drain()
578 vpu_iface_set_decode_params(inst, &vdec->params, 1); in vdec_drain()
579 vdec->drain = 0; in vdec_drain()
580 vpu_trace(inst->dev, "[%d] frame_count = %d\n", inst->id, vdec->params.frame_count); in vdec_drain()
587 struct vdec_t *vdec = inst->priv; in vdec_cmd_start() local
599 if (vdec->eos_received) in vdec_cmd_start()
606 struct vdec_t *vdec = inst->priv; in vdec_cmd_stop() local
613 vdec->drain = 1; in vdec_cmd_stop()
689 struct vdec_t *vdec = inst->priv; in vdec_check_ready() local
694 if (vdec->req_frame_count) in vdec_check_ready()
710 struct vdec_t *vdec = inst->priv; in vdec_frame_decoded() local
717 if (!info || info->id >= ARRAY_SIZE(vdec->slots)) in vdec_frame_decoded()
721 vpu_buf = vdec->slots[info->id]; in vdec_frame_decoded()
742 vdec->decoded_frame_count++; in vdec_frame_decoded()
743 if (vdec->params.display_delay_enable) { in vdec_frame_decoded()
752 vbuf->sequence = vdec->sequence++; in vdec_frame_decoded()
756 vdec->display_frame_count++; in vdec_frame_decoded()
766 struct vdec_t *vdec = inst->priv; in vdec_find_buffer() local
769 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) { in vdec_find_buffer()
770 if (!vdec->slots[i]) in vdec_find_buffer()
772 if (luma == vdec->slots[i]->luma) in vdec_find_buffer()
773 return vdec->slots[i]; in vdec_find_buffer()
781 struct vdec_t *vdec = inst->priv; in vdec_buf_done() local
791 if (!vdec->params.display_delay_enable) in vdec_buf_done()
792 vdec->sequence++; in vdec_buf_done()
811 if (vpu_get_buffer_state(vbuf) == VPU_BUF_STATE_READY && vdec->params.display_delay_enable) in vdec_buf_done()
821 vbuf->sequence = vdec->sequence; in vdec_buf_done()
826 vdec->display_frame_count++; in vdec_buf_done()
829 inst->id, vdec->decoded_frame_count, vdec->display_frame_count, vdec->sequence); in vdec_buf_done()
834 struct vdec_t *vdec = inst->priv; in vdec_stop_done() local
838 vdec->seq_hdr_found = 0; in vdec_stop_done()
839 vdec->req_frame_count = 0; in vdec_stop_done()
840 vdec->reset_codec = false; in vdec_stop_done()
841 vdec->fixed_fmt = false; in vdec_stop_done()
842 vdec->params.end_flag = 0; in vdec_stop_done()
843 vdec->drain = 0; in vdec_stop_done()
844 vdec->params.frame_count = 0; in vdec_stop_done()
845 vdec->decoded_frame_count = 0; in vdec_stop_done()
846 vdec->display_frame_count = 0; in vdec_stop_done()
847 vdec->sequence = 0; in vdec_stop_done()
848 vdec->eos_received = 0; in vdec_stop_done()
849 vdec->is_source_changed = false; in vdec_stop_done()
850 vdec->source_change = 0; in vdec_stop_done()
857 struct vdec_t *vdec = inst->priv; in vdec_check_source_change() local
863 if (vdec->reset_codec) in vdec_check_source_change()
867 if (sibling && vdec->codec_info.pixfmt == sibling->pixfmt) in vdec_check_source_change()
868 vdec->codec_info.pixfmt = inst->cap_format.pixfmt; in vdec_check_source_change()
872 if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt) in vdec_check_source_change()
874 if (inst->cap_format.width != vdec->codec_info.decoded_width) in vdec_check_source_change()
876 if (inst->cap_format.height != vdec->codec_info.decoded_height) in vdec_check_source_change()
880 if (inst->crop.left != vdec->codec_info.offset_x) in vdec_check_source_change()
882 if (inst->crop.top != vdec->codec_info.offset_y) in vdec_check_source_change()
884 if (inst->crop.width != vdec->codec_info.width) in vdec_check_source_change()
886 if (inst->crop.height != vdec->codec_info.height) in vdec_check_source_change()
894 struct vdec_t *vdec = inst->priv; in vdec_init_fmt() local
899 f.fmt.pix_mp.pixelformat = vdec->codec_info.pixfmt; in vdec_init_fmt()
900 f.fmt.pix_mp.width = vdec->codec_info.decoded_width; in vdec_init_fmt()
901 f.fmt.pix_mp.height = vdec->codec_info.decoded_height; in vdec_init_fmt()
902 if (vdec->codec_info.progressive) in vdec_init_fmt()
908 inst->out_format.width = vdec->codec_info.width; in vdec_init_fmt()
909 inst->out_format.height = vdec->codec_info.height; in vdec_init_fmt()
914 struct vdec_t *vdec = inst->priv; in vdec_init_crop() local
916 inst->crop.left = vdec->codec_info.offset_x; in vdec_init_crop()
917 inst->crop.top = vdec->codec_info.offset_y; in vdec_init_crop()
918 inst->crop.width = vdec->codec_info.width; in vdec_init_crop()
919 inst->crop.height = vdec->codec_info.height; in vdec_init_crop()
924 struct vdec_t *vdec = inst->priv; in vdec_init_mbi() local
926 vdec->mbi.size = vdec->codec_info.mbi_size; in vdec_init_mbi()
927 vdec->mbi.max_count = ARRAY_SIZE(vdec->mbi.buffer); in vdec_init_mbi()
928 scnprintf(vdec->mbi.name, sizeof(vdec->mbi.name), "mbi"); in vdec_init_mbi()
929 vdec->mbi.type = MEM_RES_MBI; in vdec_init_mbi()
930 vdec->mbi.tag = vdec->seq_tag; in vdec_init_mbi()
935 struct vdec_t *vdec = inst->priv; in vdec_init_dcp() local
937 vdec->dcp.size = vdec->codec_info.dcp_size; in vdec_init_dcp()
938 vdec->dcp.max_count = ARRAY_SIZE(vdec->dcp.buffer); in vdec_init_dcp()
939 scnprintf(vdec->dcp.name, sizeof(vdec->dcp.name), "dcp"); in vdec_init_dcp()
940 vdec->dcp.type = MEM_RES_DCP; in vdec_init_dcp()
941 vdec->dcp.tag = vdec->seq_tag; in vdec_init_dcp()
1018 struct vdec_t *vdec = inst->priv; in vdec_response_frame_abnormal() local
1022 if (!vdec->req_frame_count) in vdec_response_frame_abnormal()
1027 info.tag = vdec->seq_tag + 0xf0; in vdec_response_frame_abnormal()
1031 vdec->req_frame_count--; in vdec_response_frame_abnormal()
1038 struct vdec_t *vdec = inst->priv; in vdec_response_frame() local
1046 if (vdec->aborting) in vdec_response_frame()
1049 if (!vdec->req_frame_count) in vdec_response_frame()
1055 if (vdec->slots[vbuf->vb2_buf.index]) { in vdec_response_frame()
1062 inst->id, vpu_codec_state_name(inst->state), vbuf->vb2_buf.index, vdec->seq_tag); in vdec_response_frame()
1068 info.tag = vdec->seq_tag; in vdec_response_frame()
1086 vdec->slots[info.id] = vpu_buf; in vdec_response_frame()
1087 vdec->req_frame_count--; in vdec_response_frame()
1094 struct vdec_t *vdec = inst->priv; in vdec_response_fs_request() local
1099 for (i = vdec->req_frame_count; i > 0; i--) in vdec_response_fs_request()
1104 for (i = vdec->req_frame_count; i > 0; i--) { in vdec_response_fs_request()
1108 if (vdec->eos_received) in vdec_response_fs_request()
1112 for (i = vdec->mbi.index; i < vdec->mbi.count; i++) { in vdec_response_fs_request()
1113 if (vdec_response_fs(inst, &vdec->mbi)) in vdec_response_fs_request()
1115 if (vdec->eos_received) in vdec_response_fs_request()
1118 for (i = vdec->dcp.index; i < vdec->dcp.count; i++) { in vdec_response_fs_request()
1119 if (vdec_response_fs(inst, &vdec->dcp)) in vdec_response_fs_request()
1121 if (vdec->eos_received) in vdec_response_fs_request()
1149 struct vdec_t *vdec = inst->priv; in vdec_clear_slots() local
1154 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) { in vdec_clear_slots()
1155 if (!vdec->slots[i]) in vdec_clear_slots()
1158 vpu_buf = vdec->slots[i]; in vdec_clear_slots()
1164 vdec->slots[i]->state = VPU_BUF_STATE_IDLE; in vdec_clear_slots()
1165 vdec->slots[i] = NULL; in vdec_clear_slots()
1171 struct vdec_t *vdec = inst->priv; in vdec_event_seq_hdr() local
1174 memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info)); in vdec_event_seq_hdr()
1178 vdec->codec_info.decoded_width, in vdec_event_seq_hdr()
1179 vdec->codec_info.decoded_height, in vdec_event_seq_hdr()
1180 vdec->codec_info.offset_x, in vdec_event_seq_hdr()
1181 vdec->codec_info.offset_y, in vdec_event_seq_hdr()
1182 vdec->codec_info.width, in vdec_event_seq_hdr()
1183 vdec->codec_info.height, in vdec_event_seq_hdr()
1187 vdec->is_source_changed = vdec_check_source_change(inst); in vdec_event_seq_hdr()
1192 if (!vdec->seq_hdr_found) { in vdec_event_seq_hdr()
1193 vdec->seq_tag = vdec->codec_info.tag; in vdec_event_seq_hdr()
1194 if (vdec->is_source_changed) { in vdec_event_seq_hdr()
1196 vdec->source_change++; in vdec_event_seq_hdr()
1198 vdec->is_source_changed = false; in vdec_event_seq_hdr()
1201 if (vdec->seq_tag != vdec->codec_info.tag) { in vdec_event_seq_hdr()
1204 inst->id, vdec->seq_tag, vdec->codec_info.tag); in vdec_event_seq_hdr()
1206 vdec->seq_hdr_found++; in vdec_event_seq_hdr()
1207 vdec->fixed_fmt = true; in vdec_event_seq_hdr()
1213 struct vdec_t *vdec = inst->priv; in vdec_event_resolution_change() local
1217 vdec->seq_tag = vdec->codec_info.tag; in vdec_event_resolution_change()
1218 vdec_clear_fs(&vdec->mbi); in vdec_event_resolution_change()
1219 vdec_clear_fs(&vdec->dcp); in vdec_event_resolution_change()
1223 if (vdec->is_source_changed) { in vdec_event_resolution_change()
1225 vdec->source_change++; in vdec_event_resolution_change()
1227 vdec->is_source_changed = false; in vdec_event_resolution_change()
1234 struct vdec_t *vdec = inst->priv; in vdec_event_req_fs() local
1243 vdec->req_frame_count++; in vdec_event_req_fs()
1246 vdec_request_one_fs(&vdec->mbi); in vdec_event_req_fs()
1249 vdec_request_one_fs(&vdec->dcp); in vdec_event_req_fs()
1255 vdec_alloc_fs(inst, &vdec->mbi); in vdec_event_req_fs()
1256 vdec_alloc_fs(inst, &vdec->dcp); in vdec_event_req_fs()
1265 struct vdec_t *vdec = inst->priv; in vdec_evnet_rel_fs() local
1269 if (!fs || fs->id >= ARRAY_SIZE(vdec->slots)) in vdec_evnet_rel_fs()
1280 vpu_buf = vdec->slots[fs->id]; in vdec_evnet_rel_fs()
1281 vdec->slots[fs->id] = NULL; in vdec_evnet_rel_fs()
1291 vdec->sequence++; in vdec_evnet_rel_fs()
1307 struct vdec_t *vdec = inst->priv; in vdec_event_eos() local
1311 vdec->params.frame_count, in vdec_event_eos()
1312 vdec->decoded_frame_count, in vdec_event_eos()
1313 vdec->display_frame_count, in vdec_event_eos()
1314 vdec->sequence); in vdec_event_eos()
1316 vdec->eos_received++; in vdec_event_eos()
1317 vdec->fixed_fmt = false; in vdec_event_eos()
1348 struct vdec_t *vdec = inst->priv; in vdec_process_output() local
1360 if (vdec->reset_codec) in vdec_process_output()
1380 vdec->params.frame_count++; in vdec_process_output()
1382 if (vdec->drain) in vdec_process_output()
1390 struct vdec_t *vdec = inst->priv; in vdec_process_capture() local
1396 if (vdec->reset_codec) in vdec_process_capture()
1408 struct vdec_t *vdec = inst->priv; in vdec_on_queue_empty() local
1414 if (vdec->eos_received) in vdec_on_queue_empty()
1420 struct vdec_t *vdec = inst->priv; in vdec_abort() local
1426 vdec->aborting = true; in vdec_abort()
1428 vdec->params.end_flag = 1; in vdec_abort()
1429 vpu_iface_set_decode_params(inst, &vdec->params, 1); in vdec_abort()
1440 vdec->params.frame_count, in vdec_abort()
1441 vdec->decoded_frame_count, in vdec_abort()
1442 vdec->display_frame_count, in vdec_abort()
1443 vdec->sequence); in vdec_abort()
1444 if (!vdec->seq_hdr_found) in vdec_abort()
1445 vdec->reset_codec = true; in vdec_abort()
1446 vdec->params.end_flag = 0; in vdec_abort()
1447 vdec->drain = 0; in vdec_abort()
1448 vdec->params.frame_count = 0; in vdec_abort()
1449 vdec->decoded_frame_count = 0; in vdec_abort()
1450 vdec->display_frame_count = 0; in vdec_abort()
1451 vdec->sequence = 0; in vdec_abort()
1452 vdec->aborting = false; in vdec_abort()
1458 struct vdec_t *vdec = inst->priv; in vdec_stop() local
1463 vdec_clear_fs(&vdec->mbi); in vdec_stop()
1464 vdec_clear_fs(&vdec->dcp); in vdec_stop()
1466 vpu_free_dma(&vdec->udata); in vdec_stop()
1470 vdec->reset_codec = false; in vdec_stop()
1482 struct vdec_t *vdec; in vdec_cleanup() local
1487 vdec = inst->priv; in vdec_cleanup()
1488 vfree(vdec); in vdec_cleanup()
1493 static void vdec_init_params(struct vdec_t *vdec) in vdec_init_params() argument
1495 vdec->params.frame_count = 0; in vdec_init_params()
1496 vdec->params.end_flag = 0; in vdec_init_params()
1501 struct vdec_t *vdec = inst->priv; in vdec_start() local
1509 if (!vdec->udata.virt) { in vdec_start()
1510 vdec->udata.length = 0x1000; in vdec_start()
1511 ret = vpu_alloc_dma(inst->core, &vdec->udata); in vdec_start()
1534 vdec->params.udata.base = vdec->udata.phys; in vdec_start()
1535 vdec->params.udata.size = vdec->udata.length; in vdec_start()
1536 ret = vpu_iface_set_decode_params(inst, &vdec->params, 0); in vdec_start()
1542 vdec_init_params(vdec); in vdec_start()
1553 vpu_free_dma(&vdec->udata); in vdec_start()
1560 struct vdec_t *vdec = inst->priv; in vdec_start_session() local
1564 if (vdec->reset_codec) in vdec_start_session()
1574 vdec_update_state(inst, vdec->state, 1); in vdec_start_session()
1575 vdec->eos_received = 0; in vdec_start_session()
1588 struct vdec_t *vdec = inst->priv; in vdec_stop_session() local
1595 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()