return fdesc;
}
+int
+xa_format_check_supported(struct xa_tracker *xa,
+ enum xa_formats xa_format, unsigned int flags)
+{
+ struct xa_format_descriptor fdesc = xa_get_pipe_format(xa_format);
+ unsigned int bind;
+
+ if (fdesc.xa_format == xa_format_unknown)
+ return -XA_ERR_INVAL;
+
+ bind = stype_bind[xa_format_type(fdesc.xa_format)];
+ if (flags & XA_FLAG_SHARED)
+ bind |= PIPE_BIND_SHARED;
+ if (flags & XA_FLAG_RENDER_TARGET)
+ bind |= PIPE_BIND_RENDER_TARGET;
+
+ if (!xa->screen->is_format_supported(xa->screen, fdesc.format,
+ PIPE_TEXTURE_2D, 0, bind))
+ return -XA_ERR_INVAL;
+
+ return XA_ERR_NONE;
+}
+
struct xa_surface *
xa_surface_create(struct xa_tracker *xa,
int width,
int depth,
enum xa_surface_type stype,
enum xa_formats xa_format,
- unsigned int add_flags,
- unsigned int remove_flags, int copy_contents)
+ unsigned int new_flags,
+ int copy_contents)
{
struct pipe_resource *template = &srf->template;
struct pipe_resource *texture;
struct xa_tracker *xa = srf->xa;
int save_width;
int save_height;
- unsigned int new_flags = (srf->flags | add_flags) & ~(remove_flags);
struct xa_format_descriptor fdesc;
if (xa_format == xa_format_unknown)
enum xa_formats
xa_surface_format(const struct xa_surface *srf)
{
- return srf->fdesc.format;
+ return srf->fdesc.xa_format;
}
#include <stdint.h>
#define XA_TRACKER_VERSION_MAJOR 0
-#define XA_TRACKER_VERSION_MINOR 3
+#define XA_TRACKER_VERSION_MINOR 4
#define XA_TRACKER_VERSION_PATCH 0
#define XA_FLAG_SHARED (1 << 0)
extern void xa_tracker_destroy(struct xa_tracker *xa);
+extern int xa_format_check_supported(struct xa_tracker *xa,
+ enum xa_formats xa_format,
+ unsigned int flags);
+
extern struct xa_surface *xa_surface_create(struct xa_tracker *xa,
int width,
int height,
int depth,
enum xa_surface_type stype,
enum xa_formats rgb_format,
- unsigned int add_flags,
- unsigned int remove_flags, int copy_contents);
+ unsigned int new_flags,
+ int copy_contents);
extern int xa_surface_handle(struct xa_surface *srf,
uint32_t * handle, unsigned int *byte_stride);