am 8dda03a0: am ca93f69c: Merge "Have an actual fallback if the surface is lost" into lmp-mr1-dev

* commit '8dda03a08603f45b3c2c90633491ce2c1fea266b':
  Have an actual fallback if the surface is lost
This commit is contained in:
John Reck
2014-11-07 22:55:32 +00:00
committed by Android Git Automerger
5 changed files with 22 additions and 0 deletions

View File

@@ -66,6 +66,8 @@ public class ThreadedRenderer extends HardwareRenderer {
private static final int SYNC_OK = 0;
// Needs a ViewRoot invalidate
private static final int SYNC_INVALIDATE_REQUIRED = 1 << 0;
// Spoiler: the reward is GPU-accelerated drawing, better find that Surface!
private static final int SYNC_LOST_SURFACE_REWARD_IF_FOUND = 1 << 1;
private static final String[] VISUALIZERS = {
PROFILE_PROPERTY_VISUALIZE_BARS,
@@ -336,6 +338,12 @@ public class ThreadedRenderer extends HardwareRenderer {
int syncResult = nSyncAndDrawFrame(mNativeProxy, frameTimeNanos,
recordDuration, view.getResources().getDisplayMetrics().density);
if ((syncResult & SYNC_LOST_SURFACE_REWARD_IF_FOUND) != 0) {
setEnabled(false);
// Invalidate since we failed to draw. This should fetch a Surface
// if it is still needed or do nothing if we are no longer drawing
attachInfo.mViewRootImpl.invalidate();
}
if ((syncResult & SYNC_INVALIDATE_REQUIRED) != 0) {
attachInfo.mViewRootImpl.invalidate();
}