diff options
| author | 2019-02-15 22:20:50 +0000 | |
|---|---|---|
| committer | 2019-02-15 22:20:50 +0000 | |
| commit | 46c6532f355a09f618e378007151fb983ea82fb0 (patch) | |
| tree | 5b2e133c7c7af5d9384aedef78c919455a841822 /vulkan/libvulkan/driver.cpp | |
| parent | b7c97e8ceb6a1926b7645631ff73d53953309cd2 (diff) | |
| parent | d986181df8ff886301adaf20404f886c730ba2c7 (diff) | |
Merge "Game Driver: plumb driver choice and loading time to GpuStats"
Diffstat (limited to 'vulkan/libvulkan/driver.cpp')
| -rw-r--r-- | vulkan/libvulkan/driver.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp index 3a8e34eff2..b3259de6ea 100644 --- a/vulkan/libvulkan/driver.cpp +++ b/vulkan/libvulkan/driver.cpp @@ -33,6 +33,7 @@ #include <configstore/Utils.h> #include <cutils/properties.h> #include <graphicsenv/GraphicsEnv.h> +#include <utils/Timers.h> #include <utils/Trace.h> #include <utils/Vector.h> @@ -210,6 +211,8 @@ int LoadBuiltinDriver(const hwvulkan_module_t** module) { auto ns = android_get_exported_namespace("sphal"); if (!ns) return -ENOENT; + android::GraphicsEnv::getInstance().setDriverToLoad( + android::GraphicsEnv::Driver::VULKAN); return LoadDriver(ns, module); } @@ -219,12 +222,16 @@ int LoadUpdatedDriver(const hwvulkan_module_t** module) { auto ns = android::GraphicsEnv::getInstance().getDriverNamespace(); if (!ns) return -ENOENT; + android::GraphicsEnv::getInstance().setDriverToLoad( + android::GraphicsEnv::Driver::VULKAN_UPDATED); return LoadDriver(ns, module); } bool Hal::Open() { ATRACE_CALL(); + const nsecs_t openTime = systemTime(); + ALOG_ASSERT(!hal_.dev_, "OpenHAL called more than once"); // Use a stub device unless we successfully open a real HAL device. @@ -250,11 +257,12 @@ bool Hal::Open() { } } if (result != 0) { + android::GraphicsEnv::getInstance().setDriverLoaded( + android::GraphicsEnv::Api::API_VK, false, systemTime() - openTime); ALOGV("unable to load Vulkan HAL, using stub HAL (result=%d)", result); return true; } - android::GraphicsEnv::getInstance().sendGpuStats(); hwvulkan_device_t* device; ATRACE_BEGIN("hwvulkan module open"); @@ -263,6 +271,8 @@ bool Hal::Open() { reinterpret_cast<hw_device_t**>(&device)); ATRACE_END(); if (result != 0) { + android::GraphicsEnv::getInstance().setDriverLoaded( + android::GraphicsEnv::Api::API_VK, false, systemTime() - openTime); // Any device with a Vulkan HAL should be able to open the device. ALOGE("failed to open Vulkan HAL device: %s (%d)", strerror(-result), result); @@ -273,6 +283,9 @@ bool Hal::Open() { hal_.InitDebugReportIndex(); + android::GraphicsEnv::getInstance().setDriverLoaded( + android::GraphicsEnv::Api::API_VK, true, systemTime() - openTime); + return true; } |