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

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

Merge "[SurfaceFlinger]Use configStore useContextPriority"

parents 2b389e84 c93afd54
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -65,13 +65,6 @@ else
        DisplayHardware/HWComposer_hwc1.cpp
endif

ifeq ($(TARGET_BOARD_PLATFORM),omap4)
    LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
endif
ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
    LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
endif

ifeq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),true)
    LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
endif
+16 −10
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@
#include "GLExtensions.h"
#include "Mesh.h"

#include <vector>
#include <SurfaceFlinger.h>

EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);

// ---------------------------------------------------------------------------
@@ -76,18 +79,21 @@ RenderEngine* RenderEngine::create(EGLDisplay display, int hwcFormat) {
        LOG_ALWAYS_FATAL("no supported EGL_RENDERABLE_TYPEs");
    }

    // Also create our EGLContext
    EGLint contextAttributes[] = {
            EGL_CONTEXT_CLIENT_VERSION, contextClientVersion,      // MUST be first
    std::vector<EGLint> contextAttributes;
    contextAttributes.reserve(6);
    contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
    contextAttributes.push_back(contextClientVersion);
#ifdef EGL_IMG_context_priority
#ifdef HAS_CONTEXT_PRIORITY
#warning "using EGL_IMG_context_priority"
            EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG,
#endif
    if (SurfaceFlinger::useContextPriority) {
        contextAttributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG);
        contextAttributes.push_back(EGL_CONTEXT_PRIORITY_HIGH_IMG);
    }
#endif
            EGL_NONE, EGL_NONE
    };
    EGLContext ctxt = eglCreateContext(display, config, NULL, contextAttributes);
    contextAttributes.push_back(EGL_NONE);
    contextAttributes.push_back(EGL_NONE);

    EGLContext ctxt = eglCreateContext(display, config, NULL,
                                       contextAttributes.data());

    // if can't create a GL context, we can only abort.
    LOG_ALWAYS_FATAL_IF(ctxt==EGL_NO_CONTEXT, "EGLContext creation failed");
+6 −3
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ const String16 sDump("android.permission.DUMP");
// ---------------------------------------------------------------------------
int64_t SurfaceFlinger::vsyncPhaseOffsetNs;
int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs;
bool SurfaceFlinger::useContextPriority;

SurfaceFlinger::SurfaceFlinger()
    :   BnSurfaceComposer(),
@@ -164,6 +165,9 @@ SurfaceFlinger::SurfaceFlinger()

    ALOGI("SurfaceFlinger is starting");

    useContextPriority = getBool< ISurfaceFlingerConfigs,
            &ISurfaceFlingerConfigs::useContextPriority>(false);

    // debugging stuff...
    char value[PROPERTY_VALUE_MAX];

@@ -3224,9 +3228,8 @@ void SurfaceFlinger::logFrameStats() {
void SurfaceFlinger::appendSfConfigString(String8& result) const
{
    result.append(" [sf");
#ifdef HAS_CONTEXT_PRIORITY
    result.append(" HAS_CONTEXT_PRIORITY");
#endif
    result.appendFormat(" HAS_CONTEXT_PRIORITY=%d", useContextPriority);

#ifdef NEVER_DEFAULT_TO_ASYNC_MODE
    result.append(" NEVER_DEFAULT_TO_ASYNC_MODE");
#endif
+3 −0
Original line number Diff line number Diff line
@@ -129,6 +129,9 @@ public:
    static int64_t vsyncPhaseOffsetNs;
    static int64_t sfVsyncPhaseOffsetNs;

    // Instruct the Render Engine to use EGL_IMG_context_priority is available.
    static bool useContextPriority;

    static char const* getServiceName() ANDROID_API {
        return "SurfaceFlinger";
    }
+6 −3
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ const String16 sDump("android.permission.DUMP");
// ---------------------------------------------------------------------------
int64_t SurfaceFlinger::vsyncPhaseOffsetNs;
int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs;
bool SurfaceFlinger::useContextPriority;

SurfaceFlinger::SurfaceFlinger()
    :   BnSurfaceComposer(),
@@ -155,6 +156,9 @@ SurfaceFlinger::SurfaceFlinger()

    ALOGI("SurfaceFlinger is starting");

    useContextPriority = getBool< ISurfaceFlingerConfigs,
            &ISurfaceFlingerConfigs::useContextPriority>(false);

    char value[PROPERTY_VALUE_MAX];

    property_get("ro.bq.gpu_to_cpu_unsupported", value, "0");
@@ -2996,9 +3000,8 @@ void SurfaceFlinger::logFrameStats() {
void SurfaceFlinger::appendSfConfigString(String8& result) const
{
    result.append(" [sf");
#ifdef HAS_CONTEXT_PRIORITY
    result.append(" HAS_CONTEXT_PRIORITY");
#endif
    result.appendFormat(" HAS_CONTEXT_PRIORITY=%d", useContextPriority);

#ifdef NEVER_DEFAULT_TO_ASYNC_MODE
    result.append(" NEVER_DEFAULT_TO_ASYNC_MODE");
#endif