summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_bo.c
diff options
context:
space:
mode:
authorBen Skeggs2014-11-10 02:12:17 +0100
committerBen Skeggs2014-12-02 06:44:02 +0100
commit50ab2e5206da6aa3aa782e9660e7ccb419300546 (patch)
tree9db532d0822672e2d97870fe3398677582db0e25 /drivers/gpu/drm/nouveau/nouveau_bo.c
parentdrm/nv50-/kms: add some evo tracing ability for debugging (diff)
downloadkernel-qcow2-linux-50ab2e5206da6aa3aa782e9660e7ccb419300546.tar.gz
kernel-qcow2-linux-50ab2e5206da6aa3aa782e9660e7ccb419300546.tar.xz
kernel-qcow2-linux-50ab2e5206da6aa3aa782e9660e7ccb419300546.zip
drm/nouveau: we need pin_refcnt for nouveau_bo_placement_set()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_bo.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index d409b26607f3..5ece6efeab80 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -318,7 +318,7 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype)
ret = ttm_bo_reserve(bo, false, false, false, NULL);
if (ret)
- goto out;
+ return ret;
if (nvbo->pin_refcnt && !(memtype & (1 << bo->mem.mem_type))) {
NV_ERROR(drm, "bo %p pinned elsewhere: 0x%08x vs 0x%08x\n", bo,
@@ -327,14 +327,20 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype)
goto out;
}
- if (nvbo->pin_refcnt)
- goto ref_inc;
+ if (nvbo->pin_refcnt++)
+ goto out;
nouveau_bo_placement_set(nvbo, memtype, 0);
+ /* drop pin_refcnt temporarily, so we don't trip the assertion
+ * in nouveau_bo_move() that makes sure we're not trying to
+ * move a pinned buffer
+ */
+ nvbo->pin_refcnt--;
ret = nouveau_bo_validate(nvbo, false, false);
if (ret)
goto out;
+ nvbo->pin_refcnt++;
switch (bo->mem.mem_type) {
case TTM_PL_VRAM:
@@ -347,8 +353,6 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype)
break;
}
-ref_inc:
- nvbo->pin_refcnt++;
out:
ttm_bo_unreserve(bo);
return ret;