Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eac35ebc authored by Yiwei Zhang's avatar Yiwei Zhang
Browse files

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
parent 7aec354b
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -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) {
                    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;
        }