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

Author: Asahi Lina <[email protected]>
Date:   Tue Nov  8 10:20:03 2022 -0500

asahi: Stub import/export code

It will be used on Linux, and it is convenient to be able to compile the same
code on macOS in the mean time.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19606>

---

 src/asahi/lib/agx_bo.h     |  6 ++++++
 src/asahi/lib/agx_device.c | 14 ++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/src/asahi/lib/agx_bo.h b/src/asahi/lib/agx_bo.h
index f3b11295cf9..e4ce33e739a 100644
--- a/src/asahi/lib/agx_bo.h
+++ b/src/asahi/lib/agx_bo.h
@@ -38,6 +38,10 @@ enum agx_alloc_type {
    AGX_NUM_ALLOC,
 };
 
+/* BO is shared across processes (imported or exported) and therefore cannot be
+ * cached locally */
+#define AGX_BO_SHARED             (1 << 0)
+
 struct agx_ptr {
    /* If CPU mapped, CPU address. NULL if not mapped */
    void *cpu;
@@ -86,5 +90,7 @@ agx_bo_create(struct agx_device *dev, unsigned size, unsigned 
flags);
 
 void agx_bo_reference(struct agx_bo *bo);
 void agx_bo_unreference(struct agx_bo *bo);
+struct agx_bo *agx_bo_import(struct agx_device *dev, int fd);
+int agx_bo_export(struct agx_bo *bo);
 
 #endif
diff --git a/src/asahi/lib/agx_device.c b/src/asahi/lib/agx_device.c
index 2c60c5f5097..d5a22822bab 100644
--- a/src/asahi/lib/agx_device.c
+++ b/src/asahi/lib/agx_device.c
@@ -217,6 +217,20 @@ agx_bo_unreference(struct agx_bo *bo)
    pthread_mutex_unlock(&dev->bo_map_lock);
 }
 
+struct agx_bo *
+agx_bo_import(struct agx_device *dev, int fd)
+{
+   unreachable("Linux UAPI not yet upstream");
+}
+
+int
+agx_bo_export(struct agx_bo *bo)
+{
+   bo->flags |= AGX_BO_SHARED;
+
+   unreachable("Linux UAPI not yet upstream");
+}
+
 struct agx_bo *
 agx_bo_create(struct agx_device *dev, unsigned size, unsigned flags)
 {

Reply via email to