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

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

Merge "Move all debug flags in a single place."

parents c65347f2 c15008e7
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

#define LOG_TAG "OpenGLRenderer"

#include <utils/Log.h>

#include "Caches.h"

namespace android {
@@ -53,6 +55,41 @@ Caches::~Caches() {
    delete[] mRegionMesh;
}

///////////////////////////////////////////////////////////////////////////////
// Debug
///////////////////////////////////////////////////////////////////////////////

void Caches::dumpMemoryUsage() {
    LOGD("Current memory usage / total memory usage (bytes):");
    LOGD("  TextureCache         %8d / %8d", textureCache.getSize(), textureCache.getMaxSize());
    LOGD("  LayerCache           %8d / %8d", layerCache.getSize(), layerCache.getMaxSize());
    LOGD("  GradientCache        %8d / %8d", gradientCache.getSize(), gradientCache.getMaxSize());
    LOGD("  PathCache            %8d / %8d", pathCache.getSize(), pathCache.getMaxSize());
    LOGD("  TextDropShadowCache  %8d / %8d", dropShadowCache.getSize(),
            dropShadowCache.getMaxSize());
    for (uint32_t i = 0; i < fontRenderer.getFontRendererCount(); i++) {
        const uint32_t size = fontRenderer.getFontRendererSize(i);
        LOGD("  FontRenderer %d       %8d / %8d", i, size, size);
    }
    LOGD("Other:");
    LOGD("  FboCache             %8d / %8d", fboCache.getSize(), fboCache.getMaxSize());
    LOGD("  PatchCache           %8d / %8d", patchCache.getSize(), patchCache.getMaxSize());

    uint32_t total = 0;
    total += textureCache.getSize();
    total += layerCache.getSize();
    total += gradientCache.getSize();
    total += pathCache.getSize();
    total += dropShadowCache.getSize();
    for (uint32_t i = 0; i < fontRenderer.getFontRendererCount(); i++) {
        total += fontRenderer.getFontRendererSize(i);
    }

    LOGD("Total memory usage:");
    LOGD("  %d bytes, %.2f MB", total, total / 1024.0f / 1024.0f);
    LOGD("\n");
}

///////////////////////////////////////////////////////////////////////////////
// VBO
///////////////////////////////////////////////////////////////////////////////
+5 −0
Original line number Diff line number Diff line
@@ -114,6 +114,11 @@ public:
     */
    TextureVertex* getRegionMesh();

    /**
     * Displays the memory usage of each cache and the total sum.
     */
    void dumpMemoryUsage();

    bool blend;
    GLenum lastSrcMode;
    GLenum lastDstMode;

libs/hwui/Debug.h

0 → 100644
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ANDROID_HWUI_DEBUG_H
#define ANDROID_HWUI_DEBUG_H

// Turn on to check for OpenGL errors on each frame
#define DEBUG_OPENGL 1

// Turn on to enable memory usage summary on each frame
#define DEBUG_MEMORY_USAGE 0

// Turn on to enable layers debugging when renderered as regions
#define DEBUG_LAYERS_AS_REGIONS 0

// Turn on to display debug info about vertex/fragment shaders
#define DEBUG_PROGRAMS 0

// Turn on to display info about layers
#define DEBUG_LAYERS 0

// Turn on to display debug infor about 9patch objects
#define DEBUG_PATCHES 0

// Turn on to display debug info about paths
#define DEBUG_PATHS 0

// Turn on to display debug info about textures
#define DEBUG_TEXTURES 0

#endif // ANDROID_HWUI_DEBUG_H
+8 −8
Original line number Diff line number Diff line
@@ -169,6 +169,14 @@ public:
        return mTextureId;
    }

    uint32_t getCacheWidth() const {
        return mCacheWidth;
    }

    uint32_t getCacheHeight() const {
        return mCacheHeight;
    }

protected:
    friend class Font;

@@ -207,14 +215,6 @@ protected:
        }
    };

    uint32_t getCacheWidth() const {
        return mCacheWidth;
    }

    uint32_t getCacheHeight() const {
        return mCacheHeight;
    }

    void initTextTexture();
    bool cacheBitmap(const SkGlyph& glyph, uint32_t *retOriginX, uint32_t *retOriginY);

+16 −0
Original line number Diff line number Diff line
@@ -29,6 +29,22 @@ struct GammaFontRenderer {

    FontRenderer& getFontRenderer(const SkPaint* paint);

    uint32_t getFontRendererCount() const {
        return 3;
    }

    uint32_t getFontRendererSize(uint32_t fontRenderer) const {
        switch (fontRenderer) {
            case 0:
                return mDefaultRenderer.getCacheHeight() * mDefaultRenderer.getCacheWidth();
            case 1:
                return mBlackGammaRenderer.getCacheHeight() * mBlackGammaRenderer.getCacheWidth();
            case 2:
                return mWhiteGammaRenderer.getCacheHeight() * mWhiteGammaRenderer.getCacheWidth();
        }
        return 0;
    }

private:
    FontRenderer mDefaultRenderer;
    FontRenderer mBlackGammaRenderer;
Loading