[Mesa-dev] [PATCH 057/140] amd/addrlib: Not all ETC2 formats are 128bpp... add new ETC2 formats to differentiate between 64 and 128bpp formats.
Marek Olšák
maraeo at gmail.com
Mon Mar 20 22:43:07 UTC 2017
From: Kevin Furrow <kevin.furrow at amd.com>
---
src/amd/addrlib/addrtypes.h | 2 ++
src/amd/addrlib/core/addrelemlib.cpp | 24 ++++++++++++++++++++++-
src/amd/addrlib/core/addrelemlib.h | 38 +++++++++++++++++++-----------------
3 files changed, 45 insertions(+), 19 deletions(-)
diff --git a/src/amd/addrlib/addrtypes.h b/src/amd/addrlib/addrtypes.h
index 4d94a83..b90f420 100644
--- a/src/amd/addrlib/addrtypes.h
+++ b/src/amd/addrlib/addrtypes.h
@@ -280,20 +280,22 @@ typedef enum _AddrFormat {
ADDR_FMT_ASTC_6x6 = 0x00000044,
ADDR_FMT_ASTC_8x5 = 0x00000045,
ADDR_FMT_ASTC_8x6 = 0x00000046,
ADDR_FMT_ASTC_8x8 = 0x00000047,
ADDR_FMT_ASTC_10x5 = 0x00000048,
ADDR_FMT_ASTC_10x6 = 0x00000049,
ADDR_FMT_ASTC_10x8 = 0x0000004a,
ADDR_FMT_ASTC_10x10 = 0x0000004b,
ADDR_FMT_ASTC_12x10 = 0x0000004c,
ADDR_FMT_ASTC_12x12 = 0x0000004d,
+ ADDR_FMT_ETC2_64BPP = 0x0000004e,
+ ADDR_FMT_ETC2_128BPP = 0x0000004f,
} AddrFormat;
/**
****************************************************************************************************
* AddrDepthFormat
*
* @brief
* Neutral enum for addrFlt32ToDepthPixel
*
****************************************************************************************************
diff --git a/src/amd/addrlib/core/addrelemlib.cpp b/src/amd/addrlib/core/addrelemlib.cpp
index a60a667..e616480 100644
--- a/src/amd/addrlib/core/addrelemlib.cpp
+++ b/src/amd/addrlib/core/addrelemlib.cpp
@@ -1167,22 +1167,26 @@ VOID ElemLib::AdjustSurfaceInfo(
case ADDR_PACKED_BC4:
packedBits = 64;
bBCnFormat = TRUE;
break;
case ADDR_PACKED_BC2: // Fall through
case ADDR_PACKED_BC3: // Fall through
case ADDR_PACKED_BC5: // Fall through
bBCnFormat = TRUE;
// fall through
case ADDR_PACKED_ASTC:
+ case ADDR_PACKED_ETC2_128BPP:
packedBits = 128;
break;
+ case ADDR_PACKED_ETC2_64BPP:
+ packedBits = 64;
+ break;
case ADDR_ROUND_BY_HALF: // Fall through
case ADDR_ROUND_TRUNCATE: // Fall through
case ADDR_ROUND_DITHER: // Fall through
case ADDR_UNCOMPRESSED:
packedBits = bpp;
break;
default:
packedBits = bpp;
ADDR_ASSERT_ALWAYS();
break;
@@ -1289,22 +1293,26 @@ VOID ElemLib::RestoreSurfaceInfo(
break;
case ADDR_PACKED_BC1: // Fall through
case ADDR_PACKED_BC4:
originalBits = 64;
break;
case ADDR_PACKED_BC2: // Fall through
case ADDR_PACKED_BC3: // Fall through
case ADDR_PACKED_BC5:
// fall through
case ADDR_PACKED_ASTC:
+ case ADDR_PACKED_ETC2_128BPP:
originalBits = 128;
break;
+ case ADDR_PACKED_ETC2_64BPP:
+ originalBits = 64;
+ break;
case ADDR_ROUND_BY_HALF: // Fall through
case ADDR_ROUND_TRUNCATE: // Fall through
case ADDR_ROUND_DITHER: // Fall through
case ADDR_UNCOMPRESSED:
originalBits = bpp;
break;
default:
originalBits = bpp;
ADDR_ASSERT_ALWAYS();
break;
@@ -1485,20 +1493,34 @@ UINT_32 ElemLib::GetBitsPerPixel(
break;
case ADDR_FMT_BC5:
case ADDR_FMT_BC6: // reuse ADDR_PACKED_BC5
case ADDR_FMT_BC7: // reuse ADDR_PACKED_BC5
elemMode = ADDR_PACKED_BC5;
expandX = 4;
expandY = 4;
bpp = 128;
break;
+ case ADDR_FMT_ETC2_64BPP:
+ elemMode = ADDR_PACKED_ETC2_64BPP;
+ expandX = 4;
+ expandY = 4;
+ bpp = 64;
+ break;
+
+ case ADDR_FMT_ETC2_128BPP:
+ elemMode = ADDR_PACKED_ETC2_128BPP;
+ expandX = 4;
+ expandY = 4;
+ bpp = 128;
+ break;
+
case ADDR_FMT_ASTC_4x4:
elemMode = ADDR_PACKED_ASTC;
expandX = 4;
expandY = 4;
bpp = 128;
break;
case ADDR_FMT_ASTC_5x4:
elemMode = ADDR_PACKED_ASTC;
expandX = 5;
@@ -1718,21 +1740,21 @@ VOID ElemLib::SetClearComps(
* @note
*
* @return
* BOOL_32
****************************************************************************************************
*/
BOOL_32 ElemLib::IsBlockCompressed(
AddrFormat format) ///< [in] Format
{
return (((format >= ADDR_FMT_BC1) && (format <= ADDR_FMT_BC7)) ||
- ((format >= ADDR_FMT_ASTC_4x4) && (format <= ADDR_FMT_ASTC_12x12)));
+ ((format >= ADDR_FMT_ASTC_4x4) && (format <= ADDR_FMT_ETC2_128BPP)));
}
/**
****************************************************************************************************
* ElemLib::IsCompressed
*
* @brief
* TRUE if this is block compressed format or 1 bit format
*
diff --git a/src/amd/addrlib/core/addrelemlib.h b/src/amd/addrlib/core/addrelemlib.h
index f8da4c2..f1e3236 100644
--- a/src/amd/addrlib/core/addrelemlib.h
+++ b/src/amd/addrlib/core/addrelemlib.h
@@ -108,44 +108,46 @@ enum NumberType
ADDR_S5FIXED, // Signed 5.N-bit fixed point, with rounding
ADDR_END_NUMBER // Used for range comparisons
};
// Copy from legacy lib's AddrElement
enum ElemMode
{
// These formats allow both packing an unpacking
- ADDR_ROUND_BY_HALF, // add 1/2 and truncate when packing this element
- ADDR_ROUND_TRUNCATE, // truncate toward 0 for sign/mag, else toward neg
- ADDR_ROUND_DITHER, // Pack by dithering -- requires (x,y) position
+ ADDR_ROUND_BY_HALF, // add 1/2 and truncate when packing this element
+ ADDR_ROUND_TRUNCATE, // truncate toward 0 for sign/mag, else toward neg
+ ADDR_ROUND_DITHER, // Pack by dithering -- requires (x,y) position
// These formats only allow unpacking, no packing
- ADDR_UNCOMPRESSED, // Elements are not compressed: one data element per pixel/texel
- ADDR_EXPANDED, // Elements are split up and stored in multiple data elements
- ADDR_PACKED_STD, // Elements are compressed into ExpandX by ExpandY data elements
- ADDR_PACKED_REV, // Like ADDR_PACKED, but X order of pixels is reverved
- ADDR_PACKED_GBGR, // Elements are compressed 4:2:2 in G1B_G0R order (high to low)
- ADDR_PACKED_BGRG, // Elements are compressed 4:2:2 in BG1_RG0 order (high to low)
- ADDR_PACKED_BC1, // Each data element is uncompressed to a 4x4 pixel/texel array
- ADDR_PACKED_BC2, // Each data element is uncompressed to a 4x4 pixel/texel array
- ADDR_PACKED_BC3, // Each data element is uncompressed to a 4x4 pixel/texel array
- ADDR_PACKED_BC4, // Each data element is uncompressed to a 4x4 pixel/texel array
- ADDR_PACKED_BC5, // Each data element is uncompressed to a 4x4 pixel/texel array
- ADDR_PACKED_ASTC,
+ ADDR_UNCOMPRESSED, // Elements are not compressed: one data element per pixel/texel
+ ADDR_EXPANDED, // Elements are split up and stored in multiple data elements
+ ADDR_PACKED_STD, // Elements are compressed into ExpandX by ExpandY data elements
+ ADDR_PACKED_REV, // Like ADDR_PACKED, but X order of pixels is reverved
+ ADDR_PACKED_GBGR, // Elements are compressed 4:2:2 in G1B_G0R order (high to low)
+ ADDR_PACKED_BGRG, // Elements are compressed 4:2:2 in BG1_RG0 order (high to low)
+ ADDR_PACKED_BC1, // Each data element is uncompressed to a 4x4 pixel/texel array
+ ADDR_PACKED_BC2, // Each data element is uncompressed to a 4x4 pixel/texel array
+ ADDR_PACKED_BC3, // Each data element is uncompressed to a 4x4 pixel/texel array
+ ADDR_PACKED_BC4, // Each data element is uncompressed to a 4x4 pixel/texel array
+ ADDR_PACKED_BC5, // Each data element is uncompressed to a 4x4 pixel/texel array
+ ADDR_PACKED_ETC2_64BPP, // ETC2 formats that use 64bpp to represent each 4x4 block
+ ADDR_PACKED_ETC2_128BPP, // ETC2 formats that use 128bpp to represent each 4x4 block
+ ADDR_PACKED_ASTC, // Various ASTC formats, all are 128bpp with varying block sizes
// These formats provide various kinds of compression
- ADDR_ZPLANE_R5XX, // Compressed Zplane using r5xx architecture format
- ADDR_ZPLANE_R6XX, // Compressed Zplane using r6xx architecture format
+ ADDR_ZPLANE_R5XX, // Compressed Zplane using r5xx architecture format
+ ADDR_ZPLANE_R6XX, // Compressed Zplane using r6xx architecture format
//@@ Fill in the compression modes
- ADDR_END_ELEMENT // Used for range comparisons
+ ADDR_END_ELEMENT // Used for range comparisons
};
enum DepthPlanarType
{
ADDR_DEPTH_PLANAR_NONE = 0, // No plane z/stencl
ADDR_DEPTH_PLANAR_R600 = 1, // R600 z and stencil planes are store within a tile
ADDR_DEPTH_PLANAR_R800 = 2, // R800 has separate z and stencil planes
};
/**
--
2.7.4
More information about the mesa-dev
mailing list