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

Commit 9c1e23ba authored by Chet Haase's avatar Chet Haase
Browse files

Add logging of graphics acceleration info to bugreports

Change-Id: I9fa4cda6ccf92df9d1c644ccdc0e7274a30106e0
parent 827107f4
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -394,6 +394,8 @@ public final class ActivityThread {
        ParcelFileDescriptor fd;
    }

    native private void dumpGraphicsInfo(FileDescriptor fd);

    private final class ApplicationThread extends ApplicationThreadNative {
        private static final String HEAP_COLUMN = "%17s %8s %8s %8s %8s";
        private static final String ONE_COUNT_COLUMN = "%17s %8d";
@@ -714,6 +716,11 @@ public final class ActivityThread {

        @Override
        protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
            if (args != null && args.length == 1 && args[0].equals("graphics")) {
                pw.flush();
                dumpGraphicsInfo(fd);
                return;
            }
            long nativeMax = Debug.getNativeHeapSize() / 1024;
            long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024;
            long nativeFree = Debug.getNativeHeapFreeSize() / 1024;
+2 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ extern int register_android_backup_BackupDataInput(JNIEnv *env);
extern int register_android_backup_BackupDataOutput(JNIEnv *env);
extern int register_android_backup_FileBackupHelperBase(JNIEnv *env);
extern int register_android_backup_BackupHelperDispatcher(JNIEnv *env);
extern int register_android_app_ActivityThread(JNIEnv *env);
extern int register_android_app_NativeActivity(JNIEnv *env);
extern int register_android_view_InputChannel(JNIEnv* env);
extern int register_android_view_InputQueue(JNIEnv* env);
@@ -1298,6 +1299,7 @@ static const RegJNIRec gRegJNI[] = {
    REG_JNI(register_android_backup_FileBackupHelperBase),
    REG_JNI(register_android_backup_BackupHelperDispatcher),
    
    REG_JNI(register_android_app_ActivityThread),
    REG_JNI(register_android_app_NativeActivity),
    REG_JNI(register_android_view_InputChannel),
    REG_JNI(register_android_view_InputQueue),
+34 −0
Original line number Diff line number Diff line
@@ -591,6 +591,19 @@ static jboolean android_view_GLES20Canvas_isAvailable(JNIEnv* env, jobject clazz
#endif
}

// ----------------------------------------------------------------------------
// Logging
// ----------------------------------------------------------------------------

jfieldID gFileDescriptorField;

static void
android_app_ActivityThread_dumpGraphics(JNIEnv* env, jobject clazz, jobject javaFileDescriptor)
{
    int fd = env->GetIntField(javaFileDescriptor, gFileDescriptorField);
    uirenderer::DisplayList::outputLogBuffer(fd);
}

// ----------------------------------------------------------------------------
// JNI Glue
// ----------------------------------------------------------------------------
@@ -690,6 +703,12 @@ static JNINativeMethod gMethods[] = {
#endif
};

static JNINativeMethod gActivityThreadMethods[] = {
    { "dumpGraphicsInfo",        "(Ljava/io/FileDescriptor;)V",
                                               (void*) android_app_ActivityThread_dumpGraphics }
};


#ifdef USE_OPENGL_RENDERER
    #define FIND_CLASS(var, className) \
            var = env->FindClass(className); \
@@ -711,4 +730,19 @@ int register_android_view_GLES20Canvas(JNIEnv* env) {
    return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
}

const char* const kActivityThreadPathName = "android/app/ActivityThread";

int register_android_app_ActivityThread(JNIEnv* env)
{
    jclass gFileDescriptorClass = env->FindClass("java/io/FileDescriptor");
    LOG_FATAL_IF(clazz == NULL, "Unable to find class java.io.FileDescriptor");
    gFileDescriptorField = env->GetFieldID(gFileDescriptorClass, "descriptor", "I");
    LOG_FATAL_IF(gFileDescriptorField == NULL,
                 "Unable to find descriptor field in java.io.FileDescriptor");

    return AndroidRuntime::registerNativeMethods(
            env, kActivityThreadPathName,
            gActivityThreadMethods, NELEM(gActivityThreadMethods));
}

};
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ ifeq ($(USE_OPENGL_RENDERER),true)
		FontRenderer.cpp \
		GammaFontRenderer.cpp \
		Caches.cpp \
		DisplayListLogBuffer.cpp \
		DisplayListRenderer.cpp \
		FboCache.cpp \
		GradientCache.cpp \
+31 −18
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#define LOG_TAG "OpenGLRenderer"

#include <utils/Log.h>
#include <utils/String8.h>

#include "Caches.h"
#include "Properties.h"
@@ -69,30 +70,43 @@ Caches::~Caches() {
///////////////////////////////////////////////////////////////////////////////

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("  CircleShapeCache     %8d / %8d",
    String8 stringLog;
    dumpMemoryUsage(stringLog);
    LOGD("%s", stringLog.string());
    delete stringLog;
}

void Caches::dumpMemoryUsage(String8 &log) {
    log.appendFormat("Current memory usage / total memory usage (bytes):\n");
    log.appendFormat("  TextureCache         %8d / %8d\n",
            textureCache.getSize(), textureCache.getMaxSize());
    log.appendFormat("  LayerCache           %8d / %8d\n",
            layerCache.getSize(), layerCache.getMaxSize());
    log.appendFormat("  GradientCache        %8d / %8d\n",
            gradientCache.getSize(), gradientCache.getMaxSize());
    log.appendFormat("  PathCache            %8d / %8d\n",
            pathCache.getSize(), pathCache.getMaxSize());
    log.appendFormat("  CircleShapeCache     %8d / %8d\n",
            circleShapeCache.getSize(), circleShapeCache.getMaxSize());
    LOGD("  OvalShapeCache       %8d / %8d",
    log.appendFormat("  OvalShapeCache       %8d / %8d\n",
            ovalShapeCache.getSize(), ovalShapeCache.getMaxSize());
    LOGD("  RoundRectShapeCache  %8d / %8d",
    log.appendFormat("  RoundRectShapeCache  %8d / %8d\n",
            roundRectShapeCache.getSize(), roundRectShapeCache.getMaxSize());
    LOGD("  RectShapeCache       %8d / %8d",
    log.appendFormat("  RectShapeCache       %8d / %8d\n",
            rectShapeCache.getSize(), rectShapeCache.getMaxSize());
    LOGD("  ArcShapeCache        %8d / %8d",
    log.appendFormat("  ArcShapeCache        %8d / %8d\n",
            arcShapeCache.getSize(), arcShapeCache.getMaxSize());
    LOGD("  TextDropShadowCache  %8d / %8d", dropShadowCache.getSize(),
    log.appendFormat("  TextDropShadowCache  %8d / %8d\n", 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);
        log.appendFormat("  FontRenderer %d       %8d / %8d\n", i, size, size);
    }
    LOGD("Other:");
    LOGD("  FboCache             %8d / %8d", fboCache.getSize(), fboCache.getMaxSize());
    LOGD("  PatchCache           %8d / %8d", patchCache.getSize(), patchCache.getMaxSize());
    log.appendFormat("Other:");
    log.appendFormat("  FboCache             %8d / %8d\n",
            fboCache.getSize(), fboCache.getMaxSize());
    log.appendFormat("  PatchCache           %8d / %8d\n",
            patchCache.getSize(), patchCache.getMaxSize());

    uint32_t total = 0;
    total += textureCache.getSize();
@@ -109,9 +123,8 @@ void Caches::dumpMemoryUsage() {
        total += fontRenderer.getFontRendererSize(i);
    }

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

///////////////////////////////////////////////////////////////////////////////
Loading