Skip to content

Commit ce9b333

Browse files
committed
Merge branch 'drm-misc-fixes' of ssh://git.freedesktop.org/git/drm/drm-misc into drm-fixes
This merges two fixes that haven't been sent to me yet, but I wanted to get in. One amdgpu fix, but one nouveau regression fixer. Signed-off-by: Dave Airlie <[email protected]>
2 parents aeeb82f + 67f7430 commit ce9b333

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ amdgpu_dma_buf_move_notify(struct dma_buf_attachment *attach)
384384
struct amdgpu_vm_bo_base *bo_base;
385385
int r;
386386

387-
if (bo->tbo.resource->mem_type == TTM_PL_SYSTEM)
387+
if (!bo->tbo.resource || bo->tbo.resource->mem_type == TTM_PL_SYSTEM)
388388
return;
389389

390390
r = ttm_bo_validate(&bo->tbo, &placement, &ctx);

drivers/gpu/drm/nouveau/nouveau_fence.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,22 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e
353353

354354
if (ret)
355355
return ret;
356-
}
357356

358-
fobj = dma_resv_shared_list(resv);
359-
fence = dma_resv_excl_fence(resv);
357+
fobj = NULL;
358+
} else {
359+
fobj = dma_resv_shared_list(resv);
360+
}
360361

361-
if (fence) {
362+
/* Waiting for the exclusive fence first causes performance regressions
363+
* under some circumstances. So manually wait for the shared ones first.
364+
*/
365+
for (i = 0; i < (fobj ? fobj->shared_count : 0) && !ret; ++i) {
362366
struct nouveau_channel *prev = NULL;
363367
bool must_wait = true;
364368

369+
fence = rcu_dereference_protected(fobj->shared[i],
370+
dma_resv_held(resv));
371+
365372
f = nouveau_local_fence(fence, chan->drm);
366373
if (f) {
367374
rcu_read_lock();
@@ -373,20 +380,13 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e
373380

374381
if (must_wait)
375382
ret = dma_fence_wait(fence, intr);
376-
377-
return ret;
378383
}
379384

380-
if (!exclusive || !fobj)
381-
return ret;
382-
383-
for (i = 0; i < fobj->shared_count && !ret; ++i) {
385+
fence = dma_resv_excl_fence(resv);
386+
if (fence) {
384387
struct nouveau_channel *prev = NULL;
385388
bool must_wait = true;
386389

387-
fence = rcu_dereference_protected(fobj->shared[i],
388-
dma_resv_held(resv));
389-
390390
f = nouveau_local_fence(fence, chan->drm);
391391
if (f) {
392392
rcu_read_lock();
@@ -398,6 +398,8 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e
398398

399399
if (must_wait)
400400
ret = dma_fence_wait(fence, intr);
401+
402+
return ret;
401403
}
402404

403405
return ret;

0 commit comments

Comments
 (0)