diff options
author | Marek Olšák <maraeo@gmail.com> | 2009-12-18 18:23:00 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-22 20:14:04 -0500 |
commit | 512889f450c1851d9e3628f1894b9b64b0701eac (patch) | |
tree | b6a3ded7f8b5d6a0874c606a030fa3c18c7efa0b /drivers/gpu | |
parent | 46c64d4bfa01cda7d58c514164f8b127ab6741b7 (diff) |
drm/radeon/kms: add 3DC compression support
There are 2 formats:
ATI1N: 64 bits per 4x4 block, one-channel format
ATI2N: 128 bits per 4x4 block, two-channel format
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/r300.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r300_reg.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 6a5d1177afab..3f2cc9e2e8d9 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -887,6 +887,14 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
887 | track->textures[i].cpp = 1; | 887 | track->textures[i].cpp = 1; |
888 | track->textures[i].compress_format = R100_TRACK_COMP_DXT1; | 888 | track->textures[i].compress_format = R100_TRACK_COMP_DXT1; |
889 | break; | 889 | break; |
890 | case R300_TX_FORMAT_ATI2N: | ||
891 | if (p->rdev->family < CHIP_R420) { | ||
892 | DRM_ERROR("Invalid texture format %u\n", | ||
893 | (idx_value & 0x1F)); | ||
894 | return -EINVAL; | ||
895 | } | ||
896 | /* The same rules apply as for DXT3/5. */ | ||
897 | /* Pass through. */ | ||
890 | case R300_TX_FORMAT_DXT3: | 898 | case R300_TX_FORMAT_DXT3: |
891 | case R300_TX_FORMAT_DXT5: | 899 | case R300_TX_FORMAT_DXT5: |
892 | track->textures[i].cpp = 1; | 900 | track->textures[i].cpp = 1; |
@@ -951,6 +959,16 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
951 | track->textures[i].width_11 = tmp; | 959 | track->textures[i].width_11 = tmp; |
952 | tmp = ((idx_value >> 16) & 1) << 11; | 960 | tmp = ((idx_value >> 16) & 1) << 11; |
953 | track->textures[i].height_11 = tmp; | 961 | track->textures[i].height_11 = tmp; |
962 | |||
963 | /* ATI1N */ | ||
964 | if (idx_value & (1 << 14)) { | ||
965 | /* The same rules apply as for DXT1. */ | ||
966 | track->textures[i].compress_format = | ||
967 | R100_TRACK_COMP_DXT1; | ||
968 | } | ||
969 | } else if (idx_value & (1 << 14)) { | ||
970 | DRM_ERROR("Forbidden bit TXFORMAT_MSB\n"); | ||
971 | return -EINVAL; | ||
954 | } | 972 | } |
955 | break; | 973 | break; |
956 | case 0x4480: | 974 | case 0x4480: |
diff --git a/drivers/gpu/drm/radeon/r300_reg.h b/drivers/gpu/drm/radeon/r300_reg.h index 4b7afef35a65..1735a2b69580 100644 --- a/drivers/gpu/drm/radeon/r300_reg.h +++ b/drivers/gpu/drm/radeon/r300_reg.h | |||
@@ -900,6 +900,7 @@ | |||
900 | # define R300_TX_FORMAT_FL_I32 0x1B | 900 | # define R300_TX_FORMAT_FL_I32 0x1B |
901 | # define R300_TX_FORMAT_FL_I32A32 0x1C | 901 | # define R300_TX_FORMAT_FL_I32A32 0x1C |
902 | # define R300_TX_FORMAT_FL_R32G32B32A32 0x1D | 902 | # define R300_TX_FORMAT_FL_R32G32B32A32 0x1D |
903 | # define R300_TX_FORMAT_ATI2N 0x1F | ||
903 | /* alpha modes, convenience mostly */ | 904 | /* alpha modes, convenience mostly */ |
904 | /* if you have alpha, pick constant appropriate to the | 905 | /* if you have alpha, pick constant appropriate to the |
905 | number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */ | 906 | number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */ |