From: Ben Skeggs Date: Wed, 26 Dec 2007 19:21:13 +0000 (+1100) Subject: nouveau: track last validated offsets, so we know when relocs can be avoided. X-Git-Tag: 062012170305~17580^2~496^2~298^2~16^2~425 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc6d73e1a47cfd7f4cb615e75d9f7f944efabf03;p=profile%2Fivi%2Fmesa.git nouveau: track last validated offsets, so we know when relocs can be avoided. --- diff --git a/src/mesa/drivers/dri/nouveau_winsys/nouveau_bo.c b/src/mesa/drivers/dri/nouveau_winsys/nouveau_bo.c index 08d38c5..288674f 100644 --- a/src/mesa/drivers/dri/nouveau_winsys/nouveau_bo.c +++ b/src/mesa/drivers/dri/nouveau_winsys/nouveau_bo.c @@ -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; } diff --git a/src/mesa/drivers/dri/nouveau_winsys/nouveau_drmif.h b/src/mesa/drivers/dri/nouveau_winsys/nouveau_drmif.h index 4b42baf..3e88686 100644 --- a/src/mesa/drivers/dri/nouveau_winsys/nouveau_drmif.h +++ b/src/mesa/drivers/dri/nouveau_winsys/nouveau_drmif.h @@ -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)) diff --git a/src/mesa/drivers/dri/nouveau_winsys/nouveau_pushbuf.c b/src/mesa/drivers/dri/nouveau_winsys/nouveau_pushbuf.c index 020b1e0..a34a5c1 100644 --- a/src/mesa/drivers/dri/nouveau_winsys/nouveau_pushbuf.c +++ b/src/mesa/drivers/dri/nouveau_winsys/nouveau_pushbuf.c @@ -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;