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

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

GpuStats: track whether the app creates ES1 context

Bug: 146661131
Test: atest statsd_test:GpuStatsPuller_test
Change-Id: If2acabfca38fad08d4245c2bac643ca5fc87c1d7
parent ab17580c
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -6667,6 +6667,9 @@ message GpuStatsAppInfo {


    // App is not doing pre-rotation correctly.
    // App is not doing pre-rotation correctly.
    optional bool false_prerotation = 7;
    optional bool false_prerotation = 7;

    // App creates GLESv1 context.
    optional bool gles_1_in_use = 8;
}
}


/*
/*
+1 −0
Original line number Original line Diff line number Diff line
@@ -103,6 +103,7 @@ static bool pullGpuStatsAppInfo(const sp<IGpuService>& gpuService,
        }
        }
        if (!event->write(info.cpuVulkanInUse)) return false;
        if (!event->write(info.cpuVulkanInUse)) return false;
        if (!event->write(info.falsePrerotation)) return false;
        if (!event->write(info.falsePrerotation)) return false;
        if (!event->write(info.gles1InUse)) return false;
        event->init();
        event->init();
        data->emplace_back(event);
        data->emplace_back(event);
    }
    }
+4 −1
Original line number Original line Diff line number Diff line
@@ -57,8 +57,9 @@ static const int32_t CPU_VULKAN_VERSION = 2;
static const int32_t GLES_VERSION                 = 3;
static const int32_t GLES_VERSION                 = 3;
static const bool CPU_VULKAN_IN_USE               = true;
static const bool CPU_VULKAN_IN_USE               = true;
static const bool FALSE_PREROTATION               = true;
static const bool FALSE_PREROTATION               = true;
static const bool GLES_1_IN_USE                   = true;
static const size_t NUMBER_OF_VALUES_GLOBAL       = 13;
static const size_t NUMBER_OF_VALUES_GLOBAL       = 13;
static const size_t NUMBER_OF_VALUES_APP          = 7;
static const size_t NUMBER_OF_VALUES_APP          = 8;
// clang-format on
// clang-format on


class MockGpuStatsPuller : public GpuStatsPuller {
class MockGpuStatsPuller : public GpuStatsPuller {
@@ -152,6 +153,7 @@ TEST_F(GpuStatsPuller_test, PullGpuStatsAppInfo) {
    EXPECT_TRUE(event->write(int64VectorToProtoByteString(angleDriverLoadingTime)));
    EXPECT_TRUE(event->write(int64VectorToProtoByteString(angleDriverLoadingTime)));
    EXPECT_TRUE(event->write(CPU_VULKAN_IN_USE));
    EXPECT_TRUE(event->write(CPU_VULKAN_IN_USE));
    EXPECT_TRUE(event->write(FALSE_PREROTATION));
    EXPECT_TRUE(event->write(FALSE_PREROTATION));
    EXPECT_TRUE(event->write(GLES_1_IN_USE));
    event->init();
    event->init();
    inData.emplace_back(event);
    inData.emplace_back(event);
    MockGpuStatsPuller mockPuller(android::util::GPU_STATS_APP_INFO, &inData);
    MockGpuStatsPuller mockPuller(android::util::GPU_STATS_APP_INFO, &inData);
@@ -171,6 +173,7 @@ TEST_F(GpuStatsPuller_test, PullGpuStatsAppInfo) {
              outData[0]->getValues()[4].mValue.str_value);
              outData[0]->getValues()[4].mValue.str_value);
    EXPECT_EQ(CPU_VULKAN_IN_USE, outData[0]->getValues()[5].mValue.int_value);
    EXPECT_EQ(CPU_VULKAN_IN_USE, outData[0]->getValues()[5].mValue.int_value);
    EXPECT_EQ(FALSE_PREROTATION, outData[0]->getValues()[6].mValue.int_value);
    EXPECT_EQ(FALSE_PREROTATION, outData[0]->getValues()[6].mValue.int_value);
    EXPECT_EQ(GLES_1_IN_USE, outData[0]->getValues()[7].mValue.int_value);
}
}


}  // namespace statsd
}  // namespace statsd