| 1 |
/* |
| 2 |
* Copyright (C) 2018-2022 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#pragma once |
| 9 |
#include "opencl/source/event/event.h" |
| 10 |
|
| 11 |
struct _tagCLGLSyncInfo; |
| 12 |
typedef _tagCLGLSyncInfo CL_GL_SYNC_INFO; |
| 13 |
|
| 14 |
namespace NEO { |
| 15 |
class Context; |
| 16 |
class GLSharingFunctions; |
| 17 |
class OsInterface; |
| 18 |
class OsContext; |
| 19 |
|
| 20 |
char *createArbSyncEventName(); |
| 21 |
void destroyArbSyncEventName(char *name); |
| 22 |
|
| 23 |
void cleanupArbSyncObject(OSInterface &osInterface, CL_GL_SYNC_INFO *glSyncInfo); |
| 24 |
bool setupArbSyncObject(GLSharingFunctions &sharing, OSInterface &osInterface, CL_GL_SYNC_INFO &glSyncInfo); |
| 25 |
void signalArbSyncObject(OsContext &osContext, CL_GL_SYNC_INFO &glSyncInfo); |
| 26 |
void serverWaitForArbSyncObject(OSInterface &osInterface, CL_GL_SYNC_INFO &glSyncInfo); |
| 27 |
|
| 28 |
class GlArbSyncEvent : public Event { |
| 29 |
public: |
| 30 |
GlArbSyncEvent() = delete; |
| 31 |
~GlArbSyncEvent() override; |
| 32 |
|
| 33 |
void unblockEventBy(Event &event, TaskCountType taskLevel, int32_t transitionStatus) override; |
| 34 |
|
| 35 |
static GlArbSyncEvent *create(Event &baseEvent); |
| 36 |
|
| 37 |
CL_GL_SYNC_INFO *getSyncInfo() { |
| 38 |
return glSyncInfo.get(); |
| 39 |
} |
| 40 |
|
| 41 |
protected: |
| 42 |
GlArbSyncEvent(Context &context); |
| 43 |
MOCKABLE_VIRTUAL bool setBaseEvent(Event &ev); |
| 44 |
|
| 45 |
Event *baseEvent = nullptr; |
| 46 |
OSInterface *osInterface = nullptr; |
| 47 |
std::unique_ptr<CL_GL_SYNC_INFO> glSyncInfo; |
| 48 |
}; |
| 49 |
} // namespace NEO |
| 50 |
|
| 51 |
extern "C" CL_API_ENTRY cl_int CL_API_CALL |
| 52 |
clEnqueueMarkerWithSyncObjectINTEL(cl_command_queue commandQueue, |
| 53 |
cl_event *event, |
| 54 |
cl_context *context); |
| 55 |
|
| 56 |
extern "C" CL_API_ENTRY cl_int CL_API_CALL |
| 57 |
clGetCLObjectInfoINTEL(cl_mem memObj, |
| 58 |
void *pResourceInfo); |
| 59 |
|
| 60 |
extern "C" CL_API_ENTRY cl_int CL_API_CALL |
| 61 |
clGetCLEventInfoINTEL(cl_event event, CL_GL_SYNC_INFO **pSyncInfoHandleRet, cl_context *pClContextRet); |
| 62 |
|
| 63 |
extern "C" CL_API_ENTRY cl_int CL_API_CALL |
| 64 |
clReleaseGlSharedEventINTEL(cl_event event); |