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

Commit 8ae5b1b0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "getPlatformDisplayAngle: Get ANGLE feature overrides" into main

parents 23ab25b0 15e275c5
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -8,6 +8,11 @@ package {
    default_applicable_licenses: ["frameworks_native_license"],
}

cc_aconfig_library {
    name: "libegl_flags_c_lib",
    aconfig_declarations: "graphicsenv_flags",
}

cc_library {
    name: "libETC1",
    srcs: ["ETC1/etc1.cpp"],
@@ -155,7 +160,10 @@ cc_library_static {

cc_library_shared {
    name: "libEGL",
    defaults: ["egl_libs_defaults"],
    defaults: [
        "aconfig_lib_cc_static_link.defaults",
        "egl_libs_defaults",
    ],
    llndk: {
        symbol_file: "libEGL.map.txt",
        export_llndk_headers: ["gl_headers"],
@@ -191,6 +199,7 @@ cc_library_shared {
    static_libs: [
        "libEGL_getProcAddress",
        "libEGL_blobCache",
        "libegl_flags_c_lib",
    ],
    ldflags: [
        "-Wl,--exclude-libs=libEGL_getProcAddress.a",
+34 −7
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <android-base/properties.h>
#include <android/dlext.h>
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <com_android_graphics_graphicsenv_flags.h>
#include <configstore/Utils.h>
#include <dlfcn.h>
#include <graphicsenv/GraphicsEnv.h>
@@ -37,6 +38,7 @@

using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;
namespace graphicsenv_flags = com::android::graphics::graphicsenv::flags;

namespace android {

@@ -138,6 +140,30 @@ static EGLDisplay getPlatformDisplayAngle(EGLNativeDisplayType display, egl_conn
                attrs.push_back(attr[1]);
            }
        }

        if (graphicsenv_flags::feature_overrides()) {
            std::vector<const char*> enabled;  // ANGLE features to enable
            std::vector<const char*> disabled; // ANGLE features to disable

            // Get the list of ANGLE features to enable from Global.Settings.
            const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures();
            for (const std::string& eglFeature : eglFeatures) {
                enabled.push_back(eglFeature.c_str());
            }

            // Get the list of ANGLE features to enable/disable from gpuservice.
            GraphicsEnv::getInstance().getAngleFeatureOverrides(enabled, disabled);
            if (!enabled.empty()) {
                enabled.push_back(0);
                attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE);
                attrs.push_back(reinterpret_cast<EGLAttrib>(enabled.data()));
            }
            if (!disabled.empty()) {
                disabled.push_back(0);
                attrs.push_back(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE);
                attrs.push_back(reinterpret_cast<EGLAttrib>(disabled.data()));
            }
        } else {
            const auto& eglFeatures = GraphicsEnv::getInstance().getAngleEglFeatures();
            std::vector<const char*> features;
            if (eglFeatures.size() > 0) {
@@ -148,6 +174,7 @@ static EGLDisplay getPlatformDisplayAngle(EGLNativeDisplayType display, egl_conn
                attrs.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE);
                attrs.push_back(reinterpret_cast<EGLAttrib>(features.data()));
            }
        }

        attrs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
        attrs.push_back(EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE);