Mesa (main): freedreno/drm: Move bo common init

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 27 23:33:33 UTC 2022


Module: Mesa
Branch: main
Commit: 122cedf98c0870a388acafb5852fc62071f45696
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=122cedf98c0870a388acafb5852fc62071f45696

Author: Rob Clark <robdclark at chromium.org>
Date:   Sun Mar 27 16:22:29 2022 -0700

freedreno/drm: Move bo common init

We'll need this to happen before virtio_bo_new() returns in the next
patch.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16086>

---

 src/freedreno/drm/freedreno_bo.c     | 8 ++------
 src/freedreno/drm/freedreno_priv.h   | 2 ++
 src/freedreno/drm/msm/msm_bo.c       | 2 ++
 src/freedreno/drm/virtio/virtio_bo.c | 2 ++
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/freedreno/drm/freedreno_bo.c b/src/freedreno/drm/freedreno_bo.c
index eae3f56a626..9b67ef3e74f 100644
--- a/src/freedreno/drm/freedreno_bo.c
+++ b/src/freedreno/drm/freedreno_bo.c
@@ -57,8 +57,8 @@ lookup_bo(struct hash_table *tbl, uint32_t key)
    return bo;
 }
 
-static void
-bo_init_common(struct fd_bo *bo, struct fd_device *dev)
+void
+fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev)
 {
    /* Backend should have initialized these: */
    assert(bo->size);
@@ -89,8 +89,6 @@ bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
       return NULL;
    }
 
-   bo_init_common(bo, dev);
-
    /* add ourself into the handle table: */
    _mesa_hash_table_insert(dev->handle_table, &bo->handle, bo);
 
@@ -115,8 +113,6 @@ bo_new(struct fd_device *dev, uint32_t size, uint32_t flags,
    if (!bo)
       return NULL;
 
-   bo_init_common(bo, dev);
-
    simple_mtx_lock(&table_lock);
    /* add ourself into the handle table: */
    _mesa_hash_table_insert(dev->handle_table, &bo->handle, bo);
diff --git a/src/freedreno/drm/freedreno_priv.h b/src/freedreno/drm/freedreno_priv.h
index 0d8efa6acd4..44d81a351f4 100644
--- a/src/freedreno/drm/freedreno_priv.h
+++ b/src/freedreno/drm/freedreno_priv.h
@@ -380,6 +380,8 @@ enum fd_bo_state {
 };
 enum fd_bo_state fd_bo_state(struct fd_bo *bo);
 
+void fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev);
+
 struct fd_bo *fd_bo_new_ring(struct fd_device *dev, uint32_t size);
 
 #define enable_debug 0 /* TODO make dynamic */
diff --git a/src/freedreno/drm/msm/msm_bo.c b/src/freedreno/drm/msm/msm_bo.c
index 171d2da3929..70e7d751b73 100644
--- a/src/freedreno/drm/msm/msm_bo.c
+++ b/src/freedreno/drm/msm/msm_bo.c
@@ -222,5 +222,7 @@ msm_bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
    bo->handle = handle;
    bo->funcs = &funcs;
 
+   fd_bo_init_common(bo, dev);
+
    return bo;
 }
diff --git a/src/freedreno/drm/virtio/virtio_bo.c b/src/freedreno/drm/virtio/virtio_bo.c
index 7337b7657c5..91917d9b8ed 100644
--- a/src/freedreno/drm/virtio/virtio_bo.c
+++ b/src/freedreno/drm/virtio/virtio_bo.c
@@ -230,6 +230,8 @@ bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
    bo->funcs = &funcs;
    bo->handle = handle;
 
+   fd_bo_init_common(bo, dev);
+
    return bo;
 }
 



More information about the mesa-commit mailing list