Skip to content

Commit 1a4cf50

Browse files
lpriyank-intelgfxbot
authored andcommitted
FastclearRect downscaling API
Change-Id: I22ce7f7cea28f2a09af4bcf2681e0398439163e6
1 parent 41dbe28 commit 1a4cf50

File tree

6 files changed

+144
-9
lines changed

6 files changed

+144
-9
lines changed

Source/GmmLib/Resource/GmmResourceInfoCommon.cpp

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,16 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont
208208

209209
if(Surf.Flags.Gpu.IndirectClearColor)
210210
{
211-
AuxSurf.CCSize = PAGE_SIZE; // 128bit Float Value + 32bit RT Native Value + Padding.
212-
AuxSurf.Size += PAGE_SIZE;
211+
if(!Surf.Flags.Gpu.TiledResource)
212+
{
213+
AuxSurf.CCSize = PAGE_SIZE; // 128bit Float Value + 32bit RT Native Value + Padding.
214+
AuxSurf.Size += PAGE_SIZE;
215+
}
216+
else
217+
{
218+
AuxSurf.CCSize = GMM_KBYTE(64); // 128bit Float Value + 32bit RT Native Value + Padding.
219+
AuxSurf.Size += GMM_KBYTE(64);
220+
}
213221
}
214222

215223
TotalSize = Surf.Size + AuxSurf.Size; //Not including AuxSecSurf size, multi-Aux surface isn't supported for displayables
@@ -476,6 +484,68 @@ bool GmmLib::GmmResourceInfoCommon::RedescribePlanes()
476484
return (Status == GMM_SUCCESS) ? true : false;
477485
}
478486

487+
/////////////////////////////////////////////////////////////////////////////////////
488+
/// Returns downscaled width for fast clear of given subresource
489+
/// @param[in] uint32_t : MipLevel
490+
/// @return Width
491+
/////////////////////////////////////////////////////////////////////////////////////
492+
uint64_t GmmLib::GmmResourceInfoCommon::GetFastClearWidth(uint32_t MipLevel)
493+
{
494+
uint64_t width = 0;
495+
uint64_t mipWidth = GetMipWidth(MipLevel);
496+
uint32_t numSamples = GetNumSamples();
497+
498+
GMM_TEXTURE_CALC *pTextureCalc;
499+
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf);
500+
501+
if(numSamples == 1)
502+
{
503+
width = pTextureCalc->ScaleFCRectWidth(&Surf, mipWidth);
504+
}
505+
else if(numSamples == 2 || numSamples == 4)
506+
{
507+
width = GFX_ALIGN(mipWidth, 8) / 8;
508+
}
509+
else if(numSamples == 8)
510+
{
511+
width = GFX_ALIGN(mipWidth, 2) / 2;
512+
}
513+
else // numSamples == 16
514+
{
515+
width = mipWidth;
516+
}
517+
518+
return width;
519+
}
520+
521+
522+
/////////////////////////////////////////////////////////////////////////////////////
523+
/// Returns downscaled height for fast clear of given subresource
524+
/// @param[in] uint32_t : MipLevel
525+
/// @return height
526+
/////////////////////////////////////////////////////////////////////////////////////
527+
uint32_t GmmLib::GmmResourceInfoCommon::GetFastClearHeight(uint32_t MipLevel)
528+
{
529+
uint32_t height = 0;
530+
uint32_t mipHeight = GetMipHeight(MipLevel);
531+
uint32_t numSamples = GetNumSamples();
532+
533+
GMM_TEXTURE_CALC *pTextureCalc;
534+
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf);
535+
536+
if(numSamples == 1)
537+
{
538+
height = pTextureCalc->ScaleFCRectHeight(&Surf, mipHeight);
539+
}
540+
else
541+
{
542+
height = GFX_ALIGN(mipHeight, 2) / 2;
543+
}
544+
545+
return height;
546+
}
547+
548+
479549
/////////////////////////////////////////////////////////////////////////////////////
480550
/// This function readjustes Plane properties. Valid for MainSurf not for AuxSurf
481551
///

Source/GmmLib/inc/External/Common/GmmResourceInfo.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extern const uint32_t __GmmTileYConversionTable[5][2];
4141
//
4242
typedef struct TILE_POOL_INFO_REC
4343
{
44-
uint16_t UsedTiles; // Tiles being used in 1 tile pool
44+
uint64_t UsedTiles[4]; // Tiles being used in 1 tile pool
4545
GMM_GFX_ADDRESS StartingGfxAddress; // GfxAddress associated with the TilePool
4646
} TILE_POOL_INFO;
4747

@@ -54,10 +54,8 @@ typedef struct GMM_TILED_RESOURCE_INFO_REC
5454
// only used for tiled resources
5555
uint64_t pAuxTilePoolResArray; // list of aux tile pool allocation resource, and handles
5656

57-
union{
58-
uint32_t TilePoolArraySize;
59-
uint32_t AuxTilePoolArraySize;
60-
};
57+
uint32_t TilePoolArraySize;
58+
uint32_t AuxTilePoolArraySize;
6159

6260
struct
6361
{

Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ namespace GmmLib
217217
GMM_VIRTUAL GMM_GFX_SIZE_T GMM_STDCALL GetMipWidth(uint32_t MipLevel);
218218
GMM_VIRTUAL uint32_t GMM_STDCALL GetMipHeight(uint32_t MipLevel);
219219
GMM_VIRTUAL uint32_t GMM_STDCALL GetMipDepth(uint32_t MipLevel);
220+
GMM_VIRTUAL uint64_t GMM_STDCALL GetFastClearWidth(uint32_t MipLevel);
221+
GMM_VIRTUAL uint32_t GMM_STDCALL GetFastClearHeight(uint32_t MipLevel);
220222

221223

222224
/* inline functions */
@@ -1353,7 +1355,6 @@ namespace GmmLib
13531355
return TiledResourceMode;
13541356
}
13551357

1356-
13571358
//###################################################################################
13581359
// Functions that allows clients to override certain members
13591360
// of ResourceInfo. Client assumes the risk of using these functions.

Source/GmmLib/inc/External/Common/GmmUtil.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ OTHER DEALINGS IN THE SOFTWARE.
4747
#define __BIT64(x) ((uint64_t)1 << (x))
4848
#define __GMM_SET_BIT(A, b) (A |= __BIT(b))
4949
#define __GMM_CLEAR_BIT(A, b) (A &= ~__BIT(b))
50+
#define __GMM_SET_BIT64(A, b) (A |= __BIT64(b))
51+
#define __GMM_CLEAR_BIT64(A, b) (A &= ~__BIT64(b))
5052
#define __GMM_IS_BIT_SET(A, b) (A & __BIT(b))
5153
#define __GMM_IS_BIT_CLEAR(A, b) ((A & __BIT(b)) == 0)
5254

Source/GmmLib/inc/Internal/Common/Texture/GmmGen9TextureCalc.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,23 @@ namespace GmmLib
104104
virtual GMM_STATUS GMM_STDCALL FillTexCube(GMM_TEXTURE_INFO *pTexInfo,
105105
__GMM_BUFFER_TYPE *pRestrictions);
106106

107+
virtual uint32_t GMM_STDCALL ScaleFCRectHeight(GMM_TEXTURE_INFO * pTexInfo, uint32_t Height)
108+
{
109+
__GMM_ASSERTPTR(pTexInfo, 0);
110+
uint32_t ScaledHeight = Height;
111+
112+
if (pTexInfo->TileMode == LEGACY_TILE_Y)
113+
{
114+
const uint16_t FastClearRccTileYAlignHeight = 64; // lines - RCC ( Render Color Cache ) Alignment Sizes
115+
const uint16_t TileYClearHeightScale = 32; // lines - Clear & Resolve Rect Scaling Sizes
116+
117+
ScaledHeight = GFX_ALIGN(ScaledHeight, FastClearRccTileYAlignHeight);
118+
ScaledHeight /= TileYClearHeightScale;
119+
}
120+
return ScaledHeight;
121+
122+
}
123+
107124
/* inline functions */
108125
};
109126
}

Source/GmmLib/inc/Internal/Common/Texture/GmmTextureCalc.h

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ namespace GmmLib
270270
__GMM_ASSERTPTR(pTexInfo, 0);
271271
return(GFX_MAX(1, pTexInfo->BaseWidth >> MipLevel));
272272
}
273-
274273
virtual uint32_t GmmTexGetMipHeight(GMM_TEXTURE_INFO *pTexInfo, uint32_t MipLevel)
275274
{
276275
__GMM_ASSERTPTR(pTexInfo, 0);
@@ -283,6 +282,54 @@ namespace GmmLib
283282
return(GFX_MAX(1, pTexInfo->Depth >> MipLevel));
284283
}
285284

285+
virtual uint32_t GMM_STDCALL ScaleFCRectHeight(GMM_TEXTURE_INFO * pTexInfo, uint32_t Height)
286+
{
287+
__GMM_ASSERTPTR(pTexInfo, 0);
288+
uint32_t ScaledHeight = Height;
289+
290+
if (pTexInfo->TileMode == LEGACY_TILE_X)
291+
{
292+
const uint16_t FastClearRccTileXAlignHeight = 64; // lines - RCC ( Render Color Cache ) Alignment Sizes
293+
const uint16_t TileXClearHeightScale = 32; // lines - Clear & Resolve Rect Scaling Sizes
294+
295+
ScaledHeight = GFX_ALIGN(ScaledHeight, FastClearRccTileXAlignHeight);
296+
ScaledHeight /= TileXClearHeightScale;
297+
}
298+
else if (pTexInfo->TileMode == LEGACY_TILE_Y)
299+
{
300+
const uint16_t FastClearRccTileYAlignHeight = 128; // bits
301+
const uint16_t TileYClearHeightScale = 64; // bits
302+
303+
ScaledHeight = GFX_ALIGN(ScaledHeight, FastClearRccTileYAlignHeight);
304+
ScaledHeight /= TileYClearHeightScale;
305+
}
306+
return ScaledHeight;
307+
308+
}
309+
310+
virtual uint64_t GMM_STDCALL ScaleFCRectWidth(GMM_TEXTURE_INFO * pTexInfo, uint64_t Width)
311+
{
312+
__GMM_ASSERTPTR(pTexInfo, 0);
313+
uint64_t ScaledWidth = Width;
314+
315+
if (pTexInfo->TileMode == LEGACY_TILE_X)
316+
{
317+
const uint32_t FastClearRccTileXAlignWidth = 8192; // bits - RCC ( Render Color Cache ) Alignment Sizes
318+
const uint32_t TileXClearWidthScale = 4096; // bits - Clear & Resolve Rect Scaling Sizes
319+
320+
ScaledWidth = GFX_ALIGN(ScaledWidth, FastClearRccTileXAlignWidth / pTexInfo->BitsPerPixel);
321+
ScaledWidth /= TileXClearWidthScale;
322+
}
323+
else if (pTexInfo->TileMode == LEGACY_TILE_Y)
324+
{
325+
const uint32_t FastClearRccTileYAlignWidth = 4096; // bits
326+
const uint32_t TileYClearWidthScale = 2048; // bits
327+
328+
ScaledWidth = GFX_ALIGN(ScaledWidth, FastClearRccTileYAlignWidth / pTexInfo->BitsPerPixel);
329+
ScaledWidth /= TileYClearWidthScale;
330+
}
331+
return ScaledWidth;
332+
}
286333

287334
/* inline functions */
288335
};

0 commit comments

Comments
 (0)