mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Unified memory sharing 2/n
Move acquire/release handling to a base class Related-To: NEO-3771 Change-Id: I0127e393ce30c0b214b3c9cad590751ad9e386bc Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
9063e310af
commit
125e2a0ff8
@@ -31,14 +31,7 @@ Buffer *UnifiedBuffer::createSharedUnifiedBuffer(Context *context, cl_mem_flags
|
||||
return Buffer::createSharedBuffer(context, flags, sharingHandler, graphicsAllocation);
|
||||
}
|
||||
|
||||
void UnifiedBuffer::synchronizeObject(UpdateData &updateData) {
|
||||
// Acquiring is not implemented yet
|
||||
}
|
||||
|
||||
GraphicsAllocation *UnifiedBuffer::createGraphicsAllocation(Context *context, void *handle) {
|
||||
auto graphicsAllocation = context->getMemoryManager()->createGraphicsAllocationFromNTHandle(handle, 0);
|
||||
return graphicsAllocation;
|
||||
}
|
||||
|
||||
void UnifiedBuffer::releaseResource(MemObj *memObject) {
|
||||
}
|
||||
|
||||
@@ -18,10 +18,8 @@ class UnifiedBuffer : public UnifiedSharing {
|
||||
|
||||
public:
|
||||
static Buffer *createSharedUnifiedBuffer(Context *context, cl_mem_flags flags, UnifiedSharingMemoryDescription description, cl_int *errcodeRet);
|
||||
void synchronizeObject(UpdateData &updateData) override;
|
||||
|
||||
protected:
|
||||
void releaseResource(MemObj *memObject) override;
|
||||
static GraphicsAllocation *createGraphicsAllocation(Context *context, void *handle);
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -23,13 +23,11 @@ UnifiedSharing::UnifiedSharing(UnifiedSharingFunctions *sharingFunctions, Unifie
|
||||
memoryType(memoryType) {
|
||||
}
|
||||
|
||||
int UnifiedSharing::synchronizeHandler(UpdateData &updateData) {
|
||||
synchronizeObject(updateData);
|
||||
return CL_SUCCESS;
|
||||
void UnifiedSharing::synchronizeObject(UpdateData &updateData) {
|
||||
updateData.synchronizationStatus = SynchronizeStatus::ACQUIRE_SUCCESFUL;
|
||||
}
|
||||
|
||||
void UnifiedSharing::resolveGraphicsAllocationChange(osHandle currentSharedHandle, UpdateData *updateData) {
|
||||
updateData->synchronizationStatus = SynchronizeStatus::ACQUIRE_SUCCESFUL;
|
||||
void UnifiedSharing::releaseResource(MemObj *memObject) {
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -36,8 +36,8 @@ class UnifiedSharing : public SharingHandler {
|
||||
UnifiedSharingHandleType getExternalMemoryType() { return memoryType; }
|
||||
|
||||
protected:
|
||||
int synchronizeHandler(UpdateData &updateData) override;
|
||||
void resolveGraphicsAllocationChange(osHandle currentSharedHandle, UpdateData *updateData) override;
|
||||
void synchronizeObject(UpdateData &updateData) override;
|
||||
void releaseResource(MemObj *memObject) override;
|
||||
|
||||
private:
|
||||
UnifiedSharingFunctions *sharingFunctions;
|
||||
|
||||
@@ -111,9 +111,11 @@ TEST_F(UnifiedSharingTestsWithMemoryManager, givenUnifiedSharingHandlerWhenAcqui
|
||||
unsigned int synchronizeObjectCalled = 0u;
|
||||
unsigned int releaseResourceCalled = 0u;
|
||||
void synchronizeObject(UpdateData &updateData) override {
|
||||
UnifiedSharing::synchronizeObject(updateData);
|
||||
synchronizeObjectCalled++;
|
||||
}
|
||||
void releaseResource(MemObj *memObject) override {
|
||||
UnifiedSharing::releaseResource(memObject);
|
||||
releaseResourceCalled++;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user