aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--freedreno/freedreno_bo.c10
-rw-r--r--freedreno/freedreno_drmif.h3
-rw-r--r--freedreno/freedreno_priv.h1
-rw-r--r--freedreno/msm/msm_bo.c13
4 files changed, 27 insertions, 0 deletions
diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index df35c36a..331b8227 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -195,6 +195,16 @@ out_unlock:
195 return bo; 195 return bo;
196} 196}
197 197
198uint64_t fd_bo_get_iova(struct fd_bo *bo)
199{
200 return bo->funcs->iova(bo);
201}
202
203void fd_bo_put_iova(struct fd_bo *bo)
204{
205 /* currently a no-op */
206}
207
198struct fd_bo * fd_bo_ref(struct fd_bo *bo) 208struct fd_bo * fd_bo_ref(struct fd_bo *bo)
199{ 209{
200 atomic_inc(&bo->refcnt); 210 atomic_inc(&bo->refcnt);
diff --git a/freedreno/freedreno_drmif.h b/freedreno/freedreno_drmif.h
index c3b0d02a..2711518b 100644
--- a/freedreno/freedreno_drmif.h
+++ b/freedreno/freedreno_drmif.h
@@ -95,6 +95,7 @@ enum fd_version {
95 FD_VERSION_UNLIMITED_CMDS = 1, /* submits w/ >4 cmd buffers (growable ringbuffer) */ 95 FD_VERSION_UNLIMITED_CMDS = 1, /* submits w/ >4 cmd buffers (growable ringbuffer) */
96 FD_VERSION_FENCE_FD = 2, /* submit command supports in/out fences */ 96 FD_VERSION_FENCE_FD = 2, /* submit command supports in/out fences */
97 FD_VERSION_SUBMIT_QUEUES = 3, /* submit queues and multiple priority levels */ 97 FD_VERSION_SUBMIT_QUEUES = 3, /* submit queues and multiple priority levels */
98 FD_VERSION_BO_IOVA = 3, /* supports fd_bo_get/put_iova() */
98}; 99};
99enum fd_version fd_device_version(struct fd_device *dev); 100enum fd_version fd_device_version(struct fd_device *dev);
100 101
@@ -123,6 +124,8 @@ struct fd_bo *fd_bo_from_handle(struct fd_device *dev,
123 uint32_t handle, uint32_t size); 124 uint32_t handle, uint32_t size);
124struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name); 125struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name);
125struct fd_bo * fd_bo_from_dmabuf(struct fd_device *dev, int fd); 126struct fd_bo * fd_bo_from_dmabuf(struct fd_device *dev, int fd);
127uint64_t fd_bo_get_iova(struct fd_bo *bo);
128void fd_bo_put_iova(struct fd_bo *bo);
126struct fd_bo * fd_bo_ref(struct fd_bo *bo); 129struct fd_bo * fd_bo_ref(struct fd_bo *bo);
127void fd_bo_del(struct fd_bo *bo); 130void fd_bo_del(struct fd_bo *bo);
128int fd_bo_get_name(struct fd_bo *bo, uint32_t *name); 131int fd_bo_get_name(struct fd_bo *bo, uint32_t *name);
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 81ad6092..a0957fad 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -157,6 +157,7 @@ struct fd_bo_funcs {
157 int (*cpu_prep)(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op); 157 int (*cpu_prep)(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op);
158 void (*cpu_fini)(struct fd_bo *bo); 158 void (*cpu_fini)(struct fd_bo *bo);
159 int (*madvise)(struct fd_bo *bo, int willneed); 159 int (*madvise)(struct fd_bo *bo, int willneed);
160 uint64_t (*iova)(struct fd_bo *bo);
160 void (*destroy)(struct fd_bo *bo); 161 void (*destroy)(struct fd_bo *bo);
161}; 162};
162 163
diff --git a/freedreno/msm/msm_bo.c b/freedreno/msm/msm_bo.c
index 72471df6..281c5aa7 100644
--- a/freedreno/msm/msm_bo.c
+++ b/freedreno/msm/msm_bo.c
@@ -108,6 +108,18 @@ static int msm_bo_madvise(struct fd_bo *bo, int willneed)
108 return req.retained; 108 return req.retained;
109} 109}
110 110
111static uint64_t msm_bo_iova(struct fd_bo *bo)
112{
113 struct drm_msm_gem_info req = {
114 .handle = bo->handle,
115 .flags = MSM_INFO_IOVA,
116 };
117
118 drmCommandWriteRead(bo->dev->fd, DRM_MSM_GEM_INFO, &req, sizeof(req));
119
120 return req.offset;
121}
122
111static void msm_bo_destroy(struct fd_bo *bo) 123static void msm_bo_destroy(struct fd_bo *bo)
112{ 124{
113 struct msm_bo *msm_bo = to_msm_bo(bo); 125 struct msm_bo *msm_bo = to_msm_bo(bo);
@@ -120,6 +132,7 @@ static const struct fd_bo_funcs funcs = {
120 .cpu_prep = msm_bo_cpu_prep, 132 .cpu_prep = msm_bo_cpu_prep,
121 .cpu_fini = msm_bo_cpu_fini, 133 .cpu_fini = msm_bo_cpu_fini,
122 .madvise = msm_bo_madvise, 134 .madvise = msm_bo_madvise,
135 .iova = msm_bo_iova,
123 .destroy = msm_bo_destroy, 136 .destroy = msm_bo_destroy,
124}; 137};
125 138