Merge "Don\'t reuse LOST_SURFACE for stopped" into nyc-dev am: 9110429

am: 5cc4428

* commit '5cc4428bec11d4bcccb7165b0572014f434d6ccb':
  Don't reuse LOST_SURFACE for stopped

Change-Id: Ia5f1015dcc37b89e17623840de3bec9688360484
This commit is contained in:
John Reck
2016-04-19 14:56:28 +00:00
committed by android-build-merger
3 changed files with 22 additions and 8 deletions

View File

@@ -307,6 +307,12 @@ public final class ThreadedRenderer {
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;
// setStopped is true, drawing is false
// TODO: Remove this and SYNC_LOST_SURFACE_REWARD_IF_FOUND?
// This flag isn't really used as there's nothing that we care to do
// in response, so it really just exists to differentiate from LOST_SURFACE
// but possibly both can just be deleted.
private static final int SYNC_CONTEXT_IS_STOPPED = 1 << 2;
private static final String[] VISUALIZERS = {
PROFILE_PROPERTY_VISUALIZE_BARS,

View File

@@ -32,7 +32,7 @@ namespace renderthread {
DrawFrameTask::DrawFrameTask()
: mRenderThread(nullptr)
, mContext(nullptr)
, mSyncResult(kSync_OK) {
, mSyncResult(SyncResult::OK) {
}
DrawFrameTask::~DrawFrameTask() {
@@ -68,7 +68,7 @@ void DrawFrameTask::removeLayerUpdate(DeferredLayerUpdater* layer) {
int DrawFrameTask::drawFrame(TreeObserver* observer) {
LOG_ALWAYS_FATAL_IF(!mContext, "Cannot drawFrame with no CanvasContext!");
mSyncResult = kSync_OK;
mSyncResult = SyncResult::OK;
mSyncQueued = systemTime(CLOCK_MONOTONIC);
mObserver = observer;
postAndWait();
@@ -127,13 +127,18 @@ bool DrawFrameTask::syncFrameState(TreeInfo& info) {
// This is after the prepareTree so that any pending operations
// (RenderNode tree state, prefetched layers, etc...) will be flushed.
if (CC_UNLIKELY(!mContext->hasSurface() || !canDraw)) {
mSyncResult |= kSync_LostSurfaceRewardIfFound;
if (!mContext->hasSurface()) {
mSyncResult |= SyncResult::LostSurfaceRewardIfFound;
} else {
// If we have a surface but can't draw we must be stopped
mSyncResult |= SyncResult::ContextIsStopped;
}
info.out.canDrawThisFrame = false;
}
if (info.out.hasAnimations) {
if (info.out.requiresUiRedraw) {
mSyncResult |= kSync_UIRedrawRequired;
mSyncResult |= SyncResult::UIRedrawRequired;
}
}
// If prepareTextures is false, we ran out of texture cache space

View File

@@ -40,11 +40,14 @@ namespace renderthread {
class CanvasContext;
class RenderThread;
enum SyncResult {
kSync_OK = 0,
kSync_UIRedrawRequired = 1 << 0,
kSync_LostSurfaceRewardIfFound = 1 << 1,
namespace SyncResult {
enum {
OK = 0,
UIRedrawRequired = 1 << 0,
LostSurfaceRewardIfFound = 1 << 1,
ContextIsStopped = 1 << 2,
};
}
/*
* This is a special Super Task. It is re-used multiple times by RenderProxy,