nouveau: allow unfenced read of buffers in a few situations

This commit is contained in:
Ben Skeggs 2007-12-27 06:10:49 +11:00
parent a794fcfbdb
commit 3b8efe1dfe
2 changed files with 8 additions and 1 deletions

View file

@ -299,8 +299,10 @@ nouveau_bo_map(struct nouveau_bo *bo, uint32_t flags)
if (!nvbo)
return -EINVAL;
if (nvbo->fence)
if (flags & NOUVEAU_BO_WR)
nouveau_fence_wait(&nvbo->fence);
else
nouveau_fence_wait(&nvbo->wr_fence);
if (nvbo->sysmem)
bo->map = nvbo->sysmem;
@ -385,6 +387,8 @@ nouveau_bo_validate(struct nouveau_channel *chan, struct nouveau_bo *bo,
struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
int ret;
assert(bo->map == NULL);
if (nvbo->user) {
ret = nouveau_bo_validate_user(chan, bo, fence, flags);
if (ret) {
@ -398,6 +402,8 @@ nouveau_bo_validate(struct nouveau_channel *chan, struct nouveau_bo *bo,
return ret;
}
if (flags & NOUVEAU_BO_WR)
nouveau_fence_ref(fence, &nvbo->wr_fence);
nouveau_fence_ref(fence, &nvbo->fence);
return 0;
}

View file

@ -242,6 +242,7 @@ struct nouveau_bo_priv {
struct nouveau_bo base;
struct nouveau_fence *fence;
struct nouveau_fence *wr_fence;
struct drm_nouveau_mem_alloc drm;
void *map;