Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09d5cddf authored by John Reck's avatar John Reck
Browse files

Add kModeSync

 Bug: 16526750

Change-Id: I4c087160e80432739321172fd57880846c8de6e0
parent 4f994eb2
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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
    };

    /**
+1 −2
Original line number Diff line number Diff line
@@ -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++) {
+1 −1
Original line number Diff line number Diff line
@@ -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() {
+1 −1
Original line number Diff line number Diff line
@@ -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
}

+7 −2
Original line number Diff line number Diff line
@@ -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()) {