summaryrefslogtreecommitdiff
path: root/opengl/libs
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2024-11-12 22:22:43 -0800
committer Xin Li <delphij@google.com> 2024-11-12 22:22:43 -0800
commit6dc15689f6bb4b04c102ac3107f31377ee91f05e (patch)
tree3ca9d372bc99ac1182fdb4bc895c556d0f108bd3 /opengl/libs
parentd4d02798539f29d00059d458fd01e5b2869acbb6 (diff)
parentf151262626f1c08a104cc35d9864493ea8a72dec (diff)
Merge 24Q4 (ab/12406339) into aosp-main-future
Bug: 370570306 Merged-In: I9be1254c3e2685b0aa950b314c581824f40ce26c Change-Id: I35bc501a2b1d9eb100aaab25cd660cf2e0542f99
Diffstat (limited to 'opengl/libs')
-rw-r--r--opengl/libs/EGL/eglApi.cpp2
-rw-r--r--opengl/libs/EGL/egl_entries.in2
-rw-r--r--opengl/libs/EGL/egl_platform_entries.cpp72
-rw-r--r--opengl/libs/GLES2/gl2ext_api.in3
-rw-r--r--opengl/libs/entries.in1
-rw-r--r--opengl/libs/platform_entries.in2
6 files changed, 54 insertions, 28 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 502c14f0f1..8cb637b948 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -248,7 +248,7 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char* procname)
return cnx->platform.eglGetProcAddress(procname);
}
-EGLBoolean eglSwapBuffersWithDamageKHR(EGLDisplay dpy, EGLSurface draw, EGLint* rects,
+EGLBoolean eglSwapBuffersWithDamageKHR(EGLDisplay dpy, EGLSurface draw, const EGLint* rects,
EGLint n_rects) {
ATRACE_CALL();
clearError();
diff --git a/opengl/libs/EGL/egl_entries.in b/opengl/libs/EGL/egl_entries.in
index 1c91f1d61b..b6f2c3410b 100644
--- a/opengl/libs/EGL/egl_entries.in
+++ b/opengl/libs/EGL/egl_entries.in
@@ -106,5 +106,5 @@ EGL_ENTRY(EGLuint64NV, eglGetSystemTimeNV, void)
/* Partial update extensions */
-EGL_ENTRY(EGLBoolean, eglSwapBuffersWithDamageKHR, EGLDisplay, EGLSurface, EGLint *, EGLint)
+EGL_ENTRY(EGLBoolean, eglSwapBuffersWithDamageKHR, EGLDisplay, EGLSurface, const EGLint *, EGLint)
EGL_ENTRY(EGLBoolean, eglSetDamageRegionKHR, EGLDisplay, EGLSurface, EGLint *, EGLint)
diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp
index 0bfefd6706..6713a5c69d 100644
--- a/opengl/libs/EGL/egl_platform_entries.cpp
+++ b/opengl/libs/EGL/egl_platform_entries.cpp
@@ -916,42 +916,72 @@ EGLContext eglCreateContextImpl(EGLDisplay dpy, EGLConfig config, EGLContext sha
egl_context_t* const c = get_context(share_list);
share_list = c->context;
}
+
+ bool skip_telemetry = false;
+
+ auto findAttribute = [](const EGLint* attrib_ptr, GLint attribute, GLint* value) {
+ while (attrib_ptr && *attrib_ptr != EGL_NONE) {
+ GLint attr = *attrib_ptr++;
+ GLint val = *attrib_ptr++;
+ if (attr == attribute) {
+ if (value) {
+ *value = val;
+ }
+ return true;
+ }
+ }
+ return false;
+ };
+
+ std::vector<EGLint> replacement_attrib_list;
+ GLint telemetry_value;
+ if (findAttribute(attrib_list, EGL_TELEMETRY_HINT_ANDROID, &telemetry_value)) {
+ skip_telemetry = (telemetry_value == android::GpuStatsInfo::SKIP_TELEMETRY);
+
+ // We need to remove EGL_TELEMETRY_HINT_ANDROID or the underlying drivers will
+ // complain about an unexpected attribute
+ const EGLint* attrib_ptr = attrib_list;
+ while (attrib_ptr && *attrib_ptr != EGL_NONE) {
+ GLint attr = *attrib_ptr++;
+ GLint val = *attrib_ptr++;
+ if (attr != EGL_TELEMETRY_HINT_ANDROID) {
+ replacement_attrib_list.push_back(attr);
+ replacement_attrib_list.push_back(val);
+ }
+ }
+ replacement_attrib_list.push_back(EGL_NONE);
+ attrib_list = replacement_attrib_list.data();
+ }
// b/111083885 - If we are presenting EGL 1.4 interface to apps
// error out on robust access attributes that are invalid
// in EGL 1.4 as the driver may be fine with them but dEQP expects
// tests to fail according to spec.
if (attrib_list && (cnx->driverVersion < EGL_MAKE_VERSION(1, 5, 0))) {
- const EGLint* attrib_ptr = attrib_list;
- while (*attrib_ptr != EGL_NONE) {
- GLint attr = *attrib_ptr++;
- GLint value = *attrib_ptr++;
- if (attr == EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR) {
- // We are GL ES context with EGL 1.4, this is an invalid
- // attribute
- return setError(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
- }
- };
+ if (findAttribute(attrib_list, EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
+ nullptr)) {
+ // We are GL ES context with EGL 1.4, this is an invalid attribute
+ return setError(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
+ }
}
EGLContext context =
cnx->egl.eglCreateContext(dp->disp.dpy, config, share_list, attrib_list);
if (context != EGL_NO_CONTEXT) {
// figure out if it's a GLESv1 or GLESv2
int version = egl_connection_t::GLESv1_INDEX;
- if (attrib_list) {
- while (*attrib_list != EGL_NONE) {
- GLint attr = *attrib_list++;
- GLint value = *attrib_list++;
- if (attr == EGL_CONTEXT_CLIENT_VERSION && (value == 2 || value == 3)) {
- version = egl_connection_t::GLESv2_INDEX;
- }
- };
+ GLint version_value;
+ if (findAttribute(attrib_list, EGL_CONTEXT_CLIENT_VERSION, &version_value)) {
+ if (version_value == 2 || version_value == 3) {
+ version = egl_connection_t::GLESv2_INDEX;
+ }
}
if (version == egl_connection_t::GLESv1_INDEX) {
android::GraphicsEnv::getInstance().setTargetStats(
android::GpuStatsInfo::Stats::GLES_1_IN_USE);
}
- android::GraphicsEnv::getInstance().setTargetStats(
- android::GpuStatsInfo::Stats::CREATED_GLES_CONTEXT);
+ if (!skip_telemetry) {
+ android::GraphicsEnv::getInstance().setTargetStats(
+ android::GpuStatsInfo::Stats::CREATED_GLES_CONTEXT);
+ }
egl_context_t* c = new egl_context_t(dpy, context, config, cnx, version);
return c;
}
@@ -1324,7 +1354,7 @@ private:
std::mutex mMutex;
};
-EGLBoolean eglSwapBuffersWithDamageKHRImpl(EGLDisplay dpy, EGLSurface draw, EGLint* rects,
+EGLBoolean eglSwapBuffersWithDamageKHRImpl(EGLDisplay dpy, EGLSurface draw, const EGLint* rects,
EGLint n_rects) {
const egl_display_t* dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
diff --git a/opengl/libs/GLES2/gl2ext_api.in b/opengl/libs/GLES2/gl2ext_api.in
index 4a0d4b9e08..dc99e09ef3 100644
--- a/opengl/libs/GLES2/gl2ext_api.in
+++ b/opengl/libs/GLES2/gl2ext_api.in
@@ -427,9 +427,6 @@ void API_ENTRY(glDrawRangeElementsBaseVertexEXT)(GLenum mode, GLuint start, GLui
void API_ENTRY(glDrawElementsInstancedBaseVertexEXT)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex) {
CALL_GL_API(glDrawElementsInstancedBaseVertexEXT, mode, count, type, indices, instancecount, basevertex);
}
-void API_ENTRY(glMultiDrawElementsBaseVertexOES)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex) {
- CALL_GL_API(glMultiDrawElementsBaseVertexOES, mode, count, type, indices, primcount, basevertex);
-}
void API_ENTRY(glDrawArraysInstancedEXT)(GLenum mode, GLint start, GLsizei count, GLsizei primcount) {
CALL_GL_API(glDrawArraysInstancedEXT, mode, start, count, primcount);
}
diff --git a/opengl/libs/entries.in b/opengl/libs/entries.in
index a30651098b..4c1eefc0c7 100644
--- a/opengl/libs/entries.in
+++ b/opengl/libs/entries.in
@@ -605,7 +605,6 @@ GL_ENTRY(void, glMultMatrixxOES, const GLfixed *m)
GL_ENTRY(void, glMultiDrawArraysEXT, GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)
GL_ENTRY(void, glMultiDrawArraysIndirectEXT, GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride)
GL_ENTRY(void, glMultiDrawElementsBaseVertexEXT, GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex)
-GL_ENTRY(void, glMultiDrawElementsBaseVertexOES, GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex)
GL_ENTRY(void, glMultiDrawElementsEXT, GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount)
GL_ENTRY(void, glMultiDrawElementsIndirectEXT, GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride)
GL_ENTRY(void, glMultiTexCoord4f, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
diff --git a/opengl/libs/platform_entries.in b/opengl/libs/platform_entries.in
index 46734112d3..004aa5acb9 100644
--- a/opengl/libs/platform_entries.in
+++ b/opengl/libs/platform_entries.in
@@ -24,7 +24,7 @@ EGL_ENTRY(EGLBoolean, eglWaitGL, void)
EGL_ENTRY(EGLBoolean, eglWaitNative, EGLint)
EGL_ENTRY(EGLint, eglGetError, void)
EGL_ENTRY(__eglMustCastToProperFunctionPointerType, eglGetProcAddress, const char*)
-EGL_ENTRY(EGLBoolean, eglSwapBuffersWithDamageKHR, EGLDisplay, EGLSurface, EGLint*, EGLint)
+EGL_ENTRY(EGLBoolean, eglSwapBuffersWithDamageKHR, EGLDisplay, EGLSurface, const EGLint*, EGLint)
EGL_ENTRY(EGLBoolean, eglSwapBuffers, EGLDisplay, EGLSurface)
EGL_ENTRY(EGLBoolean, eglCopyBuffers, EGLDisplay, EGLSurface, NativePixmapType)
EGL_ENTRY(const char*, eglQueryString, EGLDisplay, EGLint)