2019-10-07 20:23:51 +08:00
|
|
|
/*
|
2020-01-07 19:54:43 +08:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-10-07 20:23:51 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/os_interface/os_library.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/mem_obj/mem_obj.h"
|
|
|
|
#include "opencl/source/sharings/sharing.h"
|
|
|
|
#include "opencl/source/sharings/unified/unified_sharing_types.h"
|
2019-10-07 20:23:51 +08:00
|
|
|
|
|
|
|
#include "CL/cl.h"
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <mutex>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
class UnifiedSharingFunctions : public SharingFunctions {
|
|
|
|
public:
|
|
|
|
uint32_t getId() const override {
|
|
|
|
return UnifiedSharingFunctions::sharingId;
|
|
|
|
}
|
|
|
|
static const uint32_t sharingId;
|
|
|
|
};
|
|
|
|
|
|
|
|
class UnifiedSharing : public SharingHandler {
|
|
|
|
public:
|
|
|
|
UnifiedSharing(UnifiedSharingFunctions *sharingFunctions, UnifiedSharingHandleType memoryType);
|
|
|
|
|
|
|
|
UnifiedSharingFunctions *peekFunctionsHandler() { return sharingFunctions; }
|
|
|
|
UnifiedSharingHandleType getExternalMemoryType() { return memoryType; }
|
|
|
|
|
|
|
|
protected:
|
2019-11-08 18:33:09 +08:00
|
|
|
void synchronizeObject(UpdateData &updateData) override;
|
|
|
|
void releaseResource(MemObj *memObject) override;
|
2019-10-07 20:23:51 +08:00
|
|
|
|
2020-01-08 19:58:37 +08:00
|
|
|
static GraphicsAllocation *createGraphicsAllocation(Context *context, UnifiedSharingMemoryDescription description, GraphicsAllocation::AllocationType allocationType);
|
2020-01-07 19:54:43 +08:00
|
|
|
|
2019-10-07 20:23:51 +08:00
|
|
|
private:
|
|
|
|
UnifiedSharingFunctions *sharingFunctions;
|
|
|
|
UnifiedSharingHandleType memoryType;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace NEO
|