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

Commit eea60692 authored by Romain Guy's avatar Romain Guy
Browse files

Improve layers debugging

Change-Id: Ia4950dd5f0e0a224ecb69c581d33aa4f32260a7c
parent 912a7b32
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ class GLES20Canvas extends HardwareCanvas {

    // The native renderer will be destroyed when this object dies.
    // DO NOT overwrite this reference once it is set.
    @SuppressWarnings("unused")
    @SuppressWarnings({"unused", "FieldCanBeLocal"})
    private CanvasFinalizer mFinalizer;

    private int mWidth;
+0 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.graphics.Canvas;
 * {@link Canvas} that can be used to render into an FBO using OpenGL.
 */
class GLES20RenderLayer extends GLES20Layer {

    private int mLayerWidth;
    private int mLayerHeight;

+9 −5
Original line number Diff line number Diff line
@@ -112,15 +112,19 @@ Layer* LayerCache::get(const uint32_t width, const uint32_t height) {
        glPixelStorei(GL_UNPACK_ALIGNMENT, 4);

#if DEBUG_LAYERS
        dump();
#endif
    }

    return layer;
}

void LayerCache::dump() {
    size_t size = mCache.size();
    for (size_t i = 0; i < size; i++) {
        const LayerEntry& entry = mCache.itemAt(i);
        LAYER_LOGD("  Layer size %dx%d", entry.mWidth, entry.mHeight);
    }
#endif
    }

    return layer;
}

bool LayerCache::resize(Layer* layer, const uint32_t width, const uint32_t height) {
+5 −0
Original line number Diff line number Diff line
@@ -101,6 +101,11 @@ public:
     */
    uint32_t getSize();

    /**
     * Prints out the content of the cache.
     */
    void dump();

private:
    void deleteLayer(Layer* layer);

+8 −2
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ void LayerRenderer::generateMesh() {
///////////////////////////////////////////////////////////////////////////////

Layer* LayerRenderer::createLayer(uint32_t width, uint32_t height, bool isOpaque) {
    LAYER_RENDERER_LOGD("Creating new layer %dx%d", width, height);
    LAYER_RENDERER_LOGD("Requesting new render layer %dx%d", width, height);

    GLuint fbo = Caches::getInstance().fboCache.get();
    if (!fbo) {
@@ -288,16 +288,22 @@ void LayerRenderer::updateTextureLayer(Layer* layer, uint32_t width, uint32_t he

void LayerRenderer::destroyLayer(Layer* layer) {
    if (layer) {
        LAYER_RENDERER_LOGD("Destroying layer, fbo = %d", layer->getFbo());
        LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d",
                layer->getWidth(), layer->getHeight(), layer->getFbo());

        if (layer->getFbo()) {
            Caches::getInstance().fboCache.put(layer->getFbo());
        }

        if (!Caches::getInstance().layerCache.put(layer)) {
            LAYER_RENDERER_LOGD("  Destroyed!");
            layer->deleteTexture();
            delete layer;
        } else {
            LAYER_RENDERER_LOGD("  Cached!");
#if DEBUG_LAYERS
            Caches::getInstance().layerCache.dump();
#endif
            layer->region.clear();
        }
    }