From 54161bf487f036bf7c795de6fabb75b340c9c9c0 Mon Sep 17 00:00:00 2001 From: Solti Date: Thu, 9 Nov 2023 21:09:53 +0000 Subject: include system ANGLE usage as ANGLE usage This CL set the system ANGLE usage as GpuStatsInfo::Driver::ANGLE. Previously it was categorized as GpuStatsInfo::Driver::GL. The reason is ANGLE will be shipped as a system driver, not as APK. We want to monitor the adoption of system ANGLE driver. Test: collect the GPU stats before and after the CL. Check the GPU stats reflects ANGLE traffic. See details in http://b/308476674#comment3 Test: run CtsAngleIntegrationHostTestCases on ABTD with the change, See details in http://b/308476674#comment2 Bug: b/308152854, b/308476674, b/308098783 Change-Id: I938b2d112f3da3ced3a1590a08fd70687da855e4 Merged-In: I9beb7c75d65b7aa2b7c5af9f262f30be9d6247d5 --- libs/graphicsenv/include/graphicsenv/GpuStatsInfo.h | 2 +- opengl/libs/EGL/Loader.cpp | 10 +++++++++- services/gpuservice/gpustats/GpuStats.cpp | 6 ++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libs/graphicsenv/include/graphicsenv/GpuStatsInfo.h b/libs/graphicsenv/include/graphicsenv/GpuStatsInfo.h index 47607a0ab9..9ebaf16eb4 100644 --- a/libs/graphicsenv/include/graphicsenv/GpuStatsInfo.h +++ b/libs/graphicsenv/include/graphicsenv/GpuStatsInfo.h @@ -104,7 +104,7 @@ public: GL_UPDATED = 2, VULKAN = 3, VULKAN_UPDATED = 4, - ANGLE = 5, + ANGLE = 5, // cover both system ANGLE and ANGLE APK }; enum Stats { diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index 10857a0e47..e487cbc54d 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -591,6 +591,8 @@ Loader::driver_t* Loader::attempt_to_load_angle(egl_connection_t* cnx) { return nullptr; } + // use ANGLE APK driver + android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::ANGLE); driver_t* hnd = nullptr; // ANGLE doesn't ship with GLES library, and thus we skip GLES driver. @@ -661,7 +663,13 @@ Loader::driver_t* Loader::attempt_to_load_updated_driver(egl_connection_t* cnx) Loader::driver_t* Loader::attempt_to_load_system_driver(egl_connection_t* cnx, const char* suffix, const bool exact) { ATRACE_CALL(); - android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::GL); + if (suffix && strcmp(suffix, "angle") == 0) { + // use system ANGLE driver + android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::ANGLE); + } else { + android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::GL); + } + driver_t* hnd = nullptr; void* dso = load_system_driver("GLES", suffix, exact); if (dso) { diff --git a/services/gpuservice/gpustats/GpuStats.cpp b/services/gpuservice/gpustats/GpuStats.cpp index f06a0457d3..11b636d564 100644 --- a/services/gpuservice/gpustats/GpuStats.cpp +++ b/services/gpuservice/gpustats/GpuStats.cpp @@ -163,11 +163,13 @@ void GpuStats::insertDriverStats(const std::string& driverPackageName, addLoadingTime(driver, driverLoadingTime, &appInfo); appInfo.appPackageName = appPackageName; appInfo.driverVersionCode = driverVersionCode; - appInfo.angleInUse = driverPackageName == "angle"; + appInfo.angleInUse = + driver == GpuStatsInfo::Driver::ANGLE || driverPackageName == "angle"; appInfo.lastAccessTime = std::chrono::system_clock::now(); mAppStats.insert({appStatsKey, appInfo}); } else { - mAppStats[appStatsKey].angleInUse = driverPackageName == "angle"; + mAppStats[appStatsKey].angleInUse = + driver == GpuStatsInfo::Driver::ANGLE || driverPackageName == "angle"; addLoadingTime(driver, driverLoadingTime, &mAppStats[appStatsKey]); mAppStats[appStatsKey].lastAccessTime = std::chrono::system_clock::now(); } -- cgit v1.2.3-59-g8ed1b