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

Commit 1c01d2b2 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Rework BOARD_EGL_NEEDS_LEGACY_FB implementation

The problem with the window format boils down to a circular
dependency that makes service startup hang, so skip a round of
queues-to-window-composer to avoid it but keep using regular
Surface objects as windows, instead of replacing them with
native windows.

Change-Id: I6fed0fe04928df370c298c68ac1eb6d5b5cfb214
parent c2f9e573
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -252,6 +252,10 @@ private:

    // must be accessed from lock/unlock thread only
    Region mDirtyRegion;

#ifdef BOARD_EGL_NEEDS_LEGACY_FB
    bool                        mDequeuedOnce;
#endif
};

}; // namespace android
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ ifeq ($(TARGET_USES_QCOM_BSP),true)
    LOCAL_CFLAGS += -DQCOM_BSP
endif

ifeq ($(BOARD_EGL_NEEDS_LEGACY_FB),true)
    LOCAL_CFLAGS += -DBOARD_EGL_NEEDS_LEGACY_FB
endif

LOCAL_MODULE:= libgui

ifeq ($(TARGET_BOARD_PLATFORM), tegra)
+18 −5
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@ Surface::Surface(
    mTransformHint = 0;
    mConsumerRunningBehind = false;
    mConnectedToCpu = false;
#ifdef BOARD_EGL_NEEDS_LEGACY_FB
    mDequeuedOnce = false;
#endif
}

Surface::~Surface() {
@@ -218,6 +221,9 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer,
    }

    *buffer = gbuf.get();
#ifdef BOARD_EGL_NEEDS_LEGACY_FB
    if (!mDequeuedOnce) mDequeuedOnce = true;
#endif
    return OK;
}

@@ -306,6 +312,12 @@ int Surface::query(int what, int* value) const {
                }
                break;
            case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: {
#ifdef BOARD_EGL_NEEDS_LEGACY_FB
                if (!mDequeuedOnce) {
                    *value = 0;
                } else
#endif
                {
                    sp<ISurfaceComposer> composer(
                            ComposerService::getComposerService());
                    if (composer->authenticateSurfaceTexture(mGraphicBufferProducer)) {
@@ -313,6 +325,7 @@ int Surface::query(int what, int* value) const {
                    } else {
                        *value = 0;
                    }
                }
                return NO_ERROR;
            }
            case NATIVE_WINDOW_CONCRETE_TYPE:
+0 −4
Original line number Diff line number Diff line
@@ -34,10 +34,6 @@ ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true)
	LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING
endif

ifeq ($(BOARD_EGL_NEEDS_LEGACY_FB),true)
	LOCAL_CFLAGS += -DBOARD_EGL_NEEDS_LEGACY_FB
endif

ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
  LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif
+0 −8
Original line number Diff line number Diff line
@@ -29,10 +29,6 @@

#include <gui/Surface.h>

#ifdef BOARD_EGL_NEEDS_LEGACY_FB
#include <ui/FramebufferNativeWindow.h>
#endif

#include <GLES/gl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -96,11 +92,7 @@ DisplayDevice::DisplayDevice(
      mOrientation()
{
    mNativeWindow = new Surface(mDisplaySurface->getIGraphicBufferProducer());
#ifndef BOARD_EGL_NEEDS_LEGACY_FB
    ANativeWindow* const window = mNativeWindow.get();
#else
    ANativeWindow* const window = new FramebufferNativeWindow();
#endif

    int format;
    window->query(window, NATIVE_WINDOW_FORMAT, &format);