Merge "Add kModeSync" into lmp-dev
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user