Merge "Add kModeSync" into lmp-dev

This commit is contained in:
Bo Liu
2014-07-28 21:44:10 +00:00
committed by Android (Google) Code Review
5 changed files with 16 additions and 7 deletions

View File

@@ -58,7 +58,12 @@ struct DrawGlInfo {
kModeProcess,
// Same as kModeProcess, however there is no GL context because it was
// lost or destroyed
kModeProcessNoContext
kModeProcessNoContext,
// Invoked every time the UI thread pushes over a frame to the render thread
// *and the owning view has a dirty display list*. This is a signal to sync
// any data that needs to be shared between the UI thread and the render thread.
// During this time the UI thread is blocked.
kModeSync
};
/**

View File

@@ -31,7 +31,6 @@ namespace uirenderer {
DisplayListData::DisplayListData()
: projectionReceiveIndex(-1)
, functorCount(0)
, hasDrawOps(false) {
}
@@ -41,7 +40,7 @@ DisplayListData::~DisplayListData() {
void DisplayListData::cleanupResources() {
Caches& caches = Caches::getInstance();
caches.unregisterFunctors(functorCount);
caches.unregisterFunctors(functors.size());
caches.resourceCache.lock();
for (size_t i = 0; i < bitmapResources.size(); i++) {

View File

@@ -126,7 +126,7 @@ public:
SortedVector<const SkPath*> sourcePaths;
Vector<const SkRegion*> regions;
Vector<Layer*> layers;
uint32_t functorCount;
Vector<Functor*> functors;
bool hasDrawOps;
bool isEmpty() {

View File

@@ -88,7 +88,7 @@ void DisplayListRenderer::resume() {
status_t DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) {
// Ignore dirty during recording, it matters only when we replay
addDrawOp(new (alloc()) DrawFunctorOp(functor));
mDisplayListData->functorCount++;
mDisplayListData->functors.add(functor);
return DrawGlInfo::kStatusDone; // No invalidate needed at record-time
}

View File

@@ -78,7 +78,7 @@ void RenderNode::setStagingDisplayList(DisplayListData* data) {
delete mStagingDisplayListData;
mStagingDisplayListData = data;
if (mStagingDisplayListData) {
Caches::getInstance().registerFunctors(mStagingDisplayListData->functorCount);
Caches::getInstance().registerFunctors(mStagingDisplayListData->functors.size());
}
}
@@ -254,6 +254,11 @@ void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) {
deleteDisplayListData();
mDisplayListData = mStagingDisplayListData;
mStagingDisplayListData = NULL;
if (mDisplayListData) {
for (size_t i = 0; i < mDisplayListData->functors.size(); i++) {
(*mDisplayListData->functors[i])(DrawGlInfo::kModeSync, NULL);
}
}
damageSelf(info);
}
}
@@ -271,7 +276,7 @@ void RenderNode::deleteDisplayListData() {
void RenderNode::prepareSubTree(TreeInfo& info, DisplayListData* subtree) {
if (subtree) {
TextureCache& cache = Caches::getInstance().textureCache;
info.out.hasFunctors |= subtree->functorCount;
info.out.hasFunctors |= subtree->functors.size();
// TODO: Fix ownedBitmapResources to not require disabling prepareTextures
// and thus falling out of async drawing path.
if (subtree->ownedBitmapResources.size()) {