Add eglSwapBuffersWithDamageKHR support
BUG: 20761426
Disabled temporarily
Change-Id: I0b6b6f0eebab886145e13fa35aefe76826965cf5
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 3de3086..436946f 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -16,36 +16,25 @@
#include "CanvasContext.h"
+#include "AnimationContext.h"
+#include "Caches.h"
+#include "DeferredLayerUpdater.h"
#include "EglManager.h"
+#include "LayerRenderer.h"
+#include "OpenGLRenderer.h"
+#include "Properties.h"
#include "RenderThread.h"
-#include "../AnimationContext.h"
-#include "../Caches.h"
-#include "../DeferredLayerUpdater.h"
-#include "../renderstate/RenderState.h"
-#include "../renderstate/Stencil.h"
-#include "../LayerRenderer.h"
-#include "../OpenGLRenderer.h"
+#include "renderstate/RenderState.h"
+#include "renderstate/Stencil.h"
#include <algorithm>
+#include <strings.h>
#include <cutils/properties.h>
#include <private/hwui/DrawGlInfo.h>
-#include <strings.h>
#define TRIM_MEMORY_COMPLETE 80
#define TRIM_MEMORY_UI_HIDDEN 20
-#define PROPERTY_SKIP_EMPTY_DAMAGE "debug.hwui.skip_empty_damage"
-
-static bool sInitialized = false;
-static bool sSkipEmptyDamage = true;
-
-static void initGlobals() {
- if (sInitialized) return;
- sInitialized = true;
- sSkipEmptyDamage = property_get_bool(PROPERTY_SKIP_EMPTY_DAMAGE,
- sSkipEmptyDamage);
-}
-
namespace android {
namespace uirenderer {
namespace renderthread {
@@ -58,9 +47,6 @@
, mAnimationContext(contextFactory->createAnimationContext(mRenderThread.timeLord()))
, mRootRenderNode(rootRenderNode)
, mJankTracker(thread.timeLord().frameIntervalNanos()) {
- // Done lazily at first draw instead of at library load to avoid
- // running pre-zygote fork
- initGlobals();
mRenderThread.renderState().registerCanvasContext(this);
mProfiler.setDensity(mRenderThread.mainDisplayInfo().density);
}
@@ -106,8 +92,8 @@
}
}
-void CanvasContext::swapBuffers() {
- if (CC_UNLIKELY(!mEglManager.swapBuffers(mEglSurface))) {
+void CanvasContext::swapBuffers(const SkRect& dirty, EGLint width, EGLint height) {
+ if (CC_UNLIKELY(!mEglManager.swapBuffers(mEglSurface, dirty, width, height))) {
setSurface(nullptr);
}
mHaveNewSurface = false;
@@ -222,7 +208,7 @@
SkRect dirty;
mDamageAccumulator.finish(&dirty);
- if (dirty.isEmpty() && sSkipEmptyDamage) {
+ if (dirty.isEmpty() && Properties::skipEmptyFrames) {
mCurrentFrameInfo->addFlag(FrameInfoFlags::kSkippedFrame);
return;
}
@@ -267,7 +253,7 @@
mCurrentFrameInfo->markSwapBuffers();
if (drew) {
- swapBuffers();
+ swapBuffers(dirty, width, height);
} else {
mEglManager.cancelFrame();
}