| 1 |
/* |
| 2 |
* Copyright (C) 2019-2023 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include "opencl/source/sharings/sharing.h" |
| 11 |
#include "opencl/source/sharings/unified/unified_sharing_types.h" |
| 12 |
|
| 13 |
namespace NEO { |
| 14 |
struct ImageInfo; |
| 15 |
|
| 16 |
class UnifiedSharingFunctions : public SharingFunctions { |
| 17 |
public: |
| 18 |
uint32_t getId() const override { |
| 19 |
return UnifiedSharingFunctions::sharingId; |
| 20 |
} |
| 21 |
static const uint32_t sharingId; |
| 22 |
}; |
| 23 |
|
| 24 |
class UnifiedSharing : public SharingHandler { |
| 25 |
public: |
| 26 |
UnifiedSharing(UnifiedSharingFunctions *sharingFunctions, UnifiedSharingHandleType memoryType); |
| 27 |
|
| 28 |
UnifiedSharingFunctions *peekFunctionsHandler() { return sharingFunctions; } |
| 29 |
UnifiedSharingHandleType getExternalMemoryType() { return memoryType; } |
| 30 |
|
| 31 |
protected: |
| 32 |
void synchronizeObject(UpdateData &updateData) override; |
| 33 |
void releaseResource(MemObj *memObject, uint32_t rootDeviceIndex) override; |
| 34 |
|
| 35 |
static GraphicsAllocation *createGraphicsAllocation(Context *context, UnifiedSharingMemoryDescription description, AllocationType allocationType); |
| 36 |
static GraphicsAllocation *createGraphicsAllocation(Context *context, UnifiedSharingMemoryDescription description, ImageInfo *imgInfo, AllocationType allocationType); |
| 37 |
|
| 38 |
private: |
| 39 |
UnifiedSharingFunctions *sharingFunctions; |
| 40 |
UnifiedSharingHandleType memoryType; |
| 41 |
}; |
| 42 |
|
| 43 |
} // namespace NEO |