#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#if defined(__GNUC__) && __GNUC__ >= 4
+#include "util/u_math.h"
+
+#if defined(__GNUC__)
#define XA_EXPORT __attribute__ ((visibility("default")))
#else
#define XA_EXPORT
};
struct xa_surface {
+ int refcount;
struct pipe_resource template;
struct xa_tracker *xa;
struct pipe_resource *tex;
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 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,
* 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
+static inline void
xa_pixel_to_float4_a8(uint32_t pixel, float *color)
{
uint32_t a;
/*
* xa_context.c
*/
+extern void
+xa_context_flush(struct xa_context *ctx);
+
extern int
xa_ctx_srf_create(struct xa_context *ctx, struct xa_surface *dst);
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,