summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/EglManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/renderthread/EglManager.h')
-rw-r--r--libs/hwui/renderthread/EglManager.h31
1 files changed, 21 insertions, 10 deletions
diff --git a/libs/hwui/renderthread/EglManager.h b/libs/hwui/renderthread/EglManager.h
index ef9effbf9953..55c81d42d8a0 100644
--- a/libs/hwui/renderthread/EglManager.h
+++ b/libs/hwui/renderthread/EglManager.h
@@ -17,10 +17,14 @@
#define EGLMANAGER_H
#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <SkImageInfo.h>
#include <SkRect.h>
#include <cutils/compiler.h>
+#include <ui/Fence.h>
#include <ui/GraphicBuffer.h>
#include <utils/StrongPointer.h>
+#include "IRenderPipeline.h"
namespace android {
namespace uirenderer {
@@ -33,20 +37,24 @@ class RenderThread;
// and EGLConfig, which are re-used by CanvasContext
class EglManager {
public:
+ explicit EglManager();
+
+ ~EglManager();
+
static const char* eglErrorString();
- // Returns true on success, false on failure
+
void initialize();
bool hasEglContext();
- EGLSurface createSurface(EGLNativeWindowType window, bool wideColorGamut);
+ EGLSurface createSurface(EGLNativeWindowType window, ColorMode colorMode);
void destroySurface(EGLSurface surface);
void destroy();
bool isCurrent(EGLSurface surface) { return mCurrentSurface == surface; }
// Returns true if the current surface changed, false if it was already current
- bool makeCurrent(EGLSurface surface, EGLint* errOut = nullptr);
+ bool makeCurrent(EGLSurface surface, EGLint* errOut = nullptr, bool force = false);
Frame beginFrame(EGLSurface surface);
void damageFrame(const Frame& frame, const SkRect& dirty);
// If this returns true it is mandatory that swapBuffers is called
@@ -60,11 +68,17 @@ public:
void fence();
+ EGLDisplay eglDisplay() const { return mEglDisplay; }
+
+ // Inserts a wait on fence command into the OpenGL ES command stream. If EGL extension
+ // support is missing, block the CPU on the fence.
+ status_t fenceWait(sp<Fence>& fence);
+
+ // Creates a fence that is signaled, when all the pending GL commands are flushed.
+ // Depending on installed extensions, the result is either Android native fence or EGL fence.
+ status_t createReleaseFence(bool useFenceSync, EGLSyncKHR* eglFence, sp<Fence>& nativeFence);
+
private:
- friend class RenderThread;
- explicit EglManager(RenderThread& thread);
- // EglContext is never destroyed, method is purposely not implemented
- ~EglManager();
void initExtensions();
void createPBufferSurface();
@@ -72,14 +86,11 @@ private:
void createContext();
EGLint queryBufferAge(EGLSurface surface);
- RenderThread& mRenderThread;
-
EGLDisplay mEglDisplay;
EGLConfig mEglConfig;
EGLConfig mEglConfigWideGamut;
EGLContext mEglContext;
EGLSurface mPBufferSurface;
-
EGLSurface mCurrentSurface;
enum class SwapBehavior {