Use root device index to get graphics allocation from buffer

pass root device index to isCompressed method

Related-To: NEO-4672
Change-Id: I6805254b09c86c0e0fb9333f8eb35d6dee73d327
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-06-23 18:08:30 +02:00
committed by sys_ocldev
parent 15b91c4d45
commit 81cc0afb1e
5 changed files with 29 additions and 26 deletions

View File

@@ -543,15 +543,17 @@ size_t Buffer::calculateHostPtrSize(const size_t *origin, const size_t *region,
return hostPtrSize;
}
bool Buffer::isReadWriteOnCpuAllowed() {
bool Buffer::isReadWriteOnCpuAllowed(uint32_t rootDeviceIndex) {
if (forceDisallowCPUCopy) {
return false;
}
if (this->isCompressed()) {
if (this->isCompressed(rootDeviceIndex)) {
return false;
}
auto graphicsAllocation = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex);
if (graphicsAllocation->peekSharedHandle() != 0) {
return false;
}
@@ -654,8 +656,8 @@ uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) cons
}
}
bool Buffer::isCompressed() const {
auto graphicsAllocation = multiGraphicsAllocation.getDefaultGraphicsAllocation();
bool Buffer::isCompressed(uint32_t rootDeviceIndex) const {
auto graphicsAllocation = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex);
if (graphicsAllocation->getDefaultGmm()) {
return graphicsAllocation->getDefaultGmm()->isRenderCompressed;
}

View File

@@ -149,12 +149,12 @@ class Buffer : public MemObj {
void transferDataToHostPtr(MemObjSizeArray &copySize, MemObjOffsetArray &copyOffset) override;
void transferDataFromHostPtr(MemObjSizeArray &copySize, MemObjOffsetArray &copyOffset) override;
bool isReadWriteOnCpuAllowed();
bool isReadWriteOnCpuAllowed(uint32_t rootDeviceIndex);
bool isReadWriteOnCpuPreffered(void *ptr, size_t size);
uint32_t getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) const;
bool isCompressed() const;
bool isCompressed(uint32_t rootDeviceIndex) const;
protected:
Buffer(Context *context,