nyan~

Engineering Rocks!

SurfaceFlinger

SurfaceFlinger

Dump of SERVICE SurfaceFlinger

Find more information about dumpsys

1
adb shell dumpsys SurfaceFlinger

Frame Latency

Prints information about last 128 frames displayed in specific window
1
adb shell dumpsys SurfaceFlinger --latency [window name]

According to output definitive, The data returned looks like this:

1
2
3
4
5
16954612
7657467895508 7657482691352 7657493499756
7657484466553 7657499645964 7657511077881
7657500793457 7657516600576 7657527404785
(...)

The first line is the refresh period (here 16.95 ms), it is followed by 128 lines w/ 3 timestamps in nanosecond each:

A) when the app started to draw
B) the vsync immediately preceding SF submitting the frame to the h/w
C) timestamp immediately after SF submitted that frame to the h/w

The difference between the 1st and 3rd timestamp is the frame-latency.

Observe composite rate in logcat

1
adb shell service call SurfaceFlinger 1001 i32 1

Force using SurfaceFlinger as compositor

1
adb shell service call SurfaceFlinger 1008 i32 1

HWUI

Disable HWUI

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 71ccac6..ec0b7ba 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -536,7 +536,7 @@ public abstract class Window {
             boolean hardwareAccelerated) {
         mAppToken = appToken;
         mAppName = appName;
-        mHardwareAccelerated = hardwareAccelerated
-                 || (!hardwareAccelerated && mAppProfileService.canForceHwUi(appName))
-                 || SystemProperties.getBoolean(PROPERTY_HARDWARE_UI, false);
+        mHardwareAccelerated = false;
         if (wm == null) {

OpenGLRenderer (libhwui) Properties

http://source.android.com/devices/tuning.html

Google IO 2012: Accelerating Android Rendering

Android 3.0 introduce a new hardware accelerated 2D rendering.
Guy and Haase have presented

  • How is android UI being drawn
  • How to enable/disable hardware acceleration in application/acitivity/window level
  • Limitations for hw acceleration
  • ComposeShader
  • Old and New drawing model
  • DisplayList
  • Set layer type per view
  • Reasons to use different type of layers
  • Tips & tricks for application developers

Google PIC