diff options
author | Dylan Baker <[email protected]> | 2018-09-06 14:17:51 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2019-11-05 16:39:55 +0000 |
commit | 68d8c1f9718edd486bf366e1fd266abfd8a81164 (patch) | |
tree | 0907a900e08da5479629b0ac06f46239c3fc58ef /src/mesa/drivers | |
parent | a550b6b7f81e16f1ec711ae029260fb3ec1dc367 (diff) |
r100: Use preprocessor to select big vs little endian paths
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_blit.c | 49 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 21 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.c | 27 |
3 files changed, 51 insertions, 46 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.c b/src/mesa/drivers/dri/radeon/radeon_blit.c index 17a5a3901fd..a72be9435ab 100644 --- a/src/mesa/drivers/dri/radeon/radeon_blit.c +++ b/src/mesa/drivers/dri/radeon/radeon_blit.c @@ -42,35 +42,26 @@ static inline uint32_t cmdpacket0(struct radeon_screen *rscrn, unsigned r100_check_blit(mesa_format mesa_format, uint32_t dst_pitch) { /* XXX others? */ - if (_mesa_little_endian()) { - switch (mesa_format) { - case MESA_FORMAT_B8G8R8A8_UNORM: - case MESA_FORMAT_B8G8R8X8_UNORM: - case MESA_FORMAT_B5G6R5_UNORM: - case MESA_FORMAT_B4G4R4A4_UNORM: - case MESA_FORMAT_B5G5R5A1_UNORM: - case MESA_FORMAT_A_UNORM8: - case MESA_FORMAT_L_UNORM8: - case MESA_FORMAT_I_UNORM8: - break; - default: - return 0; - } - } - else { - switch (mesa_format) { - case MESA_FORMAT_A8R8G8B8_UNORM: - case MESA_FORMAT_X8R8G8B8_UNORM: - case MESA_FORMAT_R5G6B5_UNORM: - case MESA_FORMAT_A4R4G4B4_UNORM: - case MESA_FORMAT_A1R5G5B5_UNORM: - case MESA_FORMAT_A_UNORM8: - case MESA_FORMAT_L_UNORM8: - case MESA_FORMAT_I_UNORM8: - break; - default: - return 0; - } + switch (mesa_format) { +#ifdef PIPE_ARCH_LITTLE_ENDIAN + case MESA_FORMAT_B8G8R8A8_UNORM: + case MESA_FORMAT_B8G8R8X8_UNORM: + case MESA_FORMAT_B5G6R5_UNORM: + case MESA_FORMAT_B4G4R4A4_UNORM: + case MESA_FORMAT_B5G5R5A1_UNORM: +#else + case MESA_FORMAT_A8R8G8B8_UNORM: + case MESA_FORMAT_X8R8G8B8_UNORM: + case MESA_FORMAT_R5G6B5_UNORM: + case MESA_FORMAT_A4R4G4B4_UNORM: + case MESA_FORMAT_A1R5G5B5_UNORM: +#endif + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: + break; + default: + return 0; } /* Rendering to small buffer doesn't work. diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 6345f2ce661..9e7887de769 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -696,11 +696,26 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv, _mesa_initialize_window_framebuffer(&rfb->base, mesaVis); if (mesaVis->redBits == 5) - rgbFormat = _mesa_little_endian() ? MESA_FORMAT_B5G6R5_UNORM : MESA_FORMAT_R5G6B5_UNORM; + rgbFormat = +#ifdef PIPE_ARCH_LITTLE_ENDIAN + MESA_FORMAT_B5G6R5_UNORM; +#else + MESA_FORMAT_R5G6B5_UNORM; +#endif else if (mesaVis->alphaBits == 0) - rgbFormat = _mesa_little_endian() ? MESA_FORMAT_B8G8R8X8_UNORM : MESA_FORMAT_X8R8G8B8_UNORM; + rgbFormat = +#ifdef PIPE_ARCH_LITTLE_ENDIAN + MESA_FORMAT_B8G8R8X8_UNORM; +#else + MESA_FORMAT_X8R8G8B8_UNORM; +#endif else - rgbFormat = _mesa_little_endian() ? MESA_FORMAT_B8G8R8A8_UNORM : MESA_FORMAT_A8R8G8B8_UNORM; + rgbFormat = +#ifdef PIPE_ARCH_LITTLE_ENDIAN + MESA_FORMAT_B8G8R8A8_UNORM; +#else + MESA_FORMAT_A8R8G8B8_UNORM; +#endif /* front color renderbuffer */ rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index bd03b9110d2..2888c1eba84 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -602,20 +602,19 @@ mesa_format _radeon_texformat_argb1555 = MESA_FORMAT_NONE; static void radeonInitTextureFormats(void) { - if (_mesa_little_endian()) { - _radeon_texformat_rgba8888 = MESA_FORMAT_A8B8G8R8_UNORM; - _radeon_texformat_argb8888 = MESA_FORMAT_B8G8R8A8_UNORM; - _radeon_texformat_rgb565 = MESA_FORMAT_B5G6R5_UNORM; - _radeon_texformat_argb4444 = MESA_FORMAT_B4G4R4A4_UNORM; - _radeon_texformat_argb1555 = MESA_FORMAT_B5G5R5A1_UNORM; - } - else { - _radeon_texformat_rgba8888 = MESA_FORMAT_R8G8B8A8_UNORM; - _radeon_texformat_argb8888 = MESA_FORMAT_A8R8G8B8_UNORM; - _radeon_texformat_rgb565 = MESA_FORMAT_R5G6B5_UNORM; - _radeon_texformat_argb4444 = MESA_FORMAT_A4R4G4B4_UNORM; - _radeon_texformat_argb1555 = MESA_FORMAT_A1R5G5B5_UNORM; - } +#ifdef PIPE_ARCH_LITTLE_ENDIAN + _radeon_texformat_rgba8888 = MESA_FORMAT_A8B8G8R8_UNORM; + _radeon_texformat_argb8888 = MESA_FORMAT_B8G8R8A8_UNORM; + _radeon_texformat_rgb565 = MESA_FORMAT_B5G6R5_UNORM; + _radeon_texformat_argb4444 = MESA_FORMAT_B4G4R4A4_UNORM; + _radeon_texformat_argb1555 = MESA_FORMAT_B5G5R5A1_UNORM; +#else + _radeon_texformat_rgba8888 = MESA_FORMAT_R8G8B8A8_UNORM; + _radeon_texformat_argb8888 = MESA_FORMAT_A8R8G8B8_UNORM; + _radeon_texformat_rgb565 = MESA_FORMAT_R5G6B5_UNORM; + _radeon_texformat_argb4444 = MESA_FORMAT_A4R4G4B4_UNORM; + _radeon_texformat_argb1555 = MESA_FORMAT_A1R5G5B5_UNORM; +#endif } void |