Update sub device internal ref counts

Change-Id: I82eea99bbb3d1edc32d09c0b703dee30b62f6b76
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2020-04-02 16:38:42 +02:00
committed by sys_ocldev
parent 6d4832fe24
commit f2c11eb870
8 changed files with 107 additions and 11 deletions

View File

@@ -69,6 +69,23 @@ ClDevice::~ClDevice() {
device.decRefInternal();
}
void ClDevice::incRefInternal() {
if (deviceInfo.parentDevice == nullptr) {
BaseObject<_cl_device_id>::incRefInternal();
return;
}
auto pParentDevice = static_cast<ClDevice *>(deviceInfo.parentDevice);
pParentDevice->incRefInternal();
}
unique_ptr_if_unused<ClDevice> ClDevice::decRefInternal() {
if (deviceInfo.parentDevice == nullptr) {
return BaseObject<_cl_device_id>::decRefInternal();
}
auto pParentDevice = static_cast<ClDevice *>(deviceInfo.parentDevice);
return pParentDevice->decRefInternal();
}
void ClDevice::allocateSyncBufferHandler() {
TakeOwnershipWrapper<ClDevice> lock(*this);
if (syncBufferHandler.get() == nullptr) {

View File

@@ -51,6 +51,9 @@ class ClDevice : public BaseObject<_cl_device_id> {
explicit ClDevice(Device &device, Platform *platformId);
~ClDevice() override;
void incRefInternal();
unique_ptr_if_unused<ClDevice> decRefInternal();
unsigned int getEnabledClVersion() const { return enabledClVersion; };
unsigned int getSupportedClVersion() const;