gl_fence_egl.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_GL_GL_FENCE_EGL_H_
  5. #define UI_GL_GL_FENCE_EGL_H_
  6. #include "ui/gl/gl_bindings.h"
  7. #include "ui/gl/gl_export.h"
  8. #include "ui/gl/gl_fence.h"
  9. namespace gl {
  10. class GL_EXPORT GLFenceEGL : public GLFence {
  11. public:
  12. GLFenceEGL(const GLFenceEGL&) = delete;
  13. GLFenceEGL& operator=(const GLFenceEGL&) = delete;
  14. ~GLFenceEGL() override;
  15. // Factory method using default initialization.
  16. static std::unique_ptr<GLFenceEGL> Create();
  17. // Factory method using custom initialization.
  18. static std::unique_ptr<GLFenceEGL> Create(EGLenum type, EGLint* attribs);
  19. // On i965, passing an already signalled fence has a large performance
  20. // cost. See crbug.com/1246254. This function should be called at
  21. // initialization to enable checking the fence before waiting on
  22. // i965 platforms. TODO(crbug.com/1246254): Remove this.
  23. static void CheckEGLFenceBeforeWait();
  24. // GLFence implementation:
  25. bool HasCompleted() override;
  26. void ClientWait() override;
  27. void ServerWait() override;
  28. void Invalidate() override;
  29. // EGL-specific wait-with-timeout implementation:
  30. EGLint ClientWaitWithTimeoutNanos(EGLTimeKHR timeout);
  31. protected:
  32. GLFenceEGL();
  33. bool InitializeInternal(EGLenum type, EGLint* attribs);
  34. EGLSyncKHR sync_;
  35. EGLDisplay display_;
  36. };
  37. } // namespace gl
  38. #endif // UI_GL_GL_FENCE_EGL_H_