r600g: switch to a common formats.h file since they are in different regs
authorDave Airlie <airlied@redhat.com>
Wed, 6 Oct 2010 02:49:26 +0000 (12:49 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 17 Oct 2010 23:13:46 +0000 (09:13 +1000)
src/gallium/drivers/r600/eg_state_inlines.h
src/gallium/drivers/r600/evergreend.h
src/gallium/drivers/r600/r600_formats.h [new file with mode: 0644]
src/gallium/drivers/r600/r600_state_inlines.h
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/r600/r600d.h

index 5a4e00aac38c29908c11a361d902e1877f5b9f04..be81c28b43f5963940aa5f6a71a9629fec8034e4 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "util/u_format.h"
 #include "evergreend.h"
+#include "r600_formats.h"
 
 static INLINE uint32_t r600_translate_blend_function(int blend_func)
 {
@@ -523,32 +524,32 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format)
                case 16:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_030008_FMT_16_FLOAT;
+                               result = FMT_16_FLOAT;
                                break;
                        case 2:
-                               result = V_030008_FMT_16_16_FLOAT;
+                               result = FMT_16_16_FLOAT;
                                break;
                        case 3:
-                               result = V_030008_FMT_16_16_16_FLOAT;
+                               result = FMT_16_16_16_FLOAT;
                                break;
                        case 4:
-                               result = V_030008_FMT_16_16_16_16_FLOAT;
+                               result = FMT_16_16_16_16_FLOAT;
                                break;
                        }
                        break;
                case 32:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_030008_FMT_32_FLOAT;
+                               result = FMT_32_FLOAT;
                                break;
                        case 2:
-                               result = V_030008_FMT_32_32_FLOAT;
+                               result = FMT_32_32_FLOAT;
                                break;
                        case 3:
-                               result = V_030008_FMT_32_32_32_FLOAT;
+                               result = FMT_32_32_32_FLOAT;
                                break;
                        case 4:
-                               result = V_030008_FMT_32_32_32_32_FLOAT;
+                               result = FMT_32_32_32_32_FLOAT;
                                break;
                        }
                        break;
@@ -564,48 +565,48 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format)
                case 8:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_030008_FMT_8;
+                               result = FMT_8;
                                break;
                        case 2:
-                               result = V_030008_FMT_8_8;
+                               result = FMT_8_8;
                                break;
                        case 3:
 //                             result = V_038008_FMT_8_8_8; /* fails piglit draw-vertices test */
 //                             break;
                        case 4:
-                               result = V_030008_FMT_8_8_8_8;
+                               result = FMT_8_8_8_8;
                                break;
                        }
                        break;
                case 16:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_030008_FMT_16;
+                               result = FMT_16;
                                break;
                        case 2:
-                               result = V_030008_FMT_16_16;
+                               result = FMT_16_16;
                                break;
                        case 3:
 //                             result = V_038008_FMT_16_16_16; /* fails piglit draw-vertices test */
 //                             break;
                        case 4:
-                               result = V_030008_FMT_16_16_16_16;
+                               result = FMT_16_16_16_16;
                                break;
                        }
                        break;
                case 32:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_030008_FMT_32;
+                               result = FMT_32;
                                break;
                        case 2:
-                               result = V_030008_FMT_32_32;
+                               result = FMT_32_32;
                                break;
                        case 3:
-                               result = V_030008_FMT_32_32_32;
+                               result = FMT_32_32_32;
                                break;
                        case 4:
-                               result = V_030008_FMT_32_32_32_32;
+                               result = FMT_32_32_32_32;
                                break;
                        }
                        break;
index 5d07f532f09b3838f4bac9f47d943d706d944fe5..8e96f9355e62a938e9bf37f768b7ba91fc89102c 100644 (file)
 #define   S_030008_DATA_FORMAT(x)                      (((x) & 0x3F) << 20)
 #define   G_030008_DATA_FORMAT(x)                      (((x) >> 20) & 0x3F)
 #define   C_030008_DATA_FORMAT                         0xFC0FFFFF
-#define     V_030008_FMT_INVALID                     0x00000000
-#define     V_030008_FMT_8                           0x00000001
-#define     V_030008_FMT_4_4                         0x00000002
-#define     V_030008_FMT_3_3_2                       0x00000003
-#define     V_030008_FMT_16                          0x00000005
-#define     V_030008_FMT_16_FLOAT                    0x00000006
-#define     V_030008_FMT_8_8                         0x00000007
-#define     V_030008_FMT_5_6_5                       0x00000008
-#define     V_030008_FMT_6_5_5                       0x00000009
-#define     V_030008_FMT_1_5_5_5                     0x0000000A
-#define     V_030008_FMT_4_4_4_4                     0x0000000B
-#define     V_030008_FMT_5_5_5_1                     0x0000000C
-#define     V_030008_FMT_32                          0x0000000D
-#define     V_030008_FMT_32_FLOAT                    0x0000000E
-#define     V_030008_FMT_16_16                       0x0000000F
-#define     V_030008_FMT_16_16_FLOAT                 0x00000010
-#define     V_030008_FMT_8_24                        0x00000011
-#define     V_030008_FMT_8_24_FLOAT                  0x00000012
-#define     V_030008_FMT_24_8                        0x00000013
-#define     V_030008_FMT_24_8_FLOAT                  0x00000014
-#define     V_030008_FMT_10_11_11                    0x00000015
-#define     V_030008_FMT_10_11_11_FLOAT              0x00000016
-#define     V_030008_FMT_11_11_10                    0x00000017
-#define     V_030008_FMT_11_11_10_FLOAT              0x00000018
-#define     V_030008_FMT_2_10_10_10                  0x00000019
-#define     V_030008_FMT_8_8_8_8                     0x0000001A
-#define     V_030008_FMT_10_10_10_2                  0x0000001B
-#define     V_030008_FMT_X24_8_32_FLOAT              0x0000001C
-#define     V_030008_FMT_32_32                       0x0000001D
-#define     V_030008_FMT_32_32_FLOAT                 0x0000001E
-#define     V_030008_FMT_16_16_16_16                 0x0000001F
-#define     V_030008_FMT_16_16_16_16_FLOAT           0x00000020
-#define     V_030008_FMT_32_32_32_32                 0x00000022
-#define     V_030008_FMT_32_32_32_32_FLOAT           0x00000023
-#define     V_030008_FMT_8_8_8                       0x0000002c
-#define     V_030008_FMT_16_16_16                    0x0000002d
-#define     V_030008_FMT_16_16_16_FLOAT              0x0000002e
-#define     V_030008_FMT_32_32_32                    0x0000002f
-#define     V_030008_FMT_32_32_32_FLOAT              0x00000030
 #define   S_030008_NUM_FORMAT_ALL(x)                   (((x) & 0x3) << 26)
 #define   G_030008_NUM_FORMAT_ALL(x)                   (((x) >> 26) & 0x3)
 #define   C_030008_NUM_FORMAT_ALL                      0xF3FFFFFF
diff --git a/src/gallium/drivers/r600/r600_formats.h b/src/gallium/drivers/r600/r600_formats.h
new file mode 100644 (file)
index 0000000..0c91a21
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef R600_FORMATS_H
+#define R600_FORMATS_H
+
+/* list of formats from R700 ISA document - apply across GPUs in different registers */
+#define     FMT_INVALID                     0x00000000
+#define     FMT_8                           0x00000001
+#define     FMT_4_4                         0x00000002
+#define     FMT_3_3_2                       0x00000003
+#define     FMT_16                          0x00000005
+#define     FMT_16_FLOAT                    0x00000006
+#define     FMT_8_8                         0x00000007
+#define     FMT_5_6_5                       0x00000008
+#define     FMT_6_5_5                       0x00000009
+#define     FMT_1_5_5_5                     0x0000000A
+#define     FMT_4_4_4_4                     0x0000000B
+#define     FMT_5_5_5_1                     0x0000000C
+#define     FMT_32                          0x0000000D
+#define     FMT_32_FLOAT                    0x0000000E
+#define     FMT_16_16                       0x0000000F
+#define     FMT_16_16_FLOAT                 0x00000010
+#define     FMT_8_24                        0x00000011
+#define     FMT_8_24_FLOAT                  0x00000012
+#define     FMT_24_8                        0x00000013
+#define     FMT_24_8_FLOAT                  0x00000014
+#define     FMT_10_11_11                    0x00000015
+#define     FMT_10_11_11_FLOAT              0x00000016
+#define     FMT_11_11_10                    0x00000017
+#define     FMT_11_11_10_FLOAT              0x00000018
+#define     FMT_2_10_10_10                  0x00000019
+#define     FMT_8_8_8_8                     0x0000001A
+#define     FMT_10_10_10_2                  0x0000001B
+#define     FMT_X24_8_32_FLOAT              0x0000001C
+#define     FMT_32_32                       0x0000001D
+#define     FMT_32_32_FLOAT                 0x0000001E
+#define     FMT_16_16_16_16                 0x0000001F
+#define     FMT_16_16_16_16_FLOAT           0x00000020
+#define     FMT_32_32_32_32                 0x00000022
+#define     FMT_32_32_32_32_FLOAT           0x00000023
+#define     FMT_1                           0x00000025
+#define     FMT_GB_GR                       0x00000027
+#define     FMT_BG_RG                       0x00000028
+#define     FMT_32_AS_8                     0x00000029
+#define     FMT_32_AS_8_8                   0x0000002a
+#define     FMT_5_9_9_9_SHAREDEXP           0x0000002b
+#define     FMT_8_8_8                       0x0000002c
+#define     FMT_16_16_16                    0x0000002d
+#define     FMT_16_16_16_FLOAT              0x0000002e
+#define     FMT_32_32_32                    0x0000002f
+#define     FMT_32_32_32_FLOAT              0x00000030
+#define     FMT_BC1                         0x00000031
+#define     FMT_BC2                         0x00000032
+#define     FMT_BC3                         0x00000033
+#define     FMT_BC4                         0x00000034
+#define     FMT_BC5                         0x00000035
+
+#endif
index 29a29d87cd325c734058d23bcf87ec7511500261..1c1978f8abb74e87d14f1dcd63b205075c6a5152 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "util/u_format.h"
 #include "r600d.h"
+#include "r600_formats.h"
 
 static INLINE uint32_t r600_translate_blend_function(int blend_func)
 {
@@ -352,13 +353,13 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format)
                /* 64-bit buffers. */
        case PIPE_FORMAT_R16G16B16A16_UNORM:
        case PIPE_FORMAT_R16G16B16A16_SNORM:
-               //              return V_0280A0_COLOR_16_16_16_16;
+               //              return FMT_16_16_16_16;
        case PIPE_FORMAT_R16G16B16A16_FLOAT:
-               //              return V_0280A0_COLOR_16_16_16_16_FLOAT;
+               //              return FMT_16_16_16_16_FLOAT;
 
                /* 128-bit buffers. */
        case PIPE_FORMAT_R32G32B32A32_FLOAT:
-               //              return V_0280A0_COLOR_32_32_32_32_FLOAT;
+               //              return FMT_32_32_32_32_FLOAT;
                return 0;
        default:
                R600_ERR("unsupported colorswap format %d\n", format);
@@ -522,32 +523,32 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format)
                 case 16:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_038008_FMT_16_FLOAT;
+                               result = FMT_16_FLOAT;
                                break;
                        case 2:
-                               result = V_038008_FMT_16_16_FLOAT;
+                               result = FMT_16_16_FLOAT;
                                break;
                        case 3:
-                               result = V_038008_FMT_16_16_16_FLOAT;
+                               result = FMT_16_16_16_FLOAT;
                                break;
                        case 4:
-                               result = V_038008_FMT_16_16_16_16_FLOAT;
+                               result = FMT_16_16_16_16_FLOAT;
                                break;
                        }
                        break;
                 case 32:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_038008_FMT_32_FLOAT;
+                               result = FMT_32_FLOAT;
                                break;
                        case 2:
-                               result = V_038008_FMT_32_32_FLOAT;
+                               result = FMT_32_32_FLOAT;
                                break;
                        case 3:
-                               result = V_038008_FMT_32_32_32_FLOAT;
+                               result = FMT_32_32_32_FLOAT;
                                break;
                        case 4:
-                               result = V_038008_FMT_32_32_32_32_FLOAT;
+                               result = FMT_32_32_32_32_FLOAT;
                                break;
                        }
                        break;
@@ -563,48 +564,48 @@ static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format)
                 case 8:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_038008_FMT_8;
+                               result = FMT_8;
                                break;
                        case 2:
-                               result = V_038008_FMT_8_8;
+                               result = FMT_8_8;
                                break;
                        case 3:
-                       //      result = V_038008_FMT_8_8_8; /* fails piglit draw-vertices test */
+                       //      result = FMT_8_8_8; /* fails piglit draw-vertices test */
                        //      break;
                        case 4:
-                               result = V_038008_FMT_8_8_8_8;
+                               result = FMT_8_8_8_8;
                                break;
                        }
                        break;
                 case 16:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_038008_FMT_16;
+                               result = FMT_16;
                                break;
                        case 2:
-                               result = V_038008_FMT_16_16;
+                               result = FMT_16_16;
                                break;
                        case 3:
-                       //      result = V_038008_FMT_16_16_16; /* fails piglit draw-vertices test */
+                       //      result = FMT_16_16_16; /* fails piglit draw-vertices test */
                        //      break;
                        case 4:
-                               result = V_038008_FMT_16_16_16_16;
+                               result = FMT_16_16_16_16;
                                break;
                        }
                        break;
                 case 32:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_038008_FMT_32;
+                               result = FMT_32;
                                break;
                        case 2:
-                               result = V_038008_FMT_32_32;
+                               result = FMT_32_32;
                                break;
                        case 3:
-                               result = V_038008_FMT_32_32_32;
+                               result = FMT_32_32_32;
                                break;
                        case 4:
-                               result = V_038008_FMT_32_32_32_32;
+                               result = FMT_32_32_32_32;
                                break;
                        }
                        break;
index 22fe8bf0f39d9be9dfb737c94774f808e610e736..152cd9210fd852c00941fb3b44642dc7572456a6 100644 (file)
@@ -35,6 +35,7 @@
 #include "r600_resource.h"
 #include "r600_state_inlines.h"
 #include "r600d.h"
+#include "r600_formats.h"
 
 extern struct u_resource_vtbl r600_texture_vtbl;
 
@@ -565,19 +566,19 @@ uint32_t r600_translate_texformat(enum pipe_format format,
        case UTIL_FORMAT_COLORSPACE_ZS:
                switch (format) {
                case PIPE_FORMAT_Z16_UNORM:
-                       result = V_0280A0_COLOR_16;
+                       result = FMT_16;
                        goto out_word4;
                case PIPE_FORMAT_X24S8_USCALED:
                        word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT);
                case PIPE_FORMAT_Z24X8_UNORM:
                case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
-                       result = V_0280A0_COLOR_8_24;
+                       result = FMT_8_24;
                        goto out_word4;
                case PIPE_FORMAT_S8X24_USCALED:
                        word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT);
                case PIPE_FORMAT_X8Z24_UNORM:
                case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
-                       result = V_0280A0_COLOR_24_8;
+                       result = FMT_24_8;
                        goto out_word4;
                case PIPE_FORMAT_S8_USCALED:
                        result = V_0280A0_COLOR_8;
@@ -635,7 +636,7 @@ uint32_t r600_translate_texformat(enum pipe_format format,
                        if (desc->channel[0].size == 5 &&
                            desc->channel[1].size == 6 &&
                            desc->channel[2].size == 5) {
-                               result = V_0280A0_COLOR_5_6_5;
+                               result = FMT_5_6_5;
                                goto out_word4;
                        }
                        goto out_unknown;
@@ -644,14 +645,14 @@ uint32_t r600_translate_texformat(enum pipe_format format,
                            desc->channel[1].size == 5 &&
                            desc->channel[2].size == 5 &&
                            desc->channel[3].size == 1) {
-                               result = V_0280A0_COLOR_1_5_5_5;
+                               result = FMT_1_5_5_5;
                                goto out_word4;
                        }
                        if (desc->channel[0].size == 10 &&
                            desc->channel[1].size == 10 &&
                            desc->channel[2].size == 10 &&
                            desc->channel[3].size == 2) {
-                               result = V_0280A0_COLOR_10_10_10_2;
+                               result = FMT_10_10_10_2;
                                goto out_word4;
                        }
                        goto out_unknown;
@@ -682,36 +683,36 @@ uint32_t r600_translate_texformat(enum pipe_format format,
                case 4:
                        switch (desc->nr_channels) {
                        case 2:
-                               result = V_0280A0_COLOR_4_4;
+                               result = FMT_4_4;
                                goto out_word4;
                        case 4:
-                               result = V_0280A0_COLOR_4_4_4_4;
+                               result = FMT_4_4_4_4;
                                goto out_word4;
                        }
                        goto out_unknown;
                case 8:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_0280A0_COLOR_8;
+                               result = FMT_8;
                                goto out_word4;
                        case 2:
-                               result = V_0280A0_COLOR_8_8;
+                               result = FMT_8_8;
                                goto out_word4;
                        case 4:
-                               result = V_0280A0_COLOR_8_8_8_8;
+                               result = FMT_8_8_8_8;
                                goto out_word4;
                        }
                        goto out_unknown;
                case 16:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_0280A0_COLOR_16;
+                               result = FMT_16;
                                goto out_word4;
                        case 2:
-                               result = V_0280A0_COLOR_16_16;
+                               result = FMT_16_16;
                                goto out_word4;
                        case 4:
-                               result = V_0280A0_COLOR_16_16_16_16;
+                               result = FMT_16_16_16_16;
                                goto out_word4;
                        }
                }
@@ -722,26 +723,26 @@ uint32_t r600_translate_texformat(enum pipe_format format,
                case 16:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_0280A0_COLOR_16_FLOAT;
+                               result = FMT_16_FLOAT;
                                goto out_word4;
                        case 2:
-                               result = V_0280A0_COLOR_16_16_FLOAT;
+                               result = FMT_16_16_FLOAT;
                                goto out_word4;
                        case 4:
-                               result = V_0280A0_COLOR_16_16_16_16_FLOAT;
+                               result = FMT_16_16_16_16_FLOAT;
                                goto out_word4;
                        }
                        goto out_unknown;
                case 32:
                        switch (desc->nr_channels) {
                        case 1:
-                               result = V_0280A0_COLOR_32_FLOAT;
+                               result = FMT_32_FLOAT;
                                goto out_word4;
                        case 2:
-                               result = V_0280A0_COLOR_32_32_FLOAT;
+                               result = FMT_32_32_FLOAT;
                                goto out_word4;
                        case 4:
-                               result = V_0280A0_COLOR_32_32_32_32_FLOAT;
+                               result = FMT_32_32_32_32_FLOAT;
                                goto out_word4;
                        }
                }
index f32f5286c9564e1fd45d52ce238c14d296760a95..76df62ffc3ea9fbca6f707f321eb9a2e9392e7e2 100644 (file)
 #define   S_038008_DATA_FORMAT(x)                      (((x) & 0x3F) << 20)
 #define   G_038008_DATA_FORMAT(x)                      (((x) >> 20) & 0x3F)
 #define   C_038008_DATA_FORMAT                         0xFC0FFFFF
-#define     V_038008_FMT_INVALID                     0x00000000
-#define     V_038008_FMT_8                           0x00000001
-#define     V_038008_FMT_4_4                         0x00000002
-#define     V_038008_FMT_3_3_2                       0x00000003
-#define     V_038008_FMT_16                          0x00000005
-#define     V_038008_FMT_16_FLOAT                    0x00000006
-#define     V_038008_FMT_8_8                         0x00000007
-#define     V_038008_FMT_5_6_5                       0x00000008
-#define     V_038008_FMT_6_5_5                       0x00000009
-#define     V_038008_FMT_1_5_5_5                     0x0000000A
-#define     V_038008_FMT_4_4_4_4                     0x0000000B
-#define     V_038008_FMT_5_5_5_1                     0x0000000C
-#define     V_038008_FMT_32                          0x0000000D
-#define     V_038008_FMT_32_FLOAT                    0x0000000E
-#define     V_038008_FMT_16_16                       0x0000000F
-#define     V_038008_FMT_16_16_FLOAT                 0x00000010
-#define     V_038008_FMT_8_24                        0x00000011
-#define     V_038008_FMT_8_24_FLOAT                  0x00000012
-#define     V_038008_FMT_24_8                        0x00000013
-#define     V_038008_FMT_24_8_FLOAT                  0x00000014
-#define     V_038008_FMT_10_11_11                    0x00000015
-#define     V_038008_FMT_10_11_11_FLOAT              0x00000016
-#define     V_038008_FMT_11_11_10                    0x00000017
-#define     V_038008_FMT_11_11_10_FLOAT              0x00000018
-#define     V_038008_FMT_2_10_10_10                  0x00000019
-#define     V_038008_FMT_8_8_8_8                     0x0000001A
-#define     V_038008_FMT_10_10_10_2                  0x0000001B
-#define     V_038008_FMT_X24_8_32_FLOAT              0x0000001C
-#define     V_038008_FMT_32_32                       0x0000001D
-#define     V_038008_FMT_32_32_FLOAT                 0x0000001E
-#define     V_038008_FMT_16_16_16_16                 0x0000001F
-#define     V_038008_FMT_16_16_16_16_FLOAT           0x00000020
-#define     V_038008_FMT_32_32_32_32                 0x00000022
-#define     V_038008_FMT_32_32_32_32_FLOAT           0x00000023
-#define     V_038008_FMT_8_8_8                       0x0000002c
-#define     V_038008_FMT_16_16_16                    0x0000002d
-#define     V_038008_FMT_16_16_16_FLOAT              0x0000002e
-#define     V_038008_FMT_32_32_32                    0x0000002f
-#define     V_038008_FMT_32_32_32_FLOAT              0x00000030
+
 #define   S_038008_NUM_FORMAT_ALL(x)                   (((x) & 0x3) << 26)
 #define   G_038008_NUM_FORMAT_ALL(x)                   (((x) >> 26) & 0x3)
 #define   C_038008_NUM_FORMAT_ALL                      0xF3FFFFFF