diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-06-24 04:30:08 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-07-07 15:02:06 -0400 |
commit | ee7fd9575734f434ad541a5985687f195a2ff853 (patch) | |
tree | 230901d687fb9c6e7e10d75882994d7b595f32d9 /drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | |
parent | 313c45fdb4b3a95004df85e9d15c9e70895f219a (diff) |
drm/amdgpu: Unpin BO if we can't get fences in amdgpu_crtc_page_flip
If reservation_object_get_fences_rcu failed, we'd previously go directly
to the cleanup label, so we'd leave the BO pinned.
While we're at it, remove two amdgpu_bo_unreserve calls in favour of two
new labels.
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_display.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index a6eecf6f9065..7dbe8d02c5a6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | |||
@@ -220,19 +220,17 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, | |||
220 | 220 | ||
221 | r = amdgpu_bo_pin_restricted(new_rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base); | 221 | r = amdgpu_bo_pin_restricted(new_rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base); |
222 | if (unlikely(r != 0)) { | 222 | if (unlikely(r != 0)) { |
223 | amdgpu_bo_unreserve(new_rbo); | ||
224 | r = -EINVAL; | 223 | r = -EINVAL; |
225 | DRM_ERROR("failed to pin new rbo buffer before flip\n"); | 224 | DRM_ERROR("failed to pin new rbo buffer before flip\n"); |
226 | goto cleanup; | 225 | goto unreserve; |
227 | } | 226 | } |
228 | 227 | ||
229 | r = reservation_object_get_fences_rcu(new_rbo->tbo.resv, &work->excl, | 228 | r = reservation_object_get_fences_rcu(new_rbo->tbo.resv, &work->excl, |
230 | &work->shared_count, | 229 | &work->shared_count, |
231 | &work->shared); | 230 | &work->shared); |
232 | if (unlikely(r != 0)) { | 231 | if (unlikely(r != 0)) { |
233 | amdgpu_bo_unreserve(new_rbo); | ||
234 | DRM_ERROR("failed to get fences for buffer\n"); | 232 | DRM_ERROR("failed to get fences for buffer\n"); |
235 | goto cleanup; | 233 | goto unpin; |
236 | } | 234 | } |
237 | 235 | ||
238 | amdgpu_bo_get_tiling_flags(new_rbo, &tiling_flags); | 236 | amdgpu_bo_get_tiling_flags(new_rbo, &tiling_flags); |
@@ -275,9 +273,11 @@ pflip_cleanup: | |||
275 | DRM_ERROR("failed to reserve new rbo in error path\n"); | 273 | DRM_ERROR("failed to reserve new rbo in error path\n"); |
276 | goto cleanup; | 274 | goto cleanup; |
277 | } | 275 | } |
276 | unpin: | ||
278 | if (unlikely(amdgpu_bo_unpin(new_rbo) != 0)) { | 277 | if (unlikely(amdgpu_bo_unpin(new_rbo) != 0)) { |
279 | DRM_ERROR("failed to unpin new rbo in error path\n"); | 278 | DRM_ERROR("failed to unpin new rbo in error path\n"); |
280 | } | 279 | } |
280 | unreserve: | ||
281 | amdgpu_bo_unreserve(new_rbo); | 281 | amdgpu_bo_unreserve(new_rbo); |
282 | 282 | ||
283 | cleanup: | 283 | cleanup: |