Lines Matching refs:len
211 static uint32_t remove_03 (uint8_t *bptr, uint32_t len);
561 int len, r;
576 len = 0;
578 vcn_dec_cmd(session_ctx_buf.addr, 5, &len);
580 vcn_dec_cmd(msg_buf.addr, 0, &len);
582 ib_cpu[len++] = reg[vcn_reg_index].data0;
583 ib_cpu[len++] = msg_buf.addr;
584 ib_cpu[len++] = reg[vcn_reg_index].data1;
585 ib_cpu[len++] = msg_buf.addr >> 32;
586 ib_cpu[len++] = reg[vcn_reg_index].cmd;
587 ib_cpu[len++] = 0;
588 for (; len % 16; ) {
589 ib_cpu[len++] = reg[vcn_reg_index].nop;
590 ib_cpu[len++] = 0;
595 amdgpu_cs_sq_ib_tail(ib_cpu + len);
600 r = submit(len, ip);
612 int size, len, i, r;
657 len = 0;
658 vcn_dec_cmd(session_ctx_buf.addr, 0x5, &len);
659 vcn_dec_cmd(msg_addr, 0x0, &len);
660 vcn_dec_cmd(dpb_addr, 0x1, &len);
661 vcn_dec_cmd(dt_addr, 0x2, &len);
662 vcn_dec_cmd(fb_addr, 0x3, &len);
663 vcn_dec_cmd(bs_addr, 0x100, &len);
664 vcn_dec_cmd(it_addr, 0x204, &len);
665 vcn_dec_cmd(ctx_addr, 0x206, &len);
668 ib_cpu[len++] = reg[vcn_reg_index].cntl;
669 ib_cpu[len++] = 0x1;
670 for (; len % 16; ) {
671 ib_cpu[len++] = reg[vcn_reg_index].nop;
672 ib_cpu[len++] = 0;
677 amdgpu_cs_sq_ib_tail(ib_cpu + len);
682 r = submit(len, ip);
697 int len, r;
710 len = 0;
711 vcn_dec_cmd(session_ctx_buf.addr, 5, &len);
713 vcn_dec_cmd(msg_buf.addr, 0, &len);
715 ib_cpu[len++] = reg[vcn_reg_index].data0;
716 ib_cpu[len++] = msg_buf.addr;
717 ib_cpu[len++] = reg[vcn_reg_index].data1;
718 ib_cpu[len++] = msg_buf.addr >> 32;
719 ib_cpu[len++] = reg[vcn_reg_index].cmd;
720 ib_cpu[len++] = 0;
721 for (; len % 16; ) {
722 ib_cpu[len++] = reg[vcn_reg_index].nop;
723 ib_cpu[len++] = 0;
728 amdgpu_cs_sq_ib_tail(ib_cpu + len);
733 r = submit(len, ip);
742 int len, r;
777 len = 0;
780 amdgpu_cs_sq_head(ib_cpu, &len, true);
783 st_offset = len;
784 st_size = &ib_cpu[len++]; /* size */
785 ib_cpu[len++] = 0x00000001; /* RENCODE_IB_PARAM_SESSION_INFO */
786 ib_cpu[len++] = ((fw_maj << 16) | (fw_min << 0));
787 ib_cpu[len++] = enc_buf.addr >> 32;
788 ib_cpu[len++] = enc_buf.addr;
789 ib_cpu[len++] = 1; /* RENCODE_ENGINE_TYPE_ENCODE; */
790 *st_size = (len - st_offset) * 4;
793 task_offset = len;
794 st_offset = len;
795 st_size = &ib_cpu[len++]; /* size */
796 ib_cpu[len++] = 0x00000002; /* RENCODE_IB_PARAM_TASK_INFO */
797 p_task_size = &ib_cpu[len++];
798 ib_cpu[len++] = enc_task_id++; /* task_id */
799 ib_cpu[len++] = 0; /* feedback */
800 *st_size = (len - st_offset) * 4;
803 st_offset = len;
804 st_size = &ib_cpu[len++]; /* size */
805 ib_cpu[len++] = 0x01000001; /* RENCODE_IB_OP_INITIALIZE */
806 *st_size = (len - st_offset) * 4;
809 st_offset = len;
810 st_size = &ib_cpu[len++]; /* size */
811 ib_cpu[len++] = 0x00000003; /* RENCODE_IB_PARAM_SESSION_INIT */
812 ib_cpu[len++] = 1; /* RENCODE_ENCODE_STANDARD_H264 */
813 ib_cpu[len++] = width;
814 ib_cpu[len++] = height;
815 ib_cpu[len++] = 0;
816 ib_cpu[len++] = 0;
817 ib_cpu[len++] = 0; /* pre encode mode */
818 ib_cpu[len++] = 0; /* chroma enabled : false */
819 ib_cpu[len++] = 0;
820 ib_cpu[len++] = 0;
821 *st_size = (len - st_offset) * 4;
824 st_offset = len;
825 st_size = &ib_cpu[len++]; /* size */
826 ib_cpu[len++] = 0x00200001; /* RENCODE_H264_IB_PARAM_SLICE_CONTROL */
827 ib_cpu[len++] = 0; /* RENCODE_H264_SLICE_CONTROL_MODE_FIXED_MBS */
828 ib_cpu[len++] = ALIGN(width, 16) / 16 * ALIGN(height, 16) / 16;
829 *st_size = (len - st_offset) * 4;
832 st_offset = len;
833 st_size = &ib_cpu[len++]; /* size */
834 ib_cpu[len++] = 0x00200002; /* RENCODE_H264_IB_PARAM_SPEC_MISC */
835 ib_cpu[len++] = 0; /* constrained intra pred flag */
836 ib_cpu[len++] = 0; /* cabac enable */
837 ib_cpu[len++] = 0; /* cabac init idc */
838 ib_cpu[len++] = 1; /* half pel enabled */
839 ib_cpu[len++] = 1; /* quarter pel enabled */
840 ib_cpu[len++] = 100; /* BASELINE profile */
841 ib_cpu[len++] = 11; /* level */
843 ib_cpu[len++] = 0; /* b_picture_enabled */
844 ib_cpu[len++] = 0; /* weighted_bipred_idc */
846 *st_size = (len - st_offset) * 4;
849 st_offset = len;
850 st_size = &ib_cpu[len++]; /* size */
851 ib_cpu[len++] = 0x00200004; /* RENCODE_H264_IB_PARAM_DEBLOCKING_FILTER */
852 ib_cpu[len++] = 0; /* disable deblocking filter idc */
853 ib_cpu[len++] = 0; /* alpha c0 offset */
854 ib_cpu[len++] = 0; /* tc offset */
855 ib_cpu[len++] = 0; /* cb offset */
856 ib_cpu[len++] = 0; /* cr offset */
857 *st_size = (len - st_offset) * 4;
860 st_offset = len;
861 st_size = &ib_cpu[len++]; /* size */
862 ib_cpu[len++] = 0x00000004; /* RENCODE_IB_PARAM_LAYER_CONTROL */
863 ib_cpu[len++] = 1; /* max temporal layer */
864 ib_cpu[len++] = 1; /* no of temporal layer */
865 *st_size = (len - st_offset) * 4;
868 st_offset = len;
869 st_size = &ib_cpu[len++]; /* size */
870 ib_cpu[len++] = 0x00000006; /* RENCODE_IB_PARAM_RATE_CONTROL_SESSION_INIT */
871 ib_cpu[len++] = 0; /* rate control */
872 ib_cpu[len++] = 48; /* vbv buffer level */
873 *st_size = (len - st_offset) * 4;
876 st_offset = len;
877 st_size = &ib_cpu[len++]; /* size */
878 ib_cpu[len++] = 0x00000009; /* RENCODE_IB_PARAM_QUALITY_PARAMS */
879 ib_cpu[len++] = 0; /* vbaq mode */
880 ib_cpu[len++] = 0; /* scene change sensitivity */
881 ib_cpu[len++] = 0; /* scene change min idr interval */
882 ib_cpu[len++] = 0;
884 ib_cpu[len++] = 0;
885 *st_size = (len - st_offset) * 4;
888 st_offset = len;
889 st_size = &ib_cpu[len++]; /* size */
890 ib_cpu[len++] = 0x00000005; /* RENCODE_IB_PARAM_LAYER_SELECT */
891 ib_cpu[len++] = 0; /* temporal layer */
892 *st_size = (len - st_offset) * 4;
895 st_offset = len;
896 st_size = &ib_cpu[len++]; /* size */
897 ib_cpu[len++] = 0x00000007; /* RENCODE_IB_PARAM_RATE_CONTROL_LAYER_INIT */
898 ib_cpu[len++] = 0;
899 ib_cpu[len++] = 0;
900 ib_cpu[len++] = 25;
901 ib_cpu[len++] = 1;
902 ib_cpu[len++] = 0x01312d00;
903 ib_cpu[len++] = 0;
904 ib_cpu[len++] = 0;
905 ib_cpu[len++] = 0;
906 *st_size = (len - st_offset) * 4;
909 st_offset = len;
910 st_size = &ib_cpu[len++]; /* size */
911 ib_cpu[len++] = 0x00000005; /* RENCODE_IB_PARAM_LAYER_SELECT */
912 ib_cpu[len++] = 0; /* temporal layer */
913 *st_size = (len - st_offset) * 4;
916 st_offset = len;
917 st_size = &ib_cpu[len++]; /* size */
918 ib_cpu[len++] = 0x00000008; /* RENCODE_IB_PARAM_RATE_CONTROL_PER_PICTURE */
919 ib_cpu[len++] = 20;
920 ib_cpu[len++] = 0;
921 ib_cpu[len++] = 51;
922 ib_cpu[len++] = 0;
923 ib_cpu[len++] = 1;
924 ib_cpu[len++] = 0;
925 ib_cpu[len++] = 1;
926 ib_cpu[len++] = 0;
927 *st_size = (len - st_offset) * 4;
930 st_offset = len;
931 st_size = &ib_cpu[len++]; /* size */
932 ib_cpu[len++] = 0x01000004; /* RENCODE_IB_OP_INIT_RC */
933 *st_size = (len - st_offset) * 4;
936 st_offset = len;
937 st_size = &ib_cpu[len++]; /* size */
938 ib_cpu[len++] = 0x01000005; /* RENCODE_IB_OP_INIT_RC_VBV_BUFFER_LEVEL */
939 *st_size = (len - st_offset) * 4;
941 *p_task_size = (len - task_offset) * 4;
944 amdgpu_cs_sq_ib_tail(ib_cpu + len);
946 r = submit(len, AMDGPU_HW_IP_VCN_ENC);
1027 static uint32_t remove_03 (uint8_t * bptr, uint32_t len)
1030 while (nal_len + 2 < len) {
1034 len--;
1035 memmove (bptr, bptr + 1, len - nal_len);
1041 return len;
1279 static void amdgpu_cs_vcn_ib_zero_count(int *len, int num)
1282 ib_cpu[(*len)++] = 0;
1288 int len, r;
1334 len = 0;
1337 amdgpu_cs_sq_head(ib_cpu, &len, true);
1340 st_offset = len;
1341 st_size = &ib_cpu[len++]; /* size */
1342 ib_cpu[len++] = 0x00000001; /* RENCODE_IB_PARAM_SESSION_INFO */
1343 ib_cpu[len++] = ((fw_maj << 16) | (fw_min << 0));
1344 ib_cpu[len++] = enc_buf.addr >> 32;
1345 ib_cpu[len++] = enc_buf.addr;
1346 ib_cpu[len++] = 1; /* RENCODE_ENGINE_TYPE_ENCODE */;
1347 *st_size = (len - st_offset) * 4;
1350 task_offset = len;
1351 st_offset = len;
1352 st_size = &ib_cpu[len++]; /* size */
1353 ib_cpu[len++] = 0x00000002; /* RENCODE_IB_PARAM_TASK_INFO */
1354 p_task_size = &ib_cpu[len++];
1355 ib_cpu[len++] = enc_task_id++; /* task_id */
1356 ib_cpu[len++] = 1; /* feedback */
1357 *st_size = (len - st_offset) * 4;
1361 st_offset = len;
1362 st_size = &ib_cpu[len++]; /* size */
1364 ib_cpu[len++] = 0x00000020; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 1 */
1366 ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU other vcn */
1367 ib_cpu[len++] = 0x00000002; /* RENCODE_DIRECT_OUTPUT_NALU_TYPE_SPS */
1368 ib_cpu[len++] = 0x00000011; /* sps len */
1369 ib_cpu[len++] = 0x00000001; /* start code */
1370 ib_cpu[len++] = 0x6764440b;
1371 ib_cpu[len++] = 0xac54c284;
1372 ib_cpu[len++] = 0x68078442;
1373 ib_cpu[len++] = 0x37000000;
1374 *st_size = (len - st_offset) * 4;
1377 st_offset = len;
1378 st_size = &ib_cpu[len++]; /* size */
1380 ib_cpu[len++] = 0x00000020; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 1*/
1382 ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU other vcn*/
1383 ib_cpu[len++] = 0x00000003; /* RENCODE_DIRECT_OUTPUT_NALU_TYPE_PPS */
1384 ib_cpu[len++] = 0x00000008; /* pps len */
1385 ib_cpu[len++] = 0x00000001; /* start code */
1386 ib_cpu[len++] = 0x68ce3c80;
1387 *st_size = (len - st_offset) * 4;
1391 st_offset = len;
1392 st_size = &ib_cpu[len++]; /* size */
1394 ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_SLICE_HEADER vcn 1 */
1396 ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_SLICE_HEADER other vcn */
1398 ib_cpu[len++] = 0x65000000;
1399 ib_cpu[len++] = 0x11040000;
1401 ib_cpu[len++] = 0x41000000;
1402 ib_cpu[len++] = 0x34210000;
1404 ib_cpu[len++] = 0xe0000000;
1405 amdgpu_cs_vcn_ib_zero_count(&len, 13);
1407 ib_cpu[len++] = 0x00000001;
1408 ib_cpu[len++] = 0x00000008;
1409 ib_cpu[len++] = 0x00020000;
1410 ib_cpu[len++] = 0x00000000;
1411 ib_cpu[len++] = 0x00000001;
1412 ib_cpu[len++] = 0x00000015;
1413 ib_cpu[len++] = 0x00020001;
1414 ib_cpu[len++] = 0x00000000;
1415 ib_cpu[len++] = 0x00000001;
1416 ib_cpu[len++] = 0x00000003;
1417 amdgpu_cs_vcn_ib_zero_count(&len, 22);
1418 *st_size = (len - st_offset) * 4;
1421 st_offset = len;
1422 st_size = &ib_cpu[len++]; /* size */
1424 ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_ENCODE_PARAMS vcn 1 */
1426 ib_cpu[len++] = 0x0000000f; /* RENCODE_IB_PARAM_ENCODE_PARAMS other vcn */
1427 ib_cpu[len++] = frame_type;
1428 ib_cpu[len++] = 0x0001f000;
1429 ib_cpu[len++] = input_buf.addr >> 32;
1430 ib_cpu[len++] = input_buf.addr;
1431 ib_cpu[len++] = (input_buf.addr + ALIGN(width, 256) * ALIGN(height, 32)) >> 32;
1432 ib_cpu[len++] = input_buf.addr + ALIGN(width, 256) * ALIGN(height, 32);
1433 ib_cpu[len++] = 0x00000100;
1434 ib_cpu[len++] = 0x00000080;
1435 ib_cpu[len++] = 0x00000000;
1436 ib_cpu[len++] = 0xffffffff;
1437 ib_cpu[len++] = 0x00000000;
1438 *st_size = (len - st_offset) * 4;
1441 st_offset = len;
1442 st_size = &ib_cpu[len++]; /* size */
1443 ib_cpu[len++] = 0x00200003; /* RENCODE_H264_IB_PARAM_ENCODE_PARAMS */
1445 ib_cpu[len++] = 0x00000000;
1446 ib_cpu[len++] = 0x00000000;
1447 ib_cpu[len++] = 0x00000000;
1448 ib_cpu[len++] = 0xffffffff;
1450 ib_cpu[len++] = 0x00000000;
1451 ib_cpu[len++] = 0x00000000;
1452 ib_cpu[len++] = 0x00000000;
1453 ib_cpu[len++] = 0x00000000;
1454 ib_cpu[len++] = 0x00000000;
1455 ib_cpu[len++] = 0x00000000;
1456 ib_cpu[len++] = 0x00000000;
1457 ib_cpu[len++] = 0xffffffff;
1458 ib_cpu[len++] = 0x00000000;
1459 ib_cpu[len++] = 0x00000000;
1460 ib_cpu[len++] = 0x00000000;
1461 ib_cpu[len++] = 0x00000000;
1462 ib_cpu[len++] = 0xffffffff;
1463 ib_cpu[len++] = 0x00000000;
1464 ib_cpu[len++] = 0x00000000;
1465 ib_cpu[len++] = 0x00000000;
1466 ib_cpu[len++] = 0x00000000;
1467 ib_cpu[len++] = 0x00000001;
1469 *st_size = (len - st_offset) * 4;
1472 st_offset = len;
1473 st_size = &ib_cpu[len++]; /* size */
1475 ib_cpu[len++] = 0x0000000d; /* ENCODE_CONTEXT_BUFFER vcn 1 */
1477 ib_cpu[len++] = 0x00000011; /* ENCODE_CONTEXT_BUFFER other vcn */
1478 ib_cpu[len++] = cpb_buf.addr >> 32;
1479 ib_cpu[len++] = cpb_buf.addr;
1480 ib_cpu[len++] = 0x00000000; /* swizzle mode */
1481 ib_cpu[len++] = 0x00000100; /* luma pitch */
1482 ib_cpu[len++] = 0x00000100; /* chroma pitch */
1483 ib_cpu[len++] = 0x00000002; /* no reconstructed picture */
1484 ib_cpu[len++] = 0x00000000; /* reconstructed pic 1 luma offset */
1485 ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32); /* pic1 chroma offset */
1487 amdgpu_cs_vcn_ib_zero_count(&len, 2);
1488 ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32) * 3 / 2; /* pic2 luma offset */
1489 ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32) * 5 / 2; /* pic2 chroma offset */
1491 amdgpu_cs_vcn_ib_zero_count(&len, 280);
1492 *st_size = (len - st_offset) * 4;
1495 st_offset = len;
1496 st_size = &ib_cpu[len++]; /* size */
1498 ib_cpu[len++] = 0x0000000e; /* VIDEO_BITSTREAM_BUFFER vcn 1 */
1500 ib_cpu[len++] = 0x00000012; /* VIDEO_BITSTREAM_BUFFER other vcn */
1502 ib_cpu[len++] = 0x00000000; /* mode */
1503 ib_cpu[len++] = bs_buf.addr >> 32;
1504 ib_cpu[len++] = bs_buf.addr;
1505 ib_cpu[len++] = 0x0001f000;
1506 ib_cpu[len++] = 0x00000000;
1507 *st_size = (len - st_offset) * 4;
1510 st_offset = len;
1511 st_size = &ib_cpu[len++]; /* size */
1513 ib_cpu[len++] = 0x00000010; /* FEEDBACK_BUFFER vcn 1 */
1515 ib_cpu[len++] = 0x00000015; /* FEEDBACK_BUFFER vcn 2,3 */
1516 ib_cpu[len++] = 0x00000000;
1517 ib_cpu[len++] = fb_buf.addr >> 32;
1518 ib_cpu[len++] = fb_buf.addr;
1519 ib_cpu[len++] = 0x00000010;
1520 ib_cpu[len++] = 0x00000028;
1521 *st_size = (len - st_offset) * 4;
1524 st_offset = len;
1525 st_size = &ib_cpu[len++];
1527 ib_cpu[len++] = 0x0000000c; /* INTRA_REFRESH vcn 1 */
1529 ib_cpu[len++] = 0x00000010; /* INTRA_REFRESH vcn 2,3 */
1530 ib_cpu[len++] = 0x00000000;
1531 ib_cpu[len++] = 0x00000000;
1532 ib_cpu[len++] = 0x00000000;
1533 *st_size = (len - st_offset) * 4;
1537 st_offset = len;
1538 st_size = &ib_cpu[len++];
1539 ib_cpu[len++] = 0x0000000c;
1540 ib_cpu[len++] = 0x00000000; /* RENCODE_COLOR_VOLUME_G22_BT709 */
1541 ib_cpu[len++] = 0x00000000;
1542 ib_cpu[len++] = 0x00000000;
1543 ib_cpu[len++] = 0x00000000;
1544 ib_cpu[len++] = 0x00000000;
1545 ib_cpu[len++] = 0x00000000; /* RENCODE_COLOR_BIT_DEPTH_8_BIT */
1546 ib_cpu[len++] = 0x00000000; /* RENCODE_COLOR_PACKING_FORMAT_NV12 */
1547 *st_size = (len - st_offset) * 4;
1550 st_offset = len;
1551 st_size = &ib_cpu[len++];
1552 ib_cpu[len++] = 0x0000000d;
1553 ib_cpu[len++] = 0x00000000; /* RENCODE_COLOR_VOLUME_G22_BT709 */
1554 ib_cpu[len++] = 0x00000000;
1555 ib_cpu[len++] = 0x00000000;
1556 ib_cpu[len++] = 0x00000000; /* RENCODE_COLOR_BIT_DEPTH_8_BIT */
1557 *st_size = (len - st_offset) * 4;
1560 st_offset = len;
1561 st_size = &ib_cpu[len++];
1562 ib_cpu[len++] = 0x01000006; /* SPEED_ENCODING_MODE */
1563 *st_size = (len - st_offset) * 4;
1566 st_offset = len;
1567 st_size = &ib_cpu[len++];
1568 ib_cpu[len++] = 0x01000003;
1569 *st_size = (len - st_offset) * 4;
1571 *p_task_size = (len - task_offset) * 4;
1574 amdgpu_cs_sq_ib_tail(ib_cpu + len);
1576 r = submit(len, AMDGPU_HW_IP_VCN_ENC);
1594 int len = 0, r;
1614 amdgpu_cs_sq_head(ib_cpu, &len, true);
1617 st_offset = len;
1618 st_size = &ib_cpu[len++]; /* size */
1619 ib_cpu[len++] = 0x00000001; /* RENCODE_IB_PARAM_SESSION_INFO */
1620 ib_cpu[len++] = ((fw_maj << 16) | (fw_min << 0));
1621 ib_cpu[len++] = enc_buf.addr >> 32;
1622 ib_cpu[len++] = enc_buf.addr;
1623 ib_cpu[len++] = 1; /* RENCODE_ENGINE_TYPE_ENCODE; */
1624 *st_size = (len - st_offset) * 4;
1627 task_offset = len;
1628 st_offset = len;
1629 st_size = &ib_cpu[len++]; /* size */
1630 ib_cpu[len++] = 0x00000002; /* RENCODE_IB_PARAM_TASK_INFO */
1631 p_task_size = &ib_cpu[len++];
1632 ib_cpu[len++] = enc_task_id++; /* task_id */
1633 ib_cpu[len++] = 0; /* feedback */
1634 *st_size = (len - st_offset) * 4;
1637 st_offset = len;
1638 st_size = &ib_cpu[len++];
1639 ib_cpu[len++] = 0x01000002; /* RENCODE_IB_OP_CLOSE_SESSION */
1640 *st_size = (len - st_offset) * 4;
1642 *p_task_size = (len - task_offset) * 4;
1645 amdgpu_cs_sq_ib_tail(ib_cpu + len);
1647 r = submit(len, AMDGPU_HW_IP_VCN_ENC);