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

Commit 20421938 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "get rid of the dependency on utils/CallStack.h"

parents 975e49a2 5f1af045
Loading
Loading
Loading
Loading
+5 −8
Original line number Original line Diff line number Diff line
@@ -58,6 +58,8 @@ cc_defaults {
        "-fvisibility=hidden",
        "-fvisibility=hidden",
    ],
    ],
    shared_libs: [
    shared_libs: [
        // ***** DO NOT ADD NEW DEPENDENCIES HERE *****
        // In particular, DO NOT add libutils or anything "above" libcutils
        "libcutils",
        "libcutils",
        "liblog",
        "liblog",
        "libdl",
        "libdl",
@@ -77,9 +79,11 @@ cc_defaults {
        "-DLOG_TAG=\"libEGL\"",
        "-DLOG_TAG=\"libEGL\"",
    ],
    ],
    shared_libs: [
    shared_libs: [
        "libutils",
        // ***** DO NOT ADD NEW DEPENDENCIES HERE *****
        // In particular, DO NOT add libutils nor anything "above" libui
        "libui",
        "libui",
        "libnativewindow",
        "libnativewindow",
        "libbacktrace",
    ],
    ],
}
}


@@ -142,7 +146,6 @@ cc_library_shared {
    name: "libGLESv1_CM",
    name: "libGLESv1_CM",
    defaults: ["gles_libs_defaults"],
    defaults: ["gles_libs_defaults"],
    srcs: ["GLES_CM/gl.cpp"],
    srcs: ["GLES_CM/gl.cpp"],

    cflags: ["-DLOG_TAG=\"libGLESv1\""],
    cflags: ["-DLOG_TAG=\"libGLESv1\""],
}
}


@@ -153,9 +156,6 @@ cc_library_shared {
    name: "libGLESv2",
    name: "libGLESv2",
    defaults: ["gles_libs_defaults"],
    defaults: ["gles_libs_defaults"],
    srcs: ["GLES2/gl2.cpp"],
    srcs: ["GLES2/gl2.cpp"],

    shared_libs: ["libutils"],

    cflags: ["-DLOG_TAG=\"libGLESv2\""],
    cflags: ["-DLOG_TAG=\"libGLESv2\""],
}
}


@@ -166,8 +166,5 @@ cc_library_shared {
    name: "libGLESv3",
    name: "libGLESv3",
    defaults: ["gles_libs_defaults"],
    defaults: ["gles_libs_defaults"],
    srcs: ["GLES2/gl2.cpp"],
    srcs: ["GLES2/gl2.cpp"],

    shared_libs: ["libutils"],

    cflags: ["-DLOG_TAG=\"libGLESv3\""],
    cflags: ["-DLOG_TAG=\"libGLESv3\""],
}
}
+38 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2017 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.
 */

#pragma once

#include <log/log.h>
#include <backtrace/Backtrace.h>
#include <memory>

class CallStack {
public:
    // Create a callstack with the current thread's stack trace.
    // Immediately dump it to logcat using the given logtag.
    static void log(const char* logtag) noexcept {
        std::unique_ptr<Backtrace> backtrace(
                Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
        if (backtrace->Unwind(2)) {
            for (size_t i = 0, c = backtrace->NumFrames(); i < c; i++) {
                __android_log_print(ANDROID_LOG_DEBUG, logtag, "%s",
                        backtrace->FormatFrameData(i).c_str());
            }
        }
    }
};
+3 −4
Original line number Original line Diff line number Diff line
@@ -24,14 +24,13 @@


#include <log/log.h>
#include <log/log.h>


#include <utils/CallStack.h>

#include "../egl_impl.h"
#include "../egl_impl.h"


#include "egldefs.h"
#include "egldefs.h"
#include "egl_tls.h"
#include "egl_tls.h"
#include "egl_display.h"
#include "egl_display.h"
#include "egl_object.h"
#include "egl_object.h"
#include "CallStack.h"
#include "Loader.h"
#include "Loader.h"


typedef __eglMustCastToProperFunctionPointerType EGLFuncPointer;
typedef __eglMustCastToProperFunctionPointerType EGLFuncPointer;
@@ -65,7 +64,7 @@ static int gl_no_context() {
        char value[PROPERTY_VALUE_MAX];
        char value[PROPERTY_VALUE_MAX];
        property_get("debug.egl.callstack", value, "0");
        property_get("debug.egl.callstack", value, "0");
        if (atoi(value)) {
        if (atoi(value)) {
            CallStack stack(LOG_TAG);
            CallStack::log(LOG_TAG);
        }
        }
    }
    }
    return 0;
    return 0;
@@ -224,7 +223,7 @@ void gl_unimplemented() {
        char value[PROPERTY_VALUE_MAX];
        char value[PROPERTY_VALUE_MAX];
        property_get("debug.egl.callstack", value, "0");
        property_get("debug.egl.callstack", value, "0");
        if (atoi(value)) {
        if (atoi(value)) {
            CallStack stack(LOG_TAG);
            CallStack::log(LOG_TAG);
        }
        }
    }
    }
}
}
+2 −3
Original line number Original line Diff line number Diff line
@@ -20,8 +20,7 @@


#include <cutils/properties.h>
#include <cutils/properties.h>
#include <log/log.h>
#include <log/log.h>
#include <utils/CallStack.h>
#include "CallStack.h"



namespace android {
namespace android {


@@ -74,7 +73,7 @@ void egl_tls_t::setErrorEtcImpl(
            char value[PROPERTY_VALUE_MAX];
            char value[PROPERTY_VALUE_MAX];
            property_get("debug.egl.callstack", value, "0");
            property_get("debug.egl.callstack", value, "0");
            if (atoi(value)) {
            if (atoi(value)) {
                CallStack stack(LOG_TAG);
                CallStack::log(LOG_TAG);
            }
            }
        }
        }
        tls->error = error;
        tls->error = error;
+1 −1
Original line number Original line Diff line number Diff line
@@ -18,7 +18,7 @@
#include <errno.h>
#include <errno.h>
#include <stdlib.h>
#include <stdlib.h>


#include <android/log.h>
#include <log/log.h>


#include "egldefs.h"
#include "egldefs.h"


Loading