mirror of
https://github.com/intel/gmmlib.git
synced 2025-09-10 12:54:37 +08:00
Fix to resolve Media and NEO sharing issue with Xe2compression on BMG (#226)
This commit is contained in:
@ -25,14 +25,14 @@ project(igfx_gmmumd)
|
|||||||
|
|
||||||
# GmmLib Api Version used for so naming
|
# GmmLib Api Version used for so naming
|
||||||
set(GMMLIB_API_MAJOR_VERSION 12)
|
set(GMMLIB_API_MAJOR_VERSION 12)
|
||||||
set(GMMLIB_API_MINOR_VERSION 6)
|
set(GMMLIB_API_MINOR_VERSION 7)
|
||||||
|
|
||||||
if(NOT DEFINED MAJOR_VERSION)
|
if(NOT DEFINED MAJOR_VERSION)
|
||||||
set(MAJOR_VERSION 12)
|
set(MAJOR_VERSION 12)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED MINOR_VERSION)
|
if(NOT DEFINED MINOR_VERSION)
|
||||||
set(MINOR_VERSION 6)
|
set(MINOR_VERSION 7)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED PATCH_VERSION)
|
if(NOT DEFINED PATCH_VERSION)
|
||||||
|
@ -39,13 +39,22 @@ extern GMM_MA_LIB_CONTEXT *pGmmMALibContext;
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
GmmLib::GmmClientContext::GmmClientContext(GMM_CLIENT ClientType, Context *pLibContext)
|
GmmLib::GmmClientContext::GmmClientContext(GMM_CLIENT ClientType, Context *pLibContext)
|
||||||
: ClientType(),
|
: ClientType(),
|
||||||
pUmdAdapter(),
|
pClientContextAilFlags(),
|
||||||
pGmmUmdContext(),
|
pGmmUmdContext(),
|
||||||
DeviceCB(),
|
DeviceCB(),
|
||||||
IsDeviceCbReceived(0)
|
IsDeviceCbReceived(0)
|
||||||
{
|
{
|
||||||
this->ClientType = ClientType;
|
this->ClientType = ClientType;
|
||||||
this->pGmmLibContext = pLibContext;
|
this->pGmmLibContext = pLibContext;
|
||||||
|
|
||||||
|
if (NULL != (pClientContextAilFlags = (GMM_AIL_STRUCT *)malloc(sizeof(GMM_AIL_STRUCT))))
|
||||||
|
{
|
||||||
|
memset(pClientContextAilFlags, 0, sizeof(GMM_AIL_STRUCT));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pClientContextAilFlags = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Destructor to free GmmLib::GmmClientContext object memory
|
/// Destructor to free GmmLib::GmmClientContext object memory
|
||||||
@ -53,6 +62,11 @@ GmmLib::GmmClientContext::GmmClientContext(GMM_CLIENT ClientType, Context *pLibC
|
|||||||
GmmLib::GmmClientContext::~GmmClientContext()
|
GmmLib::GmmClientContext::~GmmClientContext()
|
||||||
{
|
{
|
||||||
pGmmLibContext = NULL;
|
pGmmLibContext = NULL;
|
||||||
|
if (pClientContextAilFlags)
|
||||||
|
{
|
||||||
|
free(pClientContextAilFlags);
|
||||||
|
pClientContextAilFlags = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -128,6 +142,35 @@ uint8_t GMM_STDCALL GmmLib::GmmClientContext::GetSurfaceStateL1CachePolicy(GMM_R
|
|||||||
return pGmmLibContext->GetCachePolicyObj()->GetSurfaceStateL1CachePolicy(Usage);
|
return pGmmLibContext->GetCachePolicyObj()->GetSurfaceStateL1CachePolicy(Usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Member function to get the AIL flags associated with Client Context
|
||||||
|
/// @param[in] None
|
||||||
|
/// @return GMM_AIL_STRUCT associated with the ClientContext
|
||||||
|
|
||||||
|
const uint64_t* GMM_STDCALL GmmLib::GmmClientContext::GmmGetAIL()
|
||||||
|
{
|
||||||
|
return (uint64_t*)(this->pClientContextAilFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Member function to Set the AIL flags associated with Client Context
|
||||||
|
///
|
||||||
|
/// @param[in] GMM_AIL_STRUCT: Pointer to AIL struct
|
||||||
|
/// @return void
|
||||||
|
void GMM_STDCALL GmmLib::GmmClientContext::GmmSetAIL(GMM_AIL_STRUCT* pAilFlags)
|
||||||
|
{
|
||||||
|
//Cache the AilXe2CompressionRequest value
|
||||||
|
bool IsClientAilXe2Compression = this->pClientContextAilFlags->AilDisableXe2CompressionRequest;
|
||||||
|
|
||||||
|
memcpy(this->pClientContextAilFlags, pAilFlags, sizeof(GMM_AIL_STRUCT));
|
||||||
|
|
||||||
|
// Update the Current ClientContext flags with whatever was cached earlier before copy
|
||||||
|
this->pClientContextAilFlags->AilDisableXe2CompressionRequest = IsClientAilXe2Compression;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Member function of ClientContext class to return Swizzle Descriptor
|
/// Member function of ClientContext class to return Swizzle Descriptor
|
||||||
/// given Swizzle name , ResType and bpe
|
/// given Swizzle name , ResType and bpe
|
||||||
@ -952,19 +995,34 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmClientContext::GmmSetDeviceInfo(GMM_DEVICE_INF
|
|||||||
/// @see Class GmmLib::GmmClientContext
|
/// @see Class GmmLib::GmmClientContext
|
||||||
///
|
///
|
||||||
/// @param[in] ClientType : describles the UMD clients such as OCL, DX, OGL, Vulkan etc
|
/// @param[in] ClientType : describles the UMD clients such as OCL, DX, OGL, Vulkan etc
|
||||||
/// @param[in] sBDF: Adapter's BDF info
|
/// @param[in] sBDF: Adapter's BDF info@param[in] sBDF: Adapter's BDF info
|
||||||
|
/// @param[in] _pSkuTable: SkuTable Pointer
|
||||||
///
|
///
|
||||||
/// @return Pointer to GmmClientContext, if Context is created
|
/// @return Pointer to GmmClientContext, if Context is created
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
extern "C" GMM_CLIENT_CONTEXT *GMM_STDCALL GmmCreateClientContextForAdapter(GMM_CLIENT ClientType,
|
extern "C" GMM_CLIENT_CONTEXT *GMM_STDCALL GmmCreateClientContextForAdapter(GMM_CLIENT ClientType,
|
||||||
ADAPTER_BDF sBdf)
|
ADAPTER_BDF sBdf,
|
||||||
|
const void *_pSkuTable)
|
||||||
{
|
{
|
||||||
GMM_CLIENT_CONTEXT *pGmmClientContext = nullptr;
|
GMM_CLIENT_CONTEXT *pGmmClientContext = nullptr;
|
||||||
GMM_LIB_CONTEXT * pLibContext = pGmmMALibContext->GetAdapterLibContext(sBdf);
|
GMM_LIB_CONTEXT * pLibContext = pGmmMALibContext->GetAdapterLibContext(sBdf);
|
||||||
|
SKU_FEATURE_TABLE *pSkuTable;
|
||||||
|
|
||||||
if (pLibContext)
|
if (pLibContext)
|
||||||
{
|
{
|
||||||
pGmmClientContext = new GMM_CLIENT_CONTEXT(ClientType, pLibContext);
|
pGmmClientContext = new GMM_CLIENT_CONTEXT(ClientType, pLibContext);
|
||||||
|
|
||||||
|
if (pGmmClientContext)
|
||||||
|
{
|
||||||
|
pSkuTable = (SKU_FEATURE_TABLE *)_pSkuTable;
|
||||||
|
if (GFX_GET_CURRENT_RENDERCORE(pLibContext->GetPlatformInfo().Platform) >= IGFX_XE2_HPG_CORE && pLibContext->GetSkuTable().FtrXe2Compression && !pSkuTable->FtrXe2Compression)
|
||||||
|
{
|
||||||
|
|
||||||
|
GMM_AIL_STRUCT *pClientAilFlags = (GMM_AIL_STRUCT *)pGmmClientContext->GmmGetAIL();
|
||||||
|
|
||||||
|
pClientAilFlags->AilDisableXe2CompressionRequest = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return pGmmClientContext;
|
return pGmmClientContext;
|
||||||
|
@ -1005,7 +1005,16 @@ GMM_CLIENT ClientType)
|
|||||||
this->SkuTable = *pSkuTable;
|
this->SkuTable = *pSkuTable;
|
||||||
this->WaTable = *pWaTable;
|
this->WaTable = *pWaTable;
|
||||||
this->GtSysInfo = *pGtSysInfo;
|
this->GtSysInfo = *pGtSysInfo;
|
||||||
|
|
||||||
|
if (GFX_GET_CURRENT_RENDERCORE(Platform) >= IGFX_XE2_HPG_CORE && (pSkuTable->FtrXe2Compression == false))
|
||||||
|
{
|
||||||
|
this->SkuTable.FtrXe2Compression = true;
|
||||||
|
if (!(this->GetSkuTable().FtrFlatPhysCCS) || !(this->GetSkuTable().FtrE2ECompression))
|
||||||
|
{
|
||||||
|
SkuTable.FtrXe2Compression = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->pPlatformInfo = CreatePlatformInfo(Platform, false);
|
this->pPlatformInfo = CreatePlatformInfo(Platform, false);
|
||||||
if(this->pPlatformInfo == NULL)
|
if(this->pPlatformInfo == NULL)
|
||||||
{
|
{
|
||||||
|
@ -59,8 +59,8 @@ extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pI
|
|||||||
|
|
||||||
if(Status == GMM_SUCCESS)
|
if(Status == GMM_SUCCESS)
|
||||||
{
|
{
|
||||||
pOutArgs->pGmmClientContext = GmmCreateClientContextForAdapter(pInArgs->ClientType,
|
pOutArgs->pGmmClientContext = GmmCreateClientContextForAdapter(pInArgs->ClientType,
|
||||||
stAdapterBDF);
|
stAdapterBDF, pInArgs->pSkuTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -500,7 +500,9 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont
|
|||||||
if(GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS && AuxSurf.Type == RESOURCE_INVALID)
|
if(GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS && AuxSurf.Type == RESOURCE_INVALID)
|
||||||
{
|
{
|
||||||
//ie only AuxType is CCS, doesn't exist with FlatCCS, enable it for CC
|
//ie only AuxType is CCS, doesn't exist with FlatCCS, enable it for CC
|
||||||
if (!GetGmmLibContext()->GetSkuTable().FtrXe2Compression || (GetGmmLibContext()->GetSkuTable().FtrXe2Compression && (Surf.MSAA.NumSamples > 1)))
|
if (!GetGmmLibContext()->GetSkuTable().FtrXe2Compression || (GetGmmLibContext()->GetSkuTable().FtrXe2Compression &&
|
||||||
|
(!(((GMM_AIL_STRUCT *)(GetGmmClientContext()->GmmGetAIL()))->AilDisableXe2CompressionRequest)) &&
|
||||||
|
(Surf.MSAA.NumSamples > 1)))
|
||||||
{
|
{
|
||||||
AuxSurf.Type = Surf.Type;
|
AuxSurf.Type = Surf.Type;
|
||||||
}
|
}
|
||||||
|
@ -673,6 +673,18 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __GMM_KMD__
|
||||||
|
if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression && (GetGmmClientContext() != NULL))
|
||||||
|
{
|
||||||
|
if (((GMM_AIL_STRUCT *)(GetGmmClientContext()->GmmGetAIL()))->AilDisableXe2CompressionRequest)
|
||||||
|
{
|
||||||
|
//Disable Compression at resource level only, However at adapter level FtrXe2Compression could be still enabled.
|
||||||
|
//AilDisableXe2CompressionRequest helps us to acheive this.
|
||||||
|
Surf.Flags.Info.NotCompressed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if((GFX_GET_CURRENT_RENDERCORE(pPlatformResource->Platform) < IGFX_GEN8_CORE) &&
|
if((GFX_GET_CURRENT_RENDERCORE(pPlatformResource->Platform) < IGFX_GEN8_CORE) &&
|
||||||
Surf.Flags.Info.TiledW)
|
Surf.Flags.Info.TiledW)
|
||||||
{
|
{
|
||||||
|
@ -81,8 +81,12 @@ namespace GmmLib
|
|||||||
protected:
|
protected:
|
||||||
GMM_CLIENT ClientType;
|
GMM_CLIENT ClientType;
|
||||||
///< Placeholders for storing UMD context. Actual UMD context that needs to be stored here is
|
///< Placeholders for storing UMD context. Actual UMD context that needs to be stored here is
|
||||||
void *pUmdAdapter;
|
union
|
||||||
GMM_UMD_CONTEXT *pGmmUmdContext;
|
{
|
||||||
|
void *pUmdAdapter;
|
||||||
|
GMM_AIL_STRUCT *pClientContextAilFlags; //To store the UMD AIL flags. This is applicable for each client. Used to populate the corresponding LibContextAilFlags
|
||||||
|
};
|
||||||
|
GMM_UMD_CONTEXT *pGmmUmdContext;
|
||||||
GMM_DEVICE_CALLBACKS_INT DeviceCB; //OS-specific defn: Will be used by Clients to send as input arguments.
|
GMM_DEVICE_CALLBACKS_INT DeviceCB; //OS-specific defn: Will be used by Clients to send as input arguments.
|
||||||
// Flag to indicate Device_callbacks received.
|
// Flag to indicate Device_callbacks received.
|
||||||
uint8_t IsDeviceCbReceived;
|
uint8_t IsDeviceCbReceived;
|
||||||
@ -177,6 +181,9 @@ namespace GmmLib
|
|||||||
#endif
|
#endif
|
||||||
GMM_VIRTUAL uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
|
GMM_VIRTUAL uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
|
||||||
GMM_VIRTUAL const SWIZZLE_DESCRIPTOR *GMM_STDCALL GetSwizzleDesc(EXTERNAL_SWIZZLE_NAME ExternalSwizzleName, EXTERNAL_RES_TYPE ResType, uint8_t bpe, bool isStdSwizzle = false);
|
GMM_VIRTUAL const SWIZZLE_DESCRIPTOR *GMM_STDCALL GetSwizzleDesc(EXTERNAL_SWIZZLE_NAME ExternalSwizzleName, EXTERNAL_RES_TYPE ResType, uint8_t bpe, bool isStdSwizzle = false);
|
||||||
|
|
||||||
|
GMM_VIRTUAL void GMM_STDCALL GmmSetAIL(GMM_AIL_STRUCT *pAilFlags);
|
||||||
|
GMM_VIRTUAL const uint64_t *GMM_STDCALL GmmGetAIL();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,14 +195,13 @@ typedef struct GmmClientContext GMM_CLIENT_CONTEXT;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ClientContext will be unique to each client */
|
/* ClientContext will be unique to each client */
|
||||||
GMM_CLIENT_CONTEXT* GMM_STDCALL GmmCreateClientContextForAdapter(GMM_CLIENT ClientType, ADAPTER_BDF sBdf);
|
GMM_CLIENT_CONTEXT *GMM_STDCALL GmmCreateClientContextForAdapter(GMM_CLIENT ClientType,
|
||||||
|
ADAPTER_BDF sBdf, const void *_pSkuTable);
|
||||||
void GMM_STDCALL GmmDeleteClientContext(GMM_CLIENT_CONTEXT *pGmmClientContext);
|
void GMM_STDCALL GmmDeleteClientContext(GMM_CLIENT_CONTEXT *pGmmClientContext);
|
||||||
|
|
||||||
#if GMM_LIB_DLL
|
#if GMM_LIB_DLL
|
||||||
|
14
Source/GmmLib/inc/External/Common/GmmCommonExt.h
vendored
14
Source/GmmLib/inc/External/Common/GmmCommonExt.h
vendored
@ -681,3 +681,17 @@ typedef enum GMM_RESOURCE_TYPE_ENUM
|
|||||||
GMM_MAX_HW_RESOURCE_TYPE
|
GMM_MAX_HW_RESOURCE_TYPE
|
||||||
} GMM_RESOURCE_TYPE;
|
} GMM_RESOURCE_TYPE;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint64_t AilDisableXe2CompressionRequest: 1;
|
||||||
|
uint64_t reserved: 63;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
uint64_t Value;
|
||||||
|
};
|
||||||
|
} GMM_AIL_STRUCT;
|
||||||
|
@ -1160,8 +1160,13 @@ namespace GmmLib
|
|||||||
else if ((GmmAuxType == GMM_AUX_CC) && (Surf.Flags.Gpu.IndirectClearColor || Surf.Flags.Gpu.ColorDiscard))
|
else if ((GmmAuxType == GMM_AUX_CC) && (Surf.Flags.Gpu.IndirectClearColor || Surf.Flags.Gpu.ColorDiscard))
|
||||||
{
|
{
|
||||||
Offset = Surf.Size + AuxSurf.UnpaddedSize;
|
Offset = Surf.Size + AuxSurf.UnpaddedSize;
|
||||||
if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression)
|
|
||||||
{
|
if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression
|
||||||
|
#ifndef __GMM_KMD__
|
||||||
|
&& !(((GMM_AIL_STRUCT *)(GetGmmClientContext()->GmmGetAIL()))->AilDisableXe2CompressionRequest)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
if (Surf.MSAA.NumSamples > 1)
|
if (Surf.MSAA.NumSamples > 1)
|
||||||
{
|
{
|
||||||
Offset = Surf.Size; // Beginning of MCS which is first 4K of AuxSurf, Clear colour is stored only for MSAA surfaces
|
Offset = Surf.Size; // Beginning of MCS which is first 4K of AuxSurf, Clear colour is stored only for MSAA surfaces
|
||||||
@ -1248,9 +1253,12 @@ namespace GmmLib
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression
|
||||||
if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression)
|
#ifndef __GMM_KMD__
|
||||||
{
|
&& !(((GMM_AIL_STRUCT *)(GetGmmClientContext()->GmmGetAIL()))->AilDisableXe2CompressionRequest)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
if (Surf.MSAA.NumSamples > 1)
|
if (Surf.MSAA.NumSamples > 1)
|
||||||
{
|
{
|
||||||
return (AuxSurf.UnpaddedSize); // CC is part of MCS
|
return (AuxSurf.UnpaddedSize); // CC is part of MCS
|
||||||
|
Reference in New Issue
Block a user