diff options
Diffstat (limited to 'mesalib/src/gallium')
-rw-r--r-- | mesalib/src/gallium/Makefile.am | 8 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blit.c | 39 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blit.h | 7 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_inlines.h | 5 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_snprintf.c | 9 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_video.h | 74 |
6 files changed, 107 insertions, 35 deletions
diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am index 6018e9f72..21595a1aa 100644 --- a/mesalib/src/gallium/Makefile.am +++ b/mesalib/src/gallium/Makefile.am @@ -68,11 +68,11 @@ SUBDIRS += winsys/radeon/drm endif ## swrast/softpipe -if NEED_GALLIUM_SOFTPIPE_DRIVER +if HAVE_GALLIUM_SOFTPIPE SUBDIRS += drivers/softpipe ## swrast/llvmpipe -if NEED_GALLIUM_LLVMPIPE_DRIVER +if HAVE_GALLIUM_LLVMPIPE SUBDIRS += drivers/llvmpipe endif endif @@ -158,6 +158,10 @@ if HAVE_GALLIUM_OSMESA SUBDIRS += state_trackers/osmesa targets/osmesa endif +if HAVE_ST_VA +SUBDIRS += state_trackers/va targets/va +endif + if HAVE_ST_VDPAU SUBDIRS += state_trackers/vdpau targets/vdpau endif diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c index f69b4b1ab..2573bedf5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.c +++ b/mesalib/src/gallium/auxiliary/util/u_blit.c @@ -336,10 +336,10 @@ formats_compatible(enum pipe_format src_format, * Copy pixel block from src surface to dst surface. * Overlapping regions are acceptable. * Flipping and stretching are supported. - * \param filter one of PIPE_TEX_MIPFILTER_NEAREST/LINEAR - * \param writemask controls which channels in the dest surface are sourced - * from the src surface. Disabled channels are sourced - * from (0,0,0,1). + * \param filter one of PIPE_TEX_FILTER_NEAREST/LINEAR + * \param writemask bitmask of PIPE_MASK_[RGBAZS]. Controls which channels + * in the dest surface are sourced from the src surface. + * Disabled color channels are sourced from (0,0,0,1). */ void util_blit_pixels(struct blit_state *ctx, @@ -352,7 +352,7 @@ util_blit_pixels(struct blit_state *ctx, int dstX0, int dstY0, int dstX1, int dstY1, float z, uint filter, - uint writemask, uint zs_writemask) + uint writemask) { struct pipe_context *pipe = ctx->pipe; enum pipe_format src_format, dst_format; @@ -364,8 +364,8 @@ util_blit_pixels(struct blit_state *ctx, util_format_description(src_tex->format); struct pipe_blit_info info; - assert(filter == PIPE_TEX_MIPFILTER_NEAREST || - filter == PIPE_TEX_MIPFILTER_LINEAR); + assert(filter == PIPE_TEX_FILTER_NEAREST || + filter == PIPE_TEX_FILTER_LINEAR); assert(src_level <= src_tex->last_level); @@ -383,11 +383,18 @@ util_blit_pixels(struct blit_state *ctx, is_depth = util_format_has_depth(src_desc); is_stencil = util_format_has_stencil(src_desc); - blit_depth = is_depth && (zs_writemask & BLIT_WRITEMASK_Z); - blit_stencil = is_stencil && (zs_writemask & BLIT_WRITEMASK_STENCIL); + blit_depth = is_depth && (writemask & PIPE_MASK_Z); + blit_stencil = is_stencil && (writemask & PIPE_MASK_S); - assert((writemask && !zs_writemask && !is_depth && !is_stencil) || - (!writemask && (blit_depth || blit_stencil))); + if (is_depth || is_stencil) { + assert((writemask & PIPE_MASK_RGBA) == 0); + assert(blit_depth || blit_stencil); + } + else { + assert((writemask & PIPE_MASK_ZS) == 0); + assert(!blit_depth); + assert(!blit_stencil); + } /* * XXX: z parameter is deprecated. dst->u.tex.first_layer @@ -437,7 +444,7 @@ util_blit_pixels(struct blit_state *ctx, assert(info.dst.box.width >= 0); assert(info.dst.box.height >= 0); info.dst.box.depth = 1; - info.dst.format = dst->texture->format; + info.dst.format = dst_format; info.src.resource = src_tex; info.src.level = src_level; info.src.box.x = srcX0; @@ -446,8 +453,8 @@ util_blit_pixels(struct blit_state *ctx, info.src.box.width = srcX1 - srcX0; info.src.box.height = srcY1 - srcY0; info.src.box.depth = 1; - info.src.format = src_tex->format; - info.mask = writemask | (zs_writemask << 4); + info.src.format = src_format; + info.mask = writemask; info.filter = filter; info.scissor_enable = 0; @@ -486,8 +493,8 @@ util_blit_pixels_tex(struct blit_state *ctx, unsigned offset; struct pipe_resource *tex = src_sampler_view->texture; - assert(filter == PIPE_TEX_MIPFILTER_NEAREST || - filter == PIPE_TEX_MIPFILTER_LINEAR); + assert(filter == PIPE_TEX_FILTER_NEAREST || + filter == PIPE_TEX_FILTER_LINEAR); assert(tex); assert(tex->width0 != 0); diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.h b/mesalib/src/gallium/auxiliary/util/u_blit.h index 042c48942..b50edab78 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.h +++ b/mesalib/src/gallium/auxiliary/util/u_blit.h @@ -31,8 +31,6 @@ #include "pipe/p_compiler.h" -/* for TGSI_WRITEMASK_* specification in util_blit_pixels */ -#include "pipe/p_shader_tokens.h" #ifdef __cplusplus @@ -46,9 +44,6 @@ struct pipe_resource; struct pipe_sampler_view; struct pipe_surface; -#define BLIT_WRITEMASK_Z 1 -#define BLIT_WRITEMASK_STENCIL 2 - extern struct blit_state * util_create_blit(struct pipe_context *pipe, struct cso_context *cso); @@ -66,7 +61,7 @@ util_blit_pixels(struct blit_state *ctx, int dstX0, int dstY0, int dstX1, int dstY1, float z, uint filter, - uint writemask, uint zs_writemask); + uint writemask); extern void util_blit_pixels_tex(struct blit_state *ctx, diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index c80ec487e..95401621e 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -627,10 +627,11 @@ static INLINE unsigned util_max_layer(const struct pipe_resource *r, unsigned level) { switch (r->target) { - case PIPE_TEXTURE_CUBE: - return 6 - 1; case PIPE_TEXTURE_3D: return u_minify(r->depth0, level) - 1; + case PIPE_TEXTURE_CUBE: + assert(r->array_size == 6); + /* fall-through */ case PIPE_TEXTURE_1D_ARRAY: case PIPE_TEXTURE_2D_ARRAY: case PIPE_TEXTURE_CUBE_ARRAY: diff --git a/mesalib/src/gallium/auxiliary/util/u_snprintf.c b/mesalib/src/gallium/auxiliary/util/u_snprintf.c index a24b6ff38..7a2bf2a6f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_snprintf.c +++ b/mesalib/src/gallium/auxiliary/util/u_snprintf.c @@ -334,15 +334,6 @@ static void *mymemcpy(void *, void *, size_t); #endif /* HAVE_UINTPTR_T || defined(uintptr_t) */ #endif /* !defined(UINTPTR_T) */ -/* WinCE5.0 does not have uintptr_t defined */ -#if (_WIN32_WCE < 600) -#ifdef UINTPTR_T -#undef UINTPTR_T -#endif -#define UINTPTR_T unsigned long int -#endif - - /* Support for ptrdiff_t. */ #ifndef PTRDIFF_T #if HAVE_PTRDIFF_T || defined(ptrdiff_t) diff --git a/mesalib/src/gallium/auxiliary/util/u_video.h b/mesalib/src/gallium/auxiliary/util/u_video.h index d1ca7362b..45b2d6e76 100644 --- a/mesalib/src/gallium/auxiliary/util/u_video.h +++ b/mesalib/src/gallium/auxiliary/util/u_video.h @@ -72,6 +72,80 @@ u_reduce_video_profile(enum pipe_video_profile profile) } } +static INLINE void +u_copy_nv12_to_yv12(void *const *destination_data, + uint32_t const *destination_pitches, + int src_plane, int src_field, + int src_stride, int num_fields, + uint8_t const *src, + int width, int height) +{ + int x, y; + unsigned u_stride = destination_pitches[2] * num_fields; + unsigned v_stride = destination_pitches[1] * num_fields; + uint8_t *u_dst = (uint8_t *)destination_data[2] + destination_pitches[2] * src_field; + uint8_t *v_dst = (uint8_t *)destination_data[1] + destination_pitches[1] * src_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + u_dst[x] = src[2*x]; + v_dst[x] = src[2*x+1]; + } + u_dst += u_stride; + v_dst += v_stride; + src += src_stride; + } +} + +static INLINE void +u_copy_yv12_to_nv12(void *const *destination_data, + uint32_t const *destination_pitches, + int src_plane, int src_field, + int src_stride, int num_fields, + uint8_t const *src, + int width, int height) +{ + int x, y; + unsigned offset = 2 - src_plane; + unsigned stride = destination_pitches[1] * num_fields; + uint8_t *dst = (uint8_t *)destination_data[1] + destination_pitches[1] * src_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < 2 * width; x += 2) { + dst[x+offset] = src[x>>1]; + } + dst += stride; + src += src_stride; + } +} + +static INLINE void +u_copy_swap422_packed(void *const *destination_data, + uint32_t const *destination_pitches, + int src_plane, int src_field, + int src_stride, int num_fields, + uint8_t const *src, + int width, int height) +{ + int x, y; + unsigned stride = destination_pitches[0] * num_fields; + uint8_t *dst = (uint8_t *)destination_data[0] + destination_pitches[0] * src_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < 4 * width; x += 4) { + dst[x+0] = src[x+1]; + dst[x+1] = src[x+0]; + dst[x+2] = src[x+3]; + dst[x+3] = src[x+2]; + } + dst += stride; + src += src_stride; + } +} + #ifdef __cplusplus } #endif |