diff options
author | Dave Airlie <[email protected]> | 2010-10-06 12:49:26 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2010-10-18 09:13:46 +1000 |
commit | 82114ac02a2d5a764ce69711fc0a71f559ee9137 (patch) | |
tree | 55e761a905fe4efcb9c923994a5264b6d5aa12a5 /src/gallium/drivers | |
parent | c9d297162ad7efb87ab3e29c14259147d891baf9 (diff) |
r600g: switch to a common formats.h file since they are in different regs
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/r600/eg_state_inlines.h | 37 | ||||
-rw-r--r-- | src/gallium/drivers/r600/evergreend.h | 39 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_formats.h | 56 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_inlines.h | 47 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 41 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600d.h | 40 |
6 files changed, 121 insertions, 139 deletions
diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h index 5a4e00aac38..be81c28b43f 100644 --- a/src/gallium/drivers/r600/eg_state_inlines.h +++ b/src/gallium/drivers/r600/eg_state_inlines.h @@ -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; diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 5d07f532f09..8e96f9355e6 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1050,45 +1050,6 @@ #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 index 00000000000..0c91a212384 --- /dev/null +++ b/src/gallium/drivers/r600/r600_formats.h @@ -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 diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h index 29a29d87cd3..1c1978f8abb 100644 --- a/src/gallium/drivers/r600/r600_state_inlines.h +++ b/src/gallium/drivers/r600/r600_state_inlines.h @@ -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; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 22fe8bf0f39..152cd9210fd 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -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; } } diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index f32f5286c95..76df62ffc3e 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -1028,45 +1028,7 @@ #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 |