summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-05-28 16:02:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-28 16:02:06 +0000
commit45d01929291eba56e1bce582192941446b86bf5a (patch)
treef8afff902e21c27d6e3e0858765f83e86322f143 /libs
parent10f6de686e68c6cbb7bed8c9550ea5f43c19d104 (diff)
parente1628b7c6fc3822fa83cf02028ce8ad67abb0afe (diff)
downloadframeworks_base-45d01929291eba56e1bce582192941446b86bf5a.zip
frameworks_base-45d01929291eba56e1bce582192941446b86bf5a.tar.gz
frameworks_base-45d01929291eba56e1bce582192941446b86bf5a.tar.bz2
Merge "Implement FlushCaches TODO" into lmp-preview-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp7
-rw-r--r--libs/hwui/renderthread/CanvasContext.h2
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp12
-rw-r--r--libs/hwui/renderthread/RenderProxy.h3
4 files changed, 24 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index b6b3428..160fbea 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -556,6 +556,13 @@ bool CanvasContext::copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap)
return LayerRenderer::copyLayer(layer->backingLayer(), bitmap);
}
+void CanvasContext::flushCaches(Caches::FlushMode flushMode) {
+ if (mGlobalContext->hasContext()) {
+ requireGlContext();
+ Caches::getInstance().flush(flushMode);
+ }
+}
+
void CanvasContext::runWithGlContext(RenderTask* task) {
requireGlContext();
task->run();
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index a54b33e..da85d44 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -63,6 +63,8 @@ public:
bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
+ void flushCaches(Caches::FlushMode flushMode);
+
void invokeFunctor(Functor* functor);
void runWithGlContext(RenderTask* task);
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 2e103d8..8e772f2 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -282,6 +282,18 @@ void RenderProxy::destroyLayer(DeferredLayerUpdater* layer) {
post(task);
}
+CREATE_BRIDGE2(flushCaches, CanvasContext* context, Caches::FlushMode flushMode) {
+ args->context->flushCaches(args->flushMode);
+ return NULL;
+}
+
+void RenderProxy::flushCaches(Caches::FlushMode flushMode) {
+ SETUP_TASK(flushCaches);
+ args->context = mContext;
+ args->flushMode = flushMode;
+ post(task);
+}
+
CREATE_BRIDGE0(fence) {
// Intentionally empty
return NULL;
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 8aeb264..22d4e22 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -29,6 +29,7 @@
#include <utils/StrongPointer.h>
#include <utils/Vector.h>
+#include "../Caches.h"
#include "DrawFrameTask.h"
namespace android {
@@ -81,6 +82,8 @@ public:
ANDROID_API bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
ANDROID_API void destroyLayer(DeferredLayerUpdater* layer);
+ ANDROID_API void flushCaches(Caches::FlushMode flushMode);
+
ANDROID_API void fence();
ANDROID_API void notifyFramePending();