Lines Matching refs: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
303 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_g_fmt()
304 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_g_fmt()
305 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_g_fmt()
306 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_g_fmt()
315 struct vdec_t *vdec = inst->priv; in vdec_try_fmt() local
320 if (vdec->fixed_fmt) { in vdec_try_fmt()
321 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_try_fmt()
322 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_try_fmt()
323 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_try_fmt()
324 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_try_fmt()
342 struct vdec_t *vdec = inst->priv; in vdec_s_fmt_common() local
361 vdec->reset_codec = true; in vdec_s_fmt_common()
362 vdec->fixed_fmt = false; in vdec_s_fmt_common()
366 if (V4L2_TYPE_IS_OUTPUT(f->type) || !vdec->fixed_fmt) { in vdec_s_fmt_common()
388 if (!vdec->fixed_fmt) { in vdec_s_fmt_common()
390 vdec->params.codec_format = cur_fmt->pixfmt; in vdec_s_fmt_common()
391 vdec->codec_info.color_primaries = f->fmt.pix_mp.colorspace; in vdec_s_fmt_common()
392 vdec->codec_info.transfer_chars = f->fmt.pix_mp.xfer_func; in vdec_s_fmt_common()
393 vdec->codec_info.matrix_coeffs = f->fmt.pix_mp.ycbcr_enc; in vdec_s_fmt_common()
394 vdec->codec_info.full_range = f->fmt.pix_mp.quantization; in vdec_s_fmt_common()
396 vdec->params.output_format = cur_fmt->pixfmt; in vdec_s_fmt_common()
419 struct vdec_t *vdec = inst->priv; in vdec_s_fmt() local
427 if (V4L2_TYPE_IS_OUTPUT(f->type) && !vdec->fixed_fmt) { in vdec_s_fmt()
438 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; in vdec_s_fmt()
439 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; in vdec_s_fmt()
440 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; in vdec_s_fmt()
441 f->fmt.pix_mp.quantization = vdec->codec_info.full_range; in vdec_s_fmt()
476 struct vdec_t *vdec = inst->priv; in vdec_drain() local
481 if (!vdec->drain) in vdec_drain()
487 if (!vdec->params.frame_count) { in vdec_drain()
493 vdec->params.end_flag = 1; in vdec_drain()
494 vpu_iface_set_decode_params(inst, &vdec->params, 1); in vdec_drain()
495 vdec->drain = 0; in vdec_drain()
496 vpu_trace(inst->dev, "[%d] frame_count = %d\n", inst->id, vdec->params.frame_count); in vdec_drain()
503 struct vdec_t *vdec = inst->priv; in vdec_cmd_start() local
515 if (vdec->eos_received) in vdec_cmd_start()
522 struct vdec_t *vdec = inst->priv; in vdec_cmd_stop() local
529 vdec->drain = 1; in vdec_cmd_stop()
605 struct vdec_t *vdec = inst->priv; in vdec_check_ready() local
610 if (vdec->req_frame_count) in vdec_check_ready()
626 struct vdec_t *vdec = inst->priv; in vdec_frame_decoded() local
633 if (!info || info->id >= ARRAY_SIZE(vdec->slots)) in vdec_frame_decoded()
637 vpu_buf = vdec->slots[info->id]; in vdec_frame_decoded()
658 vdec->decoded_frame_count++; in vdec_frame_decoded()
667 struct vdec_t *vdec = inst->priv; in vdec_find_buffer() local
670 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) { in vdec_find_buffer()
671 if (!vdec->slots[i]) in vdec_find_buffer()
673 if (luma == vdec->slots[i]->luma) in vdec_find_buffer()
674 return vdec->slots[i]; in vdec_find_buffer()
682 struct vdec_t *vdec = inst->priv; in vdec_buf_done() local
691 sequence = vdec->sequence++; in vdec_buf_done()
720 vdec->display_frame_count++; in vdec_buf_done()
723 inst->id, vdec->decoded_frame_count, vdec->display_frame_count, vdec->sequence); in vdec_buf_done()
728 struct vdec_t *vdec = inst->priv; in vdec_stop_done() local
732 vdec->seq_hdr_found = 0; in vdec_stop_done()
733 vdec->req_frame_count = 0; in vdec_stop_done()
734 vdec->reset_codec = false; in vdec_stop_done()
735 vdec->fixed_fmt = false; in vdec_stop_done()
736 vdec->params.end_flag = 0; in vdec_stop_done()
737 vdec->drain = 0; in vdec_stop_done()
738 vdec->params.frame_count = 0; in vdec_stop_done()
739 vdec->decoded_frame_count = 0; in vdec_stop_done()
740 vdec->display_frame_count = 0; in vdec_stop_done()
741 vdec->sequence = 0; in vdec_stop_done()
742 vdec->eos_received = 0; in vdec_stop_done()
743 vdec->is_source_changed = false; in vdec_stop_done()
744 vdec->source_change = 0; in vdec_stop_done()
751 struct vdec_t *vdec = inst->priv; in vdec_check_source_change() local
758 if (vdec->reset_codec) in vdec_check_source_change()
763 fmt = vpu_helper_find_format(inst, inst->cap_format.type, vdec->codec_info.pixfmt); in vdec_check_source_change()
764 if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt) in vdec_check_source_change()
766 if (inst->cap_format.width != vdec->codec_info.decoded_width) in vdec_check_source_change()
768 if (inst->cap_format.height != vdec->codec_info.decoded_height) in vdec_check_source_change()
772 if (inst->crop.left != vdec->codec_info.offset_x) in vdec_check_source_change()
774 if (inst->crop.top != vdec->codec_info.offset_y) in vdec_check_source_change()
776 if (inst->crop.width != vdec->codec_info.width) in vdec_check_source_change()
778 if (inst->crop.height != vdec->codec_info.height) in vdec_check_source_change()
783 if (inst->cap_format.bytesperline[i] != vdec->codec_info.bytesperline[i]) in vdec_check_source_change()
785 if (inst->cap_format.sizeimage[i] != vdec->codec_info.sizeimage[i]) in vdec_check_source_change()
794 struct vdec_t *vdec = inst->priv; in vdec_init_fmt() local
798 fmt = vpu_helper_find_format(inst, inst->cap_format.type, vdec->codec_info.pixfmt); in vdec_init_fmt()
799 inst->out_format.width = vdec->codec_info.width; in vdec_init_fmt()
800 inst->out_format.height = vdec->codec_info.height; in vdec_init_fmt()
801 inst->cap_format.width = vdec->codec_info.decoded_width; in vdec_init_fmt()
802 inst->cap_format.height = vdec->codec_info.decoded_height; in vdec_init_fmt()
803 inst->cap_format.pixfmt = vdec->codec_info.pixfmt; in vdec_init_fmt()
809 inst->cap_format.bytesperline[i] = vdec->codec_info.bytesperline[i]; in vdec_init_fmt()
810 inst->cap_format.sizeimage[i] = vdec->codec_info.sizeimage[i]; in vdec_init_fmt()
812 if (vdec->codec_info.progressive) in vdec_init_fmt()
820 struct vdec_t *vdec = inst->priv; in vdec_init_crop() local
822 inst->crop.left = vdec->codec_info.offset_x; in vdec_init_crop()
823 inst->crop.top = vdec->codec_info.offset_y; in vdec_init_crop()
824 inst->crop.width = vdec->codec_info.width; in vdec_init_crop()
825 inst->crop.height = vdec->codec_info.height; in vdec_init_crop()
830 struct vdec_t *vdec = inst->priv; in vdec_init_mbi() local
832 vdec->mbi.size = vdec->codec_info.mbi_size; in vdec_init_mbi()
833 vdec->mbi.max_count = ARRAY_SIZE(vdec->mbi.buffer); in vdec_init_mbi()
834 scnprintf(vdec->mbi.name, sizeof(vdec->mbi.name), "mbi"); in vdec_init_mbi()
835 vdec->mbi.type = MEM_RES_MBI; in vdec_init_mbi()
836 vdec->mbi.tag = vdec->seq_tag; in vdec_init_mbi()
841 struct vdec_t *vdec = inst->priv; in vdec_init_dcp() local
843 vdec->dcp.size = vdec->codec_info.dcp_size; in vdec_init_dcp()
844 vdec->dcp.max_count = ARRAY_SIZE(vdec->dcp.buffer); in vdec_init_dcp()
845 scnprintf(vdec->dcp.name, sizeof(vdec->dcp.name), "dcp"); in vdec_init_dcp()
846 vdec->dcp.type = MEM_RES_DCP; in vdec_init_dcp()
847 vdec->dcp.tag = vdec->seq_tag; in vdec_init_dcp()
924 struct vdec_t *vdec = inst->priv; in vdec_response_frame_abnormal() local
927 if (!vdec->req_frame_count) in vdec_response_frame_abnormal()
932 info.tag = vdec->seq_tag + 0xf0; in vdec_response_frame_abnormal()
934 vdec->req_frame_count--; in vdec_response_frame_abnormal()
941 struct vdec_t *vdec = inst->priv; in vdec_response_frame() local
949 if (vdec->aborting) in vdec_response_frame()
952 if (!vdec->req_frame_count) in vdec_response_frame()
958 if (vdec->slots[vbuf->vb2_buf.index]) { in vdec_response_frame()
965 inst->id, inst->state, vbuf->vb2_buf.index, vdec->seq_tag); in vdec_response_frame()
971 info.tag = vdec->seq_tag; in vdec_response_frame()
986 vdec->slots[info.id] = vpu_buf; in vdec_response_frame()
987 vdec->req_frame_count--; in vdec_response_frame()
994 struct vdec_t *vdec = inst->priv; in vdec_response_fs_request() local
999 for (i = vdec->req_frame_count; i > 0; i--) in vdec_response_fs_request()
1004 for (i = vdec->req_frame_count; i > 0; i--) { in vdec_response_fs_request()
1008 if (vdec->eos_received) in vdec_response_fs_request()
1012 for (i = vdec->mbi.index; i < vdec->mbi.count; i++) { in vdec_response_fs_request()
1013 if (vdec_response_fs(inst, &vdec->mbi)) in vdec_response_fs_request()
1015 if (vdec->eos_received) in vdec_response_fs_request()
1018 for (i = vdec->dcp.index; i < vdec->dcp.count; i++) { in vdec_response_fs_request()
1019 if (vdec_response_fs(inst, &vdec->dcp)) in vdec_response_fs_request()
1021 if (vdec->eos_received) in vdec_response_fs_request()
1049 struct vdec_t *vdec = inst->priv; in vdec_clear_slots() local
1054 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) { in vdec_clear_slots()
1055 if (!vdec->slots[i]) in vdec_clear_slots()
1058 vpu_buf = vdec->slots[i]; in vdec_clear_slots()
1064 vdec->slots[i]->state = VPU_BUF_STATE_IDLE; in vdec_clear_slots()
1065 vdec->slots[i] = NULL; in vdec_clear_slots()
1071 struct vdec_t *vdec = inst->priv; in vdec_event_seq_hdr() local
1074 memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info)); in vdec_event_seq_hdr()
1078 vdec->codec_info.decoded_width, in vdec_event_seq_hdr()
1079 vdec->codec_info.decoded_height, in vdec_event_seq_hdr()
1080 vdec->codec_info.offset_x, in vdec_event_seq_hdr()
1081 vdec->codec_info.offset_y, in vdec_event_seq_hdr()
1082 vdec->codec_info.width, in vdec_event_seq_hdr()
1083 vdec->codec_info.height, in vdec_event_seq_hdr()
1087 vdec->is_source_changed = vdec_check_source_change(inst); in vdec_event_seq_hdr()
1092 if (!vdec->seq_hdr_found) { in vdec_event_seq_hdr()
1093 vdec->seq_tag = vdec->codec_info.tag; in vdec_event_seq_hdr()
1094 if (vdec->is_source_changed) { in vdec_event_seq_hdr()
1096 vdec->source_change++; in vdec_event_seq_hdr()
1098 vdec->is_source_changed = false; in vdec_event_seq_hdr()
1101 if (vdec->seq_tag != vdec->codec_info.tag) { in vdec_event_seq_hdr()
1104 inst->id, vdec->seq_tag, vdec->codec_info.tag); in vdec_event_seq_hdr()
1106 vdec->seq_hdr_found++; in vdec_event_seq_hdr()
1107 vdec->fixed_fmt = true; in vdec_event_seq_hdr()
1113 struct vdec_t *vdec = inst->priv; in vdec_event_resolution_change() local
1117 vdec->seq_tag = vdec->codec_info.tag; in vdec_event_resolution_change()
1118 vdec_clear_fs(&vdec->mbi); in vdec_event_resolution_change()
1119 vdec_clear_fs(&vdec->dcp); in vdec_event_resolution_change()
1123 if (vdec->is_source_changed) { in vdec_event_resolution_change()
1125 vdec->source_change++; in vdec_event_resolution_change()
1127 vdec->is_source_changed = false; in vdec_event_resolution_change()
1134 struct vdec_t *vdec = inst->priv; in vdec_event_req_fs() local
1143 vdec->req_frame_count++; in vdec_event_req_fs()
1146 vdec_request_one_fs(&vdec->mbi); in vdec_event_req_fs()
1149 vdec_request_one_fs(&vdec->dcp); in vdec_event_req_fs()
1155 vdec_alloc_fs(inst, &vdec->mbi); in vdec_event_req_fs()
1156 vdec_alloc_fs(inst, &vdec->dcp); in vdec_event_req_fs()
1165 struct vdec_t *vdec = inst->priv; in vdec_evnet_rel_fs() local
1169 if (!fs || fs->id >= ARRAY_SIZE(vdec->slots)) in vdec_evnet_rel_fs()
1180 vpu_buf = vdec->slots[fs->id]; in vdec_evnet_rel_fs()
1181 vdec->slots[fs->id] = NULL; in vdec_evnet_rel_fs()
1191 vdec->sequence++; in vdec_evnet_rel_fs()
1207 struct vdec_t *vdec = inst->priv; in vdec_event_eos() local
1211 vdec->params.frame_count, in vdec_event_eos()
1212 vdec->decoded_frame_count, in vdec_event_eos()
1213 vdec->display_frame_count, in vdec_event_eos()
1214 vdec->sequence); in vdec_event_eos()
1216 vdec->eos_received++; in vdec_event_eos()
1217 vdec->fixed_fmt = false; in vdec_event_eos()
1248 struct vdec_t *vdec = inst->priv; in vdec_process_output() local
1260 if (vdec->reset_codec) in vdec_process_output()
1280 vdec->params.frame_count++; in vdec_process_output()
1282 if (vdec->drain) in vdec_process_output()
1290 struct vdec_t *vdec = inst->priv; in vdec_process_capture() local
1296 if (vdec->reset_codec) in vdec_process_capture()
1308 struct vdec_t *vdec = inst->priv; in vdec_on_queue_empty() local
1314 if (vdec->eos_received) in vdec_on_queue_empty()
1320 struct vdec_t *vdec = inst->priv; in vdec_abort() local
1326 vdec->aborting = true; in vdec_abort()
1328 vdec->params.end_flag = 1; in vdec_abort()
1329 vpu_iface_set_decode_params(inst, &vdec->params, 1); in vdec_abort()
1340 vdec->params.frame_count, in vdec_abort()
1341 vdec->decoded_frame_count, in vdec_abort()
1342 vdec->display_frame_count, in vdec_abort()
1343 vdec->sequence); in vdec_abort()
1344 if (!vdec->seq_hdr_found) in vdec_abort()
1345 vdec->reset_codec = true; in vdec_abort()
1346 vdec->params.end_flag = 0; in vdec_abort()
1347 vdec->drain = 0; in vdec_abort()
1348 vdec->params.frame_count = 0; in vdec_abort()
1349 vdec->decoded_frame_count = 0; in vdec_abort()
1350 vdec->display_frame_count = 0; in vdec_abort()
1351 vdec->sequence = 0; in vdec_abort()
1352 vdec->aborting = false; in vdec_abort()
1358 struct vdec_t *vdec = inst->priv; in vdec_stop() local
1363 vdec_clear_fs(&vdec->mbi); in vdec_stop()
1364 vdec_clear_fs(&vdec->dcp); in vdec_stop()
1366 vpu_free_dma(&vdec->udata); in vdec_stop()
1370 vdec->reset_codec = false; in vdec_stop()
1384 struct vdec_t *vdec; in vdec_cleanup() local
1389 vdec = inst->priv; in vdec_cleanup()
1390 vfree(vdec); in vdec_cleanup()
1395 static void vdec_init_params(struct vdec_t *vdec) in vdec_init_params() argument
1397 vdec->params.frame_count = 0; in vdec_init_params()
1398 vdec->params.end_flag = 0; in vdec_init_params()
1403 struct vdec_t *vdec = inst->priv; in vdec_start() local
1411 if (!vdec->udata.virt) { in vdec_start()
1412 vdec->udata.length = 0x1000; in vdec_start()
1413 ret = vpu_alloc_dma(inst->core, &vdec->udata); in vdec_start()
1436 vdec->params.udata.base = vdec->udata.phys; in vdec_start()
1437 vdec->params.udata.size = vdec->udata.length; in vdec_start()
1438 ret = vpu_iface_set_decode_params(inst, &vdec->params, 0); in vdec_start()
1444 vdec_init_params(vdec); in vdec_start()
1455 vpu_free_dma(&vdec->udata); in vdec_start()
1462 struct vdec_t *vdec = inst->priv; in vdec_start_session() local
1466 if (vdec->reset_codec) in vdec_start_session()
1476 vdec_update_state(inst, vdec->state, 1); in vdec_start_session()
1477 vdec->eos_received = 0; in vdec_start_session()
1490 struct vdec_t *vdec = inst->priv; in vdec_stop_session() local
1497 vdec->drain = 0; in vdec_stop_session()
1501 vdec->eos_received = 0; in vdec_stop_session()
1511 struct vdec_t *vdec = inst->priv; in vdec_get_debug_info() local
1518 vdec->req_frame_count, in vdec_get_debug_info()
1519 vdec->codec_info.progressive ? 0 : 1); in vdec_get_debug_info()
1524 vdec->mbi.size, in vdec_get_debug_info()
1525 vdec->mbi.req_count, in vdec_get_debug_info()
1526 vdec->mbi.count, in vdec_get_debug_info()
1527 vdec->mbi.index); in vdec_get_debug_info()
1532 vdec->dcp.size, in vdec_get_debug_info()
1533 vdec->dcp.req_count, in vdec_get_debug_info()
1534 vdec->dcp.count, in vdec_get_debug_info()
1535 vdec->dcp.index); in vdec_get_debug_info()
1538 num = scnprintf(str, size, "input_frame_count = %d\n", vdec->params.frame_count); in vdec_get_debug_info()
1541 num = scnprintf(str, size, "decoded_frame_count = %d\n", vdec->decoded_frame_count); in vdec_get_debug_info()
1544 num = scnprintf(str, size, "display_frame_count = %d\n", vdec->display_frame_count); in vdec_get_debug_info()
1547 num = scnprintf(str, size, "sequence = %d\n", vdec->sequence); in vdec_get_debug_info()
1551 vdec->drain, vdec->eos_received, vdec->source_change); in vdec_get_debug_info()
1555 vdec->codec_info.frame_rate.numerator, in vdec_get_debug_info()
1556 vdec->codec_info.frame_rate.denominator); in vdec_get_debug_info()
1560 vdec->codec_info.color_primaries, in vdec_get_debug_info()
1561 vdec->codec_info.transfer_chars, in vdec_get_debug_info()
1562 vdec->codec_info.matrix_coeffs, in vdec_get_debug_info()
1563 vdec->codec_info.full_range, in vdec_get_debug_info()
1564 vdec->codec_info.vui_present); in vdec_get_debug_info()
1617 struct vdec_t *vdec; in vdec_open() local
1624 vdec = vzalloc(sizeof(*vdec)); in vdec_open()
1625 if (!vdec) { in vdec_open()
1633 inst->priv = vdec; in vdec_open()
1639 vdec->fixed_fmt = false; in vdec_open()
1640 vdec->state = VPU_CODEC_STATE_ACTIVE; in vdec_open()