Lines Matching full:vdec

183 	struct vdec_t *vdec = inst->priv;  in vdec_handle_resolution_change()  local
191 if (!vdec->source_change) in vdec_handle_resolution_change()
198 vdec->source_change--; in vdec_handle_resolution_change()
204 struct vdec_t *vdec = inst->priv; in vdec_update_state() local
209 vdec->state = inst->state; in vdec_update_state()
211 vdec->state = VPU_CODEC_STATE_ACTIVE; in vdec_update_state()
216 vdec->state = VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE; in vdec_update_state()
229 struct vdec_t *vdec = inst->priv; in vdec_set_last_buffer_dequeued() local
234 if (vdec->eos_received) { in vdec_set_last_buffer_dequeued()
236 vdec->eos_received--; in vdec_set_last_buffer_dequeued()
254 struct vdec_t *vdec = inst->priv; in vdec_enum_fmt() local
259 if (!V4L2_TYPE_IS_OUTPUT(f->type) && vdec->fixed_fmt) { in vdec_enum_fmt()
284 struct vdec_t *vdec = inst->priv; in vdec_g_fmt() local
302 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_g_fmt()
303 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_g_fmt()
304 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_g_fmt()
305 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_g_fmt()
313 struct vdec_t *vdec = inst->priv; in vdec_try_fmt() local
318 if (vdec->fixed_fmt) { in vdec_try_fmt()
319 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_try_fmt()
320 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_try_fmt()
321 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_try_fmt()
322 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_try_fmt()
340 struct vdec_t *vdec = inst->priv; in vdec_s_fmt_common() local
359 vdec->reset_codec = true; in vdec_s_fmt_common()
360 vdec->fixed_fmt = false; in vdec_s_fmt_common()
364 if (V4L2_TYPE_IS_OUTPUT(f->type) || !vdec->fixed_fmt) { in vdec_s_fmt_common()
386 if (!vdec->fixed_fmt) { in vdec_s_fmt_common()
388 vdec->params.codec_format = cur_fmt->pixfmt; in vdec_s_fmt_common()
389 vdec->codec_info.color_primaries = f->fmt.pix_mp.colorspace; in vdec_s_fmt_common()
390 vdec->codec_info.transfer_chars = f->fmt.pix_mp.xfer_func; in vdec_s_fmt_common()
391 vdec->codec_info.matrix_coeffs = f->fmt.pix_mp.ycbcr_enc; in vdec_s_fmt_common()
392 vdec->codec_info.full_range = f->fmt.pix_mp.quantization; in vdec_s_fmt_common()
394 vdec->params.output_format = cur_fmt->pixfmt; in vdec_s_fmt_common()
417 struct vdec_t *vdec = inst->priv; in vdec_s_fmt() local
425 if (V4L2_TYPE_IS_OUTPUT(f->type) && !vdec->fixed_fmt) { in vdec_s_fmt()
436 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_s_fmt()
437 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_s_fmt()
438 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_s_fmt()
439 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_s_fmt()
474 struct vdec_t *vdec = inst->priv; in vdec_drain() local
479 if (!vdec->drain) in vdec_drain()
485 if (!vdec->params.frame_count) { in vdec_drain()
491 vdec->params.end_flag = 1; in vdec_drain()
492 vpu_iface_set_decode_params(inst, &vdec->params, 1); in vdec_drain()
493 vdec->drain = 0; in vdec_drain()
494 vpu_trace(inst->dev, "[%d] frame_count = %d\n", inst->id, vdec->params.frame_count); in vdec_drain()
501 struct vdec_t *vdec = inst->priv; in vdec_cmd_start() local
513 if (vdec->eos_received) in vdec_cmd_start()
520 struct vdec_t *vdec = inst->priv; in vdec_cmd_stop() local
527 vdec->drain = 1; in vdec_cmd_stop()
603 struct vdec_t *vdec = inst->priv; in vdec_check_ready() local
608 if (vdec->req_frame_count) in vdec_check_ready()
624 struct vdec_t *vdec = inst->priv; in vdec_frame_decoded() local
631 if (!info || info->id >= ARRAY_SIZE(vdec->slots)) in vdec_frame_decoded()
635 vpu_buf = vdec->slots[info->id]; in vdec_frame_decoded()
656 vdec->decoded_frame_count++; in vdec_frame_decoded()
665 struct vdec_t *vdec = inst->priv; in vdec_find_buffer() local
668 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) { in vdec_find_buffer()
669 if (!vdec->slots[i]) in vdec_find_buffer()
671 if (luma == vdec->slots[i]->luma) in vdec_find_buffer()
672 return vdec->slots[i]; in vdec_find_buffer()
680 struct vdec_t *vdec = inst->priv; in vdec_buf_done() local
689 sequence = vdec->sequence++; in vdec_buf_done()
718 vdec->display_frame_count++; in vdec_buf_done()
721 inst->id, vdec->decoded_frame_count, vdec->display_frame_count, vdec->sequence); in vdec_buf_done()
726 struct vdec_t *vdec = inst->priv; in vdec_stop_done() local
730 vdec->seq_hdr_found = 0; in vdec_stop_done()
731 vdec->req_frame_count = 0; in vdec_stop_done()
732 vdec->reset_codec = false; in vdec_stop_done()
733 vdec->fixed_fmt = false; in vdec_stop_done()
734 vdec->params.end_flag = 0; in vdec_stop_done()
735 vdec->drain = 0; in vdec_stop_done()
736 vdec->params.frame_count = 0; in vdec_stop_done()
737 vdec->decoded_frame_count = 0; in vdec_stop_done()
738 vdec->display_frame_count = 0; in vdec_stop_done()
739 vdec->sequence = 0; in vdec_stop_done()
740 vdec->eos_received = 0; in vdec_stop_done()
741 vdec->is_source_changed = false; in vdec_stop_done()
742 vdec->source_change = 0; in vdec_stop_done()
749 struct vdec_t *vdec = inst->priv; in vdec_check_source_change() local
758 fmt = vpu_helper_find_format(inst, inst->cap_format.type, vdec->codec_info.pixfmt); in vdec_check_source_change()
759 if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt) in vdec_check_source_change()
761 if (inst->cap_format.width != vdec->codec_info.decoded_width) in vdec_check_source_change()
763 if (inst->cap_format.height != vdec->codec_info.decoded_height) in vdec_check_source_change()
767 if (inst->crop.left != vdec->codec_info.offset_x) in vdec_check_source_change()
769 if (inst->crop.top != vdec->codec_info.offset_y) in vdec_check_source_change()
771 if (inst->crop.width != vdec->codec_info.width) in vdec_check_source_change()
773 if (inst->crop.height != vdec->codec_info.height) in vdec_check_source_change()
778 if (inst->cap_format.bytesperline[i] != vdec->codec_info.bytesperline[i]) in vdec_check_source_change()
780 if (inst->cap_format.sizeimage[i] != vdec->codec_info.sizeimage[i]) in vdec_check_source_change()
789 struct vdec_t *vdec = inst->priv; in vdec_init_fmt() local
793 fmt = vpu_helper_find_format(inst, inst->cap_format.type, vdec->codec_info.pixfmt); in vdec_init_fmt()
794 inst->out_format.width = vdec->codec_info.width; in vdec_init_fmt()
795 inst->out_format.height = vdec->codec_info.height; in vdec_init_fmt()
796 inst->cap_format.width = vdec->codec_info.decoded_width; in vdec_init_fmt()
797 inst->cap_format.height = vdec->codec_info.decoded_height; in vdec_init_fmt()
798 inst->cap_format.pixfmt = vdec->codec_info.pixfmt; in vdec_init_fmt()
804 inst->cap_format.bytesperline[i] = vdec->codec_info.bytesperline[i]; in vdec_init_fmt()
805 inst->cap_format.sizeimage[i] = vdec->codec_info.sizeimage[i]; in vdec_init_fmt()
807 if (vdec->codec_info.progressive) in vdec_init_fmt()
815 struct vdec_t *vdec = inst->priv; in vdec_init_crop() local
817 inst->crop.left = vdec->codec_info.offset_x; in vdec_init_crop()
818 inst->crop.top = vdec->codec_info.offset_y; in vdec_init_crop()
819 inst->crop.width = vdec->codec_info.width; in vdec_init_crop()
820 inst->crop.height = vdec->codec_info.height; in vdec_init_crop()
825 struct vdec_t *vdec = inst->priv; in vdec_init_mbi() local
827 vdec->mbi.size = vdec->codec_info.mbi_size; in vdec_init_mbi()
828 vdec->mbi.max_count = ARRAY_SIZE(vdec->mbi.buffer); in vdec_init_mbi()
829 scnprintf(vdec->mbi.name, sizeof(vdec->mbi.name), "mbi"); in vdec_init_mbi()
830 vdec->mbi.type = MEM_RES_MBI; in vdec_init_mbi()
831 vdec->mbi.tag = vdec->seq_tag; in vdec_init_mbi()
836 struct vdec_t *vdec = inst->priv; in vdec_init_dcp() local
838 vdec->dcp.size = vdec->codec_info.dcp_size; in vdec_init_dcp()
839 vdec->dcp.max_count = ARRAY_SIZE(vdec->dcp.buffer); in vdec_init_dcp()
840 scnprintf(vdec->dcp.name, sizeof(vdec->dcp.name), "dcp"); in vdec_init_dcp()
841 vdec->dcp.type = MEM_RES_DCP; in vdec_init_dcp()
842 vdec->dcp.tag = vdec->seq_tag; in vdec_init_dcp()
919 struct vdec_t *vdec = inst->priv; in vdec_response_frame_abnormal() local
922 if (!vdec->req_frame_count) in vdec_response_frame_abnormal()
927 info.tag = vdec->seq_tag + 0xf0; in vdec_response_frame_abnormal()
929 vdec->req_frame_count--; in vdec_response_frame_abnormal()
936 struct vdec_t *vdec = inst->priv; in vdec_response_frame() local
944 if (vdec->aborting) in vdec_response_frame()
947 if (!vdec->req_frame_count) in vdec_response_frame()
953 if (vdec->slots[vbuf->vb2_buf.index]) { in vdec_response_frame()
960 inst->id, inst->state, vbuf->vb2_buf.index, vdec->seq_tag); in vdec_response_frame()
966 info.tag = vdec->seq_tag; in vdec_response_frame()
981 vdec->slots[info.id] = vpu_buf; in vdec_response_frame()
982 vdec->req_frame_count--; in vdec_response_frame()
989 struct vdec_t *vdec = inst->priv; in vdec_response_fs_request() local
994 for (i = vdec->req_frame_count; i > 0; i--) in vdec_response_fs_request()
999 for (i = vdec->req_frame_count; i > 0; i--) { in vdec_response_fs_request()
1003 if (vdec->eos_received) in vdec_response_fs_request()
1007 for (i = vdec->mbi.index; i < vdec->mbi.count; i++) { in vdec_response_fs_request()
1008 if (vdec_response_fs(inst, &vdec->mbi)) in vdec_response_fs_request()
1010 if (vdec->eos_received) in vdec_response_fs_request()
1013 for (i = vdec->dcp.index; i < vdec->dcp.count; i++) { in vdec_response_fs_request()
1014 if (vdec_response_fs(inst, &vdec->dcp)) in vdec_response_fs_request()
1016 if (vdec->eos_received) in vdec_response_fs_request()
1044 struct vdec_t *vdec = inst->priv; in vdec_clear_slots() local
1049 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) { in vdec_clear_slots()
1050 if (!vdec->slots[i]) in vdec_clear_slots()
1053 vpu_buf = vdec->slots[i]; in vdec_clear_slots()
1059 vdec->slots[i]->state = VPU_BUF_STATE_IDLE; in vdec_clear_slots()
1060 vdec->slots[i] = NULL; in vdec_clear_slots()
1066 struct vdec_t *vdec = inst->priv; in vdec_event_seq_hdr() local
1069 memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info)); in vdec_event_seq_hdr()
1073 vdec->codec_info.decoded_width, in vdec_event_seq_hdr()
1074 vdec->codec_info.decoded_height, in vdec_event_seq_hdr()
1075 vdec->codec_info.offset_x, in vdec_event_seq_hdr()
1076 vdec->codec_info.offset_y, in vdec_event_seq_hdr()
1077 vdec->codec_info.width, in vdec_event_seq_hdr()
1078 vdec->codec_info.height, in vdec_event_seq_hdr()
1082 vdec->is_source_changed = vdec_check_source_change(inst); in vdec_event_seq_hdr()
1087 if (!vdec->seq_hdr_found) { in vdec_event_seq_hdr()
1088 vdec->seq_tag = vdec->codec_info.tag; in vdec_event_seq_hdr()
1089 if (vdec->is_source_changed) { in vdec_event_seq_hdr()
1092 vdec->is_source_changed = false; in vdec_event_seq_hdr()
1095 if (vdec->seq_tag != vdec->codec_info.tag) { in vdec_event_seq_hdr()
1098 inst->id, vdec->seq_tag, vdec->codec_info.tag); in vdec_event_seq_hdr()
1100 vdec->seq_hdr_found++; in vdec_event_seq_hdr()
1101 vdec->fixed_fmt = true; in vdec_event_seq_hdr()
1107 struct vdec_t *vdec = inst->priv; in vdec_event_resolution_change() local
1111 vdec->seq_tag = vdec->codec_info.tag; in vdec_event_resolution_change()
1112 vdec_clear_fs(&vdec->mbi); in vdec_event_resolution_change()
1113 vdec_clear_fs(&vdec->dcp); in vdec_event_resolution_change()
1117 if (vdec->is_source_changed) { in vdec_event_resolution_change()
1119 vdec->source_change++; in vdec_event_resolution_change()
1121 vdec->is_source_changed = false; in vdec_event_resolution_change()
1128 struct vdec_t *vdec = inst->priv; in vdec_event_req_fs() local
1137 vdec->req_frame_count++; in vdec_event_req_fs()
1140 vdec_request_one_fs(&vdec->mbi); in vdec_event_req_fs()
1143 vdec_request_one_fs(&vdec->dcp); in vdec_event_req_fs()
1149 vdec_alloc_fs(inst, &vdec->mbi); in vdec_event_req_fs()
1150 vdec_alloc_fs(inst, &vdec->dcp); in vdec_event_req_fs()
1159 struct vdec_t *vdec = inst->priv; in vdec_evnet_rel_fs() local
1163 if (!fs || fs->id >= ARRAY_SIZE(vdec->slots)) in vdec_evnet_rel_fs()
1174 vpu_buf = vdec->slots[fs->id]; in vdec_evnet_rel_fs()
1175 vdec->slots[fs->id] = NULL; in vdec_evnet_rel_fs()
1185 vdec->sequence++; in vdec_evnet_rel_fs()
1201 struct vdec_t *vdec = inst->priv; in vdec_event_eos() local
1205 vdec->params.frame_count, in vdec_event_eos()
1206 vdec->decoded_frame_count, in vdec_event_eos()
1207 vdec->display_frame_count, in vdec_event_eos()
1208 vdec->sequence); in vdec_event_eos()
1210 vdec->eos_received++; in vdec_event_eos()
1211 vdec->fixed_fmt = false; in vdec_event_eos()
1242 struct vdec_t *vdec = inst->priv; in vdec_process_output() local
1254 if (vdec->reset_codec) in vdec_process_output()
1274 vdec->params.frame_count++; in vdec_process_output()
1276 if (vdec->drain) in vdec_process_output()
1284 struct vdec_t *vdec = inst->priv; in vdec_process_capture() local
1290 if (vdec->reset_codec) in vdec_process_capture()
1302 struct vdec_t *vdec = inst->priv; in vdec_on_queue_empty() local
1308 if (vdec->eos_received) in vdec_on_queue_empty()
1314 struct vdec_t *vdec = inst->priv; in vdec_abort() local
1320 vdec->aborting = true; in vdec_abort()
1322 vdec->params.end_flag = 1; in vdec_abort()
1323 vpu_iface_set_decode_params(inst, &vdec->params, 1); in vdec_abort()
1334 vdec->params.frame_count, in vdec_abort()
1335 vdec->decoded_frame_count, in vdec_abort()
1336 vdec->display_frame_count, in vdec_abort()
1337 vdec->sequence); in vdec_abort()
1338 vdec->params.end_flag = 0; in vdec_abort()
1339 vdec->drain = 0; in vdec_abort()
1340 vdec->params.frame_count = 0; in vdec_abort()
1341 vdec->decoded_frame_count = 0; in vdec_abort()
1342 vdec->display_frame_count = 0; in vdec_abort()
1343 vdec->sequence = 0; in vdec_abort()
1344 vdec->aborting = false; in vdec_abort()
1349 struct vdec_t *vdec = inst->priv; in vdec_stop() local
1354 vdec_clear_fs(&vdec->mbi); in vdec_stop()
1355 vdec_clear_fs(&vdec->dcp); in vdec_stop()
1357 vpu_free_dma(&vdec->udata); in vdec_stop()
1361 vdec->reset_codec = false; in vdec_stop()
1375 struct vdec_t *vdec; in vdec_cleanup() local
1380 vdec = inst->priv; in vdec_cleanup()
1381 vfree(vdec); in vdec_cleanup()
1386 static void vdec_init_params(struct vdec_t *vdec) in vdec_init_params() argument
1388 vdec->params.frame_count = 0; in vdec_init_params()
1389 vdec->params.end_flag = 0; in vdec_init_params()
1394 struct vdec_t *vdec = inst->priv; in vdec_start() local
1402 if (!vdec->udata.virt) { in vdec_start()
1403 vdec->udata.length = 0x1000; in vdec_start()
1404 ret = vpu_alloc_dma(inst->core, &vdec->udata); in vdec_start()
1427 vdec->params.udata.base = vdec->udata.phys; in vdec_start()
1428 vdec->params.udata.size = vdec->udata.length; in vdec_start()
1429 ret = vpu_iface_set_decode_params(inst, &vdec->params, 0); in vdec_start()
1435 vdec_init_params(vdec); in vdec_start()
1446 vpu_free_dma(&vdec->udata); in vdec_start()
1453 struct vdec_t *vdec = inst->priv; in vdec_start_session() local
1457 if (vdec->reset_codec) in vdec_start_session()
1468 vdec_update_state(inst, vdec->state, 1); in vdec_start_session()
1469 vdec->eos_received = 0; in vdec_start_session()
1482 struct vdec_t *vdec = inst->priv; in vdec_stop_session() local
1489 vdec->drain = 0; in vdec_stop_session()
1493 vdec->eos_received = 0; in vdec_stop_session()
1503 struct vdec_t *vdec = inst->priv; in vdec_get_debug_info() local
1510 vdec->req_frame_count, in vdec_get_debug_info()
1511 vdec->codec_info.progressive ? 0 : 1); in vdec_get_debug_info()
1516 vdec->mbi.size, in vdec_get_debug_info()
1517 vdec->mbi.req_count, in vdec_get_debug_info()
1518 vdec->mbi.count, in vdec_get_debug_info()
1519 vdec->mbi.index); in vdec_get_debug_info()
1524 vdec->dcp.size, in vdec_get_debug_info()
1525 vdec->dcp.req_count, in vdec_get_debug_info()
1526 vdec->dcp.count, in vdec_get_debug_info()
1527 vdec->dcp.index); in vdec_get_debug_info()
1530 num = scnprintf(str, size, "input_frame_count = %d\n", vdec->params.frame_count); in vdec_get_debug_info()
1533 num = scnprintf(str, size, "decoded_frame_count = %d\n", vdec->decoded_frame_count); in vdec_get_debug_info()
1536 num = scnprintf(str, size, "display_frame_count = %d\n", vdec->display_frame_count); in vdec_get_debug_info()
1539 num = scnprintf(str, size, "sequence = %d\n", vdec->sequence); in vdec_get_debug_info()
1543 vdec->drain, vdec->eos_received, vdec->source_change); in vdec_get_debug_info()
1547 vdec->codec_info.frame_rate.numerator, in vdec_get_debug_info()
1548 vdec->codec_info.frame_rate.denominator); in vdec_get_debug_info()
1552 vdec->codec_info.color_primaries, in vdec_get_debug_info()
1553 vdec->codec_info.transfer_chars, in vdec_get_debug_info()
1554 vdec->codec_info.matrix_coeffs, in vdec_get_debug_info()
1555 vdec->codec_info.full_range, in vdec_get_debug_info()
1556 vdec->codec_info.vui_present); in vdec_get_debug_info()
1609 struct vdec_t *vdec; in vdec_open() local
1616 vdec = vzalloc(sizeof(*vdec)); in vdec_open()
1617 if (!vdec) { in vdec_open()
1625 inst->priv = vdec; in vdec_open()
1631 vdec->fixed_fmt = false; in vdec_open()