diff options
author | Emily Deng <Emily.Deng@amd.com> | 2018-08-13 02:46:06 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-13 18:21:29 -0400 |
commit | 20acbed47d30efbf14e5aecc5ec5e5f152db7810 (patch) | |
tree | c3b93697a4a2b34c2c32af0caf517e37f0081b48 | |
parent | 33d5bd0705440c158c909da7538f05fc7a0ebcdf (diff) |
drm/amdgpu/vce: VCE entity initialization relies on ring initializtion
Entity init should after ring init, as the entity's sched_rq's initialization
is in ring init.
SWDEV-161495
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 33 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 6 |
5 files changed, 34 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c index b6ab4f5350c8..0cc5190f4f36 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | |||
@@ -90,8 +90,6 @@ static void amdgpu_vce_idle_work_handler(struct work_struct *work); | |||
90 | */ | 90 | */ |
91 | int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size) | 91 | int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size) |
92 | { | 92 | { |
93 | struct amdgpu_ring *ring; | ||
94 | struct drm_sched_rq *rq; | ||
95 | const char *fw_name; | 93 | const char *fw_name; |
96 | const struct common_firmware_header *hdr; | 94 | const struct common_firmware_header *hdr; |
97 | unsigned ucode_version, version_major, version_minor, binary_id; | 95 | unsigned ucode_version, version_major, version_minor, binary_id; |
@@ -188,14 +186,6 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size) | |||
188 | return r; | 186 | return r; |
189 | } | 187 | } |
190 | 188 | ||
191 | ring = &adev->vce.ring[0]; | ||
192 | rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL]; | ||
193 | r = drm_sched_entity_init(&adev->vce.entity, &rq, 1, NULL); | ||
194 | if (r != 0) { | ||
195 | DRM_ERROR("Failed setting up VCE run queue.\n"); | ||
196 | return r; | ||
197 | } | ||
198 | |||
199 | for (i = 0; i < AMDGPU_MAX_VCE_HANDLES; ++i) { | 189 | for (i = 0; i < AMDGPU_MAX_VCE_HANDLES; ++i) { |
200 | atomic_set(&adev->vce.handles[i], 0); | 190 | atomic_set(&adev->vce.handles[i], 0); |
201 | adev->vce.filp[i] = NULL; | 191 | adev->vce.filp[i] = NULL; |
@@ -236,6 +226,29 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev) | |||
236 | } | 226 | } |
237 | 227 | ||
238 | /** | 228 | /** |
229 | * amdgpu_vce_entity_init - init entity | ||
230 | * | ||
231 | * @adev: amdgpu_device pointer | ||
232 | * | ||
233 | */ | ||
234 | int amdgpu_vce_entity_init(struct amdgpu_device *adev) | ||
235 | { | ||
236 | struct amdgpu_ring *ring; | ||
237 | struct drm_sched_rq *rq; | ||
238 | int r; | ||
239 | |||
240 | ring = &adev->vce.ring[0]; | ||
241 | rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL]; | ||
242 | r = drm_sched_entity_init(&adev->vce.entity, &rq, 1, NULL); | ||
243 | if (r != 0) { | ||
244 | DRM_ERROR("Failed setting up VCE run queue.\n"); | ||
245 | return r; | ||
246 | } | ||
247 | |||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | /** | ||
239 | * amdgpu_vce_suspend - unpin VCE fw memory | 252 | * amdgpu_vce_suspend - unpin VCE fw memory |
240 | * | 253 | * |
241 | * @adev: amdgpu_device pointer | 254 | * @adev: amdgpu_device pointer |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h index 71781267ee4c..a1f209eed4c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h | |||
@@ -55,6 +55,7 @@ struct amdgpu_vce { | |||
55 | 55 | ||
56 | int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size); | 56 | int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size); |
57 | int amdgpu_vce_sw_fini(struct amdgpu_device *adev); | 57 | int amdgpu_vce_sw_fini(struct amdgpu_device *adev); |
58 | int amdgpu_vce_entity_init(struct amdgpu_device *adev); | ||
58 | int amdgpu_vce_suspend(struct amdgpu_device *adev); | 59 | int amdgpu_vce_suspend(struct amdgpu_device *adev); |
59 | int amdgpu_vce_resume(struct amdgpu_device *adev); | 60 | int amdgpu_vce_resume(struct amdgpu_device *adev); |
60 | int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | 61 | int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, |
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c index d48e877b682e..7eaa54ba016b 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | |||
@@ -439,6 +439,8 @@ static int vce_v2_0_sw_init(void *handle) | |||
439 | return r; | 439 | return r; |
440 | } | 440 | } |
441 | 441 | ||
442 | r = amdgpu_vce_entity_init(adev); | ||
443 | |||
442 | return r; | 444 | return r; |
443 | } | 445 | } |
444 | 446 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c index cc6ce6cc03f4..c8390f9adfd6 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | |||
@@ -448,6 +448,8 @@ static int vce_v3_0_sw_init(void *handle) | |||
448 | return r; | 448 | return r; |
449 | } | 449 | } |
450 | 450 | ||
451 | r = amdgpu_vce_entity_init(adev); | ||
452 | |||
451 | return r; | 453 | return r; |
452 | } | 454 | } |
453 | 455 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c index 65f8860169e9..6faeb17fc71c 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | |||
@@ -419,6 +419,7 @@ static int vce_v4_0_sw_init(void *handle) | |||
419 | { | 419 | { |
420 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 420 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
421 | struct amdgpu_ring *ring; | 421 | struct amdgpu_ring *ring; |
422 | |||
422 | unsigned size; | 423 | unsigned size; |
423 | int r, i; | 424 | int r, i; |
424 | 425 | ||
@@ -474,6 +475,11 @@ static int vce_v4_0_sw_init(void *handle) | |||
474 | return r; | 475 | return r; |
475 | } | 476 | } |
476 | 477 | ||
478 | |||
479 | r = amdgpu_vce_entity_init(adev); | ||
480 | if (r) | ||
481 | return r; | ||
482 | |||
477 | r = amdgpu_virt_alloc_mm_table(adev); | 483 | r = amdgpu_virt_alloc_mm_table(adev); |
478 | if (r) | 484 | if (r) |
479 | return r; | 485 | return r; |