diff options
author | Christian König <christian.koenig@amd.com> | 2016-07-26 06:05:40 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-07-29 14:37:10 -0400 |
commit | 4cb5877c6352c42737b53e37d61020ba0cb21c5c (patch) | |
tree | 4606ed4a07031afe212fb0a50fb419581cc733cd | |
parent | e5a6858d8a92f726f3339f6c9592cf95d894b0c1 (diff) |
drm/amdgpu: enable UVD context buffer for older HW
Supported starting on certain FW versions.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 28 |
2 files changed, 27 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 9d1909f08d43..8ebc5f1eb4c0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -1681,6 +1681,7 @@ struct amdgpu_uvd { | |||
1681 | struct amdgpu_ring ring; | 1681 | struct amdgpu_ring ring; |
1682 | struct amdgpu_irq_src irq; | 1682 | struct amdgpu_irq_src irq; |
1683 | bool address_64_bit; | 1683 | bool address_64_bit; |
1684 | bool use_ctx_buf; | ||
1684 | struct amd_sched_entity entity; | 1685 | struct amd_sched_entity entity; |
1685 | }; | 1686 | }; |
1686 | 1687 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index 6c8d16559b00..b11f4e8868d7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |||
@@ -41,8 +41,15 @@ | |||
41 | 41 | ||
42 | /* 1 second timeout */ | 42 | /* 1 second timeout */ |
43 | #define UVD_IDLE_TIMEOUT msecs_to_jiffies(1000) | 43 | #define UVD_IDLE_TIMEOUT msecs_to_jiffies(1000) |
44 | |||
45 | /* Firmware versions for VI */ | ||
46 | #define FW_1_65_10 ((1 << 24) | (65 << 16) | (10 << 8)) | ||
47 | #define FW_1_87_11 ((1 << 24) | (87 << 16) | (11 << 8)) | ||
48 | #define FW_1_87_12 ((1 << 24) | (87 << 16) | (12 << 8)) | ||
49 | #define FW_1_37_15 ((1 << 24) | (37 << 16) | (15 << 8)) | ||
50 | |||
44 | /* Polaris10/11 firmware version */ | 51 | /* Polaris10/11 firmware version */ |
45 | #define FW_1_66_16 ((1 << 24) | (66 << 16) | (16 << 8)) | 52 | #define FW_1_66_16 ((1 << 24) | (66 << 16) | (16 << 8)) |
46 | 53 | ||
47 | /* Firmware Names */ | 54 | /* Firmware Names */ |
48 | #ifdef CONFIG_DRM_AMDGPU_CIK | 55 | #ifdef CONFIG_DRM_AMDGPU_CIK |
@@ -245,6 +252,23 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) | |||
245 | if (!amdgpu_ip_block_version_cmp(adev, AMD_IP_BLOCK_TYPE_UVD, 5, 0)) | 252 | if (!amdgpu_ip_block_version_cmp(adev, AMD_IP_BLOCK_TYPE_UVD, 5, 0)) |
246 | adev->uvd.address_64_bit = true; | 253 | adev->uvd.address_64_bit = true; |
247 | 254 | ||
255 | switch (adev->asic_type) { | ||
256 | case CHIP_TONGA: | ||
257 | adev->uvd.use_ctx_buf = adev->uvd.fw_version >= FW_1_65_10; | ||
258 | break; | ||
259 | case CHIP_CARRIZO: | ||
260 | adev->uvd.use_ctx_buf = adev->uvd.fw_version >= FW_1_87_11; | ||
261 | break; | ||
262 | case CHIP_FIJI: | ||
263 | adev->uvd.use_ctx_buf = adev->uvd.fw_version >= FW_1_87_12; | ||
264 | break; | ||
265 | case CHIP_STONEY: | ||
266 | adev->uvd.use_ctx_buf = adev->uvd.fw_version >= FW_1_37_15; | ||
267 | break; | ||
268 | default: | ||
269 | adev->uvd.use_ctx_buf = adev->asic_type >= CHIP_POLARIS10; | ||
270 | } | ||
271 | |||
248 | return 0; | 272 | return 0; |
249 | } | 273 | } |
250 | 274 | ||
@@ -554,7 +578,7 @@ static int amdgpu_uvd_cs_msg_decode(struct amdgpu_device *adev, uint32_t *msg, | |||
554 | /* reference picture buffer */ | 578 | /* reference picture buffer */ |
555 | min_dpb_size = image_size * num_dpb_buffer; | 579 | min_dpb_size = image_size * num_dpb_buffer; |
556 | 580 | ||
557 | if (adev->asic_type < CHIP_POLARIS10){ | 581 | if (!adev->uvd.use_ctx_buf){ |
558 | /* macroblock context buffer */ | 582 | /* macroblock context buffer */ |
559 | min_dpb_size += | 583 | min_dpb_size += |
560 | width_in_mb * height_in_mb * num_dpb_buffer * 192; | 584 | width_in_mb * height_in_mb * num_dpb_buffer * 192; |