32 std::once_flag GCScheduler::_initialize_symbols;
35 : _display(EGL_NO_DISPLAY), _context(EGL_NO_CONTEXT), _target(
GPUTarget::
MIDGARD)
44 _context = EGL_NO_CONTEXT;
45 _display = EGL_NO_DISPLAY;
52 init(_display, _context);
91 void GCScheduler::setup_context()
103 const char *egl_extension_st =
eglQueryString(_display, EGL_EXTENSIONS);
104 ARM_COMPUTE_ERROR_ON_MSG((strstr(egl_extension_st,
"EGL_KHR_create_context") ==
nullptr),
"Failed to query EGL_KHR_create_context");
105 ARM_COMPUTE_ERROR_ON_MSG((strstr(egl_extension_st,
"EGL_KHR_surfaceless_context") ==
nullptr),
"Failed to query EGL_KHR_surfaceless_context");
108 const std::array<EGLint, 3> config_attribs =
110 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR,
116 res =
eglChooseConfig(_display, config_attribs.data(), &cfg, 1, &count);
125 const std::array<EGLint, 3> attribs =
127 EGL_CONTEXT_CLIENT_VERSION, 3,
138 res =
eglMakeCurrent(_display, EGL_NO_SURFACE, EGL_NO_SURFACE, _context);
#define ARM_COMPUTE_GL_CHECK(x)
EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
virtual void run(const Window &window)=0
Enqueue the OpenGL ES shader to process the given window.
const Window & window() const
The maximum window the kernel can be executed on.
EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
void dispatch(IGCKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
EGLint EGLAPIENTRY eglGetError()
void GL_APIENTRY glFlush(void)
EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
char const *EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
void memory_barrier()
Defines a barrier ordering memory transactions.
#define ARM_COMPUTE_ERROR_ON_MSG_VAR(cond, msg,...)
bool opengles31_is_available()
Check if the OpenGL ES 3.1 API is available at runtime.
Copyright (c) 2017-2021 Arm Limited.
void default_init_with_context(EGLDisplay display, EGLContext ctx)
Initializes the context and display used by the Scheduler.
EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
static GCScheduler & get()
Access the scheduler singleton.
void init(EGLDisplay dpy, EGLContext ctx)
Initialises the display and context to be used by the scheduler.
~GCScheduler()
Destructor.
EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Manages all the GLES kernels compilation and caching, provides accessors for the GLES Context...
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
GPUTarget get_target_from_device(const cl::Device &device)
Helper function to get the GPU target from CL device.
GCScheduler()
Constructor.
Provides global access to a OpenGL ES context and command queue.
void GL_APIENTRY glMemoryBarrier(GLbitfield barriers)
static GCKernelLibrary & get()
Get the static instance of GCKernelLibrary.
void init(std::string shader_path="./", EGLDisplay dpy=EGL_NO_DISPLAY, EGLContext ctx=EGL_NO_CONTEXT)
Initialises the kernel library.
GPUTarget
Available GPU Targets.
Common interface for all the GLES kernels.
EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
Interface to enqueue GLES kernels and get/set the GLES CommandQueue.
void default_init()
Initialises the context and command queue used by the scheduler to default values and sets a default ...