aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLingfeng Yang <lfy@google.com>2018-01-12 14:50:18 -0800
committerLingfeng Yang <lfy@google.com>2018-01-13 04:37:57 +0000
commite980c7a4de6cc56e63fd013ce7811bcdeeabb57c (patch)
treeed8fb1adfc045a8aa2417d15385300e842fb5386
parent93e2ca64fa87cf0e9f92e0239f934b20255bd65f (diff)
downloaddevice_generic_goldfish-opengl-e980c7a4de6cc56e63fd013ce7811bcdeeabb57c.tar.gz
device_generic_goldfish-opengl-e980c7a4de6cc56e63fd013ce7811bcdeeabb57c.tar.bz2
device_generic_goldfish-opengl-e980c7a4de6cc56e63fd013ce7811bcdeeabb57c.zip
Feature: IgnoreHostOpenGLErrors
bug: 71853717 If you use the emulator and the UI works fine, do this to make the UI faster. Change-Id: I044a46956eadb17021d6cf2c7b87c6423a328051
-rwxr-xr-xsystem/GLESv2_enc/GL2Encoder.cpp7
-rw-r--r--system/GLESv2_enc/GL2Encoder.h4
-rw-r--r--system/OpenglSystemCommon/HostConnection.cpp12
-rw-r--r--system/OpenglSystemCommon/HostConnection.h5
4 files changed, 26 insertions, 2 deletions
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 0e724786..a7ff5c11 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -73,6 +73,7 @@ GL2Encoder::GL2Encoder(IOStream *stream, ChecksumCalculator *protocol)
m_currMajorVersion = 2;
m_currMinorVersion = 0;
m_initialized = false;
+ m_noHostError = false;
m_state = NULL;
m_error = GL_NO_ERROR;
m_num_compressedTextureFormats = 0;
@@ -365,7 +366,11 @@ GLenum GL2Encoder::s_glGetError(void * self)
return err;
}
- return ctx->m_glGetError_enc(self);
+ if (ctx->m_noHostError) {
+ return GL_NO_ERROR;
+ } else {
+ return ctx->m_glGetError_enc(self);
+ }
}
class GL2Encoder::ErrorUpdater {
diff --git a/system/GLESv2_enc/GL2Encoder.h b/system/GLESv2_enc/GL2Encoder.h
index 0cb66306..06a07a94 100644
--- a/system/GLESv2_enc/GL2Encoder.h
+++ b/system/GLESv2_enc/GL2Encoder.h
@@ -27,6 +27,9 @@ class GL2Encoder : public gl2_encoder_context_t {
public:
GL2Encoder(IOStream *stream, ChecksumCalculator* protocol);
virtual ~GL2Encoder();
+ void setNoHostError(bool noHostError) {
+ m_noHostError = noHostError;
+ }
void setClientState(GLClientState *state) {
m_state = state;
}
@@ -92,6 +95,7 @@ private:
std::string m_currExtensions;
bool m_initialized;
+ bool m_noHostError;
GLClientState *m_state;
GLSharedGroupPtr m_shared;
GLenum m_error;
diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp
index 0b5304fe..34ddef47 100644
--- a/system/OpenglSystemCommon/HostConnection.cpp
+++ b/system/OpenglSystemCommon/HostConnection.cpp
@@ -37,7 +37,8 @@ HostConnection::HostConnection() :
m_rcEnc(NULL),
m_checksumHelper(),
m_glExtensions(),
- m_grallocOnly(true)
+ m_grallocOnly(true),
+ m_noHostError(false)
{
}
@@ -146,6 +147,7 @@ GL2Encoder *HostConnection::gl2Encoder()
m_gl2Enc = new GL2Encoder(m_stream, checksumHelper());
DBG("HostConnection::gl2Encoder new encoder %p, tid %d", m_gl2Enc, gettid());
m_gl2Enc->setContextAccessor(s_getGL2Context);
+ m_gl2Enc->setNoHostError(m_noHostError);
}
return m_gl2Enc;
}
@@ -158,6 +160,7 @@ ExtendedRCEncoderContext *HostConnection::rcEncoder()
queryAndSetSyncImpl(m_rcEnc);
queryAndSetDmaImpl(m_rcEnc);
queryAndSetGLESMaxVersion(m_rcEnc);
+ queryAndSetNoErrorState(m_rcEnc);
processPipeInit(m_rcEnc);
}
return m_rcEnc;
@@ -272,3 +275,10 @@ void HostConnection::queryAndSetGLESMaxVersion(ExtendedRCEncoderContext* rcEnc)
rcEnc->setGLESMaxVersion(GLES_MAX_VERSION_2);
}
}
+
+void HostConnection::queryAndSetNoErrorState(ExtendedRCEncoderContext* rcEnc) {
+ std::string glExtensions = queryGLExtensions(rcEnc);
+ if (glExtensions.find(kGLESNoHostError) != std::string::npos) {
+ m_noHostError = true;
+ }
+}
diff --git a/system/OpenglSystemCommon/HostConnection.h b/system/OpenglSystemCommon/HostConnection.h
index 0924cf97..2b498576 100644
--- a/system/OpenglSystemCommon/HostConnection.h
+++ b/system/OpenglSystemCommon/HostConnection.h
@@ -71,6 +71,9 @@ static const char kGLESMaxVersion_3_0[] = "ANDROID_EMU_gles_max_version_3_0";
static const char kGLESMaxVersion_3_1[] = "ANDROID_EMU_gles_max_version_3_1";
static const char kGLESMaxVersion_3_2[] = "ANDROID_EMU_gles_max_version_3_2";
+// No querying errors from host extension
+static const char kGLESNoHostError[] = "ANDROID_EMU_gles_no_host_error";
+
// ExtendedRCEncoderContext is an extended version of renderControl_encoder_context_t
// that will be used to track SyncImpl.
class ExtendedRCEncoderContext : public renderControl_encoder_context_t {
@@ -148,6 +151,7 @@ private:
void queryAndSetSyncImpl(ExtendedRCEncoderContext *rcEnc);
void queryAndSetDmaImpl(ExtendedRCEncoderContext *rcEnc);
void queryAndSetGLESMaxVersion(ExtendedRCEncoderContext *rcEnc);
+ void queryAndSetNoErrorState(ExtendedRCEncoderContext *rcEnc);
private:
IOStream *m_stream;
@@ -158,6 +162,7 @@ private:
std::string m_glExtensions;
bool m_grallocOnly;
int m_pipeFd;
+ bool m_noHostError;
};
#endif