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

Commit bd707d39 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "bootanim: Don't cache textures if they're expected to use a lot of VRAM" into ics

parents 79d2f1f2 426a70b1
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -471,13 +471,16 @@ bool BootAnimation::movie()
    for (int i=0 ; i<pcount && !exitPending() ; i++) {
        const Animation::Part& part(animation.parts[i]);
        const size_t fcount = part.frames.size();
        const int noTextureCache = ((animation.width * animation.height * fcount) >
                                 48 * 1024 * 1024) ? 1 : 0;

        glBindTexture(GL_TEXTURE_2D, 0);

        for (int r=0 ; !part.count || r<part.count ; r++) {
            for (int j=0 ; j<fcount && !exitPending(); j++) {
                const Animation::Frame& frame(part.frames[j]);

                if (r > 0) {
                if (r > 0 && !noTextureCache) {
                    glBindTexture(GL_TEXTURE_2D, frame.tid);
                } else {
                    if (part.count != 1) {
@@ -512,12 +515,14 @@ bool BootAnimation::movie()
                long wait = ns2us(frameDuration);
                if (wait > 0)
                    usleep(wait);
                if (noTextureCache)
                    glDeleteTextures(1, &frame.tid);
            }
            usleep(part.pause * ns2us(frameDuration));
        }

        // free the textures for this part
        if (part.count != 1) {
        if (part.count != 1 && !noTextureCache) {
            for (int j=0 ; j<fcount ; j++) {
                const Animation::Frame& frame(part.frames[j]);
                glDeleteTextures(1, &frame.tid);