[Mesa-dev] [PATCH 04/19] gallium: introduce memory object
Andres Rodriguez
andresx7 at gmail.com
Fri Jun 30 23:02:57 UTC 2017
From: Dave Airlie <airlied at redhat.com>
---
src/gallium/include/pipe/p_screen.h | 36 ++++++++++++++++++++++++++++++++++++
src/gallium/include/pipe/p_state.h | 2 ++
2 files changed, 38 insertions(+)
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 65e954a..929dc8f 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -357,6 +357,42 @@ struct pipe_screen {
enum pipe_format format, int max,
uint64_t *modifiers,
unsigned int *external_only, int *count);
+
+ /**
+ * Create a memory object from a winsys handle
+ *
+ * The underlying memory is most often allocated in by a foregin API.
+ * Then the underlying memory object is then exported through interfaces
+ * compatible with EXT_external_resources.
+ *
+ * Note: For DRM_API_HANDLE_TYPE_FD handles, ownership of the fd is
+ * transferred to the driver implementation. This is consistent with
+ * EXT_external_object_fd
+ *
+ * \param handle A handle representing the memory object to import
+ */
+ struct pipe_memory_object *(*memobj_create_from_handle)(struct pipe_screen *screen,
+ struct winsys_handle *handle);
+
+ /**
+ * Destroy a memory object
+ *
+ * \param memobj The memory object to destroy
+ */
+ void (*memobj_destroy)(struct pipe_screen *screen,
+ struct pipe_memory_object *memobj);
+
+ /**
+ * Create a texture from a memory object
+ *
+ * \param t texture template
+ * \param memobj The memory object used to back the texture
+ */
+ struct pipe_resource * (*resource_from_memobj)(struct pipe_screen *screen,
+ const struct pipe_resource *t,
+ struct pipe_memory_object *memobj,
+ uint64_t offset);
+
};
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 15be8cb..acbb73f 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -888,6 +888,8 @@ struct pipe_memory_info
unsigned nr_device_memory_evictions; /**< # of evictions (monotonic counter) */
};
+struct pipe_memory_object;
+
#ifdef __cplusplus
}
#endif
--
2.9.3
More information about the mesa-dev
mailing list