diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2013-10-28 20:12:01 +0100 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2013-10-28 20:12:01 +0100 |
commit | a5ed31ba3bdfb8cd761e87f3de86198c6233c3cc (patch) | |
tree | e2f014f9f005d31095cc8844f60963b47b26ff0b | |
parent | be09772e71a516759b5ce7fb9d2bab0d7227f291 (diff) | |
download | frameworks_base-a5ed31ba3bdfb8cd761e87f3de86198c6233c3cc.zip frameworks_base-a5ed31ba3bdfb8cd761e87f3de86198c6233c3cc.tar.gz frameworks_base-a5ed31ba3bdfb8cd761e87f3de86198c6233c3cc.tar.bz2 |
Adapt hardware renderer and screen rotation animation for SoftwareGL
Change-Id: I0d7809e7ae408c4762982599576be9a78d54a2dc
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r-- | core/java/android/app/ActivityManager.java | 38 | ||||
-rw-r--r-- | core/java/android/view/HardwareRenderer.java | 40 | ||||
-rw-r--r-- | services/java/com/android/server/wm/ScreenRotationAnimation.java | 18 |
3 files changed, 57 insertions, 39 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index e4e0d8e..e5c0e87 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -381,25 +381,29 @@ public class ActivityManager { * @hide */ static public boolean isHighEndGfx() { - MemInfoReader reader = new MemInfoReader(); - reader.readMemInfo(); - if (reader.getTotalSize() >= (512*1024*1024)) { - // If the device has at least 512MB RAM available to the kernel, - // we can afford the overhead of graphics acceleration. - return true; - } + if (SystemProperties.get("ro.softwaregl").equals("true")) { + return false; + } else { + MemInfoReader reader = new MemInfoReader(); + reader.readMemInfo(); + if (reader.getTotalSize() >= (512*1024*1024)) { + // If the device has at least 512MB RAM available to the kernel, + // we can afford the overhead of graphics acceleration. + return true; + } - Display display = DisplayManagerGlobal.getInstance().getRealDisplay( - Display.DEFAULT_DISPLAY); - Point p = new Point(); - display.getRealSize(p); - int pixels = p.x * p.y; - if (pixels >= (1024*600)) { - // If this is a sufficiently large screen, then there are enough - // pixels on it that we'd really like to use hw drawing. - return true; + Display display = DisplayManagerGlobal.getInstance().getRealDisplay( + Display.DEFAULT_DISPLAY); + Point p = new Point(); + display.getRealSize(p); + int pixels = p.x * p.y; + if (pixels >= (1024*600)) { + // If this is a sufficiently large screen, then there are enough + // pixels on it that we'd really like to use hw drawing. + return true; + } + return false; } - return false; } /** diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 5b7a5af..aa22d97 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -166,14 +166,14 @@ public abstract class HardwareRenderer { * * @hide */ - public static boolean sRendererDisabled = false; + public static boolean sRendererDisabled = SystemProperties.get("ro.softwaregl").equals("true") ? true : false; /** * Further hardware renderer disabling for the system process. * * @hide */ - public static boolean sSystemRendererDisabled = false; + public static boolean sSystemRendererDisabled = SystemProperties.get("ro.softwaregl").equals("true") ? true : false; /** * Number of frames to profile. @@ -1436,20 +1436,28 @@ public abstract class HardwareRenderer { @Override int[] getConfig(boolean dirtyRegions) { - return new int[] { - EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 0, - EGL_CONFIG_CAVEAT, EGL_NONE, - // TODO: Find a better way to choose the stencil size - EGL_STENCIL_SIZE, mShowOverdraw ? GLES20Canvas.getStencilSize() : 0, - EGL_SURFACE_TYPE, EGL_WINDOW_BIT | - (dirtyRegions ? EGL14.EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0), - EGL_NONE - }; + if (SystemProperties.get("ro.softwaregl").equals("true")) { + return new int[] { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG, + EGL_NONE + }; + } else { + return new int[] { + EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_DEPTH_SIZE, 0, + EGL_CONFIG_CAVEAT, EGL_NONE, + // TODO: Find a better way to choose the stencil size + EGL_STENCIL_SIZE, mShowOverdraw ? GLES20Canvas.getStencilSize() : 0, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT | + (dirtyRegions ? EGL14.EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0), + EGL_NONE + }; + } } @Override diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java index 338d706..732a32d 100644 --- a/services/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java @@ -230,14 +230,20 @@ class ScreenRotationAnimation { try { try { - if (WindowManagerService.DEBUG_SURFACE_TRACE) { - mSurface = new SurfaceTrace(session, "FreezeSurface", - mWidth, mHeight, - PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN); - } else { + if (android.os.SystemProperties.get("ro.softwaregl").equals("true")) { mSurface = new Surface(session, "FreezeSurface", mWidth, mHeight, - PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN); + PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM | Surface.HIDDEN); + } else { + if (WindowManagerService.DEBUG_SURFACE_TRACE) { + mSurface = new SurfaceTrace(session, "FreezeSurface", + mWidth, mHeight, + PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN); + } else { + mSurface = new Surface(session, "FreezeSurface", + mWidth, mHeight, + PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN); + } } if (!mSurface.isValid()) { // Screenshot failed, punt. |