mirror of https://github.com/intel/gmmlib.git
Remove YUVShaderFriendlyLayout, update GetQpitchPlanar to return QPitch in rows
Fix GetQpitchPlanar function to return Qpitch in rows and not in bytes (UMDs do not have to perform any additional calculations, GMM returns Qpitch that can be programmed directly) Change-Id: Ice2e5baf1153a108807f3eae7be57d7cecd05bac
This commit is contained in:
parent
d0a4870527
commit
a6c821ef69
|
@ -379,14 +379,6 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams()
|
|||
|
||||
GetRestrictions(Restrictions);
|
||||
|
||||
// Check non standard NV12 array layout requested for non nv12 format.
|
||||
if(Surf.Flags.Info.YUVShaderFriendlyLayout &&
|
||||
(Surf.Format != GMM_FORMAT_NV12))
|
||||
{
|
||||
GMM_ASSERTDPF(0, "Flag not supported w/ formats other than NV12!");
|
||||
goto ERROR_CASE;
|
||||
}
|
||||
|
||||
// Check array size to make sure it meets HW limits
|
||||
if((Surf.ArraySize > Restrictions.MaxArraySize) &&
|
||||
((RESOURCE_1D == Surf.Type) ||
|
||||
|
|
|
@ -213,14 +213,6 @@ void GmmLib::GmmResourceInfoCommon::GetRestrictions(__GMM_BUFFER_TYPE &Restricti
|
|||
}
|
||||
}
|
||||
|
||||
// Each plane of Y0-Y1-UV0-UV1 layout must be 4KB aligned to meet media
|
||||
// version of SURFACE_STATE req. No X,Y offsets. Align to 2KB since height
|
||||
// is alwasy even, b/c valign >= 2.
|
||||
if(Surf.Flags.Info.YUVShaderFriendlyLayout)
|
||||
{
|
||||
Restrictions.PitchAlignment = GFX_ALIGN(Restrictions.PitchAlignment, GMM_KBYTE(2));
|
||||
}
|
||||
|
||||
// SKL TileY Display needs 1MB alignment.
|
||||
if(((Surf.Type == RESOURCE_PRIMARY) ||
|
||||
Surf.Flags.Gpu.FlipChain) &&
|
||||
|
|
|
@ -688,42 +688,6 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmGen10TextureCalc::FillTexPlanar(GMM_TEXTURE_IN
|
|||
}
|
||||
case GMM_FORMAT_NV12:
|
||||
case GMM_FORMAT_NV21:
|
||||
{
|
||||
// Allocate SW defined layout (Y0)(Y1)(UV0)(UV1)
|
||||
if(pTexInfo->Flags.Info.YUVShaderFriendlyLayout)
|
||||
{
|
||||
uint32_t UnitAlignHeight, BlockHeightY, BlockHeightUV;
|
||||
|
||||
__GMM_ASSERT(pTexInfo->ArraySize == 2);
|
||||
|
||||
pTexInfo->ArraySize = 2;
|
||||
|
||||
UnitAlignHeight = pTexInfo->Alignment.VAlign;
|
||||
|
||||
// Get total height for one Y plane
|
||||
BlockHeightY = GFX_ALIGN(YHeight, UnitAlignHeight);
|
||||
|
||||
if(GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) < IGFX_GEN8_CORE)
|
||||
{
|
||||
pTexInfo->Alignment.ArraySpacingSingleLod = 1;
|
||||
}
|
||||
|
||||
// Get total height for one UV plane
|
||||
BlockHeightUV = GFX_ALIGN(GFX_CEIL_DIV(YHeight, 2), UnitAlignHeight);
|
||||
|
||||
// Save plane offset information
|
||||
pTexInfo->OffsetInfo.Plane.ArrayQPitch = 0;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_Y0] = 0;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_Y1] = BlockHeightY;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_UV0] = BlockHeightY * 2;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_UV1] = (BlockHeightY * 2) + BlockHeightUV;
|
||||
|
||||
// Get total height for (Y0)(Y1)(UV0)(UV1)
|
||||
Height = (BlockHeightY * 2) + (BlockHeightUV * 2);
|
||||
break;
|
||||
}
|
||||
// else drop down to NV11, P208.
|
||||
}
|
||||
case GMM_FORMAT_NV11:
|
||||
case GMM_FORMAT_P010:
|
||||
case GMM_FORMAT_P012:
|
||||
|
@ -936,7 +900,7 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmGen10TextureCalc::FillTexPlanar(GMM_TEXTURE_IN
|
|||
|
||||
// Planar & hybrid 2D arrays supported in DX11.1+ spec but not HW. Memory layout
|
||||
// is defined by SW requirements; Y plane must be 4KB aligned.
|
||||
if((pTexInfo->ArraySize > 1) && !pTexInfo->Flags.Info.YUVShaderFriendlyLayout)
|
||||
if(pTexInfo->ArraySize > 1)
|
||||
{
|
||||
GMM_GFX_SIZE_T ElementSizeBytes = pTexInfo->Size;
|
||||
int64_t LargeSize;
|
||||
|
|
|
@ -54,12 +54,9 @@ void GmmLib::GmmTextureCalc::FillPlanarOffsetAddress(GMM_TEXTURE_INFO *pTexInfo)
|
|||
__GMM_ASSERTPTR(((pTexInfo->TileMode < GMM_TILE_MODES) && (pTexInfo->TileMode >= TILE_NONE)), VOIDRETURN);
|
||||
GMM_DPF_ENTER;
|
||||
|
||||
if(!pTexInfo->Flags.Info.YUVShaderFriendlyLayout)
|
||||
{
|
||||
// GMM_PLANE_Y always at (0, 0)...
|
||||
pTexInfo->OffsetInfo.Plane.X[GMM_PLANE_Y] = 0;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_Y] = 0;
|
||||
}
|
||||
// GMM_PLANE_Y always at (0, 0)...
|
||||
pTexInfo->OffsetInfo.Plane.X[GMM_PLANE_Y] = 0;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_Y] = 0;
|
||||
|
||||
Height = pTexInfo->BaseHeight;
|
||||
if(pTexInfo->Flags.Gpu.__NonMsaaTileYCcs)
|
||||
|
@ -249,21 +246,6 @@ void GmmLib::GmmTextureCalc::FillPlanarOffsetAddress(GMM_TEXTURE_INFO *pTexInfo)
|
|||
}
|
||||
case GMM_FORMAT_NV12:
|
||||
case GMM_FORMAT_NV21:
|
||||
{
|
||||
// Y0
|
||||
// Y1
|
||||
// [UV0-Packing]
|
||||
// [UV1-Packing]
|
||||
if(pTexInfo->Flags.Info.YUVShaderFriendlyLayout)
|
||||
{
|
||||
// Assigned in calling fnc.
|
||||
__GMM_ASSERT(pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_Y1] &&
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_UV0] &&
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_UV1]);
|
||||
break;
|
||||
}
|
||||
// else drop down to NV11, P208.
|
||||
}
|
||||
case GMM_FORMAT_NV11:
|
||||
case GMM_FORMAT_P010:
|
||||
case GMM_FORMAT_P012:
|
||||
|
|
|
@ -1162,42 +1162,6 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmTextureCalc::FillTexPlanar(GMM_TEXTURE_INFO *
|
|||
}
|
||||
case GMM_FORMAT_NV12:
|
||||
case GMM_FORMAT_NV21:
|
||||
{
|
||||
// Allocate SW defined layout (Y0)(Y1)(UV0)(UV1)
|
||||
if(pTexInfo->Flags.Info.YUVShaderFriendlyLayout)
|
||||
{
|
||||
uint32_t UnitAlignHeight, BlockHeightY, BlockHeightUV;
|
||||
|
||||
__GMM_ASSERT(pTexInfo->ArraySize == 2);
|
||||
|
||||
pTexInfo->ArraySize = 2;
|
||||
|
||||
UnitAlignHeight = pTexInfo->Alignment.VAlign;
|
||||
|
||||
// Get total height for one Y plane
|
||||
BlockHeightY = GFX_ALIGN(YHeight, UnitAlignHeight);
|
||||
|
||||
if(GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) < IGFX_GEN8_CORE)
|
||||
{
|
||||
pTexInfo->Alignment.ArraySpacingSingleLod = 1;
|
||||
}
|
||||
|
||||
// Get total height for one UV plane
|
||||
BlockHeightUV = GFX_ALIGN(GFX_CEIL_DIV(YHeight, 2), UnitAlignHeight);
|
||||
|
||||
// Save plane offset information
|
||||
pTexInfo->OffsetInfo.Plane.ArrayQPitch = 0;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_Y0] = 0;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_Y1] = BlockHeightY;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_UV0] = BlockHeightY * 2;
|
||||
pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_3D_UV1] = (BlockHeightY * 2) + BlockHeightUV;
|
||||
|
||||
// Get total height for (Y0)(Y1)(UV0)(UV1)
|
||||
Height = (BlockHeightY * 2) + (BlockHeightUV * 2);
|
||||
break;
|
||||
}
|
||||
// else drop down to NV11, P208.
|
||||
}
|
||||
case GMM_FORMAT_NV11:
|
||||
case GMM_FORMAT_P010:
|
||||
case GMM_FORMAT_P012:
|
||||
|
@ -1401,7 +1365,7 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmTextureCalc::FillTexPlanar(GMM_TEXTURE_INFO *
|
|||
|
||||
// Planar & hybrid 2D arrays supported in DX11.1+ spec but not HW. Memory layout
|
||||
// is defined by SW requirements; Y plane must be 4KB aligned.
|
||||
if((pTexInfo->ArraySize > 1) && !pTexInfo->Flags.Info.YUVShaderFriendlyLayout)
|
||||
if(pTexInfo->ArraySize > 1)
|
||||
{
|
||||
GMM_GFX_SIZE_T ElementSizeBytes = pTexInfo->Size;
|
||||
int64_t LargeSize;
|
||||
|
|
|
@ -599,35 +599,19 @@ GMM_GFX_SIZE_T GmmLib::GmmTextureCalc::GetMipMapByteAddress(GMM_TEXTURE_INFO *
|
|||
if(GmmIsPlanar(pTexInfo->Format))
|
||||
{
|
||||
uint32_t Plane = pReqInfo->Plane;
|
||||
if(pTexInfo->Flags.Info.YUVShaderFriendlyLayout)
|
||||
|
||||
uint32_t OffsetX = 0;
|
||||
uint32_t OffsetY = 0;
|
||||
if(Plane < GMM_MAX_PLANE)
|
||||
{
|
||||
uint32_t PlaneT = ((pReqInfo->ArrayIndex == 0) && (Plane == GMM_PLANE_Y)) ?
|
||||
GMM_PLANE_3D_Y0 :
|
||||
((pReqInfo->ArrayIndex == 1) && (Plane == GMM_PLANE_Y)) ?
|
||||
GMM_PLANE_3D_Y1 :
|
||||
((pReqInfo->ArrayIndex == 0) && ((Plane == GMM_PLANE_U) || (Plane == GMM_PLANE_V))) ?
|
||||
GMM_PLANE_3D_UV0 :
|
||||
((pReqInfo->ArrayIndex == 1) && ((Plane == GMM_PLANE_U) || (Plane == GMM_PLANE_V))) ?
|
||||
GMM_PLANE_3D_UV1 :
|
||||
GMM_PLANE_3D_Y0;
|
||||
|
||||
MipMapByteAddress = Pitch * pTexInfo->OffsetInfo.Plane.Y[PlaneT];
|
||||
OffsetX = GFX_ULONG_CAST(pTexInfo->OffsetInfo.Plane.X[Plane]);
|
||||
OffsetY = GFX_ULONG_CAST(pTexInfo->OffsetInfo.Plane.Y[Plane]);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t OffsetX = 0;
|
||||
uint32_t OffsetY = 0;
|
||||
if(Plane < GMM_MAX_PLANE)
|
||||
{
|
||||
OffsetX = GFX_ULONG_CAST(pTexInfo->OffsetInfo.Plane.X[Plane]);
|
||||
OffsetY = GFX_ULONG_CAST(pTexInfo->OffsetInfo.Plane.Y[Plane]);
|
||||
}
|
||||
MipMapByteAddress = (OffsetY * Pitch) + OffsetX;
|
||||
MipMapByteAddress = (OffsetY * Pitch) + OffsetX;
|
||||
|
||||
__GMM_ASSERT(!pReqInfo->ArrayIndex || (pReqInfo->ArrayIndex < pTexInfo->ArraySize));
|
||||
__GMM_ASSERT(!pReqInfo->ArrayIndex || (pReqInfo->ArrayIndex < pTexInfo->ArraySize));
|
||||
|
||||
MipMapByteAddress += (pTexInfo->OffsetInfo.Plane.ArrayQPitch * pReqInfo->ArrayIndex);
|
||||
}
|
||||
MipMapByteAddress += (pTexInfo->OffsetInfo.Plane.ArrayQPitch * pReqInfo->ArrayIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -128,7 +128,6 @@ typedef struct GMM_RESOURCE_FLAG_REC
|
|||
uint32_t TiledYs : 1; // Tiling modifier for the allocation. Affects Linear and Y preferences. Gen9+
|
||||
uint32_t WddmProtected : 1; // Sets the DXGK_ALLOCATIONINFOFLAGS.Protected flag
|
||||
uint32_t XAdapter : 1; // For WinBlue: to support Hybrid graphics
|
||||
uint32_t YUVShaderFriendlyLayout : 1; // DX11.1+. Client wants non-std YUV memory layout, friendly to DX shader resource views. NV12 only.
|
||||
uint32_t __PreallocatedResInfo : 1; // Internal GMM flag--Clients don't set.
|
||||
uint32_t __PreWddm2SVM : 1; // Internal GMM flag--Clients don't set.
|
||||
} Info;
|
||||
|
|
|
@ -412,7 +412,7 @@ namespace GmmLib
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Returns the planar resource's QPitch
|
||||
/// @return planar QPitch
|
||||
/// @return planar QPitch in rows
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
GMM_INLINE_VIRTUAL GMM_INLINE uint32_t GMM_STDCALL GetQPitchPlanar(GMM_YUV_PLANE Plane)
|
||||
{
|
||||
|
@ -420,34 +420,12 @@ namespace GmmLib
|
|||
const GMM_PLATFORM_INFO *pPlatform;
|
||||
|
||||
__GMM_ASSERT(GmmIsPlanar(Surf.Format));
|
||||
GMM_UNREFERENCED_LOCAL_VARIABLE(Plane);
|
||||
|
||||
pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
|
||||
__GMM_ASSERT(GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN8_CORE);
|
||||
|
||||
if (Surf.Flags.Info.YUVShaderFriendlyLayout)
|
||||
{
|
||||
switch (Plane)
|
||||
{
|
||||
case GMM_PLANE_Y:
|
||||
QPitch =
|
||||
static_cast<uint32_t>(Surf.OffsetInfo.Plane.Y[GMM_PLANE_3D_Y1] - Surf.OffsetInfo.Plane.Y[GMM_PLANE_3D_Y0]);
|
||||
break;
|
||||
|
||||
case GMM_PLANE_U:
|
||||
case GMM_PLANE_V:
|
||||
QPitch =
|
||||
static_cast<uint32_t>(Surf.OffsetInfo.Plane.Y[GMM_PLANE_3D_UV1] - Surf.OffsetInfo.Plane.Y[GMM_PLANE_3D_UV0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
__GMM_ASSERT(0);
|
||||
QPitch = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QPitch = static_cast<uint32_t>(Surf.OffsetInfo.Plane.ArrayQPitch);
|
||||
}
|
||||
QPitch = static_cast<uint32_t>(Surf.OffsetInfo.Plane.ArrayQPitch / Surf.Pitch);
|
||||
|
||||
return QPitch;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue