diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2008-03-21 17:40:01 +1100 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-03-21 17:40:01 +1100 |
commit | 735ecf5de8587f8e52fe6ffc7f3f17403d140e23 (patch) | |
tree | 0ba8004860d081ce27f770bca2e1d158515e2e3c /src/gallium/winsys | |
parent | 5d2577e576635559da202d0d062601e404843b2c (diff) |
nouveau: potentially delay buffer destruction
Rather than spinning waiting for the GPU to finish with the buffer,
add a callback on the buffer's fence object instead. Gives a sizable
performance increase in OA.
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/dri/nouveau/nouveau_bo.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_bo.c b/src/gallium/winsys/dri/nouveau/nouveau_bo.c index 40d4667c47..5dbb7d0374 100644 --- a/src/gallium/winsys/dri/nouveau/nouveau_bo.c +++ b/src/gallium/winsys/dri/nouveau/nouveau_bo.c @@ -206,6 +206,18 @@ nouveau_bo_ref(struct nouveau_device *dev, uint64_t handle, return 0; } +static void +nouveau_bo_del_cb(void *priv) +{ + struct nouveau_bo_priv *nvbo = priv; + + nouveau_fence_ref(NULL, &nvbo->fence); + nouveau_mem_free(nvbo->base.device, &nvbo->drm, &nvbo->map); + if (nvbo->sysmem && !nvbo->user) + free(nvbo->sysmem); + free(nvbo); +} + void nouveau_bo_del(struct nouveau_bo **bo) { @@ -220,11 +232,9 @@ nouveau_bo_del(struct nouveau_bo **bo) return; if (nvbo->fence) - nouveau_fence_wait(&nvbo->fence); - nouveau_mem_free(nvbo->base.device, &nvbo->drm, &nvbo->map); - if (nvbo->sysmem && !nvbo->user) - free(nvbo->sysmem); - free(nvbo); + nouveau_fence_signal_cb(nvbo->fence, nouveau_bo_del_cb, nvbo); + else + nouveau_bo_del_cb(nvbo); } int |