Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu/vcn2.6: Add vcn2.6 support

Aldebaran is using vcn2.6, and the main change is vcn2.6 using
AMDGPU_MMHUB_0, and vcn2.5 using AMDGPU_MMHUB_1

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

James Zhu and committed by
Alex Deucher
eb53aa39 86d848b1

+98 -2
+97 -2
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
··· 1545 1545 .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, 1546 1546 }; 1547 1547 1548 + static const struct amdgpu_ring_funcs vcn_v2_6_dec_ring_vm_funcs = { 1549 + .type = AMDGPU_RING_TYPE_VCN_DEC, 1550 + .align_mask = 0xf, 1551 + .vmhub = AMDGPU_MMHUB_0, 1552 + .get_rptr = vcn_v2_5_dec_ring_get_rptr, 1553 + .get_wptr = vcn_v2_5_dec_ring_get_wptr, 1554 + .set_wptr = vcn_v2_5_dec_ring_set_wptr, 1555 + .emit_frame_size = 1556 + SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 + 1557 + SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 8 + 1558 + 8 + /* vcn_v2_0_dec_ring_emit_vm_flush */ 1559 + 14 + 14 + /* vcn_v2_0_dec_ring_emit_fence x2 vm fence */ 1560 + 6, 1561 + .emit_ib_size = 8, /* vcn_v2_0_dec_ring_emit_ib */ 1562 + .emit_ib = vcn_v2_0_dec_ring_emit_ib, 1563 + .emit_fence = vcn_v2_0_dec_ring_emit_fence, 1564 + .emit_vm_flush = vcn_v2_0_dec_ring_emit_vm_flush, 1565 + .test_ring = vcn_v2_0_dec_ring_test_ring, 1566 + .test_ib = amdgpu_vcn_dec_ring_test_ib, 1567 + .insert_nop = vcn_v2_0_dec_ring_insert_nop, 1568 + .insert_start = vcn_v2_0_dec_ring_insert_start, 1569 + .insert_end = vcn_v2_0_dec_ring_insert_end, 1570 + .pad_ib = amdgpu_ring_generic_pad_ib, 1571 + .begin_use = amdgpu_vcn_ring_begin_use, 1572 + .end_use = amdgpu_vcn_ring_end_use, 1573 + .emit_wreg = vcn_v2_0_dec_ring_emit_wreg, 1574 + .emit_reg_wait = vcn_v2_0_dec_ring_emit_reg_wait, 1575 + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, 1576 + }; 1577 + 1548 1578 /** 1549 1579 * vcn_v2_5_enc_ring_get_rptr - get enc read pointer 1550 1580 * ··· 1674 1644 .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, 1675 1645 }; 1676 1646 1647 + static const struct amdgpu_ring_funcs vcn_v2_6_enc_ring_vm_funcs = { 1648 + .type = AMDGPU_RING_TYPE_VCN_ENC, 1649 + .align_mask = 0x3f, 1650 + .nop = VCN_ENC_CMD_NO_OP, 1651 + .vmhub = AMDGPU_MMHUB_0, 1652 + .get_rptr = vcn_v2_5_enc_ring_get_rptr, 1653 + .get_wptr = vcn_v2_5_enc_ring_get_wptr, 1654 + .set_wptr = vcn_v2_5_enc_ring_set_wptr, 1655 + .emit_frame_size = 1656 + SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 + 1657 + SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 4 + 1658 + 4 + /* vcn_v2_0_enc_ring_emit_vm_flush */ 1659 + 5 + 5 + /* vcn_v2_0_enc_ring_emit_fence x2 vm fence */ 1660 + 1, /* vcn_v2_0_enc_ring_insert_end */ 1661 + .emit_ib_size = 5, /* vcn_v2_0_enc_ring_emit_ib */ 1662 + .emit_ib = vcn_v2_0_enc_ring_emit_ib, 1663 + .emit_fence = vcn_v2_0_enc_ring_emit_fence, 1664 + .emit_vm_flush = vcn_v2_0_enc_ring_emit_vm_flush, 1665 + .test_ring = amdgpu_vcn_enc_ring_test_ring, 1666 + .test_ib = amdgpu_vcn_enc_ring_test_ib, 1667 + .insert_nop = amdgpu_ring_insert_nop, 1668 + .insert_end = vcn_v2_0_enc_ring_insert_end, 1669 + .pad_ib = amdgpu_ring_generic_pad_ib, 1670 + .begin_use = amdgpu_vcn_ring_begin_use, 1671 + .end_use = amdgpu_vcn_ring_end_use, 1672 + .emit_wreg = vcn_v2_0_enc_ring_emit_wreg, 1673 + .emit_reg_wait = vcn_v2_0_enc_ring_emit_reg_wait, 1674 + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, 1675 + }; 1676 + 1677 1677 static void vcn_v2_5_set_dec_ring_funcs(struct amdgpu_device *adev) 1678 1678 { 1679 1679 int i; ··· 1711 1651 for (i = 0; i < adev->vcn.num_vcn_inst; ++i) { 1712 1652 if (adev->vcn.harvest_config & (1 << i)) 1713 1653 continue; 1714 - adev->vcn.inst[i].ring_dec.funcs = &vcn_v2_5_dec_ring_vm_funcs; 1654 + if (adev->asic_type == CHIP_ARCTURUS) 1655 + adev->vcn.inst[i].ring_dec.funcs = &vcn_v2_5_dec_ring_vm_funcs; 1656 + else /* CHIP_ALDEBARAN */ 1657 + adev->vcn.inst[i].ring_dec.funcs = &vcn_v2_6_dec_ring_vm_funcs; 1715 1658 adev->vcn.inst[i].ring_dec.me = i; 1716 1659 DRM_INFO("VCN(%d) decode is enabled in VM mode\n", i); 1717 1660 } ··· 1728 1665 if (adev->vcn.harvest_config & (1 << j)) 1729 1666 continue; 1730 1667 for (i = 0; i < adev->vcn.num_enc_rings; ++i) { 1731 - adev->vcn.inst[j].ring_enc[i].funcs = &vcn_v2_5_enc_ring_vm_funcs; 1668 + if (adev->asic_type == CHIP_ARCTURUS) 1669 + adev->vcn.inst[j].ring_enc[i].funcs = &vcn_v2_5_enc_ring_vm_funcs; 1670 + else /* CHIP_ALDEBARAN */ 1671 + adev->vcn.inst[j].ring_enc[i].funcs = &vcn_v2_6_enc_ring_vm_funcs; 1732 1672 adev->vcn.inst[j].ring_enc[i].me = j; 1733 1673 } 1734 1674 DRM_INFO("VCN(%d) encode is enabled in VM mode\n", j); ··· 1896 1830 .set_powergating_state = vcn_v2_5_set_powergating_state, 1897 1831 }; 1898 1832 1833 + static const struct amd_ip_funcs vcn_v2_6_ip_funcs = { 1834 + .name = "vcn_v2_6", 1835 + .early_init = vcn_v2_5_early_init, 1836 + .late_init = NULL, 1837 + .sw_init = vcn_v2_5_sw_init, 1838 + .sw_fini = vcn_v2_5_sw_fini, 1839 + .hw_init = vcn_v2_5_hw_init, 1840 + .hw_fini = vcn_v2_5_hw_fini, 1841 + .suspend = vcn_v2_5_suspend, 1842 + .resume = vcn_v2_5_resume, 1843 + .is_idle = vcn_v2_5_is_idle, 1844 + .wait_for_idle = vcn_v2_5_wait_for_idle, 1845 + .check_soft_reset = NULL, 1846 + .pre_soft_reset = NULL, 1847 + .soft_reset = NULL, 1848 + .post_soft_reset = NULL, 1849 + .set_clockgating_state = vcn_v2_5_set_clockgating_state, 1850 + .set_powergating_state = vcn_v2_5_set_powergating_state, 1851 + }; 1852 + 1899 1853 const struct amdgpu_ip_block_version vcn_v2_5_ip_block = 1900 1854 { 1901 1855 .type = AMD_IP_BLOCK_TYPE_VCN, ··· 1923 1837 .minor = 5, 1924 1838 .rev = 0, 1925 1839 .funcs = &vcn_v2_5_ip_funcs, 1840 + }; 1841 + 1842 + const struct amdgpu_ip_block_version vcn_v2_6_ip_block = 1843 + { 1844 + .type = AMD_IP_BLOCK_TYPE_VCN, 1845 + .major = 2, 1846 + .minor = 6, 1847 + .rev = 0, 1848 + .funcs = &vcn_v2_6_ip_funcs, 1926 1849 };
+1
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.h
··· 25 25 #define __VCN_V2_5_H__ 26 26 27 27 extern const struct amdgpu_ip_block_version vcn_v2_5_ip_block; 28 + extern const struct amdgpu_ip_block_version vcn_v2_6_ip_block; 28 29 29 30 #endif /* __VCN_V2_5_H__ */