X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fstate_trackers%2Fxa%2Fxa_priv.h;h=13a0e86f66ded42f443cc3521f7a9044f5dd2d5c;hb=efaac624afb2c5d74230dbec3dc358f1d50bc806;hp=d00114f99b5341aa62f248518188c10dd868df1e;hpb=4d04367eca66a85e26f7c0f5d6392823d13880f6;p=mesa.git diff --git a/src/gallium/state_trackers/xa/xa_priv.h b/src/gallium/state_trackers/xa/xa_priv.h index d00114f99b5..13a0e86f66d 100644 --- a/src/gallium/state_trackers/xa/xa_priv.h +++ b/src/gallium/state_trackers/xa/xa_priv.h @@ -38,7 +38,9 @@ #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 @@ -59,6 +61,7 @@ struct xa_format_descriptor { }; struct xa_surface { + int refcount; struct pipe_resource template; struct xa_tracker *xa; struct pipe_resource *tex; @@ -73,6 +76,7 @@ struct xa_tracker { 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; }; @@ -103,6 +107,12 @@ struct xa_context { 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; @@ -113,6 +123,27 @@ struct xa_context { 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, @@ -158,13 +189,13 @@ struct xa_shaders; * 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; @@ -179,7 +210,7 @@ xa_pixel_to_float4(uint32_t pixel, float *color) color[3] = ((float)a) / 255.; } -static INLINE void +static inline void xa_pixel_to_float4_a8(uint32_t pixel, float *color) { uint32_t a; @@ -205,6 +236,9 @@ struct xa_shader xa_shaders_get(struct xa_shaders *shaders, /* * 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); @@ -231,13 +265,15 @@ void renderer_draw_yuv(struct xa_context *r, 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,