Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cc4428b authored by John Reck's avatar John Reck Committed by android-build-merger
Browse files

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

am: 9110429f

* commit '9110429f':
  Don't reuse LOST_SURFACE for stopped

Change-Id: Ia7c609029215da17c61eb77bd3279c077d1b7713
parents bb69ce60 9110429f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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,
+9 −4
Original line number Diff line number Diff line
@@ -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
+7 −4
Original line number Diff line number Diff line
@@ -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,