Mesa (master): freedreno: Initialize the bo's iova at creation time.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 8 20:07:28 UTC 2020


Module: Mesa
Branch: master
Commit: c9e8df61dc8737f167767f2bda8a56abcae8ad5e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9e8df61dc8737f167767f2bda8a56abcae8ad5e

Author: Eric Anholt <eric at anholt.net>
Date:   Thu May  7 16:58:25 2020 -0700

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>

---

 src/freedreno/drm/freedreno_bo.c                | 9 ++-------
 src/freedreno/drm/freedreno_drmif.h             | 1 -
 src/freedreno/drm/msm_ringbuffer_sp.c           | 2 +-
 src/gallium/drivers/freedreno/freedreno_state.c | 4 ----
 4 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/freedreno/drm/freedreno_bo.c b/src/freedreno/drm/freedreno_bo.c
index 6d51023acac..04f9c1d16b4 100644
--- a/src/freedreno/drm/freedreno_bo.c
+++ b/src/freedreno/drm/freedreno_bo.c
@@ -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);
diff --git a/src/freedreno/drm/freedreno_drmif.h b/src/freedreno/drm/freedreno_drmif.h
index 210b5c18604..ad8ef9ae316 100644
--- a/src/freedreno/drm/freedreno_drmif.h
+++ b/src/freedreno/drm/freedreno_drmif.h
@@ -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);
diff --git a/src/freedreno/drm/msm_ringbuffer_sp.c b/src/freedreno/drm/msm_ringbuffer_sp.c
index 1df82d8f599..5d8e34cc9c1 100644
--- a/src/freedreno/drm/msm_ringbuffer_sp.c
+++ b/src/freedreno/drm/msm_ringbuffer_sp.c
@@ -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)
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c
index 698ca82e521..a72958a1bc8 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -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);
 		}
 



More information about the mesa-commit mailing list