aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_bufmgr.h
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-04-21 01:42:06 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:06 -0800
commit79466c13138c8c975f90a5eaf9a1049db87e20e0 (patch)
treea9c7353b4ee1c1a920094c5bb1782cc8245b703e /src/gallium/drivers/iris/iris_bufmgr.h
parent60d708bb80f0b587b99f87aac4c9faa9ee9c760b (diff)
iris: move bo_offset_from_sba
for wider use
Diffstat (limited to 'src/gallium/drivers/iris/iris_bufmgr.h')
-rw-r--r--src/gallium/drivers/iris/iris_bufmgr.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_bufmgr.h b/src/gallium/drivers/iris/iris_bufmgr.h
index 48ea7da9a5f..05d0f922951 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.h
+++ b/src/gallium/drivers/iris/iris_bufmgr.h
@@ -329,5 +329,21 @@ int iris_reg_read(struct iris_bufmgr *bufmgr, uint32_t offset, uint64_t *out);
int drm_ioctl(int fd, unsigned long request, void *arg);
+/**
+ * Returns the BO's address relative to the appropriate base address.
+ *
+ * All of our base addresses are programmed to the start of a 4GB region,
+ * so simply returning the bottom 32 bits of the BO address will give us
+ * the offset from whatever base address corresponds to that memory region.
+ */
+static inline uint32_t
+iris_bo_offset_from_base_address(struct iris_bo *bo)
+{
+ /* This only works for buffers in the memory zones corresponding to a
+ * base address - the top, unbounded memory zone doesn't have a base.
+ */
+ assert(bo->gtt_offset < IRIS_MEMZONE_OTHER_START);
+ return bo->gtt_offset;
+}
#endif /* IRIS_BUFMGR_H */