summaryrefslogtreecommitdiffstats
path: root/src/gallium/include
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-07-12 18:45:09 -0400
committerTimothy Arceri <[email protected]>2017-08-06 12:42:06 +1000
commit714dfaae726534c3791df1ef8a9768f4435166d8 (patch)
treefdf95541a8147798dfb78a2d280c79f3da8255a3 /src/gallium/include
parent1e8e4ee230af2484d6aa22dfcc99ed4354f5842e (diff)
gallium: introduce memory object
v2: fix comment regarding fd ownership, define pipe_memory_object v3: remove stray return v4 (Timothy Arceri): update trace v5 (Timothy Arceri): actually dump the params in trace Reviewed-by: Marek Olšák <[email protected]> (v3) Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_screen.h36
-rw-r--r--src/gallium/include/pipe/p_state.h8
2 files changed, 44 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index b6623d1dd71..462b683cd75 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -358,6 +358,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, the caller retains ownership
+ * of the 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,
+ bool dedicated);
+
+ /**
+ * 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 15be8cb5d02..86c7751eb18 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -888,6 +888,14 @@ struct pipe_memory_info
unsigned nr_device_memory_evictions; /**< # of evictions (monotonic counter) */
};
+/**
+ * Structure that contains information about external memory
+ */
+struct pipe_memory_object
+{
+ bool dedicated;
+};
+
#ifdef __cplusplus
}
#endif