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=e8f67a12276ee53ef94530a55f2d6571b77998af;hpb=636d01bd61cac83e13c3c64874e7e34e828ca93a;p=mesa.git diff --git a/src/gallium/state_trackers/xa/xa_priv.h b/src/gallium/state_trackers/xa/xa_priv.h index e8f67a12276..13a0e86f66d 100644 --- a/src/gallium/state_trackers/xa/xa_priv.h +++ b/src/gallium/state_trackers/xa/xa_priv.h @@ -38,6 +38,14 @@ #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 @@ -53,14 +61,13 @@ struct xa_format_descriptor { }; 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; }; @@ -69,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; }; @@ -97,6 +105,14 @@ struct xa_context { 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; @@ -107,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, @@ -152,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; @@ -173,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; @@ -199,11 +236,17 @@ 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_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 @@ -222,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,