MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Init

Method Init

tensorflow/lite/delegates/gpu/gl/egl_environment.cc:64–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64Status EglEnvironment::Init() {
65 bool is_bound;
66 RETURN_IF_ERROR(
67 TFLITE_GPU_CALL_EGL(eglBindAPI, &is_bound, EGL_OPENGL_ES_API));
68 if (!is_bound) {
69 return InternalError("No EGL error, but eglBindAPI failed");
70 }
71
72 // Re-use context and display if it was created on this thread.
73 if (eglGetCurrentContext() != EGL_NO_CONTEXT) {
74 display_ = eglGetCurrentDisplay();
75 context_ =
76 EglContext(eglGetCurrentContext(), display_, EGL_NO_CONFIG_KHR, false);
77 } else {
78 RETURN_IF_ERROR(InitDisplay(&display_));
79
80 Status status = InitConfiglessContext();
81 if (!status.ok()) {
82 status = InitSurfacelessContext();
83 }
84 if (!status.ok()) {
85 status = InitPBufferContext();
86 }
87 if (!status.ok()) {
88 return status;
89 }
90 }
91
92 if (gpu_info_.type == GpuType::UNKNOWN) {
93 RETURN_IF_ERROR(RequestGpuInfo(&gpu_info_));
94 }
95 // TODO(akulik): when do we need ForceSyncTurning?
96 ForceSyncTurning();
97 return OkStatus();
98}
99
100Status EglEnvironment::InitConfiglessContext() {
101 RETURN_IF_ERROR(CreateConfiglessContext(display_, EGL_NO_CONTEXT, &context_));

Callers 1

NewEglEnvironmentMethod · 0.45

Calls 6

EglContextClass · 0.85
InitDisplayFunction · 0.85
RequestGpuInfoFunction · 0.85
OkStatusFunction · 0.85
InternalErrorFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected