#include "pipe/p_context.h"
#include "pipe/p_state.h"
+#include "util/u_math.h"
+
+#if defined(__GNUC__)
+#define XA_EXPORT __attribute__ ((visibility("default")))
+#else
+#define XA_EXPORT
+#endif
+
#define XA_VB_SIZE (100 * 4 * 3 * 4)
#define XA_LAST_SURFACE_TYPE (xa_type_yuv_component + 1)
#define XA_MAX_SAMPLERS 3
};
struct xa_surface {
+ int refcount;
struct pipe_resource template;
struct xa_tracker *xa;
struct pipe_resource *tex;
- struct pipe_surface *srf;
- struct pipe_sampler_view *view;
+ struct pipe_transfer *transfer;
unsigned int flags;
struct xa_format_descriptor fdesc;
- struct pipe_transfer *transfer;
struct pipe_context *mapping_pipe;
};
unsigned int format_map[XA_LAST_SURFACE_TYPE][2];
int d_depth_bits_last;
int ds_depth_bits_last;
+ struct pipe_loader_device *dev;
struct pipe_screen *screen;
struct xa_context *default_ctx;
};
struct pipe_fence_handle *last_fence;
struct xa_surface *src;
struct xa_surface *dst;
+ struct pipe_surface *srf;
+
+ /* destination scissor state.. we scissor out untouched parts
+ * of the dst for the benefit of tilers:
+ */
+ struct pipe_scissor_state scissor;
+ int scissor_valid;
+
int simple_copy;
int has_solid_color;
const struct xa_composite *comp;
};
+static inline void
+xa_scissor_reset(struct xa_context *ctx)
+{
+ ctx->scissor.maxx = 0;
+ ctx->scissor.maxy = 0;
+ ctx->scissor.minx = ~0;
+ ctx->scissor.miny = ~0;
+ ctx->scissor_valid = FALSE;
+}
+
+static inline void
+xa_scissor_update(struct xa_context *ctx, unsigned minx, unsigned miny,
+ unsigned maxx, unsigned maxy)
+{
+ ctx->scissor.maxx = MAX2(ctx->scissor.maxx, maxx);
+ ctx->scissor.maxy = MAX2(ctx->scissor.maxy, maxy);
+ ctx->scissor.minx = MIN2(ctx->scissor.minx, minx);
+ ctx->scissor.miny = MIN2(ctx->scissor.miny, miny);
+ ctx->scissor_valid = TRUE;
+}
+
enum xa_vs_traits {
VS_COMPOSITE = 1 << 0,
VS_MASK = 1 << 1,
FS_MASK_SET_ALPHA = 1 << 13,
FS_SRC_LUMINANCE = 1 << 14,
FS_MASK_LUMINANCE = 1 << 15,
+ FS_DST_LUMINANCE = 1 << 16,
FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | FS_RADGRAD_FILL),
FS_COMPONENT_ALPHA = (FS_CA_FULL | FS_CA_SRCALPHA)
* Inline utilities
*/
-static INLINE int
+static inline int
xa_min(int a, int b)
{
return ((a <= b) ? a : b);
}
-static INLINE void
+static inline void
xa_pixel_to_float4(uint32_t pixel, float *color)
{
uint32_t r, g, b, a;
color[3] = ((float)a) / 255.;
}
+static inline void
+xa_pixel_to_float4_a8(uint32_t pixel, float *color)
+{
+ uint32_t a;
+
+ a = (pixel >> 24) & 0xff;
+ color[0] = ((float)a) / 255.;
+ color[1] = ((float)a) / 255.;
+ color[2] = ((float)a) / 255.;
+ color[3] = ((float)a) / 255.;
+}
/*
* xa_tgsi.c
/*
* xa_context.c
*/
+extern void
+xa_context_flush(struct xa_context *ctx);
+
extern int
-xa_surface_psurf_create(struct xa_context *ctx, struct xa_surface *dst);
+xa_ctx_srf_create(struct xa_context *ctx, struct xa_surface *dst);
extern void
-xa_surface_psurf_destroy(struct xa_surface *dst);
+xa_ctx_srf_destroy(struct xa_context *ctx);
+
+extern void
+xa_ctx_sampler_views_destroy(struct xa_context *ctx);
/*
* xa_renderer.c
struct xa_surface *srf[]);
void renderer_bind_destination(struct xa_context *r,
- struct pipe_surface *surface, int width,
- int height);
+ struct pipe_surface *surface);
void renderer_init_state(struct xa_context *r);
void renderer_copy_prepare(struct xa_context *r,
struct pipe_surface *dst_surface,
- struct pipe_resource *src_texture);
+ struct pipe_resource *src_texture,
+ const enum xa_formats src_xa_format,
+ const enum xa_formats dst_xa_format);
+
void renderer_copy(struct xa_context *r, int dx,
int dy,
int sx,