P4 to Git Change 1312399 by skudchad@skudchad_test_win_opencl2 on 2016/09/08 15:10:25
SWDEV-101383 - [RS_DVR][MGPU] Slave GPU is blocked from going into BACO when DVR process is active (no recording or instant replay)
- Fix a memory leak
- Also make sure to use VALIDATE_ONLY flag properly as bindExternalDevice can be called even during context creation for which we cant close the adaper
ReviewBoardURL = http://ocltc.amd.com/reviews/r/11330/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#555 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#174 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.h#62 edit
[ROCm/clr commit: 8705eca425]
Este commit está contenido en:
@@ -1830,15 +1830,16 @@ Device::bindExternalDevice(
|
||||
// if the GSLDevice is still uninitialized.
|
||||
// Only adapter initialization is required to validate
|
||||
// GL interoperability.
|
||||
PerformAdapterInitialization();
|
||||
PerformAdapterInitialization(validateOnly);
|
||||
|
||||
// Attempt to associate GSL-OGL
|
||||
if (!glAssociate((CALvoid*)pContext, pDevice[amd::Context::DeviceFlagIdx::GLDeviceKhrIdx])) {
|
||||
if (!validateOnly) {
|
||||
LogError("Failed gslGLAssociate()");
|
||||
}
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
LogError("Failed gslGLAssociate()");
|
||||
return false;
|
||||
}
|
||||
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -1847,14 +1848,17 @@ Device::bindExternalDevice(
|
||||
// if the GSLDevice is still uninitialized.
|
||||
// Only adapter initialization is required
|
||||
// to validate D3D10 interoperability.
|
||||
PerformAdapterInitialization();
|
||||
PerformAdapterInitialization(validateOnly);
|
||||
|
||||
// Associate GSL-D3D
|
||||
if (!associateD3D10Device(
|
||||
reinterpret_cast<ID3D10Device*>(pDevice[amd::Context::DeviceFlagIdx::D3D10DeviceKhrIdx]))) {
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
LogError("Failed gslD3D10Associate()");
|
||||
return false;
|
||||
}
|
||||
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
}
|
||||
|
||||
if (flags & amd::Context::Flags::D3D11DeviceKhr) {
|
||||
@@ -1862,36 +1866,45 @@ Device::bindExternalDevice(
|
||||
// if the GSLDevice is still uninitialized.
|
||||
// Only adapter initialization is required to validate
|
||||
// D3D11 interoperability.
|
||||
PerformAdapterInitialization();
|
||||
PerformAdapterInitialization(validateOnly);
|
||||
|
||||
// Associate GSL-D3D
|
||||
if (!associateD3D11Device(
|
||||
reinterpret_cast<ID3D11Device*>(pDevice[amd::Context::DeviceFlagIdx::D3D11DeviceKhrIdx]))) {
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
LogError("Failed gslD3D11Associate()");
|
||||
return false;
|
||||
}
|
||||
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
}
|
||||
|
||||
if (flags & amd::Context::Flags::D3D9DeviceKhr) {
|
||||
PerformAdapterInitialization();
|
||||
PerformAdapterInitialization(validateOnly);
|
||||
|
||||
// Associate GSL-D3D
|
||||
if (!associateD3D9Device(
|
||||
reinterpret_cast<IDirect3DDevice9*>(pDevice[amd::Context::DeviceFlagIdx::D3D9DeviceKhrIdx]))) {
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
LogWarning("D3D9<->OpenCL adapter mismatch or D3D9Associate() failure");
|
||||
return false;
|
||||
}
|
||||
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
}
|
||||
|
||||
if (flags & amd::Context::Flags::D3D9DeviceEXKhr) {
|
||||
PerformAdapterInitialization();
|
||||
PerformAdapterInitialization(validateOnly);
|
||||
|
||||
// Associate GSL-D3D
|
||||
if (!associateD3D9Device(
|
||||
reinterpret_cast<IDirect3DDevice9Ex*>(pDevice[amd::Context::DeviceFlagIdx::D3D9DeviceEXKhrIdx]))) {
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
LogWarning("D3D9<->OpenCL adapter mismatch or D3D9Associate() failure");
|
||||
return false;
|
||||
}
|
||||
|
||||
CloseInitializedAdapter(validateOnly);
|
||||
}
|
||||
|
||||
if (flags & amd::Context::Flags::D3D9DeviceVAKhr) {
|
||||
|
||||
@@ -31,18 +31,13 @@ void CALGSLDevice::Initialize()
|
||||
m_target = (CALtarget)0xffffffff;
|
||||
m_srcDRMDMAMem = NULL ;
|
||||
m_dstDRMDMAMem = NULL ;
|
||||
|
||||
m_flags = 0;
|
||||
m_nativeDisplayHandle = NULL;
|
||||
m_deviceMode = GSL_DEVICE_MODE_GFX;
|
||||
|
||||
m_gpuIndex = 0;
|
||||
m_usePerVPUAdapterModel = false;
|
||||
m_chainIndex = 0;
|
||||
m_vpuMask = 1;
|
||||
m_PerformLazyDeviceInit = false;
|
||||
m_computeRing = false;
|
||||
m_isComputeRingIDForced = false;
|
||||
m_forcedComputeEngineID = GSL_ENGINEID_INVALID;
|
||||
m_vpuMask = 1;
|
||||
gslDeviceOps_ = NULL;
|
||||
}
|
||||
|
||||
@@ -249,6 +244,7 @@ CALGSLDevice::open(uint32 gpuIndex, bool enableHighPerformanceState, bool report
|
||||
void
|
||||
CALGSLDevice::close()
|
||||
{
|
||||
m_fullInitialized = false;
|
||||
if (m_cs != NULL)
|
||||
{
|
||||
m_cs->Flush();
|
||||
@@ -290,10 +286,27 @@ CALGSLDevice::close()
|
||||
}
|
||||
|
||||
void
|
||||
CALGSLDevice::PerformAdapterInitialization() const
|
||||
CALGSLDevice::PerformAdapterInitialization(bool ValidateOnly)
|
||||
{
|
||||
CALGSLDevice* mutable_this = const_cast<CALGSLDevice*>(this);
|
||||
mutable_this->PerformAdapterInitialization_int(false);
|
||||
// Win10 initialization is more exhaustive.
|
||||
// @ToDo Check if Win7 can be simplified as well
|
||||
// If we end up creating a paging fence on Win10 in IOL the slave may not go idle
|
||||
PerformAdapterInitialization_int(ValidateOnly && m_initLite);
|
||||
}
|
||||
|
||||
void CALGSLDevice::CloseInitializedAdapter(bool ValidateOnly)
|
||||
{
|
||||
// @ToDo Check if Win7 can be simplified as well
|
||||
// The adapter shouldnt be destroyed if its created when bindExternalDevice is called
|
||||
// during context creation
|
||||
if (m_initLite && ValidateOnly && !m_fullInitialized)
|
||||
{
|
||||
//! @note: GSL device isn't thread safe
|
||||
amd::ScopedLock k(gslDeviceOps());
|
||||
// close the adaptor
|
||||
gsAdaptor::closeAdaptor(m_adp);
|
||||
m_adp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -309,15 +322,14 @@ CALGSLDevice::PerformFullInitialization() const
|
||||
bool
|
||||
CALGSLDevice::SetupAdapter(int32 &asic_id)
|
||||
{
|
||||
bool initLite = false;
|
||||
#ifdef ATI_OS_WIN
|
||||
if(osGetVersion() >= AMD_OS_VERSION_WINDOWS_10)
|
||||
{
|
||||
initLite = true;
|
||||
m_initLite = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
PerformAdapterInitialization_int(initLite);
|
||||
PerformAdapterInitialization_int(m_initLite);
|
||||
|
||||
if (m_adp == 0)
|
||||
{
|
||||
@@ -404,16 +416,9 @@ CALGSLDevice::SetupAdapter(int32 &asic_id)
|
||||
bool
|
||||
CALGSLDevice::SetupContext(int32 &asic_id)
|
||||
{
|
||||
bool initLite = false;
|
||||
#ifdef ATI_OS_WIN
|
||||
if(osGetVersion() >= AMD_OS_VERSION_WINDOWS_10)
|
||||
{
|
||||
initLite = true;
|
||||
}
|
||||
#endif
|
||||
gsl::gsCtx* temp_cs = m_adp->createComputeContext(m_computeRing ? (m_isComputeRingIDForced ? m_forcedComputeEngineID :
|
||||
getFirstAvailableComputeEngineID()) : GSL_ENGINEID_3DCOMPUTE0,
|
||||
m_canDMA ? GSL_ENGINEID_DRMDMA0 : GSL_ENGINEID_INVALID, initLite);
|
||||
m_canDMA ? GSL_ENGINEID_DRMDMA0 : GSL_ENGINEID_INVALID, m_initLite);
|
||||
temp_cs->getMainSubCtx()->setVPUMask(m_vpuMask);
|
||||
|
||||
m_maxtexturesize = temp_cs->getMaxTextureSize();
|
||||
@@ -542,6 +547,7 @@ CALGSLDevice::PerformAdapterInitialization_int(bool initLite)
|
||||
void
|
||||
CALGSLDevice::PerformFullInitialization_int()
|
||||
{
|
||||
m_fullInitialized = true;
|
||||
if (m_adp == 0)
|
||||
{
|
||||
PerformAdapterInitialization_int(false);
|
||||
|
||||
@@ -100,8 +100,9 @@ public:
|
||||
bool canDMA() const { return m_canDMA; }
|
||||
gslMemObject m_srcDRMDMAMem, m_dstDRMDMAMem; // memory object of flush buffer, used for DRMDMA flush
|
||||
|
||||
void PerformAdapterInitialization() const;
|
||||
void PerformAdapterInitialization(bool ValidateOnly);
|
||||
void PerformFullInitialization() const;
|
||||
void CloseInitializedAdapter(bool ValidateOnly);
|
||||
|
||||
CopyType GetCopyType(gslMemObject srcMem, gslMemObject destMem, size_t* srcOffset,
|
||||
size_t* destOffset, bool allowDMA, uint32 flags, size_t size, bool enableCopyRect) const;
|
||||
@@ -207,7 +208,11 @@ private:
|
||||
uint m_PerformLazyDeviceInit : 1;
|
||||
uint m_isComputeRingIDForced : 1;
|
||||
uint m_isSDMAL2TConstrained : 1;
|
||||
uint m_initLite : 1;
|
||||
uint m_fullInitialized : 1;
|
||||
};
|
||||
|
||||
uint m_flags;
|
||||
};
|
||||
|
||||
amd::Monitor* gslDeviceOps_; //!< Lock to serialize GSL device
|
||||
|
||||
Referencia en una nueva incidencia
Block a user