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
This commit is contained in:
Andy McFadden 2012-09-24 19:07:20 -07:00
parent a046dd9772
commit 4803b74e2a
8 changed files with 168 additions and 2 deletions

29
include/gui/GuiConfig.h Normal file
View File

@ -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 <utils/String8.h>
namespace android {
// Append the libgui configuration details to configStr.
void appendGuiConfigString(String8& configStr);
}; // namespace android
#endif /*ANDROID_GUI_CONFIG_H*/

29
include/ui/UiConfig.h Normal file
View File

@ -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 <utils/String8.h>
namespace android {
// Append the libui configuration details to configStr.
void appendUiConfigString(String8& configStr);
}; // namespace android
#endif /*ANDROID_UI_CONFIG_H*/

View File

@ -24,7 +24,8 @@ LOCAL_SRC_FILES:= \
SurfaceComposerClient.cpp \
DummyConsumer.cpp \
CpuConsumer.cpp \
BufferItemConsumer.cpp
BufferItemConsumer.cpp \
GuiConfig.cpp
LOCAL_SHARED_LIBRARIES := \
libbinder \

38
libs/gui/GuiConfig.cpp Normal file
View File

@ -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 <gui/GuiConfig.h>
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

View File

@ -23,7 +23,8 @@ LOCAL_SRC_FILES:= \
GraphicBufferMapper.cpp \
PixelFormat.cpp \
Rect.cpp \
Region.cpp
Region.cpp \
UiConfig.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \

36
libs/ui/UiConfig.cpp Normal file
View File

@ -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 <ui/UiConfig.h>
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

View File

@ -37,11 +37,13 @@
#include <gui/BitTube.h>
#include <gui/BufferQueue.h>
#include <gui/GuiConfig.h>
#include <gui/IDisplayEventConnection.h>
#include <gui/SurfaceTextureClient.h>
#include <ui/GraphicBufferAllocator.h>
#include <ui/PixelFormat.h>
#include <ui/UiConfig.h>
#include <utils/misc.h>
#include <utils/String8.h>
@ -2045,6 +2047,26 @@ void SurfaceFlinger::clearStatsLocked(const Vector<String16>& 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
*/

View File

@ -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