From 4803b74e2a12a508f7bbfde6f6a962fe3299c61c Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Mon, 24 Sep 2012 19:07:20 -0700 Subject: [PATCH] Show build config in dumpsys SurfaceFlinger This adds a line to the "dumpsys SurfaceFlinger" output that shows build-time configuration values. Example: Build configuration: [sf HAS_CONTEXT_PRIORITY] [libui] \ [libgui USE_FENCE_SYNC] Bug 7206633 Change-Id: Ibe1856b459d34a4be6ee83a4ebfd2807e6cc68a0 --- include/gui/GuiConfig.h | 29 +++++++++++++++++ include/ui/UiConfig.h | 29 +++++++++++++++++ libs/gui/Android.mk | 3 +- libs/gui/GuiConfig.cpp | 38 ++++++++++++++++++++++ libs/ui/Android.mk | 3 +- libs/ui/UiConfig.cpp | 36 ++++++++++++++++++++ services/surfaceflinger/SurfaceFlinger.cpp | 31 ++++++++++++++++++ services/surfaceflinger/SurfaceFlinger.h | 1 + 8 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 include/gui/GuiConfig.h create mode 100644 include/ui/UiConfig.h create mode 100644 libs/gui/GuiConfig.cpp create mode 100644 libs/ui/UiConfig.cpp diff --git a/include/gui/GuiConfig.h b/include/gui/GuiConfig.h new file mode 100644 index 000000000..b020ed9b6 --- /dev/null +++ b/include/gui/GuiConfig.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_GUI_CONFIG_H +#define ANDROID_GUI_CONFIG_H + +#include + +namespace android { + +// Append the libgui configuration details to configStr. +void appendGuiConfigString(String8& configStr); + +}; // namespace android + +#endif /*ANDROID_GUI_CONFIG_H*/ diff --git a/include/ui/UiConfig.h b/include/ui/UiConfig.h new file mode 100644 index 000000000..fcf8ed5d6 --- /dev/null +++ b/include/ui/UiConfig.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_UI_CONFIG_H +#define ANDROID_UI_CONFIG_H + +#include + +namespace android { + +// Append the libui configuration details to configStr. +void appendUiConfigString(String8& configStr); + +}; // namespace android + +#endif /*ANDROID_UI_CONFIG_H*/ diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk index 282c25a2f..923845c16 100644 --- a/libs/gui/Android.mk +++ b/libs/gui/Android.mk @@ -24,7 +24,8 @@ LOCAL_SRC_FILES:= \ SurfaceComposerClient.cpp \ DummyConsumer.cpp \ CpuConsumer.cpp \ - BufferItemConsumer.cpp + BufferItemConsumer.cpp \ + GuiConfig.cpp LOCAL_SHARED_LIBRARIES := \ libbinder \ diff --git a/libs/gui/GuiConfig.cpp b/libs/gui/GuiConfig.cpp new file mode 100644 index 000000000..0744e4f56 --- /dev/null +++ b/libs/gui/GuiConfig.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +namespace android { + +void appendGuiConfigString(String8& configStr) +{ + static const char* config = + " [libgui" +#ifdef USE_FENCE_SYNC + " USE_FENCE_SYNC" +#endif +#ifdef USE_NATIVE_FENCE_SYNC + " USE_NATIVE_FENCE_SYNC" +#endif +#ifdef ALLOW_DEQUEUE_CURRENT_BUFFER + " ALLOW_DEQUEUE_CURRENT_BUFFER" +#endif + "]"; + configStr.append(config); +} + +}; // namespace android diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk index 80c28a1b4..0d2e44cbd 100644 --- a/libs/ui/Android.mk +++ b/libs/ui/Android.mk @@ -23,7 +23,8 @@ LOCAL_SRC_FILES:= \ GraphicBufferMapper.cpp \ PixelFormat.cpp \ Rect.cpp \ - Region.cpp + Region.cpp \ + UiConfig.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ diff --git a/libs/ui/UiConfig.cpp b/libs/ui/UiConfig.cpp new file mode 100644 index 000000000..8b2130e70 --- /dev/null +++ b/libs/ui/UiConfig.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +namespace android { + +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + +void appendUiConfigString(String8& configStr) +{ + static const char* config = + " [libui" +#ifdef FRAMEBUFFER_FORCE_FORMAT + " FRAMEBUFFER_FORCE_FORMAT=" TOSTRING(FRAMEBUFFER_FORCE_FORMAT) +#endif + "]"; + configStr.append(config); +} + + +}; // namespace android diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index bc7552d7e..6bd300dde 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -37,11 +37,13 @@ #include #include +#include #include #include #include #include +#include #include #include @@ -2045,6 +2047,26 @@ void SurfaceFlinger::clearStatsLocked(const Vector& args, size_t& inde } } +/*static*/ void SurfaceFlinger::appendSfConfigString(String8& result) +{ + static const char* config = + " [sf" +#ifdef NO_RGBX_8888 + " NO_RGBX_8888" +#endif +#ifdef HAS_CONTEXT_PRIORITY + " HAS_CONTEXT_PRIORITY" +#endif +#ifdef NEVER_DEFAULT_TO_ASYNC_MODE + " NEVER_DEFAULT_TO_ASYNC_MODE" +#endif +#ifdef TARGET_DISABLE_TRIPLE_BUFFERING + " TARGET_DISABLE_TRIPLE_BUFFERING" +#endif + "]"; + result.append(config); +} + void SurfaceFlinger::dumpAllLocked( String8& result, char* buffer, size_t SIZE) const { @@ -2055,6 +2077,15 @@ void SurfaceFlinger::dumpAllLocked( nsecs_t inSwapBuffersDuration = (inSwapBuffers) ? now-inSwapBuffers : 0; nsecs_t inTransactionDuration = (inTransaction) ? now-inTransaction : 0; + /* + * Dump library configuration. + */ + result.append("Build configuration:"); + appendSfConfigString(result); + appendUiConfigString(result); + appendGuiConfigString(result); + result.append("\n"); + /* * Dump the visible layer list */ diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index c9877b2ef..0a019ceec 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -382,6 +382,7 @@ private: String8& result, char* buffer, size_t SIZE) const; void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const; bool startDdmConnection(); + static void appendSfConfigString(String8& result); /* ------------------------------------------------------------------------ * Attributes