Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358162
b: refs/heads/master
c: c354c89
h: refs/heads/master
v: v3
  • Loading branch information
Maarten Lankhorst committed Jan 15, 2013
1 parent d25e8fd commit 03be5e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f2d476a110bc24fde008698ae9018c99e803e25c
refs/heads/master: c354c893dd57aac11f5d96ada7c47a20fe090a6e
22 changes: 17 additions & 5 deletions trunk/drivers/gpu/drm/nouveau/nouveau_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,10 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
uint32_t sequence;
int trycnt = 0;
int ret, i;
struct nouveau_bo *res_bo = NULL;

retry:
sequence = atomic_add_return(1, &drm->ttm.validate_sequence);
retry:
if (++trycnt > 100000) {
NV_ERROR(drm, "%s failed and gave up.\n", __func__);
return -EINVAL;
Expand All @@ -340,6 +341,11 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
return -ENOENT;
}
nvbo = gem->driver_private;
if (nvbo == res_bo) {
res_bo = NULL;
drm_gem_object_unreference_unlocked(gem);
continue;
}

if (nvbo->reserved_by && nvbo->reserved_by == file_priv) {
NV_ERROR(drm, "multiple instances of buffer %d on "
Expand All @@ -352,15 +358,19 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
ret = ttm_bo_reserve(&nvbo->bo, true, false, true, sequence);
if (ret) {
validate_fini(op, NULL);
if (unlikely(ret == -EAGAIN))
ret = ttm_bo_wait_unreserved(&nvbo->bo, true);
drm_gem_object_unreference_unlocked(gem);
if (unlikely(ret == -EAGAIN)) {
sequence = atomic_add_return(1, &drm->ttm.validate_sequence);
ret = ttm_bo_reserve_slowpath(&nvbo->bo, true,
sequence);
if (!ret)
res_bo = nvbo;
}
if (unlikely(ret)) {
drm_gem_object_unreference_unlocked(gem);
if (ret != -ERESTARTSYS)
NV_ERROR(drm, "fail reserve\n");
return ret;
}
goto retry;
}

b->user_priv = (uint64_t)(unsigned long)nvbo;
Expand All @@ -382,6 +392,8 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
validate_fini(op, NULL);
return -EINVAL;
}
if (nvbo == res_bo)
goto retry;
}

return 0;
Expand Down

0 comments on commit 03be5e7

Please sign in to comment.