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

Commit 6ae68920 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Add new runtime debug flags."

parents 2f8b27bf e190aa69
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <utils/Log.h>

#include "Caches.h"
#include "Properties.h"

namespace android {

@@ -49,6 +50,9 @@ Caches::Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO),

    mCurrentBuffer = meshBuffer;
    mRegionMesh = NULL;

    mDebugLevel = readDebugLevel();
    LOGD("Enabling debug mode %d", mDebugLevel);
}

Caches::~Caches() {
+12 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ class Caches: public Singleton<Caches> {

    friend class Singleton<Caches>;

    CacheLogger mlogger;
    CacheLogger mLogger;

    GLuint mCurrentBuffer;

@@ -92,6 +92,14 @@ class Caches: public Singleton<Caches> {
    GLuint mRegionMeshIndices;

public:
    /**
     * Indicates whether the renderer is in debug mode.
     * This debug mode provides limited information to app developers.
     */
    DebugLevel getDebugLevel() const {
        return mDebugLevel;
    }

    /**
     * Binds the VBO used to render simple textured quads.
     */
@@ -145,6 +153,9 @@ public:
    ResourceCache resourceCache;

    Line line;

private:
    DebugLevel mDebugLevel;
}; // class Caches

}; // namespace uirenderer
+4 −0
Original line number Diff line number Diff line
@@ -163,6 +163,10 @@ void OpenGLRenderer::finish() {
#endif
#if DEBUG_MEMORY_USAGE
    mCaches.dumpMemoryUsage();
#else
    if (mCaches.getDebugLevel() & kDebugMemory) {
        mCaches.dumpMemoryUsage();
    }
#endif
}

+8 −0
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ void PathCache::init() {
    GLint maxTextureSize;
    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
    mMaxTextureSize = maxTextureSize;

    mDebugEnabled = readDebugLevel() & kDebugCaches;
}

///////////////////////////////////////////////////////////////////////////////
@@ -98,6 +100,9 @@ void PathCache::operator()(PathCacheEntry& path, PathTexture*& texture) {

        PATH_LOGD("PathCache::callback: delete path: name, size, mSize = %d, %d, %d",
                texture->id, size, mSize);
        if (mDebugEnabled) {
            LOGD("Path deleted, size = %d", size);
        }

        glDeleteTextures(1, &texture->id);
        delete texture;
@@ -199,6 +204,9 @@ PathTexture* PathCache::addTexture(const PathCacheEntry& entry,
        mSize += size;
        PATH_LOGD("PathCache::get: create path: name, size, mSize = %d, %d, %d",
                texture->id, size, mSize);
        if (mDebugEnabled) {
            LOGD("Path created, size = %d", size);
        }
        mCache.put(entry, texture);
        mLock.unlock();
    } else {
+2 −0
Original line number Diff line number Diff line
@@ -176,6 +176,8 @@ private:
    uint32_t mMaxSize;
    GLuint mMaxTextureSize;

    bool mDebugEnabled;

    /**
     * Used to access mCache and mSize. All methods are accessed from a single
     * thread except for remove().
Loading