diff options
-rw-r--r-- | st_api.h | 75 |
1 files changed, 42 insertions, 33 deletions
@@ -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); }; /** |