nouveau: track last validated offsets, so we know when relocs can be avoided.

This commit is contained in:
Ben Skeggs 2007-12-27 06:21:13 +11:00
parent 3b8efe1dfe
commit dc6d73e1a4
3 changed files with 18 additions and 5 deletions

View file

@ -348,8 +348,8 @@ nouveau_bo_validate_user(struct nouveau_channel *chan, struct nouveau_bo *bo,
memcpy(nvdev->sa_map + r->start, nvbo->sysmem, bo->size);
nvbo->base.offset = nvdev->sa.offset + r->start;
nvbo->base.flags = NOUVEAU_BO_GART;
nvbo->offset = nvdev->sa.offset + r->start;
nvbo->flags = NOUVEAU_BO_GART;
return 0;
}
@ -371,11 +371,11 @@ nouveau_bo_validate_bo(struct nouveau_channel *chan, struct nouveau_bo *bo,
nouveau_bo_upload(nvbo);
}
nvbo->base.offset = nvbo->drm.offset;
nvbo->offset = nvbo->drm.offset;
if (nvbo->drm.flags & (NOUVEAU_MEM_AGP | NOUVEAU_MEM_PCI))
nvbo->base.flags = NOUVEAU_BO_GART;
nvbo->flags = NOUVEAU_BO_GART;
else
nvbo->base.flags = NOUVEAU_BO_VRAM;
nvbo->flags = NOUVEAU_BO_VRAM;
return 0;
}

View file

@ -251,6 +251,9 @@ struct nouveau_bo_priv {
int user;
int refcount;
uint64_t offset;
uint64_t flags;
};
#define nouveau_bo(n) ((struct nouveau_bo_priv *)(n))

View file

@ -131,6 +131,16 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min)
ret = nouveau_bo_validate(chan, bo, fence, pbbo->flags);
assert (ret == 0);
if (bo->offset == nouveau_bo(bo)->offset &&
bo->flags == nouveau_bo(bo)->flags) {
/*XXX: could avoid reloc in this case, except with the
* current design we'd confuse the GPU quite a bit
* if we did this. Will fix soon.
*/
}
bo->offset = nouveau_bo(bo)->offset;
bo->flags = nouveau_bo(bo)->flags;
while ((r = ptr_to_pbrel(pbbo->relocs))) {
uint32_t push;