diff options
author | Leo Liu <leo.liu@amd.com> | 2017-03-03 18:13:26 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-03-29 23:54:47 -0400 |
commit | 09bfb8912dc16383ce9f95600134d8eb120107f8 (patch) | |
tree | 884ce1802e547285f72f2289b993b1ef627b055f /drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |
parent | 282aae555e13b073715c4219b80d0396e3b0bd9c (diff) |
drm/amdgpu: add initial uvd 7.0 support for vega10
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index 6d6ab7f11b4c..913ce1cb0ea3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |||
@@ -67,6 +67,14 @@ | |||
67 | #define FIRMWARE_POLARIS11 "amdgpu/polaris11_uvd.bin" | 67 | #define FIRMWARE_POLARIS11 "amdgpu/polaris11_uvd.bin" |
68 | #define FIRMWARE_POLARIS12 "amdgpu/polaris12_uvd.bin" | 68 | #define FIRMWARE_POLARIS12 "amdgpu/polaris12_uvd.bin" |
69 | 69 | ||
70 | #define FIRMWARE_VEGA10 "amdgpu/vega10_uvd.bin" | ||
71 | |||
72 | #define mmUVD_GPCOM_VCPU_DATA0_VEGA10 (0x03c4 + 0x7e00) | ||
73 | #define mmUVD_GPCOM_VCPU_DATA1_VEGA10 (0x03c5 + 0x7e00) | ||
74 | #define mmUVD_GPCOM_VCPU_CMD_VEGA10 (0x03c3 + 0x7e00) | ||
75 | #define mmUVD_NO_OP_VEGA10 (0x03ff + 0x7e00) | ||
76 | #define mmUVD_ENGINE_CNTL_VEGA10 (0x03c6 + 0x7e00) | ||
77 | |||
70 | /** | 78 | /** |
71 | * amdgpu_uvd_cs_ctx - Command submission parser context | 79 | * amdgpu_uvd_cs_ctx - Command submission parser context |
72 | * | 80 | * |
@@ -101,6 +109,8 @@ MODULE_FIRMWARE(FIRMWARE_POLARIS10); | |||
101 | MODULE_FIRMWARE(FIRMWARE_POLARIS11); | 109 | MODULE_FIRMWARE(FIRMWARE_POLARIS11); |
102 | MODULE_FIRMWARE(FIRMWARE_POLARIS12); | 110 | MODULE_FIRMWARE(FIRMWARE_POLARIS12); |
103 | 111 | ||
112 | MODULE_FIRMWARE(FIRMWARE_VEGA10); | ||
113 | |||
104 | static void amdgpu_uvd_idle_work_handler(struct work_struct *work); | 114 | static void amdgpu_uvd_idle_work_handler(struct work_struct *work); |
105 | 115 | ||
106 | int amdgpu_uvd_sw_init(struct amdgpu_device *adev) | 116 | int amdgpu_uvd_sw_init(struct amdgpu_device *adev) |
@@ -151,6 +161,9 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) | |||
151 | case CHIP_POLARIS11: | 161 | case CHIP_POLARIS11: |
152 | fw_name = FIRMWARE_POLARIS11; | 162 | fw_name = FIRMWARE_POLARIS11; |
153 | break; | 163 | break; |
164 | case CHIP_VEGA10: | ||
165 | fw_name = FIRMWARE_VEGA10; | ||
166 | break; | ||
154 | case CHIP_POLARIS12: | 167 | case CHIP_POLARIS12: |
155 | fw_name = FIRMWARE_POLARIS12; | 168 | fw_name = FIRMWARE_POLARIS12; |
156 | break; | 169 | break; |
@@ -203,9 +216,11 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) | |||
203 | DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n", | 216 | DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n", |
204 | version_major, version_minor); | 217 | version_major, version_minor); |
205 | 218 | ||
206 | bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8) | 219 | bo_size = AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE |
207 | + AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE | ||
208 | + AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles; | 220 | + AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles; |
221 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) | ||
222 | bo_size += AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8); | ||
223 | |||
209 | r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE, | 224 | r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE, |
210 | AMDGPU_GEM_DOMAIN_VRAM, &adev->uvd.vcpu_bo, | 225 | AMDGPU_GEM_DOMAIN_VRAM, &adev->uvd.vcpu_bo, |
211 | &adev->uvd.gpu_addr, &adev->uvd.cpu_addr); | 226 | &adev->uvd.gpu_addr, &adev->uvd.cpu_addr); |
@@ -319,11 +334,13 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev) | |||
319 | unsigned offset; | 334 | unsigned offset; |
320 | 335 | ||
321 | hdr = (const struct common_firmware_header *)adev->uvd.fw->data; | 336 | hdr = (const struct common_firmware_header *)adev->uvd.fw->data; |
322 | offset = le32_to_cpu(hdr->ucode_array_offset_bytes); | 337 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) { |
323 | memcpy_toio(adev->uvd.cpu_addr, adev->uvd.fw->data + offset, | 338 | offset = le32_to_cpu(hdr->ucode_array_offset_bytes); |
324 | le32_to_cpu(hdr->ucode_size_bytes)); | 339 | memcpy_toio(adev->uvd.cpu_addr, adev->uvd.fw->data + offset, |
325 | size -= le32_to_cpu(hdr->ucode_size_bytes); | 340 | le32_to_cpu(hdr->ucode_size_bytes)); |
326 | ptr += le32_to_cpu(hdr->ucode_size_bytes); | 341 | size -= le32_to_cpu(hdr->ucode_size_bytes); |
342 | ptr += le32_to_cpu(hdr->ucode_size_bytes); | ||
343 | } | ||
327 | memset_io(ptr, 0, size); | 344 | memset_io(ptr, 0, size); |
328 | } | 345 | } |
329 | 346 | ||
@@ -936,6 +953,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, | |||
936 | struct dma_fence *f = NULL; | 953 | struct dma_fence *f = NULL; |
937 | struct amdgpu_device *adev = ring->adev; | 954 | struct amdgpu_device *adev = ring->adev; |
938 | uint64_t addr; | 955 | uint64_t addr; |
956 | uint32_t data[4]; | ||
939 | int i, r; | 957 | int i, r; |
940 | 958 | ||
941 | memset(&tv, 0, sizeof(tv)); | 959 | memset(&tv, 0, sizeof(tv)); |
@@ -961,16 +979,28 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, | |||
961 | if (r) | 979 | if (r) |
962 | goto err; | 980 | goto err; |
963 | 981 | ||
982 | if (adev->asic_type >= CHIP_VEGA10) { | ||
983 | data[0] = PACKET0(mmUVD_GPCOM_VCPU_DATA0_VEGA10, 0); | ||
984 | data[1] = PACKET0(mmUVD_GPCOM_VCPU_DATA1_VEGA10, 0); | ||
985 | data[2] = PACKET0(mmUVD_GPCOM_VCPU_CMD_VEGA10, 0); | ||
986 | data[3] = PACKET0(mmUVD_NO_OP_VEGA10, 0); | ||
987 | } else { | ||
988 | data[0] = PACKET0(mmUVD_GPCOM_VCPU_DATA0, 0); | ||
989 | data[1] = PACKET0(mmUVD_GPCOM_VCPU_DATA1, 0); | ||
990 | data[2] = PACKET0(mmUVD_GPCOM_VCPU_CMD, 0); | ||
991 | data[3] = PACKET0(mmUVD_NO_OP, 0); | ||
992 | } | ||
993 | |||
964 | ib = &job->ibs[0]; | 994 | ib = &job->ibs[0]; |
965 | addr = amdgpu_bo_gpu_offset(bo); | 995 | addr = amdgpu_bo_gpu_offset(bo); |
966 | ib->ptr[0] = PACKET0(mmUVD_GPCOM_VCPU_DATA0, 0); | 996 | ib->ptr[0] = data[0]; |
967 | ib->ptr[1] = addr; | 997 | ib->ptr[1] = addr; |
968 | ib->ptr[2] = PACKET0(mmUVD_GPCOM_VCPU_DATA1, 0); | 998 | ib->ptr[2] = data[1]; |
969 | ib->ptr[3] = addr >> 32; | 999 | ib->ptr[3] = addr >> 32; |
970 | ib->ptr[4] = PACKET0(mmUVD_GPCOM_VCPU_CMD, 0); | 1000 | ib->ptr[4] = data[2]; |
971 | ib->ptr[5] = 0; | 1001 | ib->ptr[5] = 0; |
972 | for (i = 6; i < 16; i += 2) { | 1002 | for (i = 6; i < 16; i += 2) { |
973 | ib->ptr[i] = PACKET0(mmUVD_NO_OP, 0); | 1003 | ib->ptr[i] = data[3]; |
974 | ib->ptr[i+1] = 0; | 1004 | ib->ptr[i+1] = 0; |
975 | } | 1005 | } |
976 | ib->length_dw = 16; | 1006 | ib->length_dw = 16; |