summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2016-11-10 23:20:54 -0500
committerRobert Foss <robert.foss@collabora.com>2017-03-14 13:08:40 -0400
commit5404c7e3e27f3b6d9052812b234060ef50b946e8 (patch)
tree23c2fb46b42255d075632458a35236c3a10a4db7
parent0d48160601d58e171c853174c742f06927996f28 (diff)
downloaddrm_hwcomposer-hwc2_fence_threading.tar.gz
drm_hwcomposer-hwc2_fence_threading.tar.xz
THREADING: Removed Begin/EndContexthwc2_fence_threading
Change-Id: Ia917a95757c58269eeff810e21880236c346d983
-rw-r--r--glworker.cpp36
-rw-r--r--glworker.h9
2 files changed, 1 insertions, 44 deletions
diff --git a/glworker.cpp b/glworker.cpp
index 4e90c08..b8dee33 100644
--- a/glworker.cpp
+++ b/glworker.cpp
@@ -145,16 +145,6 @@ static bool HasExtension(const char *extension, const char *extensions) {
}
int GLWorkerCompositor::BeginContext() {
- private_.saved_egl_display = eglGetCurrentDisplay();
- private_.saved_egl_ctx = eglGetCurrentContext();
-
- if (private_.saved_egl_display != egl_display_ ||
- private_.saved_egl_ctx != egl_ctx_) {
- private_.saved_egl_read = eglGetCurrentSurface(EGL_READ);
- private_.saved_egl_draw = eglGetCurrentSurface(EGL_DRAW);
- } else {
- return 0;
- }
ALOGE("%s:%d, >>>> switch to our context", __func__, __LINE__);
if (!eglMakeCurrent(egl_display_, EGL_NO_SURFACE, EGL_NO_SURFACE, egl_ctx_)) {
@@ -165,22 +155,6 @@ int GLWorkerCompositor::BeginContext() {
return 0;
}
-int GLWorkerCompositor::EndContext() {
- eglMakeCurrent(egl_display_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- if (private_.saved_egl_display != eglGetCurrentDisplay() ||
- private_.saved_egl_ctx != eglGetCurrentContext()) {
- ALOGE("%s:%d, >>>> restore saved context", __func__, __LINE__);
- if (!eglMakeCurrent(private_.saved_egl_display, private_.saved_egl_read,
- private_.saved_egl_draw, private_.saved_egl_ctx)) {
- ALOGE("EndContext failed: %s", GetEGLError());
- return 1;
- }
- ALOGE("%s:%d, <<<< restore saved context", __func__, __LINE__);
- }
-
- return 0;
-}
-
static AutoGLShader CompileAndCheckShader(GLenum type, unsigned source_count,
const GLchar **sources,
std::ostringstream *shader_log) {
@@ -514,7 +488,6 @@ int GLWorkerCompositor::Init() {
int ret = 0;
ret = InitWorker();
-// _Init();
return ret;
}
@@ -608,8 +581,6 @@ int GLWorkerCompositor::_Init() {
std::ostringstream shader_log;
blend_programs_.emplace_back(GenerateProgram(1, &shader_log));
- EndContext();
-
if (blend_programs_.back().get() == 0) {
ALOGE("%s", shader_log.str().c_str());
return 1;
@@ -668,17 +639,12 @@ int GLWorkerCompositor::_Composite(DrmHwcLayer *layers,
return -EALREADY;
}
- ret = BeginContext();
- if (ret)
- return -1;
-
GLint frame_width = framebuffer->getWidth();
GLint frame_height = framebuffer->getHeight();
CachedFramebuffer *cached_framebuffer =
PrepareAndCacheFramebuffer(framebuffer);
if (cached_framebuffer == NULL) {
ALOGE("Composite failed because of failed framebuffer");
- EndContext();
return -EINVAL;
}
@@ -714,7 +680,6 @@ ALOGE("%s: region[%lu].source_layers.size()=%lu", __func__, region.source_layers
}
if (ret) {
- EndContext();
return ret;
}
@@ -794,7 +759,6 @@ ALOGE("%s: region[%lu].source_layers.size()=%lu", __func__, region.source_layers
glBindFramebuffer(GL_FRAMEBUFFER, 0);
- EndContext();
return ret;
}
diff --git a/glworker.h b/glworker.h
index efbd507..d55e189 100644
--- a/glworker.h
+++ b/glworker.h
@@ -71,13 +71,6 @@ class GLWorkerCompositor : public Worker {
};
struct {
- EGLDisplay saved_egl_display = EGL_NO_DISPLAY;
- EGLContext saved_egl_ctx = EGL_NO_CONTEXT;
- EGLSurface saved_egl_read = EGL_NO_SURFACE;
- EGLSurface saved_egl_draw = EGL_NO_SURFACE;
- } private_;
-
- struct {
DrmHwcLayer *layers;
DrmCompositionRegion *regions;
size_t num_regions;
@@ -85,7 +78,7 @@ class GLWorkerCompositor : public Worker {
Importer *importer;
} composite_;
- void InitRoutine();
+ void InitRoutine() override;
void Routine() override;
int _Init();
int _Composite(DrmHwcLayer *layers,