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

Commit 5309d7d2 authored by Jiyong Park's avatar Jiyong Park Committed by Steven Moreland
Browse files

Mark EGL/GLES libs as vendor_available

EGL/GLES libs are marked as vendor_available, otherwise vendors are not
able to use OpenGL. The libs were not simply declared as LL-NDK because
doing so causes the dual loading of libui.so in vendor processes;
platform version of libui.so is loaded since it is depended by libEGL.so
whereas there also is vendor version of libui.so in /system/lib/vndk.

When libEGL.so is built for vendors, 1) libgraphicsenv is removed from
its dependency list as the lib must not be available to vendors and 2)
eglGetNativeClientBufferANDROID is unusable since the function relies on
AHardwareBuffer_to_ANativeWindowBuffer which isn't available to vendor.

Bug: 37731063
Test: BOARD_VNDK_VERSION=current m -j libEGL.vendor
Test: BOARD_VNDK_VERSION=current m -j libGLESv2.vendor

Change-Id: I83a128b14a5d852bb0f2cd821a8e3f82c66a313f
Merged-In: I83a128b14a5d852bb0f2cd821a8e3f82c66a313f
parent d11172e3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -52,6 +52,12 @@ ndk_headers {
    license: "include/KHR/NOTICE",
}

cc_library_headers {
    name: "gl_headers",
    vendor_available: true,
    export_include_dirs: ["include"],
}

subdirs = [
    "*",
]
+16 −0
Original line number Diff line number Diff line
@@ -64,6 +64,15 @@ cc_defaults {
        "liblog",
        "libdl",
    ],
    static_libs: [
        "libarect",
    ],
    header_libs: [
        "gl_headers",
        "libsystem_headers",
        "libhardware_headers",
    ],
    export_header_lib_headers: ["gl_headers"],

    // we need to access the private Bionic header <bionic_tls.h>
    include_dirs: ["bionic/libc/private"],
@@ -75,6 +84,7 @@ cc_defaults {
cc_defaults {
    name: "egl_libs_defaults",
    defaults: ["gl_libs_defaults"],
    vendor_available: true,
    cflags: [
        "-DLOG_TAG=\"libEGL\"",
    ],
@@ -85,6 +95,11 @@ cc_defaults {
        "libnativewindow",
        "libbacktrace",
    ],
    target: {
        vendor: {
            exclude_shared_libs: ["libgraphicsenv"],
        },
    },
}

cc_library_static {
@@ -129,6 +144,7 @@ cc_test {
cc_defaults {
    name: "gles_libs_defaults",
    defaults: ["gl_libs_defaults"],
    vendor_available: true,
    arch: {
        arm: {
            instruction_set: "arm",
+4 −0
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@
#include <cutils/properties.h>
#include <log/log.h>

#ifndef __ANDROID_VNDK__
#include <graphicsenv/GraphicsEnv.h>
#endif
#include <vndksupport/linker.h>

#include "egl_trace.h"
@@ -477,10 +479,12 @@ void *Loader::load_driver(const char* kind,
    ATRACE_CALL();

    void* dso = nullptr;
#ifndef __ANDROID_VNDK__
    android_namespace_t* ns = android_getDriverNamespace();
    if (ns) {
        dso = load_updated_driver(kind, ns);
    }
#endif
    if (!dso) {
        dso = load_system_driver(kind);
        if (!dso)
+7 −0
Original line number Diff line number Diff line
@@ -1886,8 +1886,15 @@ EGLBoolean eglPresentationTimeANDROID(EGLDisplay dpy, EGLSurface surface,

EGLClientBuffer eglGetNativeClientBufferANDROID(const AHardwareBuffer *buffer) {
    clearError();
    // AHardwareBuffer_to_ANativeWindowBuffer is a platform-only symbol and thus
    // this function cannot be implemented when this libEGL is built for
    // vendors.
#ifndef __ANDROID_VNDK__
    if (!buffer) return setError(EGL_BAD_PARAMETER, (EGLClientBuffer)0);
    return const_cast<ANativeWindowBuffer *>(AHardwareBuffer_to_ANativeWindowBuffer(buffer));
#else
    return setError(EGL_BAD_PARAMETER, (EGLClientBuffer)0);
#endif
}

// ----------------------------------------------------------------------------
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <inttypes.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>

#include <thread>