From 4351857c9de86df9f418b3df28aebb1239ca35dd Mon Sep 17 00:00:00 2001 From: Jaesoo Lee Date: Mon, 23 Jan 2017 19:03:16 +0900 Subject: configstore: use utility functions defined in ConfigStoreUtils.h This change modifies existing implementation to get config values via configstore by using utility functions defined in ConfigStoreUtils.h. Specifically, as an example, the utility function getInt64() is used for vsyncEventPhaseoffsetNs defined in ISurfaceFlingerConfigs. Design doc: go/design-confighal Bug: 34724435 Test: build, run Change-Id: I82a9371a84902c1e185d619d77e4c2e3272f84db --- services/surfaceflinger/SurfaceFlinger.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'services/surfaceflinger/SurfaceFlinger.cpp') diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index cbc209de40..b39692c587 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -87,6 +87,7 @@ #include #include +#include #define DISPLAY_COUNT 1 @@ -100,22 +101,9 @@ EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint na namespace android { +using namespace android::hardware::configstore; using namespace android::hardware::configstore::V1_0; -static sp getConfigs() { - static sp configs - = ISurfaceFlingerConfigs::getService(); - return configs; -} - -static int64_t getVsyncEventPhaseOffsetNs() { - int64_t ret = 1000000; // default value - getConfigs()->vsyncEventPhaseOffsetNs([&](OptionalInt64 value) { - if (value.specified) ret = value.value; - }); - return ret; -} - // This is the phase offset in nanoseconds of the software vsync event // relative to the vsync event reported by HWComposer. The software vsync // event is when SurfaceFlinger and Choreographer-based applications run each @@ -136,7 +124,9 @@ static int64_t getVsyncEventPhaseOffsetNs() { // the latency will end up being an additional vsync period, and animations // will hiccup. Therefore, this latency should be tuned somewhat // conservatively (or at least with awareness of the trade-off being made). -static int64_t vsyncPhaseOffsetNs = getVsyncEventPhaseOffsetNs(); +static int64_t vsyncPhaseOffsetNs = getInt64< + ISurfaceFlingerConfigs, + &ISurfaceFlingerConfigs::vsyncEventPhaseOffsetNs>(1000000); // This is the phase offset at which SurfaceFlinger's composition runs. static const int64_t sfVsyncPhaseOffsetNs = SF_VSYNC_EVENT_PHASE_OFFSET_NS; -- cgit v1.2.3-59-g8ed1b