r100: Use preprocessor to select big vs little endian paths
authorDylan Baker <dylan@pnwbakers.com>
Thu, 6 Sep 2018 21:17:51 +0000 (14:17 -0700)
committerDylan Baker <dylan@pnwbakers.com>
Tue, 5 Nov 2019 16:39:55 +0000 (16:39 +0000)
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
src/mesa/drivers/dri/radeon/radeon_blit.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_texture.c

index 17a5a3901fdcb9ece69a3c94101d119e90bdbd0f..a72be9435abdf1d216cd901b12dea68555b9b5be 100644 (file)
@@ -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.
index 6345f2ce6618bab721409d1c53ac3cffbd38d202..9e7887de769c9811709244f80abda73ad2f08b81 100644 (file)
@@ -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);
index bd03b9110d23787d0475ebea4424e4c6f8eaf8a2..2888c1eba84ddaa0cc9ca86f47552109ad50b89f 100644 (file)
@@ -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