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

Commit d7f7f3f0 authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger::getNewTexture: Don't deadlock on main thread" into sc-dev

parents f9932d79 cdd7df92
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -693,12 +693,16 @@ uint32_t SurfaceFlinger::getNewTexture() {

    // The pool was empty, so we need to get a new texture name directly using a
    // blocking call to the main thread
    return schedule([this] {
    auto genTextures = [this] {
               uint32_t name = 0;
               getRenderEngine().genTextures(1, &name);
               return name;
           })
            .get();
    };
    if (std::this_thread::get_id() == mMainThreadId) {
        return genTextures();
    } else {
        return schedule(genTextures).get();
    }
}

void SurfaceFlinger::deleteTextureAsync(uint32_t texture) {