freedreno: Initialize the bo's iova at creation time.

Avoids repeated conditionals at reloc time checking if we need to go ask
the kernel.

No statistically significant difference on the drawoverhead case I'm
looking at (n=300).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4957>
This commit is contained in:
Eric Anholt 2020-05-07 16:58:25 -07:00
parent b3c4e6a597
commit c9e8df61dc
4 changed files with 3 additions and 13 deletions

View file

@ -72,6 +72,8 @@ static struct fd_bo * bo_from_handle(struct fd_device *dev,
bo->dev = fd_device_ref(dev);
bo->size = size;
bo->handle = handle;
bo->iova = bo->funcs->iova(bo);
p_atomic_set(&bo->refcnt, 1);
list_inithead(&bo->list);
/* add ourself into the handle table: */
@ -225,16 +227,9 @@ out_unlock:
uint64_t fd_bo_get_iova(struct fd_bo *bo)
{
if (!bo->iova)
bo->iova = bo->funcs->iova(bo);
return bo->iova;
}
void fd_bo_put_iova(struct fd_bo *bo)
{
/* currently a no-op */
}
struct fd_bo * fd_bo_ref(struct fd_bo *bo)
{
p_atomic_inc(&bo->refcnt);

View file

@ -158,7 +158,6 @@ struct fd_bo *fd_bo_from_handle(struct fd_device *dev,
struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name);
struct fd_bo * fd_bo_from_dmabuf(struct fd_device *dev, int fd);
uint64_t fd_bo_get_iova(struct fd_bo *bo);
void fd_bo_put_iova(struct fd_bo *bo);
struct fd_bo * fd_bo_ref(struct fd_bo *bo);
void fd_bo_del(struct fd_bo *bo);
int fd_bo_get_name(struct fd_bo *bo, uint32_t *name);

View file

@ -416,7 +416,7 @@ msm_ringbuffer_sp_emit_reloc(struct fd_ringbuffer *ring,
pipe = msm_ring->u.submit->pipe;
}
uint64_t iova = fd_bo_get_iova(reloc->bo) + reloc->offset;
uint64_t iova = reloc->bo->iova + reloc->offset;
int shift = reloc->shift;
if (shift < 0)

View file

@ -588,10 +588,6 @@ fd_set_global_binding(struct pipe_context *pctx,
for (unsigned i = 0; i < count; i++) {
unsigned n = i + first;
if (so->buf[n]) {
struct fd_resource *rsc = fd_resource(so->buf[n]);
fd_bo_put_iova(rsc->bo);
}
pipe_resource_reference(&so->buf[n], NULL);
}