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

Commit 14e1c54f authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Remove dead code"

parents 4769f85f e4c1e6c5
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -128,18 +128,8 @@ static void android_view_DisplayListCanvas_resetDisplayListCanvas(jlong canvasPt
    canvas->resetRecording(width, height, renderNode);
}

static jint android_view_DisplayListCanvas_getMaxTextureWidth() {
    if (!Caches::hasInstance()) {
        android::uirenderer::renderthread::RenderProxy::staticFence();
    }
    return Caches::getInstance().maxTextureSize;
}

static jint android_view_DisplayListCanvas_getMaxTextureHeight() {
    if (!Caches::hasInstance()) {
        android::uirenderer::renderthread::RenderProxy::staticFence();
    }
    return Caches::getInstance().maxTextureSize;
static jint android_view_DisplayListCanvas_getMaxTextureSize() {
    return android::uirenderer::renderthread::RenderProxy::maxTextureSize();
}

static void android_view_DisplayListCanvas_insertReorderBarrier(jlong canvasPtr,
@@ -205,8 +195,8 @@ static JNINativeMethod gMethods[] = {
    // ------------ @CriticalNative --------------
    { "nCreateDisplayListCanvas", "(JII)J",     (void*) android_view_DisplayListCanvas_createDisplayListCanvas },
    { "nResetDisplayListCanvas",  "(JJII)V",    (void*) android_view_DisplayListCanvas_resetDisplayListCanvas },
    { "nGetMaximumTextureWidth",  "()I",        (void*) android_view_DisplayListCanvas_getMaxTextureWidth },
    { "nGetMaximumTextureHeight", "()I",        (void*) android_view_DisplayListCanvas_getMaxTextureHeight },
    { "nGetMaximumTextureWidth",  "()I",        (void*) android_view_DisplayListCanvas_getMaxTextureSize },
    { "nGetMaximumTextureHeight", "()I",        (void*) android_view_DisplayListCanvas_getMaxTextureSize },
    { "nInsertReorderBarrier",    "(JZ)V",      (void*) android_view_DisplayListCanvas_insertReorderBarrier },
    { "nFinishRecording",         "(J)J",       (void*) android_view_DisplayListCanvas_finishRecording },
    { "nDrawRenderNode",          "(JJ)V",      (void*) android_view_DisplayListCanvas_drawRenderNode },
+0 −1
Original line number Diff line number Diff line
@@ -170,7 +170,6 @@ cc_defaults {
        "pipeline/skia/SkiaRecordingCanvas.cpp",
        "pipeline/skia/SkiaVulkanPipeline.cpp",
        "pipeline/skia/VectorDrawableAtlas.cpp",
        "renderstate/OffscreenBufferPool.cpp",
        "renderstate/PixelBufferState.cpp",
        "renderstate/RenderState.cpp",
        "renderstate/TextureState.cpp",
+1 −75
Original line number Diff line number Diff line
@@ -44,12 +44,10 @@ Caches* Caches::sInstance = nullptr;
// Constructors/destructor
///////////////////////////////////////////////////////////////////////////////

Caches::Caches(RenderState& renderState) : mRenderState(&renderState), mInitialized(false) {
Caches::Caches(RenderState& renderState) : mInitialized(false) {
    INIT_LOGD("Creating OpenGL renderer caches");
    init();
    initConstraints();
    initStaticProperties();
    initExtensions();
}

bool Caches::init() {
@@ -68,23 +66,6 @@ bool Caches::init() {
    return true;
}

void Caches::initExtensions() {
    if (extensions().hasDebugMarker()) {
        eventMark = glInsertEventMarkerEXT;

        startMark = glPushGroupMarkerEXT;
        endMark = glPopGroupMarkerEXT;
    } else {
        eventMark = eventMarkNull;
        startMark = startMarkNull;
        endMark = endMarkNull;
    }
}

void Caches::initConstraints() {
    maxTextureSize = DeviceInfo::get()->maxTextureSize();
}

void Caches::initStaticProperties() {
    // OpenGL ES 3.0+ specific features
    gpuPixelBuffersEnabled = extensions().hasPixelBufferObjects() &&
@@ -104,49 +85,6 @@ void Caches::terminate() {
    mInitialized = false;
}

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

uint32_t Caches::getOverdrawColor(uint32_t amount) const {
    static uint32_t sOverdrawColors[2][4] = {{0x2f0000ff, 0x2f00ff00, 0x3fff0000, 0x7fff0000},
                                             {0x2f0000ff, 0x4fffff00, 0x5fff8ad8, 0x7fff0000}};
    if (amount < 1) amount = 1;
    if (amount > 4) amount = 4;

    int overdrawColorIndex = static_cast<int>(Properties::overdrawColorSet);
    return sOverdrawColors[overdrawColorIndex][amount - 1];
}

void Caches::dumpMemoryUsage() {
    String8 stringLog;
    dumpMemoryUsage(stringLog);
    ALOGD("%s", stringLog.string());
}

void Caches::dumpMemoryUsage(String8& log) {
    uint32_t total = 0;
    log.appendFormat("Current memory usage / total memory usage (bytes):\n");
    if (mRenderState) {
        int memused = 0;
        for (std::set<Layer*>::iterator it = mRenderState->mActiveLayers.begin();
             it != mRenderState->mActiveLayers.end(); it++) {
            const Layer* layer = *it;
            LOG_ALWAYS_FATAL_IF(layer->getApi() != Layer::Api::OpenGL);
            const GlLayer* glLayer = static_cast<const GlLayer*>(layer);
            log.appendFormat("    GlLayer size %dx%d; texid=%u refs=%d\n", layer->getWidth(),
                             layer->getHeight(), glLayer->getTextureId(), layer->getStrongCount());
            memused += layer->getWidth() * layer->getHeight() * 4;
        }
        log.appendFormat("  Layers total   %8d (numLayers = %zu)\n", memused,
                         mRenderState->mActiveLayers.size());
        total += memused;
    }

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

///////////////////////////////////////////////////////////////////////////////
// Memory management
///////////////////////////////////////////////////////////////////////////////
@@ -161,17 +99,5 @@ void Caches::flush(FlushMode mode) {
    GLUtils::dumpGLErrors();
}

///////////////////////////////////////////////////////////////////////////////
// Regions
///////////////////////////////////////////////////////////////////////////////

TextureVertex* Caches::getRegionMesh() {
    return nullptr;
}

///////////////////////////////////////////////////////////////////////////////
// Temporary Properties
///////////////////////////////////////////////////////////////////////////////

};  // namespace uirenderer
};  // namespace android
+0 −39
Original line number Diff line number Diff line
@@ -89,30 +89,12 @@ public:
     */
    void terminate();

    /**
     * Returns a non-premultiplied ARGB color for the specified
     * amount of overdraw (1 for 1x, 2 for 2x, etc.)
     */
    uint32_t getOverdrawColor(uint32_t amount) const;

    /**
     * Call this on each frame to ensure that garbage is deleted from
     * GPU memory.
     */
    void clearGarbage();

    /**
     * Can be used to delete a layer from a non EGL thread.
     */
    void deleteLayerDeferred(Layer* layer);

    /**
     * Returns the mesh used to draw regions. Calling this method will
     * bind a VBO of type GL_ELEMENT_ARRAY_BUFFER that contains the
     * indices for the region mesh.
     */
    TextureVertex* getRegionMesh();

    /**
     * Returns the GL RGBA internal format to use for the current device
     * If the device supports linear blending and needSRGB is true,
@@ -122,46 +104,25 @@ public:
        return extensions().hasLinearBlending() && needSRGB ? GL_SRGB8_ALPHA8 : GL_RGBA;
    }

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

    // Misc
    GLint maxTextureSize;

public:
    TaskManager tasks;

    bool gpuPixelBuffersEnabled;

    // Debug methods
    PFNGLINSERTEVENTMARKEREXTPROC eventMark;
    PFNGLPUSHGROUPMARKEREXTPROC startMark;
    PFNGLPOPGROUPMARKEREXTPROC endMark;

    const Extensions& extensions() const { return DeviceInfo::get()->extensions(); }
    PixelBufferState& pixelBufferState() { return *mPixelBufferState; }
    TextureState& textureState() { return *mTextureState; }

private:
    void initExtensions();
    void initConstraints();
    void initStaticProperties();

    static void eventMarkNull(GLsizei length, const GLchar* marker) {}
    static void startMarkNull(GLsizei length, const GLchar* marker) {}
    static void endMarkNull() {}

    RenderState* mRenderState;

    // Used to render layers
    std::unique_ptr<TextureVertex[]> mRegionMesh;

    mutable Mutex mGarbageLock;
    std::vector<Layer*> mLayerGarbage;

    bool mInitialized;

    // TODO: move below to RenderState
+0 −8
Original line number Diff line number Diff line
@@ -19,14 +19,6 @@
#include "Caches.h"
#include "RenderNode.h"
#include "renderstate/RenderState.h"
#include "utils/TraceUtils.h"

#include <utils/Log.h>

#define ATRACE_LAYER_WORK(label)                                                       \
    ATRACE_FORMAT("%s HW Layer DisplayList %s %ux%u", label,                           \
                  (renderNode.get() != NULL) ? renderNode->getName() : "", getWidth(), \
                  getHeight())

namespace android {
namespace uirenderer {
Loading