Lines Matching refs:vdec
205 struct vdec_t *vdec = inst->priv;
210 vdec->params.display_delay_enable = ctrl->val;
213 vdec->params.display_delay = ctrl->val;
304 struct vdec_t *vdec = inst->priv;
310 for (i = 0; i < vdec->slot_count; i++) {
311 if (addr == vdec->slots[i].addr) {
312 if (vdec->slots[i].curr && vdec->slots[i].curr != vpu_buf) {
314 vdec->slots[i].pend = vpu_buf;
316 vpu_set_buffer_state(vbuf, vdec->slots[i].state);
323 for (i = 0; i < vdec->slot_count; i++) {
324 if (!vdec->slots[i].addr) {
325 vdec->slots[i].addr = addr;
331 new_slots = krealloc_array(vdec->slots, vdec->slot_count * 2,
332 sizeof(*vdec->slots),
339 vdec->slots = new_slots;
340 vdec->slot_count *= 2;
342 vdec->slots[i].addr = addr;
348 struct vdec_t *vdec = inst->priv;
350 if (!vdec->slots || !vdec->slot_count)
354 memset(vdec->slots, 0, sizeof(*vdec->slots) * vdec->slot_count);
359 struct vdec_t *vdec = inst->priv;
367 if (!vdec->source_change)
374 vdec->source_change--;
381 struct vdec_t *vdec = inst->priv;
386 vdec->state = inst->state;
388 vdec->state = VPU_CODEC_STATE_ACTIVE;
393 vdec->state = VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE;
407 struct vdec_t *vdec = inst->priv;
412 if (vdec->eos_received) {
414 vdec->eos_received--;
432 struct vdec_t *vdec = inst->priv;
437 if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) {
461 struct vdec_t *vdec = inst->priv;
480 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries;
481 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars;
482 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs;
483 f->fmt.pix_mp.quantization = vdec->codec_info.full_range;
492 struct vdec_t *vdec = inst->priv;
496 if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) {
506 if (vdec->fixed_fmt) {
507 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries;
508 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars;
509 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs;
510 f->fmt.pix_mp.quantization = vdec->codec_info.full_range;
528 struct vdec_t *vdec = inst->priv;
546 vdec->reset_codec = true;
547 vdec->fixed_fmt = false;
550 if (V4L2_TYPE_IS_OUTPUT(f->type) || !vdec->fixed_fmt) {
568 if (!vdec->fixed_fmt) {
570 vdec->params.codec_format = cur_fmt->pixfmt;
571 vdec->codec_info.color_primaries = f->fmt.pix_mp.colorspace;
572 vdec->codec_info.transfer_chars = f->fmt.pix_mp.xfer_func;
573 vdec->codec_info.matrix_coeffs = f->fmt.pix_mp.ycbcr_enc;
574 vdec->codec_info.full_range = f->fmt.pix_mp.quantization;
576 vdec->params.output_format = cur_fmt->pixfmt;
599 struct vdec_t *vdec = inst->priv;
607 if (V4L2_TYPE_IS_OUTPUT(f->type) && !vdec->fixed_fmt) {
618 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries;
619 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars;
620 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs;
621 f->fmt.pix_mp.quantization = vdec->codec_info.full_range;
656 struct vdec_t *vdec = inst->priv;
661 if (!vdec->drain)
667 if (!vdec->params.frame_count) {
673 vdec->params.end_flag = 1;
674 vpu_iface_set_decode_params(inst, &vdec->params, 1);
675 vdec->drain = 0;
676 vpu_trace(inst->dev, "[%d] frame_count = %d\n", inst->id, vdec->params.frame_count);
683 struct vdec_t *vdec = inst->priv;
695 if (vdec->eos_received)
702 struct vdec_t *vdec = inst->priv;
709 vdec->drain = 1;
785 struct vdec_t *vdec = inst->priv;
790 if (vdec->req_frame_count)
806 struct vdec_t *vdec = inst->priv;
813 if (!info || info->id >= vdec->slot_count)
817 vpu_buf = vdec->slots[info->id].curr;
838 vdec->slots[info->id].state = VPU_BUF_STATE_DECODED;
839 vdec->decoded_frame_count++;
840 if (vdec->params.display_delay_enable) {
844 vdec->slots[info->id].state = VPU_BUF_STATE_READY;
850 vbuf->sequence = vdec->sequence++;
854 vdec->display_frame_count++;
864 struct vdec_t *vdec = inst->priv;
867 for (i = 0; i < vdec->slot_count; i++) {
868 if (!vdec->slots[i].curr)
870 if (luma == vdec->slots[i].addr)
871 return vdec->slots[i].curr;
879 struct vdec_t *vdec = inst->priv;
889 if (!vdec->params.display_delay_enable)
890 vdec->sequence++;
909 if (vdec->params.display_delay_enable)
919 vbuf->sequence = vdec->sequence;
923 vdec->slots[vpu_buf->fs_id].state = VPU_BUF_STATE_READY;
924 vdec->display_frame_count++;
928 inst->id, vdec->decoded_frame_count, vdec->display_frame_count, vdec->sequence);
933 struct vdec_t *vdec = inst->priv;
937 vdec->seq_hdr_found = 0;
938 vdec->req_frame_count = 0;
939 vdec->reset_codec = false;
940 vdec->fixed_fmt = false;
941 vdec->params.end_flag = 0;
942 vdec->drain = 0;
943 vdec->params.frame_count = 0;
944 vdec->decoded_frame_count = 0;
945 vdec->display_frame_count = 0;
946 vdec->sequence = 0;
947 vdec->eos_received = 0;
948 vdec->is_source_changed = false;
949 vdec->source_change = 0;
956 struct vdec_t *vdec = inst->priv;
962 if (vdec->reset_codec)
966 if (sibling && vdec->codec_info.pixfmt == sibling->pixfmt)
967 vdec->codec_info.pixfmt = inst->cap_format.pixfmt;
971 if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt)
973 if (inst->cap_format.width != vdec->codec_info.decoded_width)
975 if (inst->cap_format.height != vdec->codec_info.decoded_height)
979 if (inst->crop.left != vdec->codec_info.offset_x)
981 if (inst->crop.top != vdec->codec_info.offset_y)
983 if (inst->crop.width != vdec->codec_info.width)
985 if (inst->crop.height != vdec->codec_info.height)
993 struct vdec_t *vdec = inst->priv;
998 f.fmt.pix_mp.pixelformat = vdec->codec_info.pixfmt;
999 f.fmt.pix_mp.width = vdec->codec_info.decoded_width;
1000 f.fmt.pix_mp.height = vdec->codec_info.decoded_height;
1001 if (vdec->codec_info.progressive)
1007 inst->out_format.width = vdec->codec_info.width;
1008 inst->out_format.height = vdec->codec_info.height;
1013 struct vdec_t *vdec = inst->priv;
1015 inst->crop.left = vdec->codec_info.offset_x;
1016 inst->crop.top = vdec->codec_info.offset_y;
1017 inst->crop.width = vdec->codec_info.width;
1018 inst->crop.height = vdec->codec_info.height;
1023 struct vdec_t *vdec = inst->priv;
1025 vdec->mbi.size = vdec->codec_info.mbi_size;
1026 vdec->mbi.max_count = ARRAY_SIZE(vdec->mbi.buffer);
1027 scnprintf(vdec->mbi.name, sizeof(vdec->mbi.name), "mbi");
1028 vdec->mbi.type = MEM_RES_MBI;
1029 vdec->mbi.tag = vdec->seq_tag;
1034 struct vdec_t *vdec = inst->priv;
1036 vdec->dcp.size = vdec->codec_info.dcp_size;
1037 vdec->dcp.max_count = ARRAY_SIZE(vdec->dcp.buffer);
1038 scnprintf(vdec->dcp.name, sizeof(vdec->dcp.name), "dcp");
1039 vdec->dcp.type = MEM_RES_DCP;
1040 vdec->dcp.tag = vdec->seq_tag;
1117 struct vdec_t *vdec = inst->priv;
1121 if (!vdec->req_frame_count)
1126 info.tag = vdec->seq_tag + 0xf0;
1130 vdec->req_frame_count--;
1137 struct vdec_t *vdec = inst->priv;
1145 if (vdec->aborting)
1148 if (!vdec->req_frame_count)
1155 if (vpu_buf->fs_id < 0 || vpu_buf->fs_id >= vdec->slot_count) {
1161 if (vdec->slots[vpu_buf->fs_id].curr) {
1162 if (vdec->slots[vpu_buf->fs_id].curr != vpu_buf) {
1164 vdec->slots[vpu_buf->fs_id].pend = vpu_buf;
1166 vpu_set_buffer_state(vbuf, vdec->slots[vpu_buf->fs_id].state);
1174 inst->id, vpu_codec_state_name(inst->state), vbuf->vb2_buf.index, vdec->seq_tag);
1179 info.tag = vdec->seq_tag;
1196 vdec->slots[info.id].tag = info.tag;
1197 vdec->slots[info.id].curr = vpu_buf;
1198 vdec->slots[info.id].state = VPU_BUF_STATE_INUSE;
1199 vdec->req_frame_count--;
1206 struct vdec_t *vdec = inst->priv;
1211 for (i = vdec->req_frame_count; i > 0; i--)
1216 for (i = vdec->req_frame_count; i > 0; i--) {
1220 if (vdec->eos_received)
1224 for (i = vdec->mbi.index; i < vdec->mbi.count; i++) {
1225 if (vdec_response_fs(inst, &vdec->mbi))
1227 if (vdec->eos_received)
1230 for (i = vdec->dcp.index; i < vdec->dcp.count; i++) {
1231 if (vdec_response_fs(inst, &vdec->dcp))
1233 if (vdec->eos_received)
1261 struct vdec_t *vdec = inst->priv;
1265 if (id >= vdec->slot_count)
1267 if (!vdec->slots[id].curr)
1270 vpu_buf = vdec->slots[id].curr;
1273 vdec_response_fs_release(inst, id, vdec->slots[id].tag);
1280 vdec->slots[id].curr = NULL;
1281 vdec->slots[id].state = VPU_BUF_STATE_IDLE;
1283 if (vdec->slots[id].pend) {
1284 vpu_set_buffer_state(&vdec->slots[id].pend->m2m_buf.vb, VPU_BUF_STATE_IDLE);
1285 vdec->slots[id].pend = NULL;
1291 struct vdec_t *vdec = inst->priv;
1294 for (i = 0; i < vdec->slot_count; i++) {
1295 if (!vdec->slots[i].curr)
1334 struct vdec_t *vdec = inst->priv;
1337 memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info));
1341 vdec->codec_info.decoded_width,
1342 vdec->codec_info.decoded_height,
1343 vdec->codec_info.offset_x,
1344 vdec->codec_info.offset_y,
1345 vdec->codec_info.width,
1346 vdec->codec_info.height,
1350 vdec->is_source_changed = vdec_check_source_change(inst);
1356 if (!vdec->seq_hdr_found) {
1357 vdec->seq_tag = vdec->codec_info.tag;
1358 if (vdec->is_source_changed) {
1360 vdec->source_change++;
1362 vdec->is_source_changed = false;
1365 if (vdec->seq_tag != vdec->codec_info.tag) {
1368 inst->id, vdec->seq_tag, vdec->codec_info.tag);
1370 vdec->seq_hdr_found++;
1371 vdec->fixed_fmt = true;
1377 struct vdec_t *vdec = inst->priv;
1381 vdec->seq_tag = vdec->codec_info.tag;
1382 vdec_clear_fs(&vdec->mbi);
1383 vdec_clear_fs(&vdec->dcp);
1387 if (vdec->is_source_changed) {
1389 vdec->source_change++;
1391 vdec->is_source_changed = false;
1398 struct vdec_t *vdec = inst->priv;
1407 vdec->req_frame_count++;
1410 vdec_request_one_fs(&vdec->mbi);
1413 vdec_request_one_fs(&vdec->dcp);
1419 vdec_alloc_fs(inst, &vdec->mbi);
1420 vdec_alloc_fs(inst, &vdec->dcp);
1429 struct vdec_t *vdec = inst->priv;
1431 if (!fs || fs->id >= vdec->slot_count)
1436 if (fs->id >= vdec->slot_count) {
1442 if (!vdec->slots[fs->id].curr) {
1447 if (vdec->slots[fs->id].state == VPU_BUF_STATE_DECODED) {
1449 vdec->sequence++;
1461 struct vdec_t *vdec = inst->priv;
1465 vdec->params.frame_count,
1466 vdec->decoded_frame_count,
1467 vdec->display_frame_count,
1468 vdec->sequence);
1470 vdec->eos_received++;
1471 vdec->fixed_fmt = false;
1502 struct vdec_t *vdec = inst->priv;
1514 if (vdec->reset_codec)
1534 vdec->params.frame_count++;
1536 if (vdec->drain)
1544 struct vdec_t *vdec = inst->priv;
1550 if (vdec->reset_codec)
1562 struct vdec_t *vdec = inst->priv;
1568 if (vdec->eos_received)
1574 struct vdec_t *vdec = inst->priv;
1580 vdec->aborting = true;
1582 vdec->params.end_flag = 1;
1583 vpu_iface_set_decode_params(inst, &vdec->params, 1);
1594 vdec->params.frame_count,
1595 vdec->decoded_frame_count,
1596 vdec->display_frame_count,
1597 vdec->sequence);
1598 if (!vdec->seq_hdr_found)
1599 vdec->reset_codec = true;
1600 vdec->params.end_flag = 0;
1601 vdec->drain = 0;
1602 vdec->params.frame_count = 0;
1603 vdec->decoded_frame_count = 0;
1604 vdec->display_frame_count = 0;
1605 vdec->sequence = 0;
1606 vdec->aborting = false;
1612 struct vdec_t *vdec = inst->priv;
1617 vdec_clear_fs(&vdec->mbi);
1618 vdec_clear_fs(&vdec->dcp);
1620 vpu_free_dma(&vdec->udata);
1624 vdec->reset_codec = false;
1636 struct vdec_t *vdec;
1641 vdec = inst->priv;
1642 if (vdec) {
1643 kfree(vdec->slots);
1644 vdec->slots = NULL;
1645 vdec->slot_count = 0;
1647 vfree(vdec);
1652 static void vdec_init_params(struct vdec_t *vdec)
1654 vdec->params.frame_count = 0;
1655 vdec->params.end_flag = 0;
1660 struct vdec_t *vdec = inst->priv;
1668 if (!vdec->udata.virt) {
1669 vdec->udata.length = 0x1000;
1670 ret = vpu_alloc_dma(inst->core, &vdec->udata);
1693 vdec->params.udata.base = vdec->udata.phys;
1694 vdec->params.udata.size = vdec->udata.length;
1695 ret = vpu_iface_set_decode_params(inst, &vdec->params, 0);
1701 vdec_init_params(vdec);
1712 vpu_free_dma(&vdec->udata);
1719 struct vdec_t *vdec = inst->priv;
1723 if (vdec->reset_codec)
1733 vdec_update_state(inst, vdec->state, 1);
1734 vdec->eos_received = 0;
1747 struct vdec_t *vdec = inst->priv;
1754 vdec->drain = 0;
1760 vdec->eos_received = 0;
1770 struct vdec_t *vdec = inst->priv;
1775 if (i >= vdec->slot_count || !vdec->slots[i].addr)
1778 vpu_buf = vdec->slots[i].curr;
1784 num += scnprintf(str + num, size - num, "; state = %d", vdec->slots[i].state);
1789 if (vdec->slots[i].pend)
1791 vdec->slots[i].pend->m2m_buf.vb.vb2_buf.index);
1802 struct vdec_t *vdec = inst->priv;
1809 vdec->req_frame_count,
1810 vdec->codec_info.progressive ? 0 : 1);
1815 vdec->mbi.size,
1816 vdec->mbi.req_count,
1817 vdec->mbi.count,
1818 vdec->mbi.index);
1823 vdec->dcp.size,
1824 vdec->dcp.req_count,
1825 vdec->dcp.count,
1826 vdec->dcp.index);
1829 num = scnprintf(str, size, "input_frame_count = %d\n", vdec->params.frame_count);
1832 num = scnprintf(str, size, "decoded_frame_count = %d\n", vdec->decoded_frame_count);
1835 num = scnprintf(str, size, "display_frame_count = %d\n", vdec->display_frame_count);
1838 num = scnprintf(str, size, "sequence = %d\n", vdec->sequence);
1842 vdec->drain, vdec->eos_received, vdec->source_change);
1846 vdec->codec_info.frame_rate.numerator,
1847 vdec->codec_info.frame_rate.denominator);
1851 vdec->codec_info.color_primaries,
1852 vdec->codec_info.transfer_chars,
1853 vdec->codec_info.matrix_coeffs,
1854 vdec->codec_info.full_range,
1855 vdec->codec_info.vui_present);
1911 struct vdec_t *vdec;
1918 vdec = vzalloc(sizeof(*vdec));
1919 if (!vdec) {
1924 vdec->slots = kmalloc_array(VDEC_SLOT_CNT_DFT,
1925 sizeof(*vdec->slots),
1927 if (!vdec->slots) {
1928 vfree(vdec);
1932 vdec->slot_count = VDEC_SLOT_CNT_DFT;
1937 inst->priv = vdec;
1943 vdec->fixed_fmt = false;
1944 vdec->state = VPU_CODEC_STATE_ACTIVE;