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

Commit a8f1bce0 authored by John Reck's avatar John Reck Committed by Android Git Automerger
Browse files

am c7c8b069: Merge "Cleanup debug options" into lmp-mr1-dev automerge: b0aeaad4 automerge: 49a01fc7

* commit 'c7c8b069':
  Cleanup debug options
parents 3ed8a313 c7c8b069
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -255,6 +255,9 @@ public class ThreadedRenderer extends HardwareRenderer {
            mProfilingEnabled = wantProfiling;
            changed = true;
        }
        if (changed) {
            invalidateRoot();
        }
        return changed;
    }

+5 −6
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) {
    deferInfo.mergeable &= !recordingComplexClip();
    deferInfo.opaqueOverBounds &= !recordingComplexClip() && mSaveStack.isEmpty();

    if (CC_LIKELY(mAvoidOverdraw) && mBatches.size() &&
    if (mBatches.size() &&
            state->mClipSideFlags != kClipSide_ConservativeFull &&
            deferInfo.opaqueOverBounds && state->mBounds.contains(mBounds)) {
        // avoid overdraw by resetting drawing state + discarding drawing ops
@@ -657,13 +657,12 @@ status_t DeferredDisplayList::flush(OpenGLRenderer& renderer, Rect& dirty) {
    DrawModifiers restoreDrawModifiers = renderer.getDrawModifiers();
    renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);

    if (CC_LIKELY(mAvoidOverdraw)) {
    for (unsigned int i = 1; i < mBatches.size(); i++) {
        if (mBatches[i] && mBatches[i]->coversBounds(mBounds)) {
            discardDrawingBatches(i - 1);
        }
    }
    }

    // NOTE: depth of the save stack at this point, before playback, should be reflected in
    // FLUSH_SAVE_STACK_DEPTH, so that save/restores match up correctly
    status |= replayBatchList(mBatches, renderer, dirty);
+2 −3
Original line number Diff line number Diff line
@@ -81,8 +81,8 @@ public:
class DeferredDisplayList {
    friend class DeferStateStruct; // used to give access to allocator
public:
    DeferredDisplayList(const Rect& bounds, bool avoidOverdraw = true) :
            mBounds(bounds), mAvoidOverdraw(avoidOverdraw) {
    DeferredDisplayList(const Rect& bounds) :
            mBounds(bounds) {
        clear();
    }
    ~DeferredDisplayList() { clear(); }
@@ -150,7 +150,6 @@ private:

    // layer space bounds of rendering
    Rect mBounds;
    const bool mAvoidOverdraw;

    /**
     * At defer time, stores the *defer time* savecount of save/saveLayer ops that were deferred, so
+35 −15
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@

#define DEFAULT_MAX_FRAMES 128

#define RETURN_IF_DISABLED() if (CC_LIKELY(mType == kNone)) return
#define RETURN_IF_PROFILING_DISABLED() if (CC_LIKELY(mType == kNone)) return
#define RETURN_IF_DISABLED() if (CC_LIKELY(mType == kNone && !mShowDirtyRegions)) return

#define NANOS_TO_MILLIS_FLOAT(nanos) ((nanos) * 0.000001f)

@@ -64,7 +65,9 @@ DrawProfiler::DrawProfiler()
        , mPreviousTime(0)
        , mVerticalUnit(0)
        , mHorizontalUnit(0)
        , mThresholdStroke(0) {
        , mThresholdStroke(0)
        , mShowDirtyRegions(false)
        , mFlashToggle(false) {
    setDensity(1);
}

@@ -82,27 +85,27 @@ void DrawProfiler::setDensity(float density) {
}

void DrawProfiler::startFrame(nsecs_t recordDurationNanos) {
    RETURN_IF_DISABLED();
    RETURN_IF_PROFILING_DISABLED();
    mData[mCurrentFrame].record = NANOS_TO_MILLIS_FLOAT(recordDurationNanos);
    mPreviousTime = systemTime(CLOCK_MONOTONIC);
}

void DrawProfiler::markPlaybackStart() {
    RETURN_IF_DISABLED();
    RETURN_IF_PROFILING_DISABLED();
    nsecs_t now = systemTime(CLOCK_MONOTONIC);
    mData[mCurrentFrame].prepare = NANOS_TO_MILLIS_FLOAT(now - mPreviousTime);
    mPreviousTime = now;
}

void DrawProfiler::markPlaybackEnd() {
    RETURN_IF_DISABLED();
    RETURN_IF_PROFILING_DISABLED();
    nsecs_t now = systemTime(CLOCK_MONOTONIC);
    mData[mCurrentFrame].playback = NANOS_TO_MILLIS_FLOAT(now - mPreviousTime);
    mPreviousTime = now;
}

void DrawProfiler::finishFrame() {
    RETURN_IF_DISABLED();
    RETURN_IF_PROFILING_DISABLED();
    nsecs_t now = systemTime(CLOCK_MONOTONIC);
    mData[mCurrentFrame].swapBuffers = NANOS_TO_MILLIS_FLOAT(now - mPreviousTime);
    mPreviousTime = now;
@@ -114,20 +117,31 @@ void DrawProfiler::unionDirty(SkRect* dirty) {
    // Not worth worrying about minimizing the dirty region for debugging, so just
    // dirty the entire viewport.
    if (dirty) {
        mDirtyRegion = *dirty;
        dirty->setEmpty();
    }
}

void DrawProfiler::draw(OpenGLRenderer* canvas) {
    if (CC_LIKELY(mType != kBars)) {
        return;
    RETURN_IF_DISABLED();

    if (mShowDirtyRegions) {
        mFlashToggle = !mFlashToggle;
        if (mFlashToggle) {
            SkPaint paint;
            paint.setColor(0x7fff0000);
            canvas->drawRect(mDirtyRegion.fLeft, mDirtyRegion.fTop,
                    mDirtyRegion.fRight, mDirtyRegion.fBottom, &paint);
        }
    }

    if (mType == kBars) {
        prepareShapes(canvas->getViewportHeight());
        drawGraph(canvas);
        drawCurrentFrame(canvas);
        drawThreshold(canvas);
    }
}

void DrawProfiler::createData() {
    if (mData) return;
@@ -217,6 +231,7 @@ DrawProfiler::ProfileType DrawProfiler::loadRequestedProfileType() {
}

bool DrawProfiler::loadSystemProperties() {
    bool changed = false;
    ProfileType newType = loadRequestedProfileType();
    if (newType != mType) {
        mType = newType;
@@ -225,13 +240,18 @@ bool DrawProfiler::loadSystemProperties() {
        } else {
            createData();
        }
        return true;
        changed = true;
    }
    return false;
    bool showDirty = property_get_bool(PROPERTY_DEBUG_SHOW_DIRTY_REGIONS, false);
    if (showDirty != mShowDirtyRegions) {
        mShowDirtyRegions = showDirty;
        changed = true;
    }
    return changed;
}

void DrawProfiler::dumpData(int fd) {
    RETURN_IF_DISABLED();
    RETURN_IF_PROFILING_DISABLED();

    // This method logs the last N frames (where N is <= mDataSize) since the
    // last call to dumpData(). In other words if there's a dumpData(), draw frame,
+4 −0
Original line number Diff line number Diff line
@@ -88,6 +88,10 @@ private:
     * information.
     */
    float** mRects;

    bool mShowDirtyRegions;
    SkRect mDirtyRegion;
    bool mFlashToggle;
};

} /* namespace uirenderer */
Loading