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

Commit 991d2545 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

move GraphicEnv from libgui to libui

This breaks a circular dependency between libEGL
and libgui.

Test: compiled and booted a device
Change-Id: I78932bba07fb9ef310d8e1622bd3a47f57e89c45
parent 39fe1d87
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -14,8 +14,8 @@
 * limitations under the License.
 */

#ifndef ANDROID_GUI_GRAPHICS_ENV_H
#define ANDROID_GUI_GRAPHICS_ENV_H 1
#ifndef ANDROID_UI_GRAPHICS_ENV_H
#define ANDROID_UI_GRAPHICS_ENV_H 1

#include <string>

@@ -56,4 +56,4 @@ private:
 */
extern "C" android_namespace_t* android_getDriverNamespace();

#endif // ANDROID_GUI_GRAPHICS_ENV_H
#endif // ANDROID_UI_GRAPHICS_ENV_H
+0 −2
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ cc_library_shared {
        "FrameTimestamps.cpp",
        "GLConsumer.cpp",
        "GraphicBufferAlloc.cpp",
        "GraphicsEnv.cpp",
        "GuiConfig.cpp",
        "IDisplayEventConnection.cpp",
        "IGraphicBufferAlloc.cpp",
@@ -100,7 +99,6 @@ cc_library_shared {
    ],

    shared_libs: [
        "libnativeloader",
        "libsync",
        "libbinder",
        "libcutils",
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ cc_library_shared {
        "GraphicBuffer.cpp",
        "GraphicBufferAllocator.cpp",
        "GraphicBufferMapper.cpp",
        "GraphicsEnv.cpp",
        "HdrCapabilities.cpp",
        "PixelFormat.cpp",
        "Rect.cpp",
@@ -65,6 +66,7 @@ cc_library_shared {
    shared_libs: [
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.mapper@2.0",
        "libnativeloader",
        "libbinder",
        "libcutils",
        "libhardware",
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

//#define LOG_NDEBUG 1
#define LOG_TAG "GraphicsEnv"
#include <gui/GraphicsEnv.h>
#include <ui/GraphicsEnv.h>

#include <mutex>

+5 −21
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <cutils/properties.h>
#include <log/log.h>
#include <utils/Trace.h>
#include <ui/GraphicsEnv.h>

#include <EGL/egl.h>

@@ -147,26 +148,11 @@ status_t Loader::driver_t::set(void* hnd, int32_t api)
// ----------------------------------------------------------------------------

Loader::Loader()
    : getProcAddress(NULL),
      mLibGui(nullptr),
      mGetDriverNamespace(nullptr)
    : getProcAddress(NULL)
{
    // FIXME: See note in GraphicsEnv.h about android_getDriverNamespace().
    // libgui should already be loaded in any process that uses libEGL, but
    // if for some reason it isn't, then we're not going to get a driver
    // namespace anyway, so don't force it to be loaded.
    mLibGui = dlopen("libgui.so", RTLD_NOLOAD | RTLD_LOCAL | RTLD_LAZY);
    if (!mLibGui) {
        ALOGD("failed to load libgui: %s", dlerror());
        return;
    }
    mGetDriverNamespace = reinterpret_cast<decltype(mGetDriverNamespace)>(
            dlsym(mLibGui, "android_getDriverNamespace"));
}

Loader::~Loader() {
    if (mLibGui)
        dlclose(mLibGui);
}

static void* load_wrapper(const char* path) {
@@ -483,12 +469,10 @@ void *Loader::load_driver(const char* kind,
    ATRACE_CALL();

    void* dso = nullptr;
    if (mGetDriverNamespace) {
        android_namespace_t* ns = mGetDriverNamespace();
    android_namespace_t* ns = android_getDriverNamespace();
    if (ns) {
        dso = load_updated_driver(kind, ns);
    }
    }
    if (!dso) {
        dso = load_system_driver(kind);
        if (!dso)
Loading