Merge "Re-enable empty damage drop optimization"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7b6320b0b1
@@ -401,11 +401,11 @@ void CanvasContext::draw() {
|
||||
SkRect dirty;
|
||||
mDamageAccumulator.finish(&dirty);
|
||||
|
||||
// TODO: Re-enable after figuring out cause of b/22592975
|
||||
// if (dirty.isEmpty() && Properties::skipEmptyFrames) {
|
||||
// mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame);
|
||||
// return;
|
||||
// }
|
||||
if (dirty.isEmpty() && Properties::skipEmptyFrames
|
||||
&& !surfaceRequiresRedraw()) {
|
||||
mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame);
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentFrameInfo->markIssueDrawCommandsStart();
|
||||
|
||||
@@ -638,6 +638,19 @@ int64_t CanvasContext::getFrameNumber() {
|
||||
return mFrameNumber;
|
||||
}
|
||||
|
||||
bool CanvasContext::surfaceRequiresRedraw() {
|
||||
if (!mNativeSurface) return false;
|
||||
if (mHaveNewSurface) return true;
|
||||
|
||||
int width = -1;
|
||||
int height = -1;
|
||||
ReliableSurface* surface = mNativeSurface.get();
|
||||
surface->query(NATIVE_WINDOW_WIDTH, &width);
|
||||
surface->query(NATIVE_WINDOW_HEIGHT, &height);
|
||||
|
||||
return width == mLastFrameWidth && height == mLastFrameHeight;
|
||||
}
|
||||
|
||||
SkRect CanvasContext::computeDirtyRect(const Frame& frame, SkRect* dirty) {
|
||||
if (frame.width() != mLastFrameWidth || frame.height() != mLastFrameHeight) {
|
||||
// can't rely on prior content of window if viewport size changes
|
||||
|
||||
@@ -217,6 +217,7 @@ private:
|
||||
void freePrefetchedLayers();
|
||||
|
||||
bool isSwapChainStuffed();
|
||||
bool surfaceRequiresRedraw();
|
||||
|
||||
SkRect computeDirtyRect(const Frame& frame, SkRect* dirty);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user