| 229 | } |
| 230 | |
| 231 | Status GlInteropFabric::Finish() { |
| 232 | if (!is_enabled()) { |
| 233 | return OkStatus(); |
| 234 | } |
| 235 | RETURN_IF_ERROR(gl_objects_.Release({}, &outbound_event_)); |
| 236 | |
| 237 | // if (is_egl_sync_supported_ && is_cl_to_egl_mapping_supported_) { |
| 238 | // EglSync egl_outbound_sync; |
| 239 | // RETURN_IF_ERROR(CreateEglSyncFromClEvent(outbound_event_.event(), |
| 240 | // egl_display_, |
| 241 | // &egl_outbound_sync)); |
| 242 | // // Instruct GL pipeline to wait until corresponding CL event is signaled. |
| 243 | // RETURN_IF_ERROR(egl_outbound_sync.ServerWait()); |
| 244 | // glFlush(); |
| 245 | // } else { |
| 246 | // // Slower option if proper sync is not supported. It is equivalent to |
| 247 | // // clFinish, but, hopefully, faster. |
| 248 | // outbound_event_.Wait(); |
| 249 | // } |
| 250 | |
| 251 | // This slow sync is the only working solution right now. We have to debug why |
| 252 | // above version is not working fast and reliable. |
| 253 | outbound_event_.Wait(); |
| 254 | return OkStatus(); |
| 255 | } |
| 256 | |
| 257 | } // namespace cl |
| 258 | } // namespace gpu |