diff options
author | Oded Gabbay <[email protected]> | 2016-03-21 23:46:15 +0200 |
---|---|---|
committer | Oded Gabbay <[email protected]> | 2016-04-26 11:00:16 +0300 |
commit | 2242dbe11d56b05ede7a928a9973adda4b145ad7 (patch) | |
tree | 608d5f1c46b354fc4a34f89c03b9bdabb57e6708 /src/gallium/drivers/r600/r600_state.c | |
parent | 4965c5bf72d95a73a1a4219843fe36c65b7b10c2 (diff) |
r600g/radeonsi: send endian info to format translation functions
Because r600 GPUs can't do swap in their DB unit, we need to disable
endianess swapping for textures that are handled by DB.
There are four format translation functions in r600g driver:
- r600_translate_texformat
- r600_colorformat_endian_swap
- r600_translate_colorformat
- r600_translate_colorswap
This patch adds a new parameters to those functions, called
"do_endian_swap". When running in a big-endian machine, the calling
functions will check whether the texture/color is handled by DB -
"rtex->is_depth && !rtex->is_flushing_texture" - and if so, they will
send FALSE through this parameter. Otherwise, they will send TRUE.
The translation functions, in specific cases, will look at this parameter
and configure the swapping accordingly.
v4:
evergreen_init_color_surface_rat() is only used by compute and don't
handle DB surfaces, so just sent hard-coded FALSE to translation
functions when called by it.
Signed-off-by: Oded Gabbay <[email protected]>
Cc: "11.1 11.2" <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_state.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 91e747fa937..75a43639053 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -143,13 +143,14 @@ static uint32_t r600_translate_dbformat(enum pipe_format format) static bool r600_is_sampler_format_supported(struct pipe_screen *screen, enum pipe_format format) { - return r600_translate_texformat(screen, format, NULL, NULL, NULL) != ~0U; + return r600_translate_texformat(screen, format, NULL, NULL, NULL, + FALSE) != ~0U; } static bool r600_is_colorbuffer_format_supported(enum chip_class chip, enum pipe_format format) { - return r600_translate_colorformat(chip, format) != ~0U && - r600_translate_colorswap(format) != ~0U; + return r600_translate_colorformat(chip, format, FALSE) != ~0U && + r600_translate_colorswap(format, FALSE) != ~0U; } static bool r600_is_zs_format_supported(enum pipe_format format) @@ -659,6 +660,7 @@ r600_create_sampler_view_custom(struct pipe_context *ctx, uint32_t word4 = 0, yuv_format = 0, pitch = 0; unsigned char swizzle[4], array_mode = 0; unsigned width, height, depth, offset_level, last_level; + bool do_endian_swap = FALSE; if (!view) return NULL; @@ -679,9 +681,12 @@ r600_create_sampler_view_custom(struct pipe_context *ctx, swizzle[2] = state->swizzle_b; swizzle[3] = state->swizzle_a; + if (R600_BIG_ENDIAN) + do_endian_swap = !(tmp->is_depth && !tmp->is_flushing_texture); + format = r600_translate_texformat(ctx->screen, state->format, swizzle, - &word4, &yuv_format); + &word4, &yuv_format, do_endian_swap); assert(format != ~0); if (format == ~0) { FREE(view); @@ -696,7 +701,7 @@ r600_create_sampler_view_custom(struct pipe_context *ctx, tmp = tmp->flushed_depth_texture; } - endian = r600_colorformat_endian_swap(format); + endian = r600_colorformat_endian_swap(format, do_endian_swap); offset_level = state->u.tex.first_level; last_level = state->u.tex.last_level - offset_level; @@ -824,7 +829,7 @@ static void r600_init_color_surface(struct r600_context *rctx, unsigned offset; const struct util_format_description *desc; int i; - bool blend_bypass = 0, blend_clamp = 1; + bool blend_bypass = 0, blend_clamp = 1, do_endian_swap = FALSE; if (rtex->is_depth && !rtex->is_flushing_texture && !r600_can_read_depth(rtex)) { r600_init_flushed_depth_texture(&rctx->b.b, surf->base.texture, NULL); @@ -887,13 +892,17 @@ static void r600_init_color_surface(struct r600_context *rctx, ntype = V_0280A0_NUMBER_UINT; } - format = r600_translate_colorformat(rctx->b.chip_class, surf->base.format); + if (R600_BIG_ENDIAN) + do_endian_swap = !(rtex->is_depth && !rtex->is_flushing_texture); + + format = r600_translate_colorformat(rctx->b.chip_class, surf->base.format, + do_endian_swap); assert(format != ~0); - swap = r600_translate_colorswap(surf->base.format); + swap = r600_translate_colorswap(surf->base.format, do_endian_swap); assert(swap != ~0); - endian = r600_colorformat_endian_swap(format); + endian = r600_colorformat_endian_swap(format, do_endian_swap); /* set blend bypass according to docs if SINT/UINT or 8/24 COLOR variants */ |