summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-03-04 11:54:57 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-03-04 12:50:04 +0800
commitb58f6492b3d40ffdb7b25669e8e91998ebc0348d (patch)
tree64930236c5d3260627b5c672147d75314aa325ba
parent58392ee9459a99ff44d1b6acbcae69832f11818d (diff)
Rework (un)lock_resource.
Merge "lock" and "unlock" callbacks by a simple "get". Explicitly mention EGLImage so that the implementor knows it should implement the EGLImage semantics. EGLImage is no longer associated with a pipe_surface, as the pipe_surface should be created by the rendering context.
-rw-r--r--st_api.h75
1 files changed, 42 insertions, 33 deletions
diff --git a/st_api.h b/st_api.h
index 9b59357..e538a84 100644
--- a/st_api.h
+++ b/st_api.h
@@ -98,18 +98,9 @@ enum st_attachment_type {
#define ST_ATTACHMENT_SAMPLE_MASK (1 << ST_ATTACHMENT_SAMPLE)
/**
- * Enumerations of state tracker manager resources.
- */
-enum st_manager_resource_type {
- /* return struct pipe_surface (this is likely to change) */
- ST_MANAGER_RESOURCE_EGL_IMAGE,
-};
-
-/**
* Enumerations of state tracker context resources.
*/
enum st_context_resource_type {
- /* all of them return struct pipe_texture */
ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_2D,
ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_3D,
ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_X,
@@ -132,6 +123,36 @@ struct pipe_texture;
struct pipe_fence_handle;
/**
+ * Used in st_context_iface->get_resource_for_egl_image.
+ */
+struct st_context_resource
+{
+ /* these fields are filled by the caller */
+ enum st_context_resource_type type;
+ void *resource;
+
+ /* this is owned by the caller */
+ struct pipe_texture *texture;
+};
+
+/**
+ * Used in st_manager_iface->get_egl_image.
+ */
+struct st_egl_image
+{
+ /* these fields are filled by the caller */
+ struct st_context_iface *stctxi;
+ void *egl_image;
+
+ /* this is owned by the caller */
+ struct pipe_texture *texture;
+
+ unsigned face;
+ unsigned level;
+ unsigned zslice;
+};
+
+/**
* Represent the visual of a framebuffer.
*/
struct st_visual
@@ -240,19 +261,6 @@ struct st_context_iface
void (*destroy)(struct st_context_iface *stctxi);
/**
- * Lock and unlock a state tracker context resource.
- *
- * This gives access to the underlying data structure of a state tracker
- * context resource. Unless there is some mechanism not defined here that
- * can lengthen the lifetime of the data structure, it is valid only until
- * unlocked.
- */
- void *(*lock_resource)(struct st_context_iface *stctxi,
- enum st_context_resource_type type, void *res);
- void (*unlock_resource)(struct st_context_iface *stctxi,
- enum st_context_resource_type type, void *res);
-
- /**
* Invalidate the current textures that was taken from a framebuffer.
*
* The state tracker manager calls this function to let the rendering
@@ -291,6 +299,14 @@ struct st_context_iface
*/
void (*copy)(struct st_context_iface *stctxi,
struct st_context_iface *stsrci, unsigned mask);
+
+ /**
+ * Look up and return the info of a resource for EGLImage.
+ *
+ * This function is optional.
+ */
+ boolean (*get_resource_for_egl_image)(struct st_context_iface *stctxi,
+ struct st_context_resource *stres);
};
@@ -305,19 +321,12 @@ struct st_manager
struct pipe_screen *screen;
/**
- * Lock and unlock a state tracker manager resource.
+ * Look up and return the info of an EGLImage.
*
- * This gives access to the underlying data structure of a state tracker
- * manager resource. Unless there is some mechanism not defined here that
- * can lengthen the lifetime of the data structure, it is valid only until
- * unlocked.
+ * This function is optional.
*/
- void *(*lock_resource)(struct st_manager *smapi,
- struct st_context_iface *stctxi,
- enum st_manager_resource_type type, void *res);
- void (*unlock_resource)(struct st_manager *smapi,
- struct st_context_iface *stctxi,
- enum st_manager_resource_type type, void *res);
+ boolean (*get_egl_image)(struct st_manager *smapi,
+ struct st_egl_image *stimg);
};
/**