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
|
||||
set(GMMLIB_API_MAJOR_VERSION 12)
|
||||
set(GMMLIB_API_MINOR_VERSION 6)
|
||||
set(GMMLIB_API_MINOR_VERSION 7)
|
||||
|
||||
if(NOT DEFINED MAJOR_VERSION)
|
||||
set(MAJOR_VERSION 12)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED MINOR_VERSION)
|
||||
set(MINOR_VERSION 6)
|
||||
set(MINOR_VERSION 7)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED PATCH_VERSION)
|
||||
|
@ -39,13 +39,22 @@ extern GMM_MA_LIB_CONTEXT *pGmmMALibContext;
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
GmmLib::GmmClientContext::GmmClientContext(GMM_CLIENT ClientType, Context *pLibContext)
|
||||
: ClientType(),
|
||||
pUmdAdapter(),
|
||||
pClientContextAilFlags(),
|
||||
pGmmUmdContext(),
|
||||
DeviceCB(),
|
||||
IsDeviceCbReceived(0)
|
||||
{
|
||||
this->ClientType = ClientType;
|
||||
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
|
||||
@ -53,6 +62,11 @@ GmmLib::GmmClientContext::GmmClientContext(GMM_CLIENT ClientType, Context *pLibC
|
||||
GmmLib::GmmClientContext::~GmmClientContext()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
/// 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
|
||||
/// given Swizzle name , ResType and bpe
|
||||
@ -952,20 +995,35 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmClientContext::GmmSetDeviceInfo(GMM_DEVICE_INF
|
||||
/// @see Class GmmLib::GmmClientContext
|
||||
///
|
||||
/// @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
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
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_LIB_CONTEXT * pLibContext = pGmmMALibContext->GetAdapterLibContext(sBdf);
|
||||
SKU_FEATURE_TABLE *pSkuTable;
|
||||
|
||||
if (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;
|
||||
}
|
||||
|
@ -1006,6 +1006,15 @@ GMM_CLIENT ClientType)
|
||||
this->WaTable = *pWaTable;
|
||||
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);
|
||||
if(this->pPlatformInfo == NULL)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pI
|
||||
if(Status == GMM_SUCCESS)
|
||||
{
|
||||
pOutArgs->pGmmClientContext = GmmCreateClientContextForAdapter(pInArgs->ClientType,
|
||||
stAdapterBDF);
|
||||
stAdapterBDF, pInArgs->pSkuTable);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -500,7 +500,9 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont
|
||||
if(GetGmmLibContext()->GetSkuTable().FtrFlatPhysCCS && AuxSurf.Type == RESOURCE_INVALID)
|
||||
{
|
||||
//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;
|
||||
}
|
||||
|
@ -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) &&
|
||||
Surf.Flags.Info.TiledW)
|
||||
{
|
||||
|
@ -81,7 +81,11 @@ namespace GmmLib
|
||||
protected:
|
||||
GMM_CLIENT ClientType;
|
||||
///< Placeholders for storing UMD context. Actual UMD context that needs to be stored here is
|
||||
union
|
||||
{
|
||||
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.
|
||||
// Flag to indicate Device_callbacks received.
|
||||
@ -177,6 +181,9 @@ namespace GmmLib
|
||||
#endif
|
||||
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 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
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
|
||||
#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_RESOURCE_TYPE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint64_t AilDisableXe2CompressionRequest: 1;
|
||||
uint64_t reserved: 63;
|
||||
|
||||
};
|
||||
|
||||
uint64_t Value;
|
||||
};
|
||||
} GMM_AIL_STRUCT;
|
||||
|
@ -1160,7 +1160,12 @@ namespace GmmLib
|
||||
else if ((GmmAuxType == GMM_AUX_CC) && (Surf.Flags.Gpu.IndirectClearColor || Surf.Flags.Gpu.ColorDiscard))
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -1248,8 +1253,11 @@ namespace GmmLib
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression)
|
||||
if (GetGmmLibContext()->GetSkuTable().FtrXe2Compression
|
||||
#ifndef __GMM_KMD__
|
||||
&& !(((GMM_AIL_STRUCT *)(GetGmmClientContext()->GmmGetAIL()))->AilDisableXe2CompressionRequest)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (Surf.MSAA.NumSamples > 1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user