From eac35ebc899f61c7737216d1fe4908e164ee2ae5 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Fri, 17 Jan 2020 15:55:32 -0800 Subject: GpuStats: complete the coverage of ES1 usage tracking Previously, we only track when the app explicitly creates an es1 context. This change fixes the coverage because the implicit default context creation goes to es1. Bug: 146661131 Test: build, flash and boot Change-Id: I5d60812e86bd194d41c91b1e50e3a5e3c37e072d --- opengl/libs/EGL/egl_platform_entries.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp index eefb57412c..c8840f9f19 100644 --- a/opengl/libs/EGL/egl_platform_entries.cpp +++ b/opengl/libs/EGL/egl_platform_entries.cpp @@ -976,22 +976,20 @@ EGLContext eglCreateContextImpl(EGLDisplay dpy, EGLConfig config, dp->disp.dpy, config, share_list, attrib_list); if (context != EGL_NO_CONTEXT) { // figure out if it's a GLESv1 or GLESv2 - int version = 0; + 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) { - if (value == 1) { - version = egl_connection_t::GLESv1_INDEX; - android::GraphicsEnv::getInstance().setTargetStats( - android::GpuStatsInfo::Stats::GLES_1_IN_USE); - } else if (value == 2 || value == 3) { - version = egl_connection_t::GLESv2_INDEX; - } + if (attr == EGL_CONTEXT_CLIENT_VERSION && (value == 2 || 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); + } egl_context_t* c = new egl_context_t(dpy, context, config, cnx, version); return c; } -- cgit v1.2.3-59-g8ed1b