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

Commit dcd141b0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Game Driver: plumb driver build date into GpuStats"

parents b528869d 512a723a
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@ void GraphicsEnv::setDriverPath(const std::string path) {

void GraphicsEnv::setGpuStats(const std::string& driverPackageName,
                              const std::string& driverVersionName, uint64_t driverVersionCode,
                              const std::string& driverBuildDate,
                              const std::string& appPackageName) {
    ATRACE_CALL();

@@ -166,13 +167,15 @@ void GraphicsEnv::setGpuStats(const std::string& driverPackageName,
          "\tdriverPackageName[%s]\n"
          "\tdriverVersionName[%s]\n"
          "\tdriverVersionCode[%llu]\n"
          "\tdriverBuildDate[%s]\n"
          "\tappPackageName[%s]\n",
          driverPackageName.c_str(), driverVersionName.c_str(),
          (unsigned long long)driverVersionCode, appPackageName.c_str());
          (unsigned long long)driverVersionCode, driverBuildDate.c_str(), appPackageName.c_str());

    mGpuStats.driverPackageName = driverPackageName;
    mGpuStats.driverVersionName = driverVersionName;
    mGpuStats.driverVersionCode = driverVersionCode;
    mGpuStats.driverBuildDate = driverBuildDate;
    mGpuStats.appPackageName = appPackageName;
}

@@ -262,19 +265,22 @@ void GraphicsEnv::sendGpuStatsLocked(GraphicsEnv::Driver driver, bool isDriverLo
          "\tdriverPackageName[%s]\n"
          "\tdriverVersionName[%s]\n"
          "\tdriverVersionCode[%llu]\n"
          "\tdriverBuildDate[%s]\n"
          "\tappPackageName[%s]\n"
          "\tdriver[%d]\n"
          "\tisDriverLoaded[%d]\n"
          "\tdriverLoadingTime[%lld]",
          mGpuStats.driverPackageName.c_str(), mGpuStats.driverVersionName.c_str(),
          (unsigned long long)mGpuStats.driverVersionCode, mGpuStats.appPackageName.c_str(),
          static_cast<int32_t>(driver), isDriverLoaded, (long long)driverLoadingTime);
          (unsigned long long)mGpuStats.driverVersionCode, mGpuStats.driverBuildDate.c_str(),
          mGpuStats.appPackageName.c_str(), static_cast<int32_t>(driver), isDriverLoaded,
          (long long)driverLoadingTime);

    const sp<IGpuService> gpuService = getGpuService();
    if (gpuService) {
        gpuService->setGpuStats(mGpuStats.driverPackageName, mGpuStats.driverVersionName,
                                mGpuStats.driverVersionCode, mGpuStats.appPackageName, driver,
                                isDriverLoaded, driverLoadingTime);
                                mGpuStats.driverVersionCode, mGpuStats.driverBuildDate,
                                mGpuStats.appPackageName, driver, isDriverLoaded,
                                driverLoadingTime);
    }
}

+10 −5
Original line number Diff line number Diff line
@@ -29,20 +29,22 @@ public:

    virtual void setGpuStats(const std::string& driverPackageName,
                             const std::string& driverVersionName, uint64_t driverVersionCode,
                             const std::string& appPackageName, GraphicsEnv::Driver driver,
                             bool isDriverLoaded, int64_t driverLoadingTime) {
                             const std::string& driverBuildDate, const std::string& appPackageName,
                             GraphicsEnv::Driver driver, bool isDriverLoaded,
                             int64_t driverLoadingTime) {
        Parcel data, reply;
        data.writeInterfaceToken(IGpuService::getInterfaceDescriptor());

        data.writeUtf8AsUtf16(driverPackageName);
        data.writeUtf8AsUtf16(driverVersionName);
        data.writeUint64(driverVersionCode);
        data.writeUtf8AsUtf16(driverBuildDate);
        data.writeUtf8AsUtf16(appPackageName);
        data.writeInt32(static_cast<int32_t>(driver));
        data.writeBool(isDriverLoaded);
        data.writeInt64(driverLoadingTime);

        remote()->transact(BnGpuService::SET_GPU_STATS, data, &reply);
        remote()->transact(BnGpuService::SET_GPU_STATS, data, &reply, IBinder::FLAG_ONEWAY);
    }
};

@@ -66,6 +68,9 @@ status_t BnGpuService::onTransact(uint32_t code, const Parcel& data, Parcel* rep
            uint64_t driverVersionCode;
            if ((status = data.readUint64(&driverVersionCode)) != OK) return status;

            std::string driverBuildDate;
            if ((status = data.readUtf8FromUtf16(&driverBuildDate)) != OK) return status;

            std::string appPackageName;
            if ((status = data.readUtf8FromUtf16(&appPackageName)) != OK) return status;

@@ -78,8 +83,8 @@ status_t BnGpuService::onTransact(uint32_t code, const Parcel& data, Parcel* rep
            int64_t driverLoadingTime;
            if ((status = data.readInt64(&driverLoadingTime)) != OK) return status;

            setGpuStats(driverPackageName, driverVersionName, driverVersionCode, appPackageName,
                        static_cast<GraphicsEnv::Driver>(driver), isDriverLoaded,
            setGpuStats(driverPackageName, driverVersionName, driverVersionCode, driverBuildDate,
                        appPackageName, static_cast<GraphicsEnv::Driver>(driver), isDriverLoaded,
                        driverLoadingTime);

            return OK;
+4 −1
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ private:
        std::string driverPackageName;
        std::string driverVersionName;
        uint64_t driverVersionCode;
        std::string driverBuildDate;
        std::string appPackageName;
        Driver glDriverToLoad;
        Driver glDriverFallback;
@@ -58,6 +59,7 @@ private:
              : driverPackageName(""),
                driverVersionName(""),
                driverVersionCode(0),
                driverBuildDate(""),
                appPackageName(""),
                glDriverToLoad(Driver::NONE),
                glDriverFallback(Driver::NONE),
@@ -78,7 +80,8 @@ public:
    void setDriverPath(const std::string path);
    android_namespace_t* getDriverNamespace();
    void setGpuStats(const std::string& driverPackageName, const std::string& driverVersionName,
                     uint64_t versionCode, const std::string& appPackageName);
                     uint64_t versionCode, const std::string& driverBuildDate,
                     const std::string& appPackageName);
    void setDriverToLoad(Driver driver);
    void setDriverLoaded(Api api, bool isDriverLoaded, int64_t driverLoadingTime);
    void clearDriverLoadingInfo(Api api);
+3 −2
Original line number Diff line number Diff line
@@ -35,8 +35,9 @@ public:
    // set GPU stats from GraphicsEnvironment.
    virtual void setGpuStats(const std::string& driverPackageName,
                             const std::string& driverVersionName, uint64_t driverVersionCode,
                             const std::string& appPackageName, GraphicsEnv::Driver driver,
                             bool isDriverLoaded, int64_t driverLoadingTime) = 0;
                             const std::string& driverBuildDate, const std::string& appPackageName,
                             GraphicsEnv::Driver driver, bool isDriverLoaded,
                             int64_t driverLoadingTime) = 0;
};

class BnGpuService : public BnInterface<IGpuService> {
+5 −3
Original line number Diff line number Diff line
@@ -39,8 +39,9 @@ GpuService::GpuService() = default;

void GpuService::setGpuStats(const std::string& driverPackageName,
                             const std::string& driverVersionName, uint64_t driverVersionCode,
                             const std::string& appPackageName, GraphicsEnv::Driver driver,
                             bool isDriverLoaded, int64_t driverLoadingTime) {
                             const std::string& driverBuildDate, const std::string& appPackageName,
                             GraphicsEnv::Driver driver, bool isDriverLoaded,
                             int64_t driverLoadingTime) {
    ATRACE_CALL();

    std::lock_guard<std::mutex> lock(mStateLock);
@@ -48,12 +49,13 @@ void GpuService::setGpuStats(const std::string& driverPackageName,
          "\tdriverPackageName[%s]\n"
          "\tdriverVersionName[%s]\n"
          "\tdriverVersionCode[%llu]\n"
          "\tdriverBuildDate[%s]\n"
          "\tappPackageName[%s]\n"
          "\tdriver[%d]\n"
          "\tisDriverLoaded[%d]\n"
          "\tdriverLoadingTime[%lld]",
          driverPackageName.c_str(), driverVersionName.c_str(),
          (unsigned long long)driverVersionCode, appPackageName.c_str(),
          (unsigned long long)driverVersionCode, driverBuildDate.c_str(), appPackageName.c_str(),
          static_cast<int32_t>(driver), isDriverLoaded, (long long)driverLoadingTime);
}

Loading